pub struct TransactionalKeyspace { /* private fields */ }Expand description
Transactional keyspace
Implementations§
Source§impl TransactionalKeyspace
impl TransactionalKeyspace
Sourcepub fn write_tx(&self) -> WriteTransaction<'_>
pub fn write_tx(&self) -> WriteTransaction<'_>
Starts a new writeable transaction.
Sourcepub fn read_tx(&self) -> ReadTransaction
pub fn read_tx(&self) -> ReadTransaction
Starts a new read-only transaction.
Sourcepub fn persist(&self, mode: PersistMode) -> Result<()>
pub fn persist(&self, mode: PersistMode) -> Result<()>
Flushes the active journal. The durability depends on the PersistMode
used.
Persisting only affects durability, NOT consistency! Even without flushing data is crash-safe.
§Examples
let keyspace = Config::new(folder).open_transactional()?;
let items = keyspace.open_partition("my_items", PartitionCreateOptions::default())?;
items.insert("a", "hello")?;
keyspace.persist(PersistMode::SyncAll)?;§Errors
Returns error, if an IO error occurred.
Sourcepub fn open_partition(
&self,
name: &str,
create_options: PartitionCreateOptions,
) -> Result<TxPartitionHandle>
pub fn open_partition( &self, name: &str, create_options: PartitionCreateOptions, ) -> Result<TxPartitionHandle>
Sourcepub fn partition_count(&self) -> usize
pub fn partition_count(&self) -> usize
Returns the amount of partitions
Sourcepub fn list_partitions(&self) -> Vec<StrView>
pub fn list_partitions(&self) -> Vec<StrView>
Gets a list of all partition names in the keyspace
Sourcepub fn partition_exists(&self, name: &str) -> bool
pub fn partition_exists(&self, name: &str) -> bool
Returns true if the partition with the given name exists.
Sourcepub fn delete_partition(&self, handle: TxPartitionHandle) -> Result<()>
pub fn delete_partition(&self, handle: TxPartitionHandle) -> Result<()>
Destroys the partition, removing all data associated with it.
§Errors
Will return Err if an IO error occurs.
Sourcepub fn write_buffer_size(&self) -> u64
pub fn write_buffer_size(&self) -> u64
Returns the current write buffer size (active + sealed memtables).
Sourcepub fn journal_count(&self) -> usize
pub fn journal_count(&self) -> usize
Returns the amount of journals on disk.
Sourcepub fn disk_space(&self) -> u64
pub fn disk_space(&self) -> u64
Returns the disk space usage of the entire keyspace.
Trait Implementations§
Source§impl Clone for TransactionalKeyspace
impl Clone for TransactionalKeyspace
Source§fn clone(&self) -> TransactionalKeyspace
fn clone(&self) -> TransactionalKeyspace
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TransactionalKeyspace
impl !RefUnwindSafe for TransactionalKeyspace
impl Send for TransactionalKeyspace
impl Sync for TransactionalKeyspace
impl Unpin for TransactionalKeyspace
impl !UnwindSafe for TransactionalKeyspace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more