pub struct BtmCfg {
pub enable: bool,
pub itv: u64,
pub cap: u64,
pub mode: SnapMode,
pub algo: SnapAlgo,
pub volume: String,
}
Expand description
Config structure of snapshot
Fields
enable: bool
a global switch for enabling snapshot functions
itv: u64
interval between adjacent snapshots, default to 10 blocks
cap: u64
the maximum number of snapshots that will be stored, default to 100
mode: SnapMode
Zfs or Btrfs or External, will try a guess if missing
algo: SnapAlgo
Fair or Fade, default to ‘Fair’
volume: String
a data volume containing both ledger data and tendermint data
Implementations
sourceimpl BtmCfg
impl BtmCfg
sourcepub fn new_client_hdr() -> Self
pub fn new_client_hdr() -> Self
Used in client side
sourcepub fn snapshot(&self, idx: u64) -> Result<()>
pub fn snapshot(&self, idx: u64) -> Result<()>
generate a snapshot for the latest state of blockchain
sourcepub fn rollback(&self, idx: Option<u64>, strict: bool) -> Result<()>
pub fn rollback(&self, idx: Option<u64>, strict: bool) -> Result<()>
rollback the state of blockchain to a specificed height
sourcepub fn get_sorted_snapshots(&self) -> Result<Vec<u64>>
pub fn get_sorted_snapshots(&self) -> Result<Vec<u64>>
Get snapshot list in ‘DESC’ order.
sourcepub fn guess_mode(volume: &str) -> Result<SnapMode>
pub fn guess_mode(volume: &str) -> Result<SnapMode>
try to guess a correct mode
NOTE: not suitable for External
mode
sourcepub fn list_snapshots(&self) -> Result<()>
pub fn list_snapshots(&self) -> Result<()>
List all existing snapshots.
sourcepub fn clean_snapshots(&self) -> Result<()>
pub fn clean_snapshots(&self) -> Result<()>
Clean all existing snapshots.
Trait Implementations
sourceimpl CommandFactory for BtmCfg
impl CommandFactory for BtmCfg
sourcefn into_app<'b>() -> Command<'b>
fn into_app<'b>() -> Command<'b>
Replaced with `CommandFactory::command
Deprecated, replaced with CommandFactory::command
sourcefn into_app_for_update<'b>() -> Command<'b>
fn into_app_for_update<'b>() -> Command<'b>
Replaced with `CommandFactory::command_for_update
Deprecated, replaced with CommandFactory::command_for_update
sourcefn command_for_update<'help>() -> App<'help>
fn command_for_update<'help>() -> App<'help>
sourceimpl FromArgMatches for BtmCfg
impl FromArgMatches for BtmCfg
sourcefn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Instantiate Self
from ArgMatches
, parsing the arguments as needed. Read more
sourcefn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches
) -> Result<(), Error>
fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches
) -> Result<(), Error>
Assign values from ArgMatches
to self
.
sourceimpl Parser for BtmCfg
impl Parser for BtmCfg
sourcefn parse_from<I, T>(itr: I) -> Self where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn parse_from<I, T>(itr: I) -> Self where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
Parse from iterator, exit on error
sourcefn try_parse_from<I, T>(itr: I) -> Result<Self, Error> where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error> where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
Parse from iterator, return Err on error.
sourcefn update_from<I, T>(&mut self, itr: I) where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn update_from<I, T>(&mut self, itr: I) where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
Update from iterator, exit on error
sourcefn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error> where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error> where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
Update from iterator, return Err on error.
Auto Trait Implementations
impl RefUnwindSafe for BtmCfg
impl Send for BtmCfg
impl Sync for BtmCfg
impl Unpin for BtmCfg
impl UnwindSafe for BtmCfg
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more