Class: Tarantool::Client::SpaceInfo
- Inherits:
-
Data
- Object
- Data
- Tarantool::Client::SpaceInfo
- Defined in:
- tarantool-client/lib/tarantool/client/space_info.rb
Overview
Format and indexes of a space from the loaded schema. indexes maps names to IndexInfo in id order.
Defined Under Namespace
Classes: Field
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#indexes ⇒ Object
readonly
Returns the value of attribute indexes.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields
6 7 8 |
# File 'tarantool-client/lib/tarantool/client/space_info.rb', line 6 def fields @fields end |
#id ⇒ Object (readonly)
Returns the value of attribute id
6 7 8 |
# File 'tarantool-client/lib/tarantool/client/space_info.rb', line 6 def id @id end |
#indexes ⇒ Object (readonly)
Returns the value of attribute indexes
6 7 8 |
# File 'tarantool-client/lib/tarantool/client/space_info.rb', line 6 def indexes @indexes end |
#name ⇒ Object (readonly)
Returns the value of attribute name
6 7 8 |
# File 'tarantool-client/lib/tarantool/client/space_info.rb', line 6 def name @name end |
Class Method Details
.from_tuples(space, index_tuples) ⇒ Object
9 10 11 12 13 14 15 |
# File 'tarantool-client/lib/tarantool/client/space_info.rb', line 9 def self.from_tuples(space, index_tuples) id, _owner, name, _engine, _field_count, _flags, format = space fields = (format || []).map { |raw| SpaceInfo::Field.from_raw(raw) } indexes = index_tuples.map { |tuple| IndexInfo.from_tuple(tuple, fields) }.sort_by(&:id) new(id:, name:, fields:, indexes: indexes.to_h { |index| [index.name, index] }) end |
Instance Method Details
#primary_index ⇒ Object
17 18 19 |
# File 'tarantool-client/lib/tarantool/client/space_info.rb', line 17 def primary_index indexes.each_value.find { |index| index.id.zero? } end |