Skip to main content

Mount

Struct Mount 

Source
pub struct Mount(/* private fields */);

Implementations§

Source§

impl Mount

Source

pub async fn inner(&self) -> MountInner

Source

pub fn blobs(&self) -> BlobsStore

Source

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.

Source

pub async fn init( id: Uuid, name: String, owner: &SecretKey, blobs: &BlobsStore, ) -> Result<Self, MountError>

Source

pub async fn load( link: &Link, secret_key: &SecretKey, blobs: &BlobsStore, ) -> Result<Self, MountError>

Source

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.

Source

pub async fn add_owner(&mut self, peer: PublicKey) -> Result<(), MountError>

Add an owner to this bucket. Owners get an encrypted share immediately.

Source

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.

Source

pub async fn is_published(&self) -> bool

Check if this bucket is published (mirrors can decrypt).

Source

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).

Source

pub async fn add<R>(&mut self, path: &Path, data: R) -> Result<(), MountError>
where R: Read + Send + Sync + 'static + Unpin,

Source

pub async fn rm(&mut self, path: &Path) -> Result<(), MountError>

Source

pub async fn mkdir(&mut self, path: &Path) -> Result<(), MountError>

Source

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:

  1. Validates that the move is legal (destination not inside source)
  2. Retrieves the node at the source path
  3. Removes it from the source location
  4. 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 exist
  • PathAlreadyExists - destination path already exists
  • MoveIntoSelf - attempting to move a directory into itself (e.g., /foo -> /foo/bar)
  • Default - attempting to move the root directory
Source

pub async fn ls( &self, path: &Path, ) -> Result<BTreeMap<PathBuf, NodeLink>, MountError>

Source

pub async fn ls_deep( &self, path: &Path, ) -> Result<BTreeMap<PathBuf, NodeLink>, MountError>

Source

pub async fn cat(&self, path: &Path) -> Result<Vec<u8>, MountError>

Source

pub async fn get(&self, path: &Path) -> Result<NodeLink, MountError>

Get the NodeLink for a file at a given path

Source

pub async fn _get_pins_from_blobs( link: &Link, blobs: &BlobsStore, ) -> Result<Pins, MountError>

Source

pub async fn _put_manifest_in_blobs( bucket_data: &Manifest, blobs: &BlobsStore, ) -> Result<Link, MountError>

Source

pub async fn _put_pins_in_blobs( pins: &Pins, blobs: &BlobsStore, ) -> Result<Link, MountError>

Source

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.

Source

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 with
  • blobs - The blob store to read manifests from
§Returns

The common ancestor link, or None if chains never converge (different buckets).

Source

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:

  1. Finds the common ancestor between the two chains
  2. Collects ops from both chains since that ancestor
  3. Merges using the resolver
  4. Applies the merged state
  5. Saves the result as a new version
§Arguments
  • incoming - The mount to merge changes from
  • resolver - The conflict resolution strategy to use
  • blobs - The blob store
§Returns

A MergeResult containing conflict information and the new version link.

Trait Implementations§

Source§

impl Clone for Mount

Source§

fn clone(&self) -> Mount

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> CompatExt for T

Source§

fn compat(self) -> Compat<T>

Applies the Compat adapter by value. Read more
Source§

fn compat_ref(&self) -> Compat<&T>

Applies the Compat adapter by shared reference. Read more
Source§

fn compat_mut(&mut self) -> Compat<&mut T>

Applies the Compat adapter by mutable reference. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,