pub trait KeyGenerator {
    type Key: EncodeLike<Self::Key> + StaticTypeInfo;
    type KArg: Encode;
    type HashFn: FnOnce(&[u8]) -> Vec<u8>;
    type HArg;

    const HASHER_METADATA: &'static [StorageHasher];

    fn final_key<KArg: EncodeLikeTuple<Self::KArg> + TupleToEncodedIter>(
        key: KArg
    ) -> Vec<u8> ; fn migrate_key<KArg: EncodeLikeTuple<Self::KArg> + TupleToEncodedIter>(
        key: &KArg,
        hash_fns: Self::HArg
    ) -> Vec<u8> ; }
Expand description

A trait that contains the current key as an associated type.

Required Associated Types§

Required Associated Constants§

Required Methods§

Given a key tuple, calculate the final key by encoding each element individually and hashing them using the corresponding hasher in the KeyGenerator.

Given a key tuple, migrate the keys from using the old hashers as given by hash_fns to using the newer hashers as specified by this KeyGenerator.

Implementations on Foreign Types§

Implementors§