mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 06:17:56 +00:00
frame-support Add translate_next (#14043)
* Frame Add translate_next This works similarly to to `translate` but only translate a single entry. This function will be useful in the context of multi-block migration. * Add test * add None return case * fixes * PR comment use `?`
This commit is contained in:
@@ -303,6 +303,15 @@ pub trait IterableStorageMap<K: FullEncode, V: FullCodec>: StorageMap<K, V> {
|
||||
///
|
||||
/// NOTE: If a value fail to decode because storage is corrupted then it is skipped.
|
||||
fn translate<O: Decode, F: FnMut(K, O) -> Option<V>>(f: F);
|
||||
|
||||
/// Translate the next entry following `previous_key` by a function `f`.
|
||||
/// By returning `None` from `f` for an element, you'll remove it from the map.
|
||||
///
|
||||
/// Returns the next key to iterate from in lexicographical order of the encoded key.
|
||||
fn translate_next<O: Decode, F: FnMut(K, O) -> Option<V>>(
|
||||
previous_key: Option<Vec<u8>>,
|
||||
f: F,
|
||||
) -> Option<Vec<u8>>;
|
||||
}
|
||||
|
||||
/// A strongly-typed double map in storage whose secondary keys and values can be iterated over.
|
||||
|
||||
Reference in New Issue
Block a user