[−][src]Struct exonum_merkledb::migration::Migration
Access to migrated indexes.
Migration
is conceptually similar to a Prefixed
access. For example, an index with
address "list"
in a migration Migration::new("foo", _)
will map to the address "foo.list"
after the migration is flushed. The major difference with Prefixed
is that the indexes
in a migration cannot be accessed in any other way. That is, it is impossible to access
an index in a migration without constructing a Migration
object first.
Methods
impl<T: RawAccess> Migration<T>
[src]
pub fn new(namespace: impl Into<String>, access: T) -> Self
[src]
Creates a migration in the specified namespace.
pub fn state_hash(&self) -> Hash
[src]
Returns the state hash of indexes within the migration. The state hash is up to date
for Snapshot
s (including Patch
es), but is generally stale for Fork
s.
impl<T: RawAccess + AsReadonly> Migration<T>
[src]
pub fn state_aggregator(&self) -> ProofMapIndex<T::Readonly, str, Hash>
[src]
Returns the state aggregator for the indexes within the migration. The aggregator
is up to date for Snapshot
s (including Patch
es), but is generally stale for Fork
s.
Note that keys in the aggregator are full addresses, which include the migration namespace, as is the case for the default aggregator.
Examples
let db = TemporaryDB::new(); let fork = db.fork(); { let migration = Migration::new("migration", &fork); migration.get_proof_entry("entry").set(42); } let patch = fork.into_patch(); let migration_view = Migration::new("migration", &patch); let aggregator = migration_view.state_aggregator(); assert!(aggregator.contains("migration.entry")); // Not "entry": `state_aggregator` uses // full index names as keys.
impl<T: RawAccessMut> Migration<T>
[src]
pub fn create_tombstone<I>(&self, addr: I) where
I: Into<IndexAddress>,
[src]
I: Into<IndexAddress>,
Marks an index with the specified address as removed during migration.
Panics
Panics if an index already exists at the specified address.
Trait Implementations
impl<T: RawAccess> Access for Migration<T>
[src]
type Base = T
Raw access serving as the basis for created indexes.
fn get_index_metadata(
self,
addr: IndexAddress
) -> Result<Option<IndexMetadata>, AccessError>
[src]
self,
addr: IndexAddress
) -> Result<Option<IndexMetadata>, AccessError>
fn get_or_create_view(
self,
addr: IndexAddress,
index_type: IndexType
) -> Result<ViewWithMetadata<Self::Base>, AccessError>
[src]
self,
addr: IndexAddress,
index_type: IndexType
) -> Result<ViewWithMetadata<Self::Base>, AccessError>
fn group_keys<K: ?Sized>(
self,
base_addr: IndexAddress
) -> GroupKeys<Self::Base, K> where
K: BinaryKey,
Self::Base: AsReadonly<Readonly = Self::Base>,
[src]
self,
base_addr: IndexAddress
) -> GroupKeys<Self::Base, K> where
K: BinaryKey,
Self::Base: AsReadonly<Readonly = Self::Base>,
impl<T: Clone> Clone for Migration<T>
[src]
impl<T: Debug> Debug for Migration<T>
[src]
impl<T: RawAccess> From<Migration<T>> for GenericAccess<T>
[src]
impl<'a, T> IntoErased<'a> for Migration<T> where
T: Into<GenericRawAccess<'a>>,
[src]
T: Into<GenericRawAccess<'a>>,
fn into_erased(self) -> ErasedAccess<'a>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Migration<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Migration<T> where
T: Send,
T: Send,
impl<T> Sync for Migration<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Migration<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Migration<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Access for T where
T: RawAccess,
[src]
T: RawAccess,
type Base = T
Raw access serving as the basis for created indexes.
fn get_index_metadata(
Self,
IndexAddress
) -> Result<Option<IndexMetadata<Vec<u8>>>, AccessError>
[src]
Self,
IndexAddress
) -> Result<Option<IndexMetadata<Vec<u8>>>, AccessError>
fn get_or_create_view(
Self,
IndexAddress,
IndexType
) -> Result<ViewWithMetadata<<T as Access>::Base>, AccessError>
[src]
Self,
IndexAddress,
IndexType
) -> Result<ViewWithMetadata<<T as Access>::Base>, AccessError>
fn group_keys<K>(Self, IndexAddress) -> GroupKeys<<T as Access>::Base, K> where
K: BinaryKey + ?Sized,
<T as Access>::Base: AsReadonly,
<<T as Access>::Base as AsReadonly>::Readonly == <T as Access>::Base,
[src]
K: BinaryKey + ?Sized,
<T as Access>::Base: AsReadonly,
<<T as Access>::Base as AsReadonly>::Readonly == <T as Access>::Base,
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>,