Struct infinitree::Infinitree [−][src]
pub struct Infinitree<I> { /* fields omitted */ }
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()
);
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.
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
.
// No message can be given using a literal 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);
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
pub fn iter<K, O, Q>(
&self,
field: Intent<Box<Q>>,
pred: impl Fn(&K) -> QueryAction + 'static
) -> Result<impl Iterator<Item = O> + '_> where
for<'de> <Q as Collection>::Serialized: Deserialize<'de>,
Q: Collection<Key = K, Item = O> + 'static,
pub fn iter<K, O, Q>(
&self,
field: Intent<Box<Q>>,
pred: impl Fn(&K) -> QueryAction + 'static
) -> Result<impl Iterator<Item = O> + '_> where
for<'de> <Q as Collection>::Serialized: Deserialize<'de>,
Q: Collection<Key = K, Item = O> + 'static,
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 ChunkPointer
s
that you get when using an AEADWriter
stack manually.
You can obtain an AEADWriter
using object_writer
.
Auto Trait Implementations
impl<I> !RefUnwindSafe for Infinitree<I>
impl<I> Send for Infinitree<I> where
I: Send,
impl<I> Sync for Infinitree<I> where
I: Sync,
impl<I> Unpin for Infinitree<I> where
I: Unpin,
impl<I> !UnwindSafe for Infinitree<I>
Blanket Implementations
Mutably borrows from an owned value. Read more
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