pub struct ConcurrentDatabase { /* private fields */ }
Expand description
Thread-safe wrapper around an in-memory database
This provides a concurrent version of the InMemoryDatabase that can be safely shared between threads.
Implementations§
Source§impl ConcurrentDatabase
impl ConcurrentDatabase
Sourcepub fn with_max_age(max_age: Duration) -> Self
pub fn with_max_age(max_age: Duration) -> Self
Create a new concurrent database with a specific maximum age
Trait Implementations§
Source§impl Database for ConcurrentDatabase
impl Database for ConcurrentDatabase
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 ConcurrentDatabase
impl !RefUnwindSafe for ConcurrentDatabase
impl Send for ConcurrentDatabase
impl Sync for ConcurrentDatabase
impl Unpin for ConcurrentDatabase
impl !UnwindSafe for ConcurrentDatabase
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