pub struct BtmCfg {
pub enable: bool,
pub itv: u64,
pub cap: u64,
pub mode: SnapMode,
pub algo: SnapAlgo,
pub target: String,
}Expand description
Config structure of snapshot
Fields
enable: boola global switch for enabling snapshot functions
itv: u64interval between adjacent snapshots, default to 10 blocks
cap: u64the maximum number of snapshots that will be stored, default to 100
mode: SnapModeZfs or Btrfs or External, will try a guess if missing
algo: SnapAlgoFair or Fade, default to ‘Fair’
target: Stringa 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(&self) -> Result<SnapMode>
pub fn guess_mode(&self) -> Result<SnapMode>
try to guess a correct mode
NOTE: not suitable for External mode
Trait Implementations
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.
sourcefn clap<'help>() -> App<'help>
fn clap<'help>() -> App<'help>
StructOpt::clap is replaced with IntoApp::into_app (derived as part of Parser)
Deprecated, StructOpt::clap replaced with IntoApp::into_app (derive as part of
Parser) Read more
sourcefn from_clap(matches: &ArgMatches) -> Self
fn from_clap(matches: &ArgMatches) -> Self
StructOpt::from_clap is replaced with FromArgMatches::from_arg_matches (derived as part of Parser)
Deprecated, StructOpt::from_clap replaced with FromArgMatches::from_arg_matches (derive as part of
Parser) Read more
sourcefn from_args() -> Self
fn from_args() -> Self
StructOpt::from_args is replaced with Parser::parse (note the change in derives)
Deprecated, StructOpt::from_args replaced with Parser::parse (note the change in derives)
sourcefn from_args_safe() -> Result<Self, Error>
fn from_args_safe() -> Result<Self, Error>
StructOpt::from_args_safe is replaced with Parser::try_parse (note the change in derives)
Deprecated, StructOpt::from_args_safe replaced with Parser::try_parse (note the change in derives)
sourcefn from_iter<I, T>(itr: I) -> Self where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn from_iter<I, T>(itr: I) -> Self where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
StructOpt::from_iter is replaced with Parser::parse_from (note the change in derives)
Deprecated, StructOpt::from_iter replaced with Parser::parse_from (note the change in derives)
sourcefn from_iter_safe<I, T>(itr: I) -> Result<Self, Error> where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn from_iter_safe<I, T>(itr: I) -> Result<Self, Error> where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
StructOpt::from_iter_safe is replaced with Parser::try_parse_from (note the change in derives)
Deprecated, StructOpt::from_iter_safe replaced with Parser::try_parse_from (note the
change in derives) Read more
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 · sourcepub fn borrow_mut(&mut self) -> &mut T
pub 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.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more