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]
K: ResourceKey,
pub fn create<V: ResourceValue>(
options: DharmaOpts
) -> Result<Persistence<K>, Errors>
[src]
options: DharmaOpts
) -> Result<Persistence<K>, Errors>
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]
&mut self,
key: K,
value: V
) -> Result<(), Errors>
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]
&mut self,
values: &Vec<(K, V)>
) -> Result<(), Errors>
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]
options: DharmaOpts
) -> Result<Vec<(T, U)>, Errors>
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]
K: ResourceKey,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,