pub struct LazyTree<T: TreeLike> {
pub tree: T,
pub name: HashMap<Uuid, String>,
pub key: HashMap<Uuid, AESKey>,
pub implicit_deleted: HashMap<Uuid, bool>,
pub children: HashMap<Uuid, HashSet<Uuid>>,
}
Fields§
§tree: T
§name: HashMap<Uuid, String>
§key: HashMap<Uuid, AESKey>
§implicit_deleted: HashMap<Uuid, bool>
§children: HashMap<Uuid, HashSet<Uuid>>
Implementations§
Source§impl<T> LazyTree<T>where
T: TreeLike<F = SignedFile>,
impl<T> LazyTree<T>where
T: TreeLike<F = SignedFile>,
Sourcepub fn decrypt(
&mut self,
account: &Account,
id: &Uuid,
public_key_cache: &mut LookupTable<Owner, String>,
) -> SharedResult<File>
pub fn decrypt( &mut self, account: &Account, id: &Uuid, public_key_cache: &mut LookupTable<Owner, String>, ) -> SharedResult<File>
convert FileMetadata into File. fields have been decrypted, public keys replaced with usernames, deleted files filtered out, etc.
Sourcepub fn decrypt_all<I>(
&mut self,
account: &Account,
ids: I,
public_key_cache: &mut LookupTable<Owner, String>,
skip_invisible: bool,
) -> SharedResult<Vec<File>>
pub fn decrypt_all<I>( &mut self, account: &Account, ids: I, public_key_cache: &mut LookupTable<Owner, String>, skip_invisible: bool, ) -> SharedResult<Vec<File>>
convert FileMetadata into File. fields have been decrypted, public keys replaced with usernames, deleted files filtered out, etc.
pub fn create_op( &mut self, id: Uuid, key: AESKey, parent: &Uuid, name: &str, file_type: FileType, account: &Account, ) -> SharedResult<(SignedFile, Uuid)>
pub fn rename_op( &mut self, id: &Uuid, name: &str, account: &Account, ) -> SharedResult<SignedFile>
pub fn move_op( &mut self, id: &Uuid, new_parent: &Uuid, account: &Account, ) -> SharedResult<Vec<SignedFile>>
pub fn delete_op( &self, id: &Uuid, account: &Account, ) -> SharedResult<SignedFile>
pub fn read_document( &mut self, d: &impl DocumentService, id: &Uuid, account: &Account, ) -> SharedResult<DecryptedDocument>
pub fn update_document_op( &mut self, id: &Uuid, document: &[u8], account: &Account, ) -> SharedResult<(SignedFile, EncryptedDocument)>
Source§impl<Base, Local, Staged> LazyTree<Staged>where
Staged: StagedTreeLike<Base = Base, Staged = Local, F = SignedFile> + TreeLikeMut,
Base: TreeLike<F = Staged::F>,
Local: TreeLikeMut<F = Staged::F>,
impl<Base, Local, Staged> LazyTree<Staged>where
Staged: StagedTreeLike<Base = Base, Staged = Local, F = SignedFile> + TreeLikeMut,
Base: TreeLike<F = Staged::F>,
Local: TreeLikeMut<F = Staged::F>,
pub fn create_unvalidated( &mut self, id: Uuid, key: AESKey, parent: &Uuid, name: &str, file_type: FileType, account: &Account, ) -> SharedResult<Uuid>
pub fn create( &mut self, id: Uuid, key: AESKey, parent: &Uuid, name: &str, file_type: FileType, account: &Account, ) -> SharedResult<Uuid>
pub fn rename_unvalidated( &mut self, id: &Uuid, name: &str, account: &Account, ) -> SharedResult<()>
pub fn rename( &mut self, id: &Uuid, name: &str, account: &Account, ) -> SharedResult<()>
pub fn move_unvalidated( &mut self, id: &Uuid, new_parent: &Uuid, account: &Account, ) -> SharedResult<()>
pub fn move_file( &mut self, id: &Uuid, new_parent: &Uuid, account: &Account, ) -> SharedResult<()>
pub fn delete_unvalidated( &mut self, id: &Uuid, account: &Account, ) -> SharedResult<()>
pub fn delete(&mut self, id: &Uuid, account: &Account) -> SharedResult<()>
pub fn update_document_unvalidated( &mut self, id: &Uuid, document: &[u8], account: &Account, ) -> SharedResult<EncryptedDocument>
pub fn update_document( &mut self, id: &Uuid, document: &[u8], account: &Account, ) -> SharedResult<EncryptedDocument>
pub fn delete_unreferenced_file_versions( &self, docs: &impl DocumentService, ) -> SharedResult<()>
Source§impl<T: TreeLike> LazyTree<T>
impl<T: TreeLike> LazyTree<T>
pub fn access_mode( &self, owner: Owner, id: &Uuid, ) -> SharedResult<Option<UserAccessMode>>
pub fn all_children(&mut self) -> SharedResult<&HashMap<Uuid, HashSet<Uuid>>>
pub fn calculate_deleted(&mut self, id: &Uuid) -> SharedResult<bool>
pub fn decrypt_key( &mut self, id: &Uuid, account: &Account, ) -> SharedResult<AESKey>
pub fn name(&mut self, id: &Uuid, account: &Account) -> SharedResult<String>
pub fn name_using_links( &mut self, id: &Uuid, account: &Account, ) -> SharedResult<String>
pub fn parent_using_links(&mut self, id: &Uuid) -> SharedResult<Uuid>
pub fn linked_by(&mut self, id: &Uuid) -> SharedResult<Option<Uuid>>
Sourcepub fn children(&mut self, id: &Uuid) -> SharedResult<HashSet<Uuid>>
pub fn children(&mut self, id: &Uuid) -> SharedResult<HashSet<Uuid>>
Returns ids of files whose parent is the argument. Does not include the argument. TODO could consider returning a reference to the underlying cached value
pub fn children_using_links(&mut self, id: &Uuid) -> SharedResult<HashSet<Uuid>>
Sourcepub fn descendants(&mut self, id: &Uuid) -> SharedResult<HashSet<Uuid>>
pub fn descendants(&mut self, id: &Uuid) -> SharedResult<HashSet<Uuid>>
Returns ids of files for which the argument is an ancestor—the files’ children, recursively. Does not include the argument. This function tolerates cycles.
pub fn descendants_using_links( &mut self, id: &Uuid, ) -> SharedResult<HashSet<Uuid>>
Sourcepub fn ancestors(&self, id: &Uuid) -> SharedResult<HashSet<Uuid>>
pub fn ancestors(&self, id: &Uuid) -> SharedResult<HashSet<Uuid>>
Returns ids of files for which the argument is a descendent—the files’ parent, recursively. Does not include the argument. This function tolerates cycles.
pub fn decrypt_document( &mut self, id: &Uuid, encrypted: &EncryptedDocument, account: &Account, ) -> SharedResult<DecryptedDocument>
pub fn stage<T2: TreeLikeMut<F = T::F>>( self, staged: T2, ) -> LazyTree<StagedTree<T, T2>>
pub fn stage_removals( self, removed: HashSet<Uuid>, ) -> LazyTree<StagedTree<T, Option<T::F>>>
pub fn assert_names_decryptable( &mut self, account: &Account, ) -> SharedResult<()>
Source§impl<T> LazyTree<T>where
T: TreeLikeMut,
impl<T> LazyTree<T>where
T: TreeLikeMut,
pub fn stage_and_promote<S: TreeLikeMut<F = T::F>>( &mut self, staged: S, ) -> SharedResult<()>
pub fn stage_validate_and_promote<S: TreeLikeMut<F = T::F>>( &mut self, staged: S, owner: Owner, ) -> SharedResult<()>
pub fn stage_removals_and_promote( &mut self, removed: HashSet<Uuid>, ) -> SharedResult<()>
Source§impl<Base, Staged> LazyTree<StagedTree<Base, Staged>>
impl<Base, Staged> LazyTree<StagedTree<Base, Staged>>
pub fn promote(self) -> SharedResult<LazyTree<Base>>
Source§impl<Base, Staged> LazyTree<StagedTree<Base, Staged>>
impl<Base, Staged> LazyTree<StagedTree<Base, Staged>>
Source§impl<Base, Local> LazyTree<StagedTree<Base, Local>>
impl<Base, Local> LazyTree<StagedTree<Base, Local>>
pub fn path_to_id( &mut self, path: &str, root: &Uuid, account: &Account, ) -> SharedResult<Uuid>
pub fn id_to_path( &mut self, id: &Uuid, account: &Account, ) -> SharedResult<String>
pub fn list_paths( &mut self, filter: Option<Filter>, account: &Account, ) -> SharedResult<Vec<String>>
Source§impl<Base, Local> LazyTree<StagedTree<Base, Local>>
impl<Base, Local> LazyTree<StagedTree<Base, Local>>
pub fn create_link_at_path( &mut self, path: &str, target_id: Uuid, root: &Uuid, account: &Account, pub_key: &PublicKey, ) -> SharedResult<Uuid>
pub fn create_at_path( &mut self, path: &str, root: &Uuid, account: &Account, pub_key: &PublicKey, ) -> SharedResult<Uuid>
Source§impl<'a> LazyTree<ServerTree<'a>>
impl<'a> LazyTree<ServerTree<'a>>
Sourcepub fn stage_diff(
self,
changes: Vec<FileDiff<SignedFile>>,
) -> SharedResult<LazyStaged1<ServerTree<'a>, Vec<ServerFile>>>
pub fn stage_diff( self, changes: Vec<FileDiff<SignedFile>>, ) -> SharedResult<LazyStaged1<ServerTree<'a>, Vec<ServerFile>>>
Validates a diff prior to staging it. Performs individual validations, then validations that require a tree