Skip to main content

BloomChainMeta

Struct BloomChainMeta 

Source
pub struct BloomChainMeta {
    pub base: KeyMeta,
    pub n_filters: u16,
    pub expansion: u16,
    pub base_capacity: u32,
    pub error_rate: f64,
    pub bloom_bytes: u32,
}
Expand description

Bloom filter chain metadata (aligned with Apache Kvrocks BloomChainMetadata 46-byte format). 布隆过滤器链元数据(对标 Apache Kvrocks BloomChainMetadata 46字节)

Fields§

§base: KeyMeta§n_filters: u16§expansion: u16§base_capacity: u32§error_rate: f64§bloom_bytes: u32

Implementations§

Source§

impl BloomChainMeta

Source

pub const ENCODED_SIZE: usize

Source

pub fn new( base_capacity: u32, error_rate: f64, expansion: u16, version: u64, expire_at: u64, bloom_bytes: u32, ) -> Self

Source

pub const fn is_scaling(&self) -> bool

Source

pub fn is_expired(&self, now_ms: u64) -> bool

Source

pub fn get_capacity(&self) -> u32

Source

pub fn sub_filter_capacity(&self, filter_index: u16) -> u32

Source

pub fn encode(&self) -> [u8; 46]

Source

pub fn decode(bytes: &[u8]) -> Option<Self>

Trait Implementations§

Source§

impl Clone for BloomChainMeta

Source§

fn clone(&self) -> BloomChainMeta

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for BloomChainMeta

Source§

impl Debug for BloomChainMeta

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'__de> Decode<'__de> for BloomChainMeta
where '__de:,

Source§

impl Encode for BloomChainMeta

Source§

impl MetaOps for BloomChainMeta

Source§

const TAG: &[u8]

Metadata key tag slice (e.g. b"sm", b"hm"). meta key 标签(如 b"sm", b"hm"),用于 check_key_not_other_type
Source§

type EncodedBytes = [u8; 46]

Source§

fn decode(bytes: &[u8]) -> Option<Self>

Source§

fn is_expired(&self, now_ms: u64) -> bool

Source§

fn encode_bytes(&self) -> Self::EncodedBytes

Encoded bytes slice for storage write operations without heap allocation. 编码后的字节,用于写入存储(零堆分配)
Source§

fn base(&self) -> &KeyMeta

Returns immutable reference to base KeyMeta. 获取 base 引用(访问 expire_at / ttl 等通用字段)
Source§

fn base_mut(&mut self) -> &mut KeyMeta

Returns mutable reference to base KeyMeta. 获取 base 可变引用(修改 expire_at)
Source§

impl PartialEq for BloomChainMeta

Source§

fn eq(&self, other: &BloomChainMeta) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BloomChainMeta

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DecodeOwned for T
where T: for<'de> Decode<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.