[][src]Trait frame_support::storage::generator::StorageMap

pub trait StorageMap<K: FullEncode, V: FullCodec> {
    type Query;
    type Hasher: StorageHasher;
    fn module_prefix() -> &'static [u8];
fn storage_prefix() -> &'static [u8];
fn from_optional_value_to_query(v: Option<V>) -> Self::Query;
fn from_query_to_optional_value(v: Self::Query) -> Option<V>; fn storage_map_final_key<KeyArg>(key: KeyArg) -> Vec<u8>
    where
        KeyArg: EncodeLike<K>
, { ... } }

Generator for StorageMap used by decl_storage.

By default each key value is stored at:

Twox128(module_prefix) ++ Twox128(storage_prefix) ++ Hasher(encode(key))

Warning

If the keys are not trusted (e.g. can be set by a user), a cryptographic hasher such as blake2_256 must be used. Otherwise, other values in storage can be compromised.

Associated Types

type Query

The type that get/take returns.

type Hasher: StorageHasher

Hasher. Used for generating final key.

Loading content...

Required methods

Important traits for &'_ mut [u8]
fn module_prefix() -> &'static [u8]

Module prefix. Used for generating final key.

Important traits for &'_ mut [u8]
fn storage_prefix() -> &'static [u8]

Storage prefix. Used for generating final key.

fn from_optional_value_to_query(v: Option<V>) -> Self::Query

Convert an optional value retrieved from storage to the type queried.

fn from_query_to_optional_value(v: Self::Query) -> Option<V>

Convert a query to an optional value into storage.

Loading content...

Provided methods

Important traits for Vec<u8>
fn storage_map_final_key<KeyArg>(key: KeyArg) -> Vec<u8> where
    KeyArg: EncodeLike<K>, 

Generate the full key used in top storage.

Loading content...

Implementors

Loading content...