Struct noosphere_fs::SphereFs

source ·
pub struct SphereFs<S, K>where
    S: Storage,
    K: KeyMaterial + Clone + 'static,
{ /* private fields */ }
Expand description

SphereFs: An FS-like abstraction over Noosphere content.

A sphere implements a flat namespace that maps strings to CIDs, which in turn refer to the sphere owner’s content. However, it is not particularly convenient for users to think of their content as organized around these primitives. The SphereFs interface offers a familiar, relatively high-level interface for operation on sphere content.

Implementations§

Get the DID identity of the sphere that this FS view is reading from and writing to

The CID revision of the sphere that this FS view is reading from and writing to

Get a data view into the sphere at the current revision

Create an FS view into the latest revision found in the provided sphere reference storage

Create an FS view into the sphere data at a specific revision; note that writes to this view will “fork” history and update the sphere reference to point to the fork.

Rewind the view to point to the version of the sphere just prior to this one in the edit chronology. If there was a previous version to rewind to then the returned Option has the CID of the revision, otherwise if the current version is the oldest one it is None.

Returns true if the content identitifed by slug exists in the sphere at the current revision.

Read a file that is associated with a given slug at the revision of the sphere that this view is pointing to. Note that “contents” are AsyncRead, and content bytes won’t be read until contents is polled.

Write to a slug in the sphere. In order to commit the change to the sphere, you must call save. You can buffer multiple writes before saving.

The returned CID is a link to the memo for the newly added content.

Similar to write, but instead of generating blocks from some provided bytes, the caller provides a CID of an existing DAG in storage. That CID is used as the body of a Memo that is written to the specified slug, and the CID of the memo is returned.

Unlinks a slug from the content space. Note that this does not remove the blocks that were previously associated with the content found at the given slug, because they will still be available at an earlier revision of the sphere. In order to commit the change, you must save. Note that this call is a no-op if there is no matching slug linked in the sphere.

The returned value is the CID previously associated with the slug, if any.

Commits a series of writes to the sphere. In addition to commiting new content to the sphere and block storage, this method:

  • Creates a new revision based on the one that this FS view points to
  • Signs the new revision with provided key material
  • Updates this FS view to point to the new revision

The new revision CID of the sphere is returned.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

Calls U::from(self).

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

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Scrape the references from an impl Read. Read more
Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more