pub struct InMemoryDatabase { /* private fields */ }
Expand description
In-memory database implementation
This is a simple database that keeps all threat lists in memory. It’s suitable for applications with moderate memory usage requirements.
Implementations§
Source§impl InMemoryDatabase
impl InMemoryDatabase
Sourcepub fn with_max_age(max_age: Duration) -> Self
pub fn with_max_age(max_age: Duration) -> Self
Create a new in-memory database with a specific maximum age
Trait Implementations§
Source§impl Database for InMemoryDatabase
impl Database for InMemoryDatabase
Source§fn is_ready<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_ready<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if the database is ready for queries
Source§fn status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the current database status
Source§fn update<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
api: &'life1 SafeBrowsingApi,
threat_lists: &'life2 [ThreatDescriptor],
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn update<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
api: &'life1 SafeBrowsingApi,
threat_lists: &'life2 [ThreatDescriptor],
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Update the database with the latest threat lists
Source§fn lookup<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 HashPrefix,
) -> Pin<Box<dyn Future<Output = Result<Option<(HashPrefix, Vec<ThreatDescriptor>)>, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn lookup<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 HashPrefix,
) -> Pin<Box<dyn Future<Output = Result<Option<(HashPrefix, Vec<ThreatDescriptor>)>, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Look up a hash prefix in the database Read more
Auto Trait Implementations§
impl Freeze for InMemoryDatabase
impl !RefUnwindSafe for InMemoryDatabase
impl Send for InMemoryDatabase
impl Sync for InMemoryDatabase
impl Unpin for InMemoryDatabase
impl !UnwindSafe for InMemoryDatabase
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