[−][src]Trait rocks_sys::slice_transform::SliceTransform
A SliceTranform is a generic pluggable way of transforming one string
to another. Its primary use-case is in configuring rocksdb
to store prefix blooms by setting prefix_extractor in
ColumnFamilyOptions.
Required methods
fn transform<'a>(&self, key: &'a [u8]) -> &'a [u8]
Extract a prefix from a specified key. This method is called when a key is inserted into the db, and the returned slice is used to create a bloom filter.
Provided methods
fn in_domain(&self, _key: &[u8]) -> bool
Determine whether the specified key is compatible with the logic specified in the Transform method. This method is invoked for every key that is inserted into the db. If this method returns true, then Transform is called to translate the key to its prefix and that returned prefix is inserted into the bloom filter. If this method returns false, then the call to Transform is skipped and no prefix is inserted into the bloom filters.
For example, if the Transform method operates on a fixed length prefix of size 4, then an invocation to InDomain("abc") returns false because the specified key length(3) is shorter than the prefix size of 4.
Wiki documentation here: https://github.com/facebook/rocksdb/wiki/Prefix-Seek-API-Changes
fn name(&self) -> &str
Return the name of this transformation.