referrerpolicy=no-referrer-when-downgrade
frame_support::traits

Trait StorageInstance

Source
pub trait StorageInstance {
    const STORAGE_PREFIX: &'static str;

    // Required method
    fn pallet_prefix() -> &'static str;

    // Provided methods
    fn pallet_prefix_hash() -> [u8; 16] { ... }
    fn storage_prefix_hash() -> [u8; 16] { ... }
    fn prefix_hash() -> [u8; 32] { ... }
}
Expand description

An instance of a storage in a pallet.

Define an instance for an individual storage inside a pallet. The pallet prefix is used to isolate the storage between pallets, and the storage prefix is used to isolate storages inside a pallet.

NOTE: These information can be used to define storages in pallet such as a StorageMap which can use keys after twox_128(pallet_prefix())++twox_128(STORAGE_PREFIX)

Required Associated Constants§

Source

const STORAGE_PREFIX: &'static str

Prefix given to a storage to isolate from other storages in the pallet.

Required Methods§

Source

fn pallet_prefix() -> &'static str

Prefix of a pallet to isolate it from other pallets.

Provided Methods§

Source

fn pallet_prefix_hash() -> [u8; 16]

Return the prefix hash of pallet instance.

NOTE: This hash must be twox_128(pallet_prefix()). Should not impl this function by hand. Only use the default or macro generated impls.

Source

fn storage_prefix_hash() -> [u8; 16]

Return the prefix hash of storage instance.

NOTE: This hash must be twox_128(STORAGE_PREFIX).

Source

fn prefix_hash() -> [u8; 32]

Return the prefix hash of instance.

NOTE: This hash must be twox_128(pallet_prefix())++twox_128(STORAGE_PREFIX). Should not impl this function by hand. Only use the default or macro generated impls.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

impl<T: Config> StorageInstance for Candidates_Storage_Instance<T>

impl<T: Config> StorageInstance for CodeInfoOf_Storage_Instance<T>

impl<T: Config> StorageInstance for PristineCode_Storage_Instance<T>

impl<T: Config> StorageInstance for ContractInfoOf_Storage_Instance<T>

impl<T: Config> StorageInstance for ContractInfoOf_Storage_Instance<T>

impl<T: Config> StorageInstance for MyMap_Storage_Instance<T>

impl<T: Config<I>, I: 'static> StorageInstance for ListPrefix<T, I>

impl<T: Config<I>, I: 'static> StorageInstance for ReferendumInfoFor_Storage_Instance<T, I>

impl<T: Config<I>, I: 'static> StorageInstance for ReferendumInfoFor_Storage_Instance<T, I>

impl<T: Config> StorageInstance for DisabledValidators_Storage_Instance<T>

impl<T: Config> StorageInstance for OldUnappliedSlashes_Storage_Instance<T>

impl<T: Config> StorageInstance for AvailabilityBitfields_Storage_Instance<T>

impl<T: Config> StorageInstance for PendingAvailability_Storage_Instance<T>