pub struct RedbDatabase { /* private fields */ }Expand description
Redb-based persistent database for Safe Browsing
Implementations§
Source§impl RedbDatabase
impl RedbDatabase
Sourcepub fn new<P: AsRef<Path>>(path: P) -> Result<Self, DatabaseError>
pub fn new<P: AsRef<Path>>(path: P) -> Result<Self, DatabaseError>
Create a new redb database at the specified path
Sourcepub async fn init(&self) -> Result<(), DatabaseError>
pub async fn init(&self) -> Result<(), DatabaseError>
Initialize the database and load cache
Sourcepub async fn with_max_age<P: AsRef<Path>>(
path: P,
max_age: Duration,
) -> Result<Self, DatabaseError>
pub async fn with_max_age<P: AsRef<Path>>( path: P, max_age: Duration, ) -> Result<Self, DatabaseError>
Create a new redb database with a custom maximum age
Sourcepub fn default_path() -> Result<PathBuf, DatabaseError>
pub fn default_path() -> Result<PathBuf, DatabaseError>
Get the default database path in the system cache directory
Trait Implementations§
Source§impl Database for RedbDatabase
impl Database for RedbDatabase
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 !RefUnwindSafe for RedbDatabase
impl !UnwindSafe for RedbDatabase
impl Freeze for RedbDatabase
impl Send for RedbDatabase
impl Sync for RedbDatabase
impl Unpin for RedbDatabase
impl UnsafeUnpin for RedbDatabase
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