[][src]Struct grin_store::lmdb::Store

pub struct Store { /* fields omitted */ }

LMDB-backed store facilitating data access and serialization. All writes are done through a Batch abstraction providing atomicity.

Implementations

impl Store[src]

pub fn new(
    root_path: &str,
    env_name: Option<&str>,
    db_name: Option<&str>,
    max_readers: Option<u32>
) -> Result<Store, Error>
[src]

Create a new LMDB env under the provided directory. By default creates an environment named "lmdb". Be aware of transactional semantics in lmdb (transactions are per environment, not per database).

pub fn with_version(&self, version: ProtocolVersion) -> Store[src]

Construct a new store using a specific protocol version. Permits access to the db with legacy protocol versions for db migrations.

pub fn protocol_version(&self) -> ProtocolVersion[src]

Protocol version for the store.

pub fn open(&self) -> Result<(), Error>[src]

Opens the database environment

pub fn needs_resize(&self) -> Result<bool, Error>[src]

Determines whether the environment needs a resize based on a simple percentage threshold

pub fn do_resize(&self) -> Result<(), Error>[src]

Increments the database size by as many ALLOC_CHUNK_SIZES to give a minimum threshold of free space

pub fn get_with<T, F>(&self, key: &[u8], f: F) -> Result<Option<T>, Error> where
    F: Fn(&[u8]) -> T, 
[src]

Gets a value from the db, provided its key

pub fn get_ser<T: Readable>(&self, key: &[u8]) -> Result<Option<T>, Error>[src]

Gets a Readable value from the db, provided its key. Encapsulates serialization.

pub fn exists(&self, key: &[u8]) -> Result<bool, Error>[src]

Whether the provided key exists

pub fn iter<T: Readable>(&self, from: &[u8]) -> Result<SerIterator<T>, Error>[src]

Produces an iterator of (key, value) pairs, where values are Readable types moving forward from the provided key.

pub fn batch(&self) -> Result<Batch<'_>, Error>[src]

Builds a new batch to be used with this store.

Auto Trait Implementations

impl !RefUnwindSafe for Store

impl Send for Store

impl Sync for Store

impl Unpin for Store

impl !UnwindSafe for Store

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, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SafeBorrow<T> for T where
    T: ?Sized

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<T> UnsafeAny for T where
    T: Any

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