[][src]Trait frame_support::storage::StoragePrefixedMap

pub trait StoragePrefixedMap<Value: FullCodec> {
    pub fn module_prefix() -> &'static [u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
;
pub fn storage_prefix() -> &'static [u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
; pub fn final_prefix() -> [u8; 32] { ... }
pub fn remove_all() { ... }
pub fn iter_values() -> PrefixIterator<Value>

Notable traits for PrefixIterator<T>

impl<T> Iterator for PrefixIterator<T> type Item = T;
{ ... }
pub fn translate_values<OldValue: Decode, F: Fn(OldValue) -> Option<Value>>(
        f: F
    ) { ... } }

Trait for maps that store all its value after a unique prefix.

By default the final prefix is:

Twox128(module_prefix) ++ Twox128(storage_prefix)

Required methods

pub fn module_prefix() -> &'static [u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Module prefix. Used for generating final key.

pub fn storage_prefix() -> &'static [u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Storage prefix. Used for generating final key.

Loading content...

Provided methods

pub fn final_prefix() -> [u8; 32][src]

Final full prefix that prefixes all keys.

pub fn remove_all()[src]

Remove all value of the storage.

pub fn iter_values() -> PrefixIterator<Value>

Notable traits for PrefixIterator<T>

impl<T> Iterator for PrefixIterator<T> type Item = T;
[src]

Iter over all value of the storage.

NOTE: If a value failed to decode becaues storage is corrupted then it is skipped.

pub fn translate_values<OldValue: Decode, F: Fn(OldValue) -> Option<Value>>(
    f: F
)
[src]

Translate the values of all elements by a function f, in the map in no particular order. By returning None from f for an element, you'll remove it from the map.

NOTE: If a value fail to decode because storage is corrupted then it is skipped.

Warning

This function must be used with care, before being updated the storage still contains the old type, thus other calls (such as get) will fail at decoding it.

Usage

This would typically be called inside the module implementation of on_runtime_upgrade.

Loading content...

Implementors

Loading content...