pub enum CacheScope {
Shared,
User(String),
}Expand description
Trust/visibility scope for a cached CRDT state entry.
Cached state holds the same kind of data — opaque serialized Store state — regardless of where they came from. They differ only in provenance, which determines who is allowed to see them:
-
Shared: state the daemon materialized itself via a local Transaction. The daemon is the trusted computer, so these bytes are good for any user with read permission on the database. Encrypted stores never land here (the daemon has no encryptor key — see
crate::store::PasswordStore), so shared state is always plaintext. -
User(uuid): state a specific user computed and published over the service wire. The daemon cannot verify the merge result, so it is scoped to that user only — alice’s publication is invisible to bob. This is where encrypted-store materializations live (the client decrypts, merges, re-encrypts, and publishes the ciphertext).
On read, the wire handler resolves 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 cached state.
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 (const: unstable) · 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§fn eq(&self, other: &CacheScope) -> bool
fn eq(&self, other: &CacheScope) -> bool
self and other values to be equal, and is used by ==.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<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