pub struct FileIdempotencyStore { /* private fields */ }Expand description
Append-oriented local idempotency store with atomic compaction.
Implementations§
Source§impl FileIdempotencyStore
impl FileIdempotencyStore
Sourcepub fn new(path: impl AsRef<Path>) -> RuntimeResult<Self>
pub fn new(path: impl AsRef<Path>) -> RuntimeResult<Self>
Opens a store without expiration.
Sourcepub fn new_with_ttl(
path: impl AsRef<Path>,
ttl_ms: Option<u64>,
) -> RuntimeResult<Self>
pub fn new_with_ttl( path: impl AsRef<Path>, ttl_ms: Option<u64>, ) -> RuntimeResult<Self>
Opens a store with optional record expiration.
Sourcepub fn compact(&mut self, now_ms: u64) -> RuntimeResult<usize>
pub fn compact(&mut self, now_ms: u64) -> RuntimeResult<usize>
Removes expired records and atomically rewrites the backing file.
Trait Implementations§
Source§impl Debug for FileIdempotencyStore
impl Debug for FileIdempotencyStore
Source§impl IdempotencyStore for FileIdempotencyStore
impl IdempotencyStore for FileIdempotencyStore
Source§fn get(&self, key: &str) -> RuntimeResult<Option<IdempotencyRecord>>
fn get(&self, key: &str) -> RuntimeResult<Option<IdempotencyRecord>>
Returns a stored record by key.
Source§fn insert(&mut self, record: IdempotencyRecord) -> RuntimeResult<()>
fn insert(&mut self, record: IdempotencyRecord) -> RuntimeResult<()>
Inserts or replaces a validated record.
Auto Trait Implementations§
impl Freeze for FileIdempotencyStore
impl RefUnwindSafe for FileIdempotencyStore
impl Send for FileIdempotencyStore
impl Sync for FileIdempotencyStore
impl Unpin for FileIdempotencyStore
impl UnsafeUnpin for FileIdempotencyStore
impl UnwindSafe for FileIdempotencyStore
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