mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 10:01:17 +00:00
Use loops rather than backend for compatibility. (#11542)
* Use `loops` rather than `backend` for compatibility. * Move over other converters
This commit is contained in:
@@ -111,10 +111,12 @@ pub enum KillStorageResult {
|
||||
|
||||
impl From<MultiRemovalResults> for KillStorageResult {
|
||||
fn from(r: MultiRemovalResults) -> Self {
|
||||
match r {
|
||||
MultiRemovalResults { maybe_cursor: None, backend, .. } => Self::AllRemoved(backend),
|
||||
MultiRemovalResults { maybe_cursor: Some(..), backend, .. } =>
|
||||
Self::SomeRemaining(backend),
|
||||
// We use `loops` here rather than `backend` because that's the same as the original
|
||||
// functionality pre-#11490. This won't matter once we switch to the new host function
|
||||
// since we won't be using the `KillStorageResult` type in the runtime any more.
|
||||
match r.maybe_cursor {
|
||||
None => Self::AllRemoved(r.loops),
|
||||
Some(..) => Self::SomeRemaining(r.loops),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,11 +191,7 @@ pub trait Storage {
|
||||
/// backend.
|
||||
#[version(2)]
|
||||
fn clear_prefix(&mut self, prefix: &[u8], limit: Option<u32>) -> KillStorageResult {
|
||||
let r = Externalities::clear_prefix(*self, prefix, limit, None);
|
||||
match r.maybe_cursor {
|
||||
None => KillStorageResult::AllRemoved(r.loops),
|
||||
Some(_) => KillStorageResult::SomeRemaining(r.loops),
|
||||
}
|
||||
Externalities::clear_prefix(*self, prefix, limit, None).into()
|
||||
}
|
||||
|
||||
/// Partially clear the storage of each key-value pair where the key starts with the given
|
||||
@@ -403,11 +401,7 @@ pub trait DefaultChildStorage {
|
||||
#[version(3)]
|
||||
fn storage_kill(&mut self, storage_key: &[u8], limit: Option<u32>) -> KillStorageResult {
|
||||
let child_info = ChildInfo::new_default(storage_key);
|
||||
let r = self.kill_child_storage(&child_info, limit, None);
|
||||
match r.maybe_cursor {
|
||||
None => KillStorageResult::AllRemoved(r.loops),
|
||||
Some(..) => KillStorageResult::SomeRemaining(r.loops),
|
||||
}
|
||||
self.kill_child_storage(&child_info, limit, None).into()
|
||||
}
|
||||
|
||||
/// Clear a child storage key.
|
||||
@@ -452,11 +446,7 @@ pub trait DefaultChildStorage {
|
||||
limit: Option<u32>,
|
||||
) -> KillStorageResult {
|
||||
let child_info = ChildInfo::new_default(storage_key);
|
||||
let r = self.clear_child_prefix(&child_info, prefix, limit, None);
|
||||
match r.maybe_cursor {
|
||||
None => KillStorageResult::AllRemoved(r.loops),
|
||||
Some(..) => KillStorageResult::SomeRemaining(r.loops),
|
||||
}
|
||||
self.clear_child_prefix(&child_info, prefix, limit, None).into()
|
||||
}
|
||||
|
||||
/// Clear the child storage of each key-value pair where the key starts with the given `prefix`.
|
||||
|
||||
Reference in New Issue
Block a user