Trove

Trait Trove 

Source
pub trait Trove<T> {
    // Required methods
    fn trove_type() -> DataAddress;
    fn to_bytes(trove: &T) -> Result<Bytes>;
    async fn from_bytes(client: &DwebClient, bytes: Bytes) -> Result<T>;
}
Expand description

gives access to every version of the struct that has ever been stored on Autonomi.

Each History is created using an owner secret key and a name (String). Different T can have overlapping names without problems, because the Trove::trove_type() is also used when a new history is created.

For read-only access, only the address of the history is needed, which gives access to both the first entry in the history and the most recent.

For write access, both the owning secret key and the name must be provided.

Example, using the built-in dweb::trove::Tree struct you can store and access every published version of a tree of files, which might represent a website.

Notes:

  • the dweb-cli supports viewing of versioned websites and directories using a standard web browser, including viewing every version published on Autonomi (similar to the Internet Archive).
  • History manages a sequence of versions of a struct implementing Trove, amounting to a versioned history for any struct impl Trove.

Required Methods§

Source

fn trove_type() -> DataAddress

Source

fn to_bytes(trove: &T) -> Result<Bytes>

Source

async fn from_bytes(client: &DwebClient, bytes: Bytes) -> Result<T>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§