pub struct RecentPeersFileStore { /* private fields */ }Expand description
A caller-scoped native file store for recently authenticated FIPS peers.
This type only handles persistence. The caller chooses the path and remains responsible for cache pruning, peer authorization, and deciding when to load or save the cache.
Implementations§
Source§impl RecentPeersFileStore
impl RecentPeersFileStore
Sourcepub fn new(
path: impl Into<PathBuf>,
expected_local_npub: impl Into<String>,
expected_scope: impl Into<String>,
) -> Result<Self, RecentPeersFileError>
pub fn new( path: impl Into<PathBuf>, expected_local_npub: impl Into<String>, expected_scope: impl Into<String>, ) -> Result<Self, RecentPeersFileError>
Bind a file path to one local identity and application scope.
Sourcepub fn local_npub(&self) -> &str
pub fn local_npub(&self) -> &str
Local identity to which loaded and saved documents must be bound.
Sourcepub fn scope(&self) -> &str
pub fn scope(&self) -> &str
Application scope to which loaded and saved documents must be bound.
Sourcepub fn load(&self) -> Result<RecentPeers, RecentPeersFileError>
pub fn load(&self) -> Result<RecentPeers, RecentPeersFileError>
Load and strictly validate the cache.
A missing file produces a new empty cache for the expected identity and scope. Malformed or mismatched existing files are returned as errors.
Sourcepub fn save(
&self,
recent_peers: &RecentPeers,
) -> Result<(), RecentPeersFileError>
pub fn save( &self, recent_peers: &RecentPeers, ) -> Result<(), RecentPeersFileError>
Strictly validate and replace the cache using a same-directory temporary file.
Trait Implementations§
Source§impl Clone for RecentPeersFileStore
impl Clone for RecentPeersFileStore
Source§fn clone(&self) -> RecentPeersFileStore
fn clone(&self) -> RecentPeersFileStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RecentPeersFileStore
impl RefUnwindSafe for RecentPeersFileStore
impl Send for RecentPeersFileStore
impl Sync for RecentPeersFileStore
impl Unpin for RecentPeersFileStore
impl UnsafeUnpin for RecentPeersFileStore
impl UnwindSafe for RecentPeersFileStore
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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