pub struct JsonFileBackend { /* private fields */ }Expand description
JSON file backend implementation with atomic writes
Implementations§
Source§impl JsonFileBackend
impl JsonFileBackend
Sourcepub fn with_pretty(path: impl Into<PathBuf>, pretty: bool) -> Self
pub fn with_pretty(path: impl Into<PathBuf>, pretty: bool) -> Self
Create with pretty print option
Sourcepub fn with_session_id(
path: impl Into<PathBuf>,
session_id: impl Into<String>,
) -> Self
pub fn with_session_id( path: impl Into<PathBuf>, session_id: impl Into<String>, ) -> Self
Create with session ID
Sourcepub fn set_session_id(&mut self, session_id: impl Into<String>)
pub fn set_session_id(&mut self, session_id: impl Into<String>)
Set session ID
Sourcepub async fn get_stored_session_id(&self) -> Layer3Result<Option<String>>
pub async fn get_stored_session_id(&self) -> Layer3Result<Option<String>>
Get session ID from storage (if exists)
Trait Implementations§
Source§impl FileBackend for JsonFileBackend
impl FileBackend for JsonFileBackend
Source§fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
entries: &'life1 [MemoryEntry],
) -> Pin<Box<dyn Future<Output = Layer3Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
entries: &'life1 [MemoryEntry],
) -> Pin<Box<dyn Future<Output = Layer3Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Save entries to file with atomic write
Source§fn save_with_session<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
entries: &'life2 [MemoryEntry],
) -> Pin<Box<dyn Future<Output = Layer3Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn save_with_session<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
entries: &'life2 [MemoryEntry],
) -> Pin<Box<dyn Future<Output = Layer3Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Save with session ID for container
Source§fn load<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<MemoryEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<MemoryEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load entries from file
Source§fn load_container<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Layer3Result<StorageContainer>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_container<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Layer3Result<StorageContainer>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load full storage container
Source§fn exists<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn exists<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if backend file exists
Auto Trait Implementations§
impl Freeze for JsonFileBackend
impl RefUnwindSafe for JsonFileBackend
impl Send for JsonFileBackend
impl Sync for JsonFileBackend
impl Unpin for JsonFileBackend
impl UnsafeUnpin for JsonFileBackend
impl UnwindSafe for JsonFileBackend
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