pub struct Infinitree<I, CustomData = ()> where
    CustomData: Serialize + DeserializeOwned + Send + Sync + 'static, 
{ /* private fields */ }
Expand description

An Infinitree root.

This is primarily a wrapper around an Index that manages versioning and key management.

Implementations

Initialize an empty index and tree with no version history.

Examples
use infinitree::{Infinitree, Key, fields::Serialized, backends::Directory};

#[derive(infinitree::Index, Default)]
struct Measurements {
    list: Serialized<Vec<usize>>
}

let mut tree = Infinitree::<Measurements>::empty(
    Directory::new("/storage").unwrap(),
    Key::from_credentials("username", "password").unwrap()
);

Load all version information from the tree.

This method doesn’t load the index, only the associated metadata.

Commit changes currently in the index.

This persists currently in-memory data, and also records the commit with message to the log.

Examples

Any commit message works that implements ToString.

use infinitree::{Infinitree, Key, fields::Serialized, backends::Directory};

let mut tree = Infinitree::<infinitree::fields::VersionedMap<String, String>>::empty(
    Directory::new("/storage").unwrap(),
    Key::from_credentials("username", "password").unwrap()
);

// Commit message can be omitted using `None`
tree.commit(None);

// Otherwise a hardcoded &str also works
tree.commit("this is a message");

// Or even a String instance
let message = "this is a string".to_string();
tree.commit(message);

Wraps the given index in an Infinitree.

This is primarily useful if you’re done writing an Index, and want to commit and persist it, or if you need extra initialization because Default is not viable.

Return all generations in the tree.

Only run persistence query operations (query, load, iter) on the selected generations.

Commit changes currently in the index.

For full documentation, please read Infinitree::commit.

Commit using manually prepared metadata

For full documentation, please read Infinitree::commit.

Load into memory all fields for the selected version ranges

Load the field for the selected generation set

Load into memory all data from field where pred returns true

Same as query, but returns an Iterator

Return a handle for an object writer.

This can be used to manually write sparse data if you don’t want to store it in memory. Especially useful for e.g. files.

Note that currently there’s no fragmenting internally, so anything written using an ObjectWriter must be less than about 4MB.

Return a handle for an object reader

The object reader is for reading out those ChunkPointers that you get when using an AEADWriter stack manually.

You can obtain an AEADWriter using object_writer.

Return an immutable reference to the internal index.

By design this is read-only, as the index fields should use internal mutability and be thread-safe individually.

Return the backend

This allows synchronization of backends that queue upload jobs, or other background tasks.

Trait Implementations

Executes the destructor for this type. Read more

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.

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