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)
};TransactionDBCheckpoint does not expose create_checkpoint_with_log_size
because RocksDB TransactionDB checkpoints are expected to flush regardless
of that setting:
use rust_rocksdb::{checkpoint::TransactionDBCheckpoint, TransactionDB};
let db: TransactionDB = TransactionDB::open_default("foo").unwrap();
let checkpoint = TransactionDBCheckpoint::new(&db).unwrap();
checkpoint
.create_checkpoint_with_log_size("foo-checkpoint", u64::MAX)
.unwrap();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 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.