pub struct Checkpoint<'db> { /* private fields */ }Expand description
Database’s checkpoint object. Used to create checkpoints of the specified DB from time to time.
Implementations§
Source§impl<'db> Checkpoint<'db>
impl<'db> Checkpoint<'db>
Sourcepub fn new<T: ThreadMode, I: DBInner>(
db: &'db DBCommon<T, I>,
) -> Result<Self, Error>
pub fn new<T: ThreadMode, I: DBInner>( db: &'db DBCommon<T, I>, ) -> Result<Self, Error>
Creates new checkpoint object for specific DB.
Does not actually produce checkpoints, call .create_checkpoint() method to produce
a DB 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 new physical DB checkpoint in directory specified by path.
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.
§Examples
use rust_rocksdb::{DB, checkpoint::Checkpoint};
fn export_column_family(db: &DB, column_family_name: &str, export_path: &str) {
let cp = Checkpoint::new(&db).unwrap();
let cf = db.cf_handle(column_family_name).unwrap();
let export_metadata = cp.export_column_family(&cf, export_path).unwrap();
assert!(export_metadata.get_files().len() > 0);
}See also: DB::create_column_family_with_import.
Trait Implementations§
Auto Trait Implementations§
impl<'db> Freeze for Checkpoint<'db>
impl<'db> RefUnwindSafe for Checkpoint<'db>
impl<'db> !Send for Checkpoint<'db>
impl<'db> !Sync for Checkpoint<'db>
impl<'db> Unpin for Checkpoint<'db>
impl<'db> UnwindSafe for Checkpoint<'db>
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