pub struct Database<K, V>where
K: Ord + Clone + Debug + Sync + Send + 'static,
V: Eq + Clone + Debug + Sync + Send + 'static,{ /* private fields */ }
Expand description
A transactional in-memory database
Implementations§
Source§impl<K, V> Database<K, V>
impl<K, V> Database<K, V>
Sourcepub fn with_gc(self) -> Self
pub fn with_gc(self) -> Self
Configure the database to use inactive garbage collection.
This function will create a background thread which will periodically remove any MVCC transaction entries which are older than the current database timestamp, and which are no longer being used by any long-running transactions. Effectively previous versions are cleaned up and removed as soon as possible, whilst ensuring that transaction snapshots still operate correctly.
Sourcepub fn with_gc_history(self, history: Duration) -> Self
pub fn with_gc_history(self, history: Duration) -> Self
Configure the database to use historic garbage collection.
This function will create a background thread which will periodically remove any MVCC transaction entries which are older than the historic duration subtracted from the current database timestamp, and which are no longer being used by any long-running transactions. Effectively previous versions are cleaned up and removed if the transaction entries are older than the specified duration, whilst ensuring that transaction snapshots still operate correctly.
Sourcepub fn transaction(&self, write: bool) -> Transaction<K, V>
pub fn transaction(&self, write: bool) -> Transaction<K, V>
Start a new transaction on this database