pub struct ClientDataStoreManager { /* private fields */ }Expand description
High-level client data store manager.
Wraps a ClientDataStore backend with:
- Size-based routing (small → inline, large → external)
- Content-hash key generation (SHA-256 dedup)
- Process-local LRU cache
This is the type that [RustvelloApp] owns. It corresponds to pynenc’s
BaseClientDataStore public API.
Implementations§
Source§impl ClientDataStoreManager
impl ClientDataStoreManager
Sourcepub fn new(
backend: Arc<dyn ClientDataStore>,
config: ClientDataStoreConfig,
) -> Self
pub fn new( backend: Arc<dyn ClientDataStore>, config: ClientDataStoreConfig, ) -> Self
Create a new manager wrapping the given backend.
Sourcepub async fn store_if_large(&self, serialized: &str) -> RustvelloResult<String>
pub async fn store_if_large(&self, serialized: &str) -> RustvelloResult<String>
Store a serialized value, externalizing it if it exceeds the size threshold.
Returns either:
- The original
serializedstring (inline, if small or disabled) - A reference key string (if externalized)
Sourcepub async fn resolve(&self, data: &str) -> RustvelloResult<String>
pub async fn resolve(&self, data: &str) -> RustvelloResult<String>
Resolve a value — if it’s a reference key, retrieve from backend (with LRU cache). If it’s an inline value, return as-is.
Sourcepub async fn store(&self, key: &str, value: &str) -> RustvelloResult<()>
pub async fn store(&self, key: &str, value: &str) -> RustvelloResult<()>
Store a value directly by key (delegates to backend).
Sourcepub async fn retrieve(&self, key: &str) -> RustvelloResult<String>
pub async fn retrieve(&self, key: &str) -> RustvelloResult<String>
Retrieve a value directly by key (delegates to backend).
Sourcepub async fn purge(&self) -> RustvelloResult<()>
pub async fn purge(&self) -> RustvelloResult<()>
Clear the LRU cache and purge all backend data.
Sourcepub fn config(&self) -> &ClientDataStoreConfig
pub fn config(&self) -> &ClientDataStoreConfig
Get the current configuration.
Sourcepub fn backend_name(&self) -> &'static str
pub fn backend_name(&self) -> &'static str
Human-readable name of the underlying backend implementation.
Sourcepub async fn usage_stats(&self) -> Vec<(&'static str, String)>
pub async fn usage_stats(&self) -> Vec<(&'static str, String)>
Key-value statistics about the underlying backend’s current state.
Auto Trait Implementations§
impl !Freeze for ClientDataStoreManager
impl !RefUnwindSafe for ClientDataStoreManager
impl Send for ClientDataStoreManager
impl Sync for ClientDataStoreManager
impl Unpin for ClientDataStoreManager
impl UnsafeUnpin for ClientDataStoreManager
impl !UnwindSafe for ClientDataStoreManager
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