Skip to main content

BackupEngineOptions

Struct BackupEngineOptions 

Source
pub struct BackupEngineOptions { /* private fields */ }

Implementations§

Source§

impl BackupEngineOptions

Source

pub fn new<P: AsRef<Path>>(backup_dir: P) -> Result<Self, Error>

Initializes BackupEngineOptions with the directory to be used for storing/accessing the backup files.

Source

pub fn set_max_background_operations(&mut self, max_background_operations: i32)

Sets the number of operations (such as file copies or file checksums) that RocksDB may perform in parallel when executing a backup or restore.

Default: 1

Source

pub fn set_sync(&mut self, sync: bool)

Sets whether to use fsync(2) to sync file data and metadata to disk after every file write, guaranteeing that backups will be consistent after a reboot or if machine crashes. Setting it to false will speed things up a bit, but some (newer) backups might be inconsistent. In most cases, everything should be fine, though.

Default: true

Documentation: https://github.com/facebook/rocksdb/wiki/How-to-backup-RocksDB#advanced-usage

Source

pub fn get_sync(&mut self) -> bool

Returns the value of the sync option.

Source

pub fn set_current_temperatures_override_manifest(&mut self, val: bool)

(Experimental - subject to change or removal) When taking a backup and saving file temperature info (minimum schema_version is 2), there are two potential sources of truth for the placement of files into temperature tiers: (a) the current file temperature reported by the FileSystem or (b) the expected file temperature recorded in DB manifest. When this option is false (default), (b) overrides (a) if both are not UNKNOWN. When true, (a) overrides (b) if both are not UNKNOWN. Regardless of this setting, a known temperature overrides UNKNOWN.

Source

pub fn get_current_temperatures_override_manifest(&self) -> bool

Returns the value of the current_temperatures_override_manifest option.

Source

pub fn set_io_buffer_size(&mut self, val: u64)

Sets the io_buffer_size option.

Source

pub fn get_io_buffer_size(&self) -> u64

Returns the value of the io_buffer_size option.

Source

pub fn set_schema_version(&mut self, val: c_int)

Major schema version to use when writing backup meta files 1 (default) - compatible with very old versions of RocksDB. 2 - can be read by RocksDB versions >= 6.19.0. Minimum schema version for

  • (Experimental) saving and restoring file temperature metadata
Source

pub fn get_schema_version(&self) -> c_int

Returns the value of the schema_version option.

Source

pub fn set_share_files_with_checksum(&mut self, val: bool)

share_files_with_checksum supports table and blob files.

Only used if share_table_files is set to true. Setting to false is DEPRECATED and potentially dangerous because in that case BackupEngine can lose data if backing up databases with distinct or divergent history, for example if restoring from a backup other than the latest, writing to the DB, and creating another backup. Setting to true (default) prevents these issues by ensuring that different table files (SSTs) and blob files with the same number are treated as distinct. See share_files_with_checksum_naming and ShareFilesNaming.

Default: true

Source

pub fn get_share_files_with_checksum(&self) -> bool

Returns the value of the share_files_with_checksum option.

Source

pub fn get_backup_log_files(&self) -> bool

Returns the current backup_log_files setting.

See Self::set_backup_log_files for what this controls.

Source

pub fn get_backup_rate_limit(&self) -> u64

Returns the current backup_rate_limit setting.

See Self::set_backup_rate_limit for what this controls.

Source

pub fn get_callback_trigger_interval_size(&self) -> u64

Returns the current callback_trigger_interval_size setting.

See Self::set_callback_trigger_interval_size for what this controls.

Source

pub fn get_destroy_old_data(&self) -> bool

Returns the current destroy_old_data setting.

See Self::set_destroy_old_data for what this controls.

Source

pub fn get_max_background_operations(&self) -> c_int

Returns the current max_background_operations setting.

See Self::set_max_background_operations for what this controls.

Source

pub fn get_max_valid_backups_to_open(&self) -> c_int

Returns the current max_valid_backups_to_open setting.

See Self::set_max_valid_backups_to_open for what this controls.

Source

pub fn get_restore_rate_limit(&self) -> u64

Returns the current restore_rate_limit setting.

See Self::set_restore_rate_limit for what this controls.

Source

pub fn get_share_table_files(&self) -> bool

Returns the current share_table_files setting.

See Self::set_share_table_files for what this controls.

Source

pub fn set_backup_log_files(&mut self, val: bool)

If false, we won’t backup log files. This option can be useful for backing up in-memory databases where log file are persisted, but table files are in memory. Default: true.

Source

pub fn set_backup_rate_limit(&mut self, val: u64)

Max bytes that can be transferred in a second while creating a backup.

If 0, go as fast as you can. This limit only applies to writes.

Default: 0

Source

pub fn set_callback_trigger_interval_size(&mut self, val: u64)

During backup user can get callback every time next callback_trigger_interval_size bytes being copied. Default: 4194304.

Source

pub fn set_destroy_old_data(&mut self, val: bool)

If true, it will delete whatever backups there are already Default: false.

Source

pub fn set_max_valid_backups_to_open(&mut self, val: c_int)

For BackupEngineReadOnly, Open() will open at most this many of the latest non-corrupted backups.

Note: this setting is ignored (behaves like INT_MAX) for any kind of writable BackupEngine because it would inhibit accounting for shared files for proper backup deletion, including purging any incompletely created backups on creation of a new backup.

Default: INT_MAX.

Source

pub fn set_restore_rate_limit(&mut self, val: u64)

Max bytes that can be transferred in a second during restore. If 0, go as fast as you can This limit only applies to writes. To also limit reads, a rate limiter able to also limit reads (e.g, its mode = kAllIo) have to be passed in through the option “restore_rate_limiter” Default: 0.

Source

pub fn set_share_table_files(&mut self, val: bool)

Share_table_files supports table and blob files.

If share_table_files == true, the backup directory will share table and blob files among backups, to save space among backups of the same DB and to enable incremental backups by only copying new files. If share_table_files == false, each backup will be on its own and will not share any data with other backups.

default: true.

Source

pub fn set_backup_dir<P: AsRef<Path>>( &mut self, backup_dir: P, ) -> Result<(), Error>

Changes the directory backups are written to and read from, replacing the one given to Self::new.

RocksDB copies the string, so the path is not borrowed. It cannot contain an interior NUL.

Source

pub fn get_backup_dir(&self) -> PathBuf

Returns the directory backups are written to and read from.

Source

pub fn set_share_files_with_checksum_naming(&mut self, val: ShareFilesNaming)

Sets the naming scheme used for table and blob files stored in the shared_checksum directory.

The value must select exactly one naming scheme from the low bits, see ShareFilesNaming. Default: ShareFilesNaming::DEFAULT.

Changing this is downgrade safe, because RocksDB can read, restore and delete backups whose files use a different scheme. It does mean that adding more backups to the same directory can store a file a second time under its new shared name.

Source

pub fn get_share_files_with_checksum_naming(&self) -> ShareFilesNaming

Returns the current share_files_with_checksum_naming setting.

Source

pub fn set_env(&mut self, env: &Env)

Sets the Env used for the backup directory itself. The database being backed up keeps using its own Env.

RocksDB stores a borrowed Env* and BackupEngineImpl copies the options by value, so the Env has to outlive the engine. This type keeps a handle, and BackupEngine::open takes another one, so the Env stays alive for as long as either of them does.

Source

pub fn set_backup_rate_limiter( &mut self, rate_bytes_per_sec: i64, refill_period_us: i64, fairness: i32, )

Sets a rate limiter for backup I/O, which unlike Self::set_backup_rate_limit can be tuned beyond a byte budget.

The limiter created here defaults to limiting writes only. Use Self::set_backup_rate_limiter_with_mode to limit reads as well.

The C API holds the limiter in a shared_ptr, so it stays alive for as long as the options and the engine need it and there is nothing for the caller to keep.

Source

pub fn set_backup_rate_limiter_with_mode( &mut self, rate_bytes_per_sec: i64, refill_period_us: i64, fairness: i32, mode: RateLimiterMode, auto_tuned: bool, )

Sets a rate limiter for backup I/O, choosing which operations count against the limit and whether the limit is auto tuned.

See crate::Options::set_ratelimiter_with_mode for what the parameters mean.

Source

pub fn set_restore_rate_limiter( &mut self, rate_bytes_per_sec: i64, refill_period_us: i64, fairness: i32, )

Sets a rate limiter for restore I/O.

The limiter created here defaults to limiting writes only, which is what Self::set_restore_rate_limit already does. Use Self::set_restore_rate_limiter_with_mode with RateLimiterMode::KAllIo to also limit reads.

Ownership works as described on Self::set_backup_rate_limiter.

Source

pub fn set_restore_rate_limiter_with_mode( &mut self, rate_bytes_per_sec: i64, refill_period_us: i64, fairness: i32, mode: RateLimiterMode, auto_tuned: bool, )

Sets a rate limiter for restore I/O, choosing which operations count against the limit and whether the limit is auto tuned.

See crate::Options::set_ratelimiter_with_mode for what the parameters mean.

Trait Implementations§

Source§

impl Drop for BackupEngineOptions

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.