Struct eyros::DB[][src]

pub struct DB<S, T, P, V> where
    S: RA,
    P: Point,
    V: Value,
    T: Tree<P, V>, 
{ pub storage: Arc<Mutex<Box<dyn Storage<S>>>>, pub fields: Arc<SetupFields>, pub meta_store: Arc<Mutex<S>>, pub meta: Arc<RwLock<Meta<P>>>, pub trees: Arc<TreeFile<S, T, P, V>>, }
Expand description

Top-level database API.

Fields

storage: Arc<Mutex<Box<dyn Storage<S>>>>fields: Arc<SetupFields>meta_store: Arc<Mutex<S>>meta: Arc<RwLock<Meta<P>>>trees: Arc<TreeFile<S, T, P, V>>

Implementations

Create a database instance from setup, a configuration builder.

let mut db: DB<_,T,P,V> = DB::open_from_setup(
  Setup::from_path(&PathBuf::from("/tmp/eyros-db/"))
    .branch_factor(5)
    .max_depth(8)
    .max_records(20_000)
).await?;

You can also use Setup’s .build()? method to get a DB instance:

use eyros::{DB,Coord,Tree2,Setup};

let mut db: DB<_,T,P,V> = Setup::from_path(&PathBuf::from("/tmp/eyros-db/"))
  .branch_factor(5)
  .max_depth(8)
  .max_records(20_000)
  .build()
  .await?;

Always open a database with the same types. There are no runtime checks yet to ensure a database is opened with the same types that it was created with. It’s fine to change the Setup settings on a previously-created database, but those settings will only affect new operations.

Create a database instance from storage, an interface for reading, writing, and removing files.

Write a collection of updates to the database with default options. This does not sync the changes to disk: call sync() for that. Each update can be a Row::Insert(point,value) or a Row::Delete(point,id) (where the type of id is defined in Value::Id). For deletes, you need not have exactly the same point as the original record, only a point that will intersect it.

Perform a batch update with an explicit rebuild depth to override the rebuild depth defined in the Setup. A greater rebuild depth trades write performance for better query performance, which you can also obtain by calling optimize().

Perform a batch update with explicit batch options.

Improve query performance by rebuilding the first rebuild_depth levels of the tree. A higher value for rebuild_depth will use more memory, as the trees are read into memory during rebuilding and not written back out again until sync() is called.

Write the changes made to the database to file storage.

Query the database for every feature that intersects bbox. Results are provided as a readable stream of (point,value) records.

Query the database for every feature that intersects bbox. The provided trace will be called right before a tree file is opened with the corresponding TreeRef for the given tree.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. 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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

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.