pub struct LedgerSnapshot {
pub protocol_version: u32,
pub sequence_number: u32,
pub timestamp: u64,
pub network_id: [u8; 32],
pub base_reserve: u32,
pub min_persistent_entry_ttl: u32,
pub min_temp_entry_ttl: u32,
pub max_entry_ttl: u32,
pub ledger_entries: Vec<(Box<LedgerKey>, (Box<LedgerEntry>, Option<u32>))>,
}
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
§min_persistent_entry_ttl: u32
§min_temp_entry_ttl: u32
§max_entry_ttl: u32
§ledger_entries: Vec<(Box<LedgerKey>, (Box<LedgerEntry>, Option<u32>))>
Implementations§
Source§impl LedgerSnapshot
impl LedgerSnapshot
pub fn from<'a>( info: LedgerInfo, entries: impl IntoIterator<Item = (&'a Box<LedgerKey>, (&'a Box<LedgerEntry>, Option<u32>))>, ) -> 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>, Option<u32>))>
pub fn entries( &self, ) -> impl IntoIterator<Item = (&Box<LedgerKey>, &(Box<LedgerEntry>, Option<u32>))>
Get the entries in the snapshot.
Sourcepub fn set_entries<'a>(
&mut self,
entries: impl IntoIterator<Item = (&'a Box<LedgerKey>, (&'a Box<LedgerEntry>, Option<u32>))>,
)
pub fn set_entries<'a>( &mut self, entries: impl IntoIterator<Item = (&'a Box<LedgerKey>, (&'a Box<LedgerEntry>, Option<u32>))>, )
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>, Option<u32>)>)>,
)
pub fn update_entries<'a>( &mut self, entries: impl IntoIterator<Item = &'a (Rc<LedgerKey>, Option<(Rc<LedgerEntry>, Option<u32>)>)>, )
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 for LedgerSnapshot
impl PartialEq for LedgerSnapshot
Source§impl Serialize for LedgerSnapshot
impl Serialize for LedgerSnapshot
Source§impl SnapshotSource for &LedgerSnapshot
impl SnapshotSource for &LedgerSnapshot
Source§impl SnapshotSource for LedgerSnapshot
impl SnapshotSource for LedgerSnapshot
impl Eq for LedgerSnapshot
impl StructuralPartialEq for LedgerSnapshot
Auto Trait Implementations§
impl Freeze for LedgerSnapshot
impl RefUnwindSafe for LedgerSnapshot
impl Send for LedgerSnapshot
impl Sync for LedgerSnapshot
impl Unpin for LedgerSnapshot
impl UnwindSafe for LedgerSnapshot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, U, V, W, E, C> Compare<(T, U, V, W)> for C
impl<T, U, V, W, E, C> Compare<(T, U, V, W)> for C
type Error = E
fn compare( &self, a: &(T, U, V, W), b: &(T, U, V, W), ) -> Result<Ordering, <C as Compare<(T, U, V, W)>>::Error>
Source§impl<T, U, V, W, X, E, C> Compare<(T, U, V, W, X)> for C
impl<T, U, V, W, X, E, C> Compare<(T, U, V, W, X)> for C
type Error = E
fn compare( &self, a: &(T, U, V, W, X), b: &(T, U, V, W, X), ) -> Result<Ordering, <C as Compare<(T, U, V, W, X)>>::Error>
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more