pub trait Database {
// Required methods
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 status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: '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;
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 time_since_last_update<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<Duration>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = DatabaseStats> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Database interface for Safe Browsing
This trait defines the methods required for a Safe Browsing database implementation. It provides methods for looking up hash prefixes and updating the database from the Safe Browsing API.
Required Methods§
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
If found, returns the matching hash prefix and the list of threat descriptors that contain it