pub struct MemoryBackend { /* private fields */ }Expand description
In-memory backend — always available. Originally feature-gated, now
unconditional because production adapters (e.g., dig-l1-wallet’s
encrypt/decrypt-bytes helpers) wrap it in scratch backends to reuse the
full keystore format without touching the filesystem.
A keychain backend that lives entirely in process memory.
Legitimate uses:
- Scratch backend for bytes-in / bytes-out adapters (e.g.
dig-l1-wallet::keystore::encryption::encrypt_secret_key). - Tests and doc examples where touching the filesystem is overhead.
Do not use this as the storage medium for a long-lived keystore — process exit drops all state.
Implementations§
Source§impl MemoryBackend
impl MemoryBackend
Trait Implementations§
Source§impl Default for MemoryBackend
impl Default for MemoryBackend
Source§fn default() -> MemoryBackend
fn default() -> MemoryBackend
Returns the “default value” for a type. Read more
Source§impl KeychainBackend for MemoryBackend
impl KeychainBackend for MemoryBackend
Source§fn read(&self, key: &BackendKey) -> Result<Vec<u8>>
fn read(&self, key: &BackendKey) -> Result<Vec<u8>>
Read the full contents of the blob at
key. Read moreSource§fn write(&self, key: &BackendKey, data: &[u8]) -> Result<()>
fn write(&self, key: &BackendKey, data: &[u8]) -> Result<()>
Write
data to key. Implementations should be atomic — a reader
seeing the key after this call must see either the old bytes or the
new bytes in full, never a torn mix.Source§fn delete(&self, key: &BackendKey) -> Result<()>
fn delete(&self, key: &BackendKey) -> Result<()>
Remove the blob at
key. Implementations should best-effort overwrite
the storage before removing so residual disk sectors do not retain the
ciphertext.Auto Trait Implementations§
impl !Freeze for MemoryBackend
impl !RefUnwindSafe for MemoryBackend
impl Send for MemoryBackend
impl Sync for MemoryBackend
impl Unpin for MemoryBackend
impl UnsafeUnpin for MemoryBackend
impl UnwindSafe for MemoryBackend
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