pub struct LinkDatabase { /* private fields */ }Expand description
Proxy link database.
Implementations§
Source§impl LinkDatabase
impl LinkDatabase
Sourcepub async fn new(db_path: impl AsRef<Path>) -> Result<Self>
pub async fn new(db_path: impl AsRef<Path>) -> Result<Self>
Create or open a link database at the specified path.
§Errors
Returns an error if the database cannot be created or opened.
Sourcepub fn add_link(&mut self, record: ProxyLinkRecord) -> Result<()>
pub fn add_link(&mut self, record: ProxyLinkRecord) -> Result<()>
Add a proxy link to the database.
Sourcepub fn get_link(&self, proxy_path: &Path) -> Option<&ProxyLinkRecord>
pub fn get_link(&self, proxy_path: &Path) -> Option<&ProxyLinkRecord>
Get a link by proxy path.
Sourcepub fn get_link_by_original(
&self,
original_path: &Path,
) -> Option<&ProxyLinkRecord>
pub fn get_link_by_original( &self, original_path: &Path, ) -> Option<&ProxyLinkRecord>
Get a link by original path.
Sourcepub fn remove_link(
&mut self,
proxy_path: &Path,
) -> Result<Option<ProxyLinkRecord>>
pub fn remove_link( &mut self, proxy_path: &Path, ) -> Result<Option<ProxyLinkRecord>>
Remove a link by proxy path.
Sourcepub fn update_verification(
&mut self,
proxy_path: &Path,
timestamp: i64,
) -> Result<()>
pub fn update_verification( &mut self, proxy_path: &Path, timestamp: i64, ) -> Result<()>
Update a link’s verification timestamp.
Sourcepub fn all_links(&self) -> Vec<&ProxyLinkRecord>
pub fn all_links(&self) -> Vec<&ProxyLinkRecord>
Get all links in the database.
Auto Trait Implementations§
impl Freeze for LinkDatabase
impl RefUnwindSafe for LinkDatabase
impl Send for LinkDatabase
impl Sync for LinkDatabase
impl Unpin for LinkDatabase
impl UnsafeUnpin for LinkDatabase
impl UnwindSafe for LinkDatabase
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