ServerAccountStorage

Trait ServerAccountStorage 

Source
pub trait ServerAccountStorage {
Show 18 methods // Required methods fn account_id(&self) -> &AccountId; fn list_device_keys(&self) -> HashSet<&DevicePublicKey>; fn paths(&self) -> Arc<Paths>; fn folders(&self) -> &HashMap<VaultId, Arc<RwLock<FolderEventLog>>>; fn folders_mut( &mut self, ) -> &mut HashMap<VaultId, Arc<RwLock<FolderEventLog>>>; fn set_devices(&mut self, devices: IndexSet<TrustedDevice>); fn rename_account<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn read_vault<'life0, 'life1, 'async_trait>( &'life0 self, folder_id: &'life1 VaultId, ) -> Pin<Box<dyn Future<Output = Result<Vault, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn write_vault<'life0, 'life1, 'async_trait>( &'life0 self, vault: &'life1 Vault, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn write_login_vault<'life0, 'life1, 'async_trait>( &'life0 self, vault: &'life1 Vault, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn replace_folder<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, folder_id: &'life1 VaultId, diff: &'life2 FolderDiff, ) -> Pin<Box<dyn Future<Output = Result<(FolderEventLog, Vault), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn set_folder_flags<'life0, 'life1, 'async_trait>( &'life0 self, folder_id: &'life1 VaultId, flags: VaultFlags, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn import_account<'life0, 'life1, 'async_trait>( &'life0 mut self, account_data: &'life1 CreateSet, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn load_folders<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Summary>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn import_folder<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, id: &'life1 VaultId, buffer: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn rename_folder<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, id: &'life1 VaultId, name: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn delete_folder<'life0, 'life1, 'async_trait>( &'life0 mut self, id: &'life1 VaultId, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn delete_account<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait;
}
Expand description

Trait for server storage implementations.

Required Methods§

Source

fn account_id(&self) -> &AccountId

Account identifier.

Source

fn list_device_keys(&self) -> HashSet<&DevicePublicKey>

List the public keys of trusted devices.

Source

fn paths(&self) -> Arc<Paths>

Computed storage directories for the provider.

Source

fn folders(&self) -> &HashMap<VaultId, Arc<RwLock<FolderEventLog>>>

Folder event logs.

Source

fn folders_mut(&mut self) -> &mut HashMap<VaultId, Arc<RwLock<FolderEventLog>>>

Mutable folder event logs.

Source

fn set_devices(&mut self, devices: IndexSet<TrustedDevice>)

Set the collection of trusted devices.

Source

fn rename_account<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Rename the account.

Source

fn read_vault<'life0, 'life1, 'async_trait>( &'life0 self, folder_id: &'life1 VaultId, ) -> Pin<Box<dyn Future<Output = Result<Vault, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read a vault from storage.

Source

fn write_vault<'life0, 'life1, 'async_trait>( &'life0 self, vault: &'life1 Vault, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Write a vault to storage.

Source

fn write_login_vault<'life0, 'life1, 'async_trait>( &'life0 self, vault: &'life1 Vault, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Write a login vault to storage.

Source

fn replace_folder<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, folder_id: &'life1 VaultId, diff: &'life2 FolderDiff, ) -> Pin<Box<dyn Future<Output = Result<(FolderEventLog, Vault), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Replace all the events for a folder.

Source

fn set_folder_flags<'life0, 'life1, 'async_trait>( &'life0 self, folder_id: &'life1 VaultId, flags: VaultFlags, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update folder flags.

Source

fn import_account<'life0, 'life1, 'async_trait>( &'life0 mut self, account_data: &'life1 CreateSet, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Import an account from a change set of event logs.

Does not prepare the identity vault event log which should be done by calling initialize_account() before creating new storage.

Intended to be used on a server to create a new account from a collection of patches.

Source

fn load_folders<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Summary>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load folders from the local disc.

Creates the in-memory event logs for each folder on disc.

Source

fn import_folder<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, id: &'life1 VaultId, buffer: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Import a folder into an existing account.

If a folder with the same identifier already exists it is overwritten.

Buffer is the encoded representation of the vault.

Source

fn rename_folder<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, id: &'life1 VaultId, name: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Set the name of a folder.

Source

fn delete_folder<'life0, 'life1, 'async_trait>( &'life0 mut self, id: &'life1 VaultId, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a folder.

Source

fn delete_account<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete this account.

Implementors§