pub struct StoreKeyPrefix { /* private fields */ }Expand description
A client-side namespace layered over raw Store keys.
The prefix consumes a small number of high bits in the physical Store key
and stores the caller’s logical key in the remaining payload bits. QMDB,
SQL, and other higher-level instances continue to build their own logical
keys as before; a prefixed StoreClient maps those keys on the wire and
maps returned keys back before callers see them.
Implementations§
Source§impl StoreKeyPrefix
impl StoreKeyPrefix
pub fn new(reserved_bits: u8, prefix: u16) -> Result<Self, StoreKeyPrefixError>
pub fn reserved_bits(self) -> u8
pub fn prefix(self) -> u16
Sourcepub fn max_logical_key_len(self) -> usize
pub fn max_logical_key_len(self) -> usize
Maximum logical key bytes available under this prefix.
Sourcepub fn encode_key(self, key: &Key) -> Result<Key, StoreKeyPrefixError>
pub fn encode_key(self, key: &Key) -> Result<Key, StoreKeyPrefixError>
Encode a logical key into the physical Store keyspace.
Sourcepub fn decode_key(self, key: &Key) -> Result<Key, StoreKeyPrefixError>
pub fn decode_key(self, key: &Key) -> Result<Key, StoreKeyPrefixError>
Decode a physical Store key back into the logical keyspace.
Sourcepub fn encode_range(
self,
start: &Key,
end: &Key,
) -> Result<(Key, Key), StoreKeyPrefixError>
pub fn encode_range( self, start: &Key, end: &Key, ) -> Result<(Key, Key), StoreKeyPrefixError>
Encode an inclusive logical range into the physical Store keyspace.
Empty end means unbounded in the logical keyspace and is narrowed to
this prefix’s physical upper bound. Long logical upper bounds are
clamped to the maximum logical key length representable under this
prefix; this preserves scans over existing KeyCodec::prefix_bounds
ranges, whose upper bound is intentionally MAX_KEY_LEN bytes.
Trait Implementations§
Source§impl Clone for StoreKeyPrefix
impl Clone for StoreKeyPrefix
Source§fn clone(&self) -> StoreKeyPrefix
fn clone(&self) -> StoreKeyPrefix
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StoreKeyPrefix
impl Debug for StoreKeyPrefix
Source§impl Hash for StoreKeyPrefix
impl Hash for StoreKeyPrefix
Source§impl PartialEq for StoreKeyPrefix
impl PartialEq for StoreKeyPrefix
impl Copy for StoreKeyPrefix
impl Eq for StoreKeyPrefix
impl StructuralPartialEq for StoreKeyPrefix
Auto Trait Implementations§
impl Freeze for StoreKeyPrefix
impl RefUnwindSafe for StoreKeyPrefix
impl Send for StoreKeyPrefix
impl Sync for StoreKeyPrefix
impl Unpin for StoreKeyPrefix
impl UnsafeUnpin for StoreKeyPrefix
impl UnwindSafe for StoreKeyPrefix
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.