Skip to main content

TransactionDBCheckpoint

Struct TransactionDBCheckpoint 

Source
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>

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Drop for TransactionDBCheckpoint<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.