Return number of keys removed when calling storage_kill on child trie (#8166)

* Initial piping of returning amount of keys killed

* One more test for `None` limit

* forgot to update

* fix return value

* use version 3

* Update to return `KillOutcome`

* Update name to KillChildStorageResult
This commit is contained in:
Shawn Tabrizi
2021-02-22 11:24:12 -08:00
committed by GitHub
parent 74a1d69477
commit d25229bc89
10 changed files with 100 additions and 40 deletions
+3 -3
View File
@@ -32,7 +32,7 @@ use sp_core::crypto::UncheckedFrom;
use frame_support::{
dispatch::DispatchResult,
debug,
storage::child::{self, KillOutcome},
storage::child::{self, KillChildStorageResult},
traits::Get,
weights::Weight,
};
@@ -269,13 +269,13 @@ where
let removed = queue.swap_remove(0);
match outcome {
// This should not happen as our budget was large enough to remove all keys.
KillOutcome::SomeRemaining => {
KillChildStorageResult::SomeRemaining(_) => {
debug::error!(
"After deletion keys are remaining in this child trie: {:?}",
removed.trie_id,
);
},
KillOutcome::AllRemoved => (),
KillChildStorageResult::AllRemoved(_) => (),
}
}
remaining_key_budget = remaining_key_budget