pub struct EncryptedSyncStorage { /* private fields */ }Expand description
SyncStorage that delegates raw I/O to a CloudHome and handles
the path layout and encryption layer.
Implementations§
Source§impl EncryptedSyncStorage
impl EncryptedSyncStorage
pub fn new(home: Box<dyn CloudHome>, encryption: EncryptionService) -> Self
Return a shared reference to the encryption lock for external use (e.g., SyncHandle can share the same instance for snapshot creation).
Sourcepub fn cloud_home(&self) -> &dyn CloudHome
pub fn cloud_home(&self) -> &dyn CloudHome
Borrow the underlying CloudHome for direct access (e.g., grant_access/revoke_access).
Trait Implementations§
Source§impl SyncStorage for EncryptedSyncStorage
impl SyncStorage for EncryptedSyncStorage
Source§fn list_heads<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<DeviceHead>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_heads<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<DeviceHead>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all device heads (one LIST call to
heads/).Source§fn get_changeset<'life0, 'life1, 'async_trait>(
&'life0 self,
device_id: &'life1 str,
seq: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_changeset<'life0, 'life1, 'async_trait>(
&'life0 self,
device_id: &'life1 str,
seq: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch a single changeset by device_id and seq. Read more
Source§fn put_changeset<'life0, 'life1, 'async_trait>(
&'life0 self,
device_id: &'life1 str,
seq: u64,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put_changeset<'life0, 'life1, 'async_trait>(
&'life0 self,
device_id: &'life1 str,
seq: u64,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Upload a changeset blob (plaintext — the implementation encrypts it).
Writes to
changes/{device_id}/{seq}.enc.Source§fn put_head<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
device_id: &'life1 str,
seq: u64,
snapshot_seq: Option<u64>,
timestamp: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn put_head<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
device_id: &'life1 str,
seq: u64,
snapshot_seq: Option<u64>,
timestamp: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Update the head pointer for a device.
Writes to
heads/{device_id}.json.enc.
If snapshot_seq is Some, the head records that a snapshot covers
all changesets up to that seq. timestamp is the RFC 3339 time of
this sync (used by the sync status UI).Source§fn put_blob<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
id: &'life2 str,
scope: BlobScope,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn put_blob<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
id: &'life2 str,
scope: BlobScope,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Upload an encrypted blob to
{namespace}/{id[0..2]}/{id[2..4]}/{id}.
The plaintext is encrypted with the key selected by scope
(master, or a per-scope derived key).Source§fn get_blob<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
id: &'life2 str,
scope: BlobScope,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_blob<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
id: &'life2 str,
scope: BlobScope,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Download and decrypt a blob from
{namespace}/{id[0..2]}/{id[2..4]}/{id},
using the key selected by scope.Source§fn put_snapshot<'life0, 'async_trait>(
&'life0 self,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn put_snapshot<'life0, 'async_trait>(
&'life0 self,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Upload an encrypted snapshot.
Writes to
snapshot.db.enc (overwrites any previous snapshot).Source§fn get_snapshot<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_snapshot<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Download the encrypted snapshot.
Returns bytes from
snapshot.db.enc.Source§fn delete_changeset<'life0, 'life1, 'async_trait>(
&'life0 self,
device_id: &'life1 str,
seq: u64,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_changeset<'life0, 'life1, 'async_trait>(
&'life0 self,
device_id: &'life1 str,
seq: u64,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a single changeset from storage.
Removes
changes/{device_id}/{seq}.enc.Source§fn list_changesets<'life0, 'life1, 'async_trait>(
&'life0 self,
device_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u64>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_changesets<'life0, 'life1, 'async_trait>(
&'life0 self,
device_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u64>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List all changeset keys for a device.
Returns the sequence numbers that exist in
changes/{device_id}/.Source§fn get_min_schema_version<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<u32>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_min_schema_version<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<u32>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the minimum schema version required to sync with this storage. Read more
Source§fn set_min_schema_version<'life0, 'async_trait>(
&'life0 self,
version: u32,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_min_schema_version<'life0, 'async_trait>(
&'life0 self,
version: u32,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set the minimum schema version required to sync with this storage. Read more
Source§fn put_membership_entry<'life0, 'life1, 'async_trait>(
&'life0 self,
author_pubkey: &'life1 str,
seq: u64,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put_membership_entry<'life0, 'life1, 'async_trait>(
&'life0 self,
author_pubkey: &'life1 str,
seq: u64,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Upload a membership entry.
Writes to
membership/{author_pubkey_hex}/{seq}.enc.Source§fn get_membership_entry<'life0, 'life1, 'async_trait>(
&'life0 self,
author_pubkey: &'life1 str,
seq: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_membership_entry<'life0, 'life1, 'async_trait>(
&'life0 self,
author_pubkey: &'life1 str,
seq: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Download a membership entry.
Reads from
membership/{author_pubkey_hex}/{seq}.enc.Source§fn list_membership_entries<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, u64)>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_membership_entries<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, u64)>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all membership entry keys.
Returns tuples of (author_pubkey, seq).
Source§fn put_wrapped_key<'life0, 'life1, 'async_trait>(
&'life0 self,
user_pubkey: &'life1 str,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put_wrapped_key<'life0, 'life1, 'async_trait>(
&'life0 self,
user_pubkey: &'life1 str,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Upload a wrapped library key for a member.
Writes to
keys/{user_pubkey_hex}.enc.Source§fn get_wrapped_key<'life0, 'life1, 'async_trait>(
&'life0 self,
user_pubkey: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_wrapped_key<'life0, 'life1, 'async_trait>(
&'life0 self,
user_pubkey: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Download a wrapped library key for a member.
Reads from
keys/{user_pubkey_hex}.enc.Source§fn delete_wrapped_key<'life0, 'life1, 'async_trait>(
&'life0 self,
user_pubkey: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_wrapped_key<'life0, 'life1, 'async_trait>(
&'life0 self,
user_pubkey: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a wrapped library key.
Removes
keys/{user_pubkey_hex}.enc.Source§fn put_snapshot_meta<'life0, 'async_trait>(
&'life0 self,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn put_snapshot_meta<'life0, 'async_trait>(
&'life0 self,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Upload snapshot metadata (plaintext – the implementation encrypts it).
Writes to
snapshot_meta.json.enc.Source§fn get_snapshot_meta<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_snapshot_meta<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Download snapshot metadata (decrypted).
Reads from
snapshot_meta.json.enc. Returns NotFound if no metadata exists.Auto Trait Implementations§
impl Freeze for EncryptedSyncStorage
impl !RefUnwindSafe for EncryptedSyncStorage
impl Send for EncryptedSyncStorage
impl Sync for EncryptedSyncStorage
impl Unpin for EncryptedSyncStorage
impl !UnwindSafe for EncryptedSyncStorage
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
§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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.