pub struct LazyTree<T>where
T: TreeLike,{
pub tree: T,
pub name: HashMap<Uuid, String>,
pub key: HashMap<Uuid, [u8; 32]>,
pub implicit_deleted: HashMap<Uuid, bool>,
pub children: HashMap<Uuid, HashSet<Uuid>>,
}Fields§
§tree: T§name: HashMap<Uuid, String>§key: HashMap<Uuid, [u8; 32]>§implicit_deleted: HashMap<Uuid, bool>§children: HashMap<Uuid, HashSet<Uuid>>Implementations§
source§impl<T> LazyTree<T>
impl<T> LazyTree<T>
sourcepub fn decrypt(
&mut self,
account: &Account,
id: &Uuid,
public_key_cache: &mut LookupTable<Owner, String>
) -> Result<File, SharedError>
pub fn decrypt( &mut self, account: &Account, id: &Uuid, public_key_cache: &mut LookupTable<Owner, String> ) -> Result<File, SharedError>
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
) -> Result<Vec<File>, SharedError>
pub fn decrypt_all<I>( &mut self, account: &Account, ids: I, public_key_cache: &mut LookupTable<Owner, String>, skip_invisible: bool ) -> Result<Vec<File>, SharedError>
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: [u8; 32], parent: &Uuid, name: &str, file_type: FileType, account: &Account ) -> Result<(ECSigned<FileMetadata>, Uuid), SharedError>
pub fn rename_op( &mut self, id: &Uuid, name: &str, account: &Account ) -> Result<ECSigned<FileMetadata>, SharedError>
pub fn move_op( &mut self, id: &Uuid, new_parent: &Uuid, account: &Account ) -> Result<Vec<ECSigned<FileMetadata>>, SharedError>
pub fn delete_op( &self, id: &Uuid, account: &Account ) -> Result<ECSigned<FileMetadata>, SharedError>
pub fn read_document( &mut self, d: &impl DocumentService, id: &Uuid, account: &Account ) -> Result<Vec<u8>, SharedError>
pub fn update_document_op( &mut self, id: &Uuid, document: &[u8], account: &Account ) -> Result<(ECSigned<FileMetadata>, AESEncrypted<Vec<u8>>), SharedError>
source§impl<Base, Local, Staged> LazyTree<Staged>where
Staged: TreeLikeMut<F = ECSigned<FileMetadata>> + StagedTreeLike<Base = Base, Staged = Local>,
Base: TreeLike<F = <Staged as TreeLike>::F>,
Local: TreeLikeMut<F = <Staged as TreeLike>::F>,
impl<Base, Local, Staged> LazyTree<Staged>where
Staged: TreeLikeMut<F = ECSigned<FileMetadata>> + StagedTreeLike<Base = Base, Staged = Local>,
Base: TreeLike<F = <Staged as TreeLike>::F>,
Local: TreeLikeMut<F = <Staged as TreeLike>::F>,
pub fn create_unvalidated( &mut self, id: Uuid, key: [u8; 32], parent: &Uuid, name: &str, file_type: FileType, account: &Account ) -> Result<Uuid, SharedError>
pub fn create( &mut self, id: Uuid, key: [u8; 32], parent: &Uuid, name: &str, file_type: FileType, account: &Account ) -> Result<Uuid, SharedError>
pub fn rename_unvalidated( &mut self, id: &Uuid, name: &str, account: &Account ) -> Result<(), SharedError>
pub fn rename( &mut self, id: &Uuid, name: &str, account: &Account ) -> Result<(), SharedError>
pub fn move_unvalidated( &mut self, id: &Uuid, new_parent: &Uuid, account: &Account ) -> Result<(), SharedError>
pub fn move_file( &mut self, id: &Uuid, new_parent: &Uuid, account: &Account ) -> Result<(), SharedError>
pub fn delete_unvalidated( &mut self, id: &Uuid, account: &Account ) -> Result<(), SharedError>
pub fn delete( &mut self, id: &Uuid, account: &Account ) -> Result<(), SharedError>
pub fn update_document_unvalidated( &mut self, id: &Uuid, document: &[u8], account: &Account ) -> Result<AESEncrypted<Vec<u8>>, SharedError>
pub fn update_document( &mut self, id: &Uuid, document: &[u8], account: &Account ) -> Result<AESEncrypted<Vec<u8>>, SharedError>
pub fn delete_unreferenced_file_versions( &self, docs: &impl DocumentService ) -> Result<(), SharedError>
source§impl<T> LazyTree<T>where
T: TreeLike,
impl<T> LazyTree<T>where
T: TreeLike,
pub fn access_mode( &self, owner: Owner, id: &Uuid ) -> Result<Option<UserAccessMode>, SharedError>
pub fn all_children( &mut self ) -> Result<&HashMap<Uuid, HashSet<Uuid>>, SharedError>
pub fn calculate_deleted(&mut self, id: &Uuid) -> Result<bool, SharedError>
pub fn decrypt_key( &mut self, id: &Uuid, account: &Account ) -> Result<[u8; 32], SharedError>
pub fn name( &mut self, id: &Uuid, account: &Account ) -> Result<String, SharedError>
pub fn name_using_links( &mut self, id: &Uuid, account: &Account ) -> Result<String, SharedError>
pub fn parent_using_links(&mut self, id: &Uuid) -> Result<Uuid, SharedError>
pub fn linked_by(&mut self, id: &Uuid) -> Result<Option<Uuid>, SharedError>
sourcepub fn children(&mut self, id: &Uuid) -> Result<HashSet<Uuid>, SharedError>
pub fn children(&mut self, id: &Uuid) -> Result<HashSet<Uuid>, SharedError>
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 ) -> Result<HashSet<Uuid>, SharedError>
sourcepub fn descendants(&mut self, id: &Uuid) -> Result<HashSet<Uuid>, SharedError>
pub fn descendants(&mut self, id: &Uuid) -> Result<HashSet<Uuid>, SharedError>
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 ) -> Result<HashSet<Uuid>, SharedError>
sourcepub fn ancestors(&self, id: &Uuid) -> Result<HashSet<Uuid>, SharedError>
pub fn ancestors(&self, id: &Uuid) -> Result<HashSet<Uuid>, SharedError>
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: &AESEncrypted<Vec<u8>>, account: &Account ) -> Result<Vec<u8>, SharedError>
pub fn stage<T2>(self, staged: T2) -> LazyTree<StagedTree<T, T2>>
pub fn stage_removals( self, removed: HashSet<Uuid> ) -> LazyTree<StagedTree<T, Option<<T as TreeLike>::F>>>
pub fn assert_names_decryptable( &mut self, account: &Account ) -> Result<(), SharedError>
source§impl<T> LazyTree<T>where
T: TreeLikeMut,
impl<T> LazyTree<T>where
T: TreeLikeMut,
pub fn stage_and_promote<S>(&mut self, staged: S) -> Result<(), SharedError>
pub fn stage_validate_and_promote<S>( &mut self, staged: S, owner: Owner ) -> Result<(), SharedError>
pub fn stage_removals_and_promote( &mut self, removed: HashSet<Uuid> ) -> Result<(), SharedError>
source§impl<Base, Staged> LazyTree<StagedTree<Base, Staged>>
impl<Base, Staged> LazyTree<StagedTree<Base, Staged>>
pub fn promote(self) -> Result<LazyTree<Base>, SharedError>
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 ) -> Result<Uuid, SharedError>
pub fn id_to_path( &mut self, id: &Uuid, account: &Account ) -> Result<String, SharedError>
pub fn list_paths( &mut self, filter: Option<Filter>, account: &Account ) -> Result<Vec<String>, SharedError>
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 ) -> Result<Uuid, SharedError>
pub fn create_at_path( &mut self, path: &str, root: &Uuid, account: &Account, pub_key: &PublicKey ) -> Result<Uuid, SharedError>
source§impl<'a> LazyTree<ServerTree<'a>>
impl<'a> LazyTree<ServerTree<'a>>
sourcepub fn stage_diff(
self,
changes: Vec<FileDiff<ECSigned<FileMetadata>>>
) -> Result<LazyTree<StagedTree<ServerTree<'a>, Vec<ServerFile>>>, SharedError>
pub fn stage_diff( self, changes: Vec<FileDiff<ECSigned<FileMetadata>>> ) -> Result<LazyTree<StagedTree<ServerTree<'a>, Vec<ServerFile>>>, SharedError>
Validates a diff prior to staging it. Performs individual validations, then validations that require a tree