pub enum CacheScope {
Shared,
User(String),
}Expand description
Trust/visibility scope for a cached CRDT state entry.
Cached materializations are the same kind of data — opaque serialized CRDT state bytes — regardless of where they came from. They differ only in provenance, which determines who is allowed to see them:
-
Shared: bytes the daemon computed itself via a local Transaction. The daemon is the trusted computer; these bytes are good for any user with read permission on the database. Populated automatically as a side effect of
Database::get_store_stateand other daemon-side materialization paths. Encrypted stores never land here (daemon has no encryptor key — seecrate::store::PasswordStore), so Shared entries are always plaintext. -
User(uuid): bytes a specific user uploaded over the service wire via
CacheCrdtState. The daemon cannot verify the merge result, so it is scoped to that user only — alice’s upload is invisible to bob. This is where encrypted-store materializations live (the client decrypts, merges, re-encrypts, and pushes the ciphertext).
On read, the wire handler tries User(session_user) first and falls
back to Shared on miss — so a remote read of an unencrypted store
benefits from cross-user dedup via the Shared scope, while encrypted
store reads only ever hit User-scoped entries.
Variants§
Daemon-computed; visible to every user with database read permission.
User(String)
Client-uploaded; visible only to the named user.
Implementations§
Source§impl CacheScope
impl CacheScope
Sourcepub fn storage_key(&self) -> Option<&str>
pub fn storage_key(&self) -> Option<&str>
Storage key for the scope — None encodes Self::Shared, Some
encodes Self::User. Useful for backends that need a single
nullable column or a uniform key prefix (e.g. SQL primary keys,
Redis key formatting).
Trait Implementations§
Source§impl Clone for CacheScope
impl Clone for CacheScope
Source§fn clone(&self) -> CacheScope
fn clone(&self) -> CacheScope
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CacheScope
impl Debug for CacheScope
Source§impl<'de> Deserialize<'de> for CacheScope
impl<'de> Deserialize<'de> for CacheScope
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for CacheScope
impl Hash for CacheScope
Source§impl PartialEq for CacheScope
impl PartialEq for CacheScope
Source§impl Serialize for CacheScope
impl Serialize for CacheScope
impl Eq for CacheScope
impl StructuralPartialEq for CacheScope
Auto Trait Implementations§
impl Freeze for CacheScope
impl RefUnwindSafe for CacheScope
impl Send for CacheScope
impl Sync for CacheScope
impl Unpin for CacheScope
impl UnsafeUnpin for CacheScope
impl UnwindSafe for CacheScope
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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