Trait sov_schema_db::SeekKeyEncoder
source · pub trait SeekKeyEncoder<S: Schema + ?Sized>: Sized {
// Required method
fn encode_seek_key(&self) -> Result<Vec<u8>>;
}Expand description
This defines a type that can be used to seek a SchemaIterator, via
interfaces like SchemaIterator::seek. Mind you, not all
KeyEncoders shall be SeekKeyEncoders, and
vice versa. E.g.:
- Some key types don’t use an encoding that results in sensible
seeking behavior under lexicographic ordering (what RocksDB uses by
default), which means you shouldn’t implement
SeekKeyEncoderat all. - Other key types might maintain full lexicographic order, which means the
original key type can also be
SeekKeyEncoder. - Other key types may be composite, and the first field alone may be
a good candidate for
SeekKeyEncoder.
Required Methods§
sourcefn encode_seek_key(&self) -> Result<Vec<u8>>
fn encode_seek_key(&self) -> Result<Vec<u8>>
Converts self to bytes which is used to seek the underlying raw
iterator.
If self is also a KeyEncoder, then
SeekKeyEncoder::encode_seek_key MUST return the same bytes as
KeyEncoder::encode_key.