mirror of
https://github.com/pezkuwichain/pezframe-metadata.git
synced 2026-06-14 09:51:01 +00:00
Combine Map/NMap/DoubleMap StorageEntryTypes (#23)
* Combine Map and NMap StorageEntryTypes * Fmt * Remove DoubleMap * Add comments to StorageEntryType::Map * Release 14.0.0-rc.2
This commit is contained in:
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [14.0.0-rc.2] - 2021-08-04
|
||||||
|
### Changed
|
||||||
|
Combine Map/NMap/DoubleMap StorageEntryTypes [#23](https://github.com/paritytech/frame-metadata/pull/23)
|
||||||
|
|
||||||
## [14.0.0-rc.1] - 2021-07-30
|
## [14.0.0-rc.1] - 2021-07-30
|
||||||
### Added
|
### Added
|
||||||
- Metadata V14
|
- Metadata V14
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "frame-metadata"
|
name = "frame-metadata"
|
||||||
version = "14.0.0-rc.1"
|
version = "14.0.0-rc.2"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
|
|||||||
+10
-37
@@ -240,20 +240,11 @@ pub enum StorageHasher {
|
|||||||
pub enum StorageEntryType<T: Form = MetaForm> {
|
pub enum StorageEntryType<T: Form = MetaForm> {
|
||||||
Plain(T::Type),
|
Plain(T::Type),
|
||||||
Map {
|
Map {
|
||||||
hasher: StorageHasher,
|
/// One or more hashers, should be one hasher per key element.
|
||||||
key: T::Type,
|
|
||||||
value: T::Type,
|
|
||||||
},
|
|
||||||
DoubleMap {
|
|
||||||
hasher: StorageHasher,
|
|
||||||
key1: T::Type,
|
|
||||||
key2: T::Type,
|
|
||||||
value: T::Type,
|
|
||||||
key2_hasher: StorageHasher,
|
|
||||||
},
|
|
||||||
NMap {
|
|
||||||
keys: T::Type,
|
|
||||||
hashers: Vec<StorageHasher>,
|
hashers: Vec<StorageHasher>,
|
||||||
|
/// The type of the key, can be a tuple with elements for each of the hashers.
|
||||||
|
key: T::Type,
|
||||||
|
/// The type of the value.
|
||||||
value: T::Type,
|
value: T::Type,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -264,33 +255,15 @@ impl IntoPortable for StorageEntryType {
|
|||||||
fn into_portable(self, registry: &mut Registry) -> Self::Output {
|
fn into_portable(self, registry: &mut Registry) -> Self::Output {
|
||||||
match self {
|
match self {
|
||||||
Self::Plain(plain) => StorageEntryType::Plain(registry.register_type(&plain)),
|
Self::Plain(plain) => StorageEntryType::Plain(registry.register_type(&plain)),
|
||||||
Self::Map { hasher, key, value } => StorageEntryType::Map {
|
Self::Map {
|
||||||
hasher,
|
hashers,
|
||||||
|
key,
|
||||||
|
value,
|
||||||
|
} => StorageEntryType::Map {
|
||||||
|
hashers,
|
||||||
key: registry.register_type(&key),
|
key: registry.register_type(&key),
|
||||||
value: registry.register_type(&value),
|
value: registry.register_type(&value),
|
||||||
},
|
},
|
||||||
Self::DoubleMap {
|
|
||||||
hasher,
|
|
||||||
key1,
|
|
||||||
key2,
|
|
||||||
value,
|
|
||||||
key2_hasher,
|
|
||||||
} => StorageEntryType::DoubleMap {
|
|
||||||
hasher,
|
|
||||||
key1: registry.register_type(&key1),
|
|
||||||
key2: registry.register_type(&key2),
|
|
||||||
value: registry.register_type(&value),
|
|
||||||
key2_hasher,
|
|
||||||
},
|
|
||||||
StorageEntryType::NMap {
|
|
||||||
keys,
|
|
||||||
hashers,
|
|
||||||
value,
|
|
||||||
} => StorageEntryType::NMap {
|
|
||||||
keys: registry.register_type(&keys),
|
|
||||||
hashers,
|
|
||||||
value: registry.register_type(&value),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user