pub struct TransactionDBCheckpoint<'db> { /* private fields */ }Expand description
TransactionDB’s checkpoint object. Used to create checkpoints of the specified TransactionDB from time to time.
A TransactionDBCheckpoint must not outlive the TransactionDB it was created from:
use rust_rocksdb::{checkpoint::TransactionDBCheckpoint, SingleThreaded, TransactionDB};
let _checkpoint = {
let db = TransactionDB::<SingleThreaded>::open_default("foo").unwrap();
TransactionDBCheckpoint::new(&db)
};RocksDB TransactionDB checkpoints are expected to flush memtables regardless
of the log_size_for_flush setting.
Implementations§
Source§impl<'db> TransactionDBCheckpoint<'db>
impl<'db> TransactionDBCheckpoint<'db>
Sourcepub fn new<T: ThreadMode>(db: &'db TransactionDB<T>) -> Result<Self, Error>
pub fn new<T: ThreadMode>(db: &'db TransactionDB<T>) -> Result<Self, Error>
Creates new checkpoint object for a specific TransactionDB.
Does not actually produce checkpoints, call .create_checkpoint() to produce
a TransactionDB checkpoint.
Sourcepub fn create_checkpoint<P: AsRef<Path>>(&self, path: P) -> Result<(), Error>
pub fn create_checkpoint<P: AsRef<Path>>(&self, path: P) -> Result<(), Error>
Creates a new physical RocksDB checkpoint in the directory specified by path.
This method uses the default log_size_for_flush value (0), which instructs
RocksDB to flush memtables as needed before creating the checkpoint.
Sourcepub fn create_checkpoint_with_log_size<P: AsRef<Path>>(
&self,
path: P,
log_size_for_flush: u64,
) -> Result<(), Error>
pub fn create_checkpoint_with_log_size<P: AsRef<Path>>( &self, path: P, log_size_for_flush: u64, ) -> Result<(), Error>
Creates a new physical RocksDB checkpoint in path, allowing the caller to
control log_size_for_flush.
The value is forwarded to RocksDB’s Checkpoint API. TransactionDB checkpoints may still flush memtables regardless of this threshold.
Sourcepub fn export_column_family<P: AsRef<Path>>(
&self,
column_family: &impl AsColumnFamilyRef,
path: P,
) -> Result<ExportImportFilesMetaData, Error>
pub fn export_column_family<P: AsRef<Path>>( &self, column_family: &impl AsColumnFamilyRef, path: P, ) -> Result<ExportImportFilesMetaData, Error>
Export a specified Column Family.
Creates copies of the live SST files at the specified export path.
- SST files will be created as hard links when the directory specified is in the same partition as the db directory, copied otherwise.
- the path must not yet exist - a new directory will be created as part of the export.
- Always triggers a flush.
See also: DB::create_column_family_with_import.