[−][src]Struct exonum_merkledb::SystemSchema
System-wide information about the database.
Examples
let db = TemporaryDB::new(); let fork = db.fork(); fork.get_proof_list("list").extend(vec![1_u32, 2, 3]); fork.get_map(("plain_map", &1)).put(&1_u8, "so plain".to_owned()); fork.get_map(("plain_map", &2)).put(&2_u8, "s0 plane".to_owned()); let patch = fork.into_patch(); let state_hash = SystemSchema::new(&patch).state_hash(); // ^-- State hash of the entire database including changes in the `patch`. db.merge(patch).unwrap(); let snapshot = db.snapshot(); let aggregator = SystemSchema::new(&snapshot).state_aggregator(); assert_eq!(aggregator.object_hash(), state_hash); assert_eq!(aggregator.keys().collect::<Vec<_>>(), vec!["list".to_owned()]); // ^-- No other aggregated indexes so far. let index_hash = aggregator.get(&"list".to_owned()).unwrap(); assert_eq!( index_hash, snapshot.get_proof_list::<_, u32>("list").object_hash() ); // It is possible to prove that an index has a specific state // given `state_hash`: let proof = aggregator.get_proof("list".to_owned()); proof.check_against_hash(state_hash).unwrap();
Methods
impl<T: RawAccess> SystemSchema<T>
[src]
pub fn new(access: T) -> Self
[src]
Creates an instance based on the specified access
.
pub fn state_hash(&self) -> Hash
[src]
Returns the state hash of the database. The state hash is up to date for Snapshot
s
(including Patch
es), but is generally stale for Fork
s.
See state aggregation for details how the database state is aggregated.
impl<T: RawAccess + AsReadonly> SystemSchema<T>
[src]
pub fn state_aggregator(&self) -> ProofMapIndex<T::Readonly, str, Hash>
[src]
Returns the state aggregator of the database. The aggregator is up to date for Snapshot
s
(including Patch
es), but is generally stale for Fork
s.
See state aggregation for details how the database state is aggregated.
Trait Implementations
impl<T: Clone> Clone for SystemSchema<T>
[src]
fn clone(&self) -> SystemSchema<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Copy> Copy for SystemSchema<T>
[src]
impl<T: Debug> Debug for SystemSchema<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for SystemSchema<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for SystemSchema<T> where
T: Send,
T: Send,
impl<T> Sync for SystemSchema<T> where
T: Sync,
T: Sync,
impl<T> Unpin for SystemSchema<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for SystemSchema<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,