Struct soroban_ledger_snapshot::LedgerSnapshot
source · pub struct LedgerSnapshot {
pub protocol_version: u32,
pub sequence_number: u32,
pub timestamp: u64,
pub network_id: [u8; 32],
pub base_reserve: u32,
pub ledger_entries: Vec<(Box<LedgerKey>, Box<LedgerEntry>)>,
}Expand description
Ledger snapshot stores a snapshot of a ledger that can be restored for use
in environments as a LedgerInfo and a SnapshotSource.
Fields§
§protocol_version: u32§sequence_number: u32§timestamp: u64§network_id: [u8; 32]§base_reserve: u32§ledger_entries: Vec<(Box<LedgerKey>, Box<LedgerEntry>)>Implementations§
source§impl LedgerSnapshot
impl LedgerSnapshot
pub fn from<'a>( info: LedgerInfo, entries: impl IntoIterator<Item = (&'a Box<LedgerKey>, &'a Box<LedgerEntry>)> ) -> Self
sourcepub fn update(&mut self, host: &Host)
pub fn update(&mut self, host: &Host)
Update the snapshot with the state within the given Host.
The ledger info of the host will overwrite the ledger info in the snapshot. The entries in the host’s storage will overwrite entries in the snapshot. Existing entries in the snapshot that are untouched by the host will remain.
pub fn ledger_info(&self) -> LedgerInfo
sourcepub fn set_ledger_info(&mut self, info: LedgerInfo)
pub fn set_ledger_info(&mut self, info: LedgerInfo)
Set the ledger info in the snapshot.
sourcepub fn entries(
&self
) -> impl IntoIterator<Item = (&Box<LedgerKey>, &Box<LedgerEntry>)>
pub fn entries( &self ) -> impl IntoIterator<Item = (&Box<LedgerKey>, &Box<LedgerEntry>)>
Get the entries in the snapshot.
sourcepub fn set_entries<'a>(
&mut self,
entries: impl IntoIterator<Item = (&'a Box<LedgerKey>, &'a Box<LedgerEntry>)>
)
pub fn set_entries<'a>( &mut self, entries: impl IntoIterator<Item = (&'a Box<LedgerKey>, &'a Box<LedgerEntry>)> )
Replace the entries in the snapshot with the entries in the iterator.
sourcepub fn update_entries<'a>(
&mut self,
entries: impl IntoIterator<Item = &'a (Rc<LedgerKey>, Option<Rc<LedgerEntry>>)>
)
pub fn update_entries<'a>( &mut self, entries: impl IntoIterator<Item = &'a (Rc<LedgerKey>, Option<Rc<LedgerEntry>>)> )
Update entries in the snapshot by adding or replacing any entries that have entry in the input iterator, or removing any that does not have an entry.
Trait Implementations§
source§impl Clone for LedgerSnapshot
impl Clone for LedgerSnapshot
source§fn clone(&self) -> LedgerSnapshot
fn clone(&self) -> LedgerSnapshot
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for LedgerSnapshot
impl Debug for LedgerSnapshot
source§impl Default for LedgerSnapshot
impl Default for LedgerSnapshot
source§impl<'de> Deserialize<'de> for LedgerSnapshot
impl<'de> Deserialize<'de> for LedgerSnapshot
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<LedgerSnapshot> for LedgerSnapshot
impl PartialEq<LedgerSnapshot> for LedgerSnapshot
source§fn eq(&self, other: &LedgerSnapshot) -> bool
fn eq(&self, other: &LedgerSnapshot) -> bool
This method tests for
self and other values to be equal, and is used
by ==.