Type Alias TxKeyspace

Source
pub type TxKeyspace = TransactionalKeyspace;
Expand description

Aliased Type§

struct TxKeyspace { /* private fields */ }

Implementations§

Source§

impl TxKeyspace

Source

pub fn write_tx(&self) -> WriteTransaction<'_>

Starts a new writeable transaction.

Source

pub fn read_tx(&self) -> ReadTransaction

Starts a new read-only transaction.

Source

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.

Source

pub fn open_partition( &self, name: &str, create_options: PartitionCreateOptions, ) -> Result<TxPartitionHandle>

Creates or opens a keyspace partition.

If the partition does not yet exist, it will be created configured with create_options. Otherwise simply a handle to the existing partition will be returned.

Partition names can be up to 255 characters long, can not be empty and can only contain alphanumerics, underscore (_), dash (-), hash tag (#) and dollar ($).

§Errors

Returns error, if an IO error occurred.

§Panics

Panics if the partition name is invalid.

Source

pub fn partition_count(&self) -> usize

Returns the amount of partitions

Source

pub fn list_partitions(&self) -> Vec<StrView>

Gets a list of all partition names in the keyspace

Source

pub fn partition_exists(&self, name: &str) -> bool

Returns true if the partition with the given name exists.

Source

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.

Source

pub fn write_buffer_size(&self) -> u64

Returns the current write buffer size (active + sealed memtables).

Source

pub fn journal_count(&self) -> usize

Returns the amount of journals on disk.

Source

pub fn disk_space(&self) -> u64

Returns the disk space usage of the entire keyspace.

Source

pub fn open(config: Config) -> Result<Self>

Opens a keyspace in the given directory.

§Errors

Returns error, if an IO error occurred.