Struct tarantool::index::Index

source ·
pub struct Index { /* private fields */ }
Expand description

An index is a group of key values and pointers.

Implementations§

Get a tuple from index by the key.

Please note that this function works much faster than select

  • key - encoded key in MsgPack Array format ([part1, part2, ...]).

Returns a tuple or None if index is empty

Allocate and initialize iterator for index.

This is an alternative to space.select() which goes via a particular index and can make use of additional parameter that specify the iterator type.

  • type - iterator type
  • key - encoded key in MsgPack Array format ([part1, part2, ...]).

Delete a tuple identified by a key.

Same as space.delete(), but a key is searched in this index instead of in the primary-key index. This index ought to be unique.

  • key - encoded key in MsgPack Array format ([part1, part2, ...]).

Returns the deleted tuple

Update a tuple.

Same as space.update(), but a key is searched in this index instead of primary key. This index ought to be unique.

  • key - encoded key in MsgPack Array format ([part1, part2, ...]).
  • ops - encoded operations in MsgPack array format, e.g. [['=', field_id, value], ['!', 2, 'xxx']]

Returns a new tuple.

See also: index.upsert()

👎Deprecated: use update_raw instead
Safety

ops must be a slice of valid msgpack arrays.

Safety

key must be a valid msgpack array. ops must be a valid msgpack array of msgpack arrays.

Execute an UPSERT request.

Will try to insert tuple. Update if already exists.

  • value - encoded tuple in MsgPack Array format ([field1, field2, ...])
  • ops - encoded operations in MsgPack array format, e.g. [['=', field_id, value], ['!', 2, 'xxx']]

See also: index.update()

👎Deprecated: use upsert_raw instead
Safety

ops must be a slice of valid msgpack arrays.

Safety

value must be a valid msgpack array. ops must be a valid msgpack array of msgpack arrays.

Return the number of elements in the index.

Return the number of bytes used in memory by the index.

Return a random tuple from the index (useful for statistical analysis).

  • rnd - random seed

Return a first (minimal) tuple that matched the provided key.

  • key - encoded key in MsgPack Array format ([part1, part2, ...]).

Returns a tuple or None if index is empty

Return a last (maximal) tuple that matched the provided key.

  • key - encoded key in MsgPack Array format ([part1, part2, ...]).

Returns a tuple or None if index is empty

Count the number of tuples that matched the provided key.

  • type - iterator type
  • key - encoded key in MsgPack Array format ([part1, part2, ...]).

Extract key from tuple according to key definition of given index. Returned buffer is allocated on box_txn_alloc() with this key.

  • tuple - tuple from which need to extract key.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.