pub struct FilterPersistence { /* private fields */ }Expand description
Cuckoo filter persistence manager.
Stores and retrieves filter state from SQLite for fast startup.
Implementations§
Source§impl FilterPersistence
impl FilterPersistence
Sourcepub async fn new(sqlite_path: &str) -> Result<Self, StorageError>
pub async fn new(sqlite_path: &str) -> Result<Self, StorageError>
Create a new filter persistence manager.
Uses the same SQLite file as the WAL for simplicity.
Sourcepub async fn save(
&self,
filter_id: &str,
filter_bytes: &[u8],
merkle_root: &[u8; 32],
entry_count: usize,
) -> Result<(), StorageError>
pub async fn save( &self, filter_id: &str, filter_bytes: &[u8], merkle_root: &[u8; 32], entry_count: usize, ) -> Result<(), StorageError>
Save filter state with current merkle root.
Sourcepub async fn load(
&self,
filter_id: &str,
) -> Result<Option<SavedFilterState>, StorageError>
pub async fn load( &self, filter_id: &str, ) -> Result<Option<SavedFilterState>, StorageError>
Load filter state if it exists.
Sourcepub async fn delete(&self, filter_id: &str) -> Result<(), StorageError>
pub async fn delete(&self, filter_id: &str) -> Result<(), StorageError>
Delete saved filter state.
Sourcepub async fn is_filter_current(
&self,
filter_id: &str,
current_root: &[u8; 32],
) -> Result<bool, StorageError>
pub async fn is_filter_current( &self, filter_id: &str, current_root: &[u8; 32], ) -> Result<bool, StorageError>
Check if a saved filter matches the current merkle root.
If it matches, the filter can be trusted immediately.
Auto Trait Implementations§
impl Freeze for FilterPersistence
impl !RefUnwindSafe for FilterPersistence
impl Send for FilterPersistence
impl Sync for FilterPersistence
impl Unpin for FilterPersistence
impl !UnwindSafe for FilterPersistence
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more