pub struct Mount(/* private fields */);Implementations§
Source§impl Mount
impl Mount
pub async fn inner(&self) -> MountInner
pub fn blobs(&self) -> BlobsStore
pub async fn link(&self) -> Link
Sourcepub async fn save(
&self,
blobs: &BlobsStore,
publish: bool,
) -> Result<(Link, Link, u64), MountError>
pub async fn save( &self, blobs: &BlobsStore, publish: bool, ) -> Result<(Link, Link, u64), MountError>
Save the current mount state to the blobs store.
If publish is true, the secret will be stored in plaintext, allowing
mirrors to decrypt the bucket contents.
pub async fn init( id: Uuid, name: String, owner: &SecretKey, blobs: &BlobsStore, ) -> Result<Self, MountError>
pub async fn load( link: &Link, secret_key: &SecretKey, blobs: &BlobsStore, ) -> Result<Self, MountError>
Sourcepub async fn load_manifest(
link: &Link,
blobs: &BlobsStore,
) -> Result<Manifest, MountError>
pub async fn load_manifest( link: &Link, blobs: &BlobsStore, ) -> Result<Manifest, MountError>
Load just the manifest from a link without full mount decryption.
This is useful for checking roles/shares before deciding which version to load. Returns the manifest if the blob exists, without attempting decryption.
Sourcepub async fn add_owner(&mut self, peer: PublicKey) -> Result<(), MountError>
pub async fn add_owner(&mut self, peer: PublicKey) -> Result<(), MountError>
Add an owner to this bucket. Owners get an encrypted share immediately.
Sourcepub async fn add_mirror(&mut self, peer: PublicKey)
pub async fn add_mirror(&mut self, peer: PublicKey)
Add a mirror to this bucket. Mirrors can sync bucket data but cannot decrypt until published.
Sourcepub async fn is_published(&self) -> bool
pub async fn is_published(&self) -> bool
Check if this bucket is published (mirrors can decrypt).
Sourcepub async fn publish(&self) -> Result<(Link, Link, u64), MountError>
pub async fn publish(&self) -> Result<(Link, Link, u64), MountError>
Save and publish this bucket, granting decryption access to all mirrors.
This is a convenience method equivalent to save(blobs, true).
pub async fn add<R>(&mut self, path: &Path, data: R) -> Result<(), MountError>
pub async fn rm(&mut self, path: &Path) -> Result<(), MountError>
pub async fn mkdir(&mut self, path: &Path) -> Result<(), MountError>
Sourcepub async fn mv(&mut self, from: &Path, to: &Path) -> Result<(), MountError>
pub async fn mv(&mut self, from: &Path, to: &Path) -> Result<(), MountError>
Move or rename a file or directory from one path to another.
This operation:
- Validates that the move is legal (destination not inside source)
- Retrieves the node at the source path
- Removes it from the source location
- Inserts it at the destination location
The node’s content (files/subdirectories) is not re-encrypted during the move; only the tree structure is updated. This makes moves efficient regardless of the size of the subtree being moved.
§Errors
PathNotFound- source path doesn’t existPathAlreadyExists- destination path already existsMoveIntoSelf- attempting to move a directory into itself (e.g., /foo -> /foo/bar)Default- attempting to move the root directory
pub async fn ls( &self, path: &Path, ) -> Result<BTreeMap<PathBuf, NodeLink>, MountError>
pub async fn ls_deep( &self, path: &Path, ) -> Result<BTreeMap<PathBuf, NodeLink>, MountError>
pub async fn cat(&self, path: &Path) -> Result<Vec<u8>, MountError>
Sourcepub async fn get(&self, path: &Path) -> Result<NodeLink, MountError>
pub async fn get(&self, path: &Path) -> Result<NodeLink, MountError>
Get the NodeLink for a file at a given path
pub async fn _set_node_link_at_path( node: Node, node_link: NodeLink, path: &Path, blobs: &BlobsStore, ) -> Result<(NodeLink, Vec<Hash>), MountError>
pub async fn _get_pins_from_blobs( link: &Link, blobs: &BlobsStore, ) -> Result<Pins, MountError>
pub async fn _put_manifest_in_blobs( bucket_data: &Manifest, blobs: &BlobsStore, ) -> Result<Link, MountError>
pub async fn _put_pins_in_blobs( pins: &Pins, blobs: &BlobsStore, ) -> Result<Link, MountError>
Sourcepub async fn collect_ops_since(
&self,
ancestor_link: Option<&Link>,
blobs: &BlobsStore,
) -> Result<PathOpLog, MountError>
pub async fn collect_ops_since( &self, ancestor_link: Option<&Link>, blobs: &BlobsStore, ) -> Result<PathOpLog, MountError>
Collect all ops from manifest chain back to (but not including) ancestor_link.
Traverses the manifest chain starting from the current version, collecting ops_logs from each manifest until we reach the ancestor (or genesis). The collected ops are merged in chronological order.
§Arguments
ancestor_link- Stop when reaching this link (not included). None means collect all accessible ops (stops when we can’t decrypt a manifest).blobs- The blob store to read manifests from
§Returns
A combined PathOpLog containing all operations since the ancestor.
Sourcepub async fn find_common_ancestor(
&self,
other: &Mount,
blobs: &BlobsStore,
) -> Result<Option<Link>, MountError>
pub async fn find_common_ancestor( &self, other: &Mount, blobs: &BlobsStore, ) -> Result<Option<Link>, MountError>
Find the common ancestor between this mount’s chain and another’s.
Walks both chains backwards via the previous links and returns
the first link where both chains converge.
§Arguments
other- The other mount to find common ancestor withblobs- The blob store to read manifests from
§Returns
The common ancestor link, or None if chains never converge (different buckets).
Sourcepub async fn merge_from<R: ConflictResolver>(
&mut self,
incoming: &Mount,
resolver: &R,
blobs: &BlobsStore,
) -> Result<(MergeResult, Link), MountError>
pub async fn merge_from<R: ConflictResolver>( &mut self, incoming: &Mount, resolver: &R, blobs: &BlobsStore, ) -> Result<(MergeResult, Link), MountError>
Merge another mount’s changes into this one using the given resolver.
This method:
- Finds the common ancestor between the two chains
- Collects ops from both chains since that ancestor
- Merges using the resolver
- Applies the merged state
- Saves the result as a new version
§Arguments
incoming- The mount to merge changes fromresolver- The conflict resolution strategy to useblobs- The blob store
§Returns
A MergeResult containing conflict information and the new version link.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Mount
impl !RefUnwindSafe for Mount
impl Send for Mount
impl Sync for Mount
impl Unpin for Mount
impl !UnwindSafe for Mount
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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