[][src]Struct schemadb::DB

pub struct DB { /* fields omitted */ }

This DB is a schematized RocksDB wrapper where all data passed in and out are typed according to Schemas.

Implementations

impl DB[src]

pub fn open(
    path: impl AsRef<Path>,
    name: &'static str,
    column_families: Vec<ColumnFamilyName>,
    db_opts: &Options
) -> Result<Self>
[src]

Create db with all the column families provided if it doesn't exist at path; Otherwise, try to open it with all the column families.

pub fn open_readonly(
    path: impl AsRef<Path>,
    name: &'static str,
    column_families: Vec<ColumnFamilyName>,
    db_opts: &Options
) -> Result<Self>
[src]

Open db in readonly mode Note that this still assumes there's only one process that opens the same DB. See open_as_secondary

pub fn open_as_secondary<P: AsRef<Path>>(
    primary_path: P,
    secondary_path: P,
    name: &'static str,
    column_families: Vec<ColumnFamilyName>,
    db_opts: &Options
) -> Result<Self>
[src]

Open db as secondary. This allows to read the DB in another process while it's already opened for read / write in one (e.g. a Libra Node) https://github.com/facebook/rocksdb/blob/493f425e77043cc35ea2d89ee3c4ec0274c700cb/include/rocksdb/db.h#L176-L222

pub fn get<S: Schema>(&self, schema_key: &S::Key) -> Result<Option<S::Value>>[src]

Reads single record by key.

pub fn put<S: Schema>(&self, key: &S::Key, value: &S::Value) -> Result<()>[src]

Writes single record.

pub fn range_delete<S, SK>(&self, begin: &SK, end: &SK) -> Result<()> where
    S: Schema,
    SK: SeekKeyCodec<S>, 
[src]

Delete all keys in range [begin, end).

SK has to be an explicit type parameter since https://github.com/rust-lang/rust/issues/44721

pub fn iter<S: Schema>(
    &self,
    opts: ReadOptions
) -> Result<SchemaIterator<'_, S>>
[src]

Returns a forward SchemaIterator on a certain schema.

pub fn rev_iter<S: Schema>(
    &self,
    opts: ReadOptions
) -> Result<SchemaIterator<'_, S>>
[src]

Returns a backward SchemaIterator on a certain schema.

pub fn write_schemas(&self, batch: SchemaBatch) -> Result<()>[src]

Writes a group of records wrapped in a SchemaBatch.

pub fn get_approximate_sizes_cf(
    &self
) -> Result<BTreeMap<ColumnFamilyName, u64>>
[src]

Returns the approximate size of each non-empty column family in bytes.

pub fn flush_all(&self) -> Result<()>[src]

Flushes all memtable data. This is only used for testing get_approximate_sizes_cf in unit tests.

Trait Implementations

impl Debug for DB[src]

Auto Trait Implementations

impl RefUnwindSafe for DB

impl Send for DB

impl Sync for DB

impl Unpin for DB

impl UnwindSafe for DB

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,