Struct dharmadb::persistence::Persistence[][src]

pub struct Persistence<K: ResourceKey> { /* fields omitted */ }

Encapsulates all functionality that involves reading and writing to File System.

Implementations

impl<K> Persistence<K> where
    K: ResourceKey
[src]

pub fn create<V: ResourceValue>(
    options: DharmaOpts
) -> Result<Persistence<K>, Errors>
[src]

Create the persistence layer that will be used to orchestrate read / writes with the File System.

Arguments

  • option - The Dharma options configuration.

Returns

A result that resolves:

  • Ok - The created persistence instance.
  • Err - Error encountered while creating persistence layer.

pub fn get<V: ResourceValue>(&mut self, key: &K) -> Result<Option<V>, Errors>[src]

Get the value associated with the specified key.

Arguments

  • key - The key whose value to query.

returns

Result that resolves:

  • Ok - Optional that may contain the result value.
  • Err - Error that occurred while reading the value.

pub fn insert<V: ResourceValue>(
    &mut self,
    key: K,
    value: V
) -> Result<(), Errors>
[src]

Associate the supplied value with the key. This operation writes the record to the Write Ahead Log so that it can be recovered in case of failure.

Arguments

  • key - The key.
  • value - The value to save associated with the key.

Returns

A result that resolves:

  • Ok - If value was successfully saved.
  • Err - Error that occurred while saving value.

pub fn flush<V: ResourceValue>(
    &mut self,
    values: &Vec<(K, V)>
) -> Result<(), Errors>
[src]

Flush the list of key value pairs to disk. This method assumes that list is already sorted by key and writes the list to disk as an SSTable.

Arguments

  • values - List of Key-Value pairs that need to be written to disk.

Returns

Result that signifies:

  • Ok - If values were flushed to disk successfully.
  • Err - Error that occurred while saving value.

pub fn recover<T: ResourceKey, U: ResourceValue>(
    options: DharmaOpts
) -> Result<Vec<(T, U)>, Errors>
[src]

Attempt to recover data from existing WAL. This operation does not ensure database recovery and could lead to data loss. WAL is deleted after this operation.

pub fn delete(&mut self, key: &K) -> Result<(), Errors>[src]

Trait Implementations

impl<K> Drop for Persistence<K> where
    K: ResourceKey
[src]

Auto Trait Implementations

impl<K> !RefUnwindSafe for Persistence<K>

impl<K> !Send for Persistence<K>

impl<K> !Sync for Persistence<K>

impl<K> Unpin for Persistence<K>

impl<K> !UnwindSafe for Persistence<K>

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, 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.