Skip to content
Snippets Groups Projects
Commit be1e247d authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

Adds documentation for `wipe` and `commit` (#5053)


* Adds documentation for `wipe` and `commit`

This adds documentation to `wipe` and `commit` of `Externalities`.
Besides that it removes the default implementation that would just panic
and requires that all implementers of the trait implement the functions.

* Update primitives/externalities/src/lib.rs

Co-Authored-By: default avatarjoe petrowski <25483142+joepetrowski@users.noreply.github.com>

Co-authored-by: default avatarjoe petrowski <25483142+joepetrowski@users.noreply.github.com>
parent 0dc9e615
No related merge requests found
......@@ -203,13 +203,21 @@ pub trait Externalities: ExtensionStore {
/// Returns the SCALE encoded hash.
fn storage_changes_root(&mut self, parent: &[u8]) -> Result<Option<Vec<u8>>, ()>;
fn wipe(&mut self) {
unimplemented!()
}
/// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/// Benchmarking related functionality and shouldn't be used anywhere else!
/// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
///
/// Wipes all changes from caches and the database.
///
/// The state will be reset to genesis.
fn wipe(&mut self);
fn commit(&mut self) {
unimplemented!()
}
/// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/// Benchmarking related functionality and shouldn't be used anywhere else!
/// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
///
/// Commits all changes to the database and clears all caches.
fn commit(&mut self);
}
/// Extension for the [`Externalities`] trait.
......
......@@ -298,6 +298,10 @@ impl Externalities for BasicExternalities {
fn storage_changes_root(&mut self, _parent: &[u8]) -> Result<Option<Vec<u8>>, ()> {
Ok(None)
}
fn wipe(&mut self) {}
fn commit(&mut self) {}
}
impl sp_externalities::ExtensionStore for BasicExternalities {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment