Trait polkadot_sdk_frame::traits::StorageInstance
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§
const STORAGE_PREFIX: &'static str
const STORAGE_PREFIX: &'static str
Prefix given to a storage to isolate from other storages in the pallet.
Required Methods§
fn pallet_prefix() -> &'static str
fn pallet_prefix() -> &'static str
Prefix of a pallet to isolate it from other pallets.
Provided Methods§
fn pallet_prefix_hash() -> [u8; 16]
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.
fn storage_prefix_hash() -> [u8; 16]
fn storage_prefix_hash() -> [u8; 16]
Return the prefix hash of storage instance.
NOTE: This hash must be twox_128(STORAGE_PREFIX)
.
fn prefix_hash() -> [u8; 32]
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.