pub struct LazyTree<T: TreeLike> {
pub tree: T,
pub name: HashMap<Uuid, String>,
pub implicit_deleted: HashMap<Uuid, bool>,
pub linked_by: HashMap<Uuid, Uuid>,
pub children: HashMap<Uuid, HashSet<Uuid>>,
}Fields§
§tree: T§name: HashMap<Uuid, String>§implicit_deleted: HashMap<Uuid, bool>§linked_by: HashMap<Uuid, Uuid>§children: HashMap<Uuid, HashSet<Uuid>>Implementations§
Source§impl<T> LazyTree<T>where
T: TreeLike<F = SignedMeta>,
impl<T> LazyTree<T>where
T: TreeLike<F = SignedMeta>,
Sourcepub fn decrypt(
&mut self,
keychain: &Keychain,
id: &Uuid,
public_key_cache: &LookupTable<Owner, String>,
) -> LbResult<File>
pub fn decrypt( &mut self, keychain: &Keychain, id: &Uuid, public_key_cache: &LookupTable<Owner, String>, ) -> LbResult<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,
keychain: &Keychain,
ids: I,
public_key_cache: &LookupTable<Owner, String>,
skip_invisible: bool,
) -> LbResult<Vec<File>>
pub fn decrypt_all<I>( &mut self, keychain: &Keychain, ids: I, public_key_cache: &LookupTable<Owner, String>, skip_invisible: bool, ) -> LbResult<Vec<File>>
convert FileMetadata into File. fields have been decrypted, public keys replaced with usernames, deleted files filtered out, etc.
pub fn is_invisible_id(&mut self, id: Uuid) -> LbResult<bool>
pub fn create_op( &mut self, id: Uuid, key: AESKey, parent: &Uuid, name: &str, file_type: FileType, keychain: &Keychain, ) -> LbResult<(SignedMeta, Uuid)>
pub fn rename_op( &mut self, id: &Uuid, name: &str, keychain: &Keychain, ) -> LbResult<SignedMeta>
pub fn move_op( &mut self, id: &Uuid, new_parent: &Uuid, keychain: &Keychain, ) -> LbResult<Vec<SignedMeta>>
pub fn delete_op(&self, id: &Uuid, keychain: &Keychain) -> LbResult<SignedMeta>
pub fn decrypt_document( &mut self, id: &Uuid, doc: &EncryptedDocument, keychain: &Keychain, ) -> LbResult<DecryptedDocument>
pub fn update_document_op( &mut self, id: &Uuid, document: &[u8], keychain: &Keychain, ) -> LbResult<(SignedMeta, EncryptedDocument)>
Source§impl<Base, Local, Staged> LazyTree<Staged>where
Staged: StagedTreeLike<Base = Base, Staged = Local, F = SignedMeta> + 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 = SignedMeta> + 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, keychain: &Keychain, ) -> LbResult<Uuid>
pub fn create( &mut self, id: Uuid, key: AESKey, parent: &Uuid, name: &str, file_type: FileType, keychain: &Keychain, ) -> LbResult<Uuid>
pub fn rename_unvalidated( &mut self, id: &Uuid, name: &str, keychain: &Keychain, ) -> LbResult<()>
pub fn rename( &mut self, id: &Uuid, name: &str, keychain: &Keychain, ) -> LbResult<()>
pub fn move_unvalidated( &mut self, id: &Uuid, new_parent: &Uuid, keychain: &Keychain, ) -> LbResult<()>
pub fn move_file( &mut self, id: &Uuid, new_parent: &Uuid, keychain: &Keychain, ) -> LbResult<()>
pub fn delete_unvalidated( &mut self, id: &Uuid, keychain: &Keychain, ) -> LbResult<()>
pub fn delete(&mut self, id: &Uuid, keychain: &Keychain) -> LbResult<()>
pub fn update_document_unvalidated( &mut self, id: &Uuid, document: &[u8], keychain: &Keychain, ) -> LbResult<EncryptedDocument>
pub fn update_document( &mut self, id: &Uuid, document: &[u8], keychain: &Keychain, ) -> LbResult<EncryptedDocument>
Source§impl<T: TreeLike> LazyTree<T>
impl<T: TreeLike> LazyTree<T>
pub fn access_mode( &self, owner: Owner, id: &Uuid, ) -> LbResult<Option<UserAccessMode>>
pub fn all_children(&mut self) -> LbResult<&HashMap<Uuid, HashSet<Uuid>>>
pub fn calculate_deleted(&mut self, id: &Uuid) -> LbResult<bool>
pub fn decrypt_key( &mut self, id: &Uuid, keychain: &Keychain, ) -> LbResult<AESKey>
pub fn name(&mut self, id: &Uuid, keychain: &Keychain) -> LbResult<String>
pub fn name_using_links( &mut self, id: &Uuid, keychain: &Keychain, ) -> LbResult<String>
pub fn parent_using_links(&mut self, id: &Uuid) -> LbResult<Uuid>
pub fn linked_by(&mut self, id: &Uuid) -> LbResult<Option<Uuid>>
Sourcepub fn children(&mut self, id: &Uuid) -> LbResult<HashSet<Uuid>>
pub fn children(&mut self, id: &Uuid) -> LbResult<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) -> LbResult<HashSet<Uuid>>
Sourcepub fn descendants(&mut self, id: &Uuid) -> LbResult<HashSet<Uuid>>
pub fn descendants(&mut self, id: &Uuid) -> LbResult<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) -> LbResult<HashSet<Uuid>>
Sourcepub fn ancestors(&self, id: &Uuid) -> LbResult<HashSet<Uuid>>
pub fn ancestors(&self, id: &Uuid) -> LbResult<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 pending_roots(&mut self, keychain: &Keychain) -> LbResult<Vec<Uuid>>
pub fn non_deleted_pending_files( &mut self, keychain: &Keychain, ) -> LbResult<Vec<Uuid>>
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, keychain: &Keychain) -> LbResult<()>
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, ) -> LbResult<()>
pub fn stage_validate_and_promote<S: TreeLikeMut<F = T::F>>( &mut self, staged: S, owner: Owner, ) -> LbResult<()>
pub fn stage_removals_and_promote( &mut self, removed: HashSet<Uuid>, ) -> LbResult<()>
Source§impl<Base, Staged> LazyTree<StagedTree<Base, Staged>>
impl<Base, Staged> LazyTree<StagedTree<Base, Staged>>
Source§impl<Base, Staged> LazyTree<StagedTree<Base, Staged>>
impl<Base, Staged> LazyTree<StagedTree<Base, Staged>>
Source§impl<T> LazyTree<T>where
T: TreeLike<F = SignedMeta>,
impl<T> LazyTree<T>where
T: TreeLike<F = SignedMeta>,
pub fn path_to_id( &mut self, path: &str, root: &Uuid, keychain: &Keychain, ) -> LbResult<Uuid>
pub fn id_to_path(&mut self, id: &Uuid, keychain: &Keychain) -> LbResult<String>
pub fn list_paths( &mut self, filter: Option<Filter>, keychain: &Keychain, ) -> LbResult<Vec<(Uuid, String)>>
Source§impl<Base, Local> LazyTree<StagedTree<Base, Local>>
impl<Base, Local> LazyTree<StagedTree<Base, Local>>
Source§impl<'a> LazyTree<ServerTree<'a>>
impl<'a> LazyTree<ServerTree<'a>>
Sourcepub fn stage_diff(
self,
changes: Vec<FileDiff<SignedFile>>,
) -> LbResult<LazyStaged1<ServerTree<'a>, Vec<ServerMeta>>>
pub fn stage_diff( self, changes: Vec<FileDiff<SignedFile>>, ) -> LbResult<LazyStaged1<ServerTree<'a>, Vec<ServerMeta>>>
Validates a diff prior to staging it. Performs individual validations, then validations that require a tree
pub fn stage_diff_v2( self, changes: Vec<FileDiff<SignedMeta>>, ) -> LbResult<LazyStaged1<ServerTree<'a>, Vec<ServerMeta>>>
Source§impl<T, Base, Local> LazyTree<T>where
T: StagedTreeLike<Base = Base, Staged = Local>,
Base: TreeLike<F = T::F>,
Local: TreeLike<F = T::F>,
impl<T, Base, Local> LazyTree<T>where
T: StagedTreeLike<Base = Base, Staged = Local>,
Base: TreeLike<F = T::F>,
Local: TreeLike<F = T::F>,
pub fn validate(&mut self, owner: Owner) -> LbResult<()>
pub fn assert_all_files_decryptable(&mut self, owner: Owner) -> LbResult<()>
pub fn assert_all_filenames_size_limit(&self) -> LbResult<()>
pub fn assert_only_folders_have_children(&self) -> LbResult<()>
pub fn assert_all_files_same_owner_as_parent(&mut self) -> LbResult<()>
pub fn assert_no_cycles(&mut self) -> LbResult<()>
pub fn assert_no_path_conflicts(&mut self) -> LbResult<()>
pub fn assert_no_duplicate_links(&mut self) -> LbResult<()>
pub fn assert_no_broken_links(&mut self) -> LbResult<()>
pub fn assert_no_owned_links(&self) -> LbResult<()>
pub fn assert_no_root_changes(&mut self) -> LbResult<()>
pub fn assert_no_changes_to_deleted_files(&mut self) -> LbResult<()>
Trait Implementations§
Source§impl<T: TreeLike> TreeLike for LazyTree<T>
impl<T: TreeLike> TreeLike for LazyTree<T>
type F = <T as TreeLike>::F
fn ids(&self) -> Vec<Uuid>
fn maybe_find(&self, id: &Uuid) -> Option<&Self::F>
fn find(&self, id: &Uuid) -> LbResult<&Self::F>
fn maybe_find_parent<F2: FileLike>(&self, file: &F2) -> Option<&Self::F>
fn find_parent<F2: FileLike>(&self, file: &F2) -> LbResult<&Self::F>
fn all_files(&self) -> LbResult<Vec<&Self::F>>
fn stage<Staged>(&self, staged: Staged) -> StagedTree<&Self, Staged>
fn to_staged<Staged>(self, staged: Staged) -> StagedTree<Self, Staged>
fn as_lazy(&self) -> LazyTree<&Self>
fn to_lazy(self) -> LazyTree<Self>
Auto Trait Implementations§
impl<T> Freeze for LazyTree<T>where
T: Freeze,
impl<T> RefUnwindSafe for LazyTree<T>where
T: RefUnwindSafe,
impl<T> Send for LazyTree<T>where
T: Send,
impl<T> Sync for LazyTree<T>where
T: Sync,
impl<T> Unpin for LazyTree<T>where
T: Unpin,
impl<T> UnwindSafe for LazyTree<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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