pub struct KeyMeta {
pub rtype: RedisType,
pub flags: u8,
pub expire_at: u64,
pub version: u64,
pub size: u64,
}Expand description
Fundamental 26-byte metadata structure (aligned with Apache Kvrocks KeyMetadata). 基础通用 26 字节元数据结构(对标 Apache Kvrocks KeyMetadata)
Fields§
§rtype: RedisType§flags: u8§expire_at: u64§version: u64§size: u64Implementations§
Source§impl KeyMeta
impl KeyMeta
pub const META_64BIT_ENCODING_MASK: u8 = 0x80
pub const META_TYPE_MASK: u8 = 0x0F
pub const ENCODED_SIZE: usize = 26
pub const KVROCKS_COMPLEX_ENCODED_SIZE: usize = 25
pub const KVROCKS_SINGLE_KV_ENCODED_SIZE: usize = 9
pub const fn new( rtype: RedisType, expire_at: u64, version: u64, size: u64, ) -> Self
pub fn new_with_version(rtype: RedisType, expire_at: u64, size: u64) -> Self
pub const fn is_expired(&self, now_ms: u64) -> bool
pub const fn is_single_kv_type(&self) -> bool
pub const fn is_emptyable_type(&self) -> bool
pub const fn ttl(&self, now_ms: u64) -> i64
pub const fn ttl_ms(&self, now_ms: u64) -> i64
pub const fn ttl_sec(&self, now_ms: u64) -> i64
pub fn expire_at_ms_to_sec(ms: u64) -> u64
pub const fn is_64bit_encoded_flags(flags: u8) -> bool
pub const fn is_64bit_encoded(&self) -> bool
pub const fn common_encoded_size(&self) -> usize
Sourcepub const fn get_offset_after_expire(flags: u8) -> usize
pub const fn get_offset_after_expire(flags: u8) -> usize
Returns byte offset following expiration timestamp in encoded metadata. 获取元数据过期时间之后的字节偏移量(对标 Kvrocks Metadata::GetOffsetAfterExpire)
Sourcepub const fn get_offset_after_size(flags: u8) -> usize
pub const fn get_offset_after_size(flags: u8) -> usize
Returns byte offset following size field in encoded metadata. 获取复合元数据大小之后的字节偏移量(对标 Kvrocks Metadata::GetOffsetAfterSize)
Sourcepub fn encode(&self) -> [u8; 26]
pub fn encode(&self) -> [u8; 26]
Encodes into standard 26-byte metadata header. 编码为标准 26 字节元数据头
Sourcepub fn encode_kvrocks(&self) -> Vec<u8> ⓘ
pub fn encode_kvrocks(&self) -> Vec<u8> ⓘ
Encodes into compact Kvrocks binary format (25-byte composite / 9-byte SingleKV). 编码为 Kvrocks 1:1 紧凑二进制格式(25字节复合类型 / 9字节SingleKV)
Trait Implementations§
impl Copy for KeyMeta
impl<'__de> Decode<'__de> for KeyMetawhere
'__de:,
impl Encode for KeyMeta
impl Eq for KeyMeta
impl StructuralPartialEq for KeyMeta
Auto Trait Implementations§
impl Freeze for KeyMeta
impl RefUnwindSafe for KeyMeta
impl Send for KeyMeta
impl Sync for KeyMeta
impl Unpin for KeyMeta
impl UnsafeUnpin for KeyMeta
impl UnwindSafe for KeyMeta
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DecodeOwned for Twhere
T: for<'de> Decode<'de>,
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
Compare self to
key and return true if they are equal.