Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
5b3d0b5
Add transactional storage functionality to OverlayChanges
athei May 25, 2020
68e34f0
Add storage transactions runtime interface
athei Jun 5, 2020
0a70191
Add frame support for transactions
athei Jun 5, 2020
0e32850
Merge branch 'master' into at-storage-tx
athei Jun 6, 2020
c767eea
Fix committed typo
athei Jun 8, 2020
c48d417
Rename 'changes' variable to 'overlay'
athei Jun 8, 2020
98a89da
Fix renaming change
athei Jun 8, 2020
3fb2e05
Fixed strange line break
athei Jun 8, 2020
1acf7a4
Rename clear to clear_where
athei Jun 8, 2020
d4440a4
Add comment regarding delete value on mutation
athei Jun 8, 2020
14738f8
Merge remote-tracking branch 'origin/master' into at-storage-tx
athei Jun 8, 2020
3592246
Add comment which changes are covered by a transaction
athei Jun 8, 2020
7395a03
Do force the arg to with_transaction return a Result
athei Jun 8, 2020
81e5241
Use rust doc comments on every documentable place
athei Jun 9, 2020
ff52101
Fix wording of insert_diry doc
athei Jun 9, 2020
d789aab
Improve doc on start_transaction
athei Jun 9, 2020
5e65240
Rename value to overlayed in close_transaction
athei Jun 9, 2020
7eb9065
Inline negation
athei Jun 9, 2020
5dd6a85
Improve wording of close_transaction comments
athei Jun 9, 2020
1c8e7c1
Get rid of an expect by using get_or_insert_with
athei Jun 9, 2020
232b68f
Remove trailing whitespace
athei Jun 9, 2020
00b9ff3
Rename should to expected in tests
athei Jun 9, 2020
85617a5
Rolling back a transaction must mark the overlay as dirty
athei Jun 9, 2020
04471b4
Merge remote-tracking branch 'origin/master' into at-storage-tx
athei Jun 9, 2020
4e039a1
Protect client initiated storage tx from being droped by runtime
athei Jun 9, 2020
52888f2
Merge remote-tracking branch 'origin/master' into at-storage-tx
athei Jun 10, 2020
db24a2b
Merge remote-tracking branch 'origin/master' into at-storage-tx
athei Jun 10, 2020
8ee3696
Review nits
athei Jun 10, 2020
843c84a
Return Err when entering or exiting runtime fails
athei Jun 10, 2020
5c851f6
Merge remote-tracking branch 'origin/master' into at-storage-tx
athei Jun 10, 2020
c60a4c1
Documentation fixup
athei Jun 10, 2020
1ad2077
Remove close type
athei Jun 11, 2020
de8af5b
Move enter/exit runtime to excute_aux in the state-machine
athei Jun 11, 2020
552f611
Merge remote-tracking branch 'origin/master' into at-storage-tx
athei Jun 11, 2020
4cf20c9
Rename Discard -> Rollback
athei Jun 11, 2020
10022f6
Move child changeset creation to constructor
athei Jun 11, 2020
5c0c35f
Move child spawning into the closure
athei Jun 11, 2020
8db272c
Merge remote-tracking branch 'origin/master' into at-storage-tx
athei Jun 11, 2020
76ce5cf
Apply suggestions from code review
athei Jun 12, 2020
3d0f162
Fixup for code suggestion
athei Jun 12, 2020
1651f68
Unify re-exports
athei Jun 12, 2020
64f3c90
Rename overlay_changes to mod.rs and move into subdir
athei Jun 12, 2020
1568984
Change proof wording
athei Jun 16, 2020
96b6fd6
Merge branch 'master' into at-storage-tx
athei Jun 16, 2020
5878df6
Merge branch 'master' into at-storage-tx
athei Jun 19, 2020
6a8b3a7
Adapt a new test from master to storage-tx
athei Jun 19, 2020
46a56dc
Suggestions from the latest round of review
athei Jun 20, 2020
1d72286
Merge remote-tracking branch 'origin/master' into at-storage-tx
athei Jun 20, 2020
5145916
Fix warning message
athei Jun 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix committed typo
  • Loading branch information
athei committed Jun 8, 2020
commit c767eea0be2f4ee50f2885ee1b2e09f56b3fe30a
2 changes: 1 addition & 1 deletion frame/support/src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub mod migration;
/// Execute the supplied function in a new storage transaction.
///
/// All changes to storage performed by the supplied function are discarded if an
/// error is returned and comitted on success.
/// error is returned and committed on success.
///
/// Transactions can be nested to any depth. Commits happen to the parent transaction.
pub fn with_transaction<T, E, F>(f: F) -> Result<T, E> where
Expand Down
2 changes: 1 addition & 1 deletion primitives/externalities/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ pub trait Externalities: ExtensionStore {
/// For every transaction there must be a matching call to either `storage_rollback_transaction`
/// or `storage_commit_transaction`.
///
/// Changes made without any open transaction are comitted immediatly
/// Changes made without any open transaction are committed immediatly
fn storage_start_transaction(&mut self);

/// Rollback the last transaction started by `start_transaction`.
Expand Down
16 changes: 8 additions & 8 deletions primitives/state-machine/src/overlayed_changes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl OverlayedChanges {
/// If there is no value in the overlay, the default callback is used to initiate the value.
/// Warning this function registers a change, so the mutable reference MUST be modified.
///
/// Can be rolled back or comitted when called inside a transaction.
/// Can be rolled back or committed when called inside a transaction.
#[must_use = "A change was registered, so this value MUST be modified."]
pub fn value_mut_or_insert_with(
&mut self,
Expand Down Expand Up @@ -217,7 +217,7 @@ impl OverlayedChanges {

/// Set a new value for the specified key.
///
/// Can be rolled back or comitted when called inside a transaction.
/// Can be rolled back or committed when called inside a transaction.
pub(crate) fn set_storage(&mut self, key: StorageKey, val: Option<StorageValue>) {
let size_write = val.as_ref().map(|x| x.len() as u64).unwrap_or(0);
self.stats.tally_write_overlay(size_write);
Expand All @@ -228,7 +228,7 @@ impl OverlayedChanges {
///
/// `None` can be used to delete a value specified by the given key.
///
/// Can be rolled back or comitted when called inside a transaction.
/// Can be rolled back or committed when called inside a transaction.
pub(crate) fn set_child_storage(
&mut self,
child_info: &ChildInfo,
Expand All @@ -254,7 +254,7 @@ impl OverlayedChanges {

/// Clear child storage of given storage key.
///
/// Can be rolled back or comitted when called inside a transaction.
/// Can be rolled back or committed when called inside a transaction.
pub(crate) fn clear_child_storage(
&mut self,
child_info: &ChildInfo,
Expand All @@ -270,14 +270,14 @@ impl OverlayedChanges {

/// Removes all key-value pairs which keys share the given prefix.
///
/// Can be rolled back or comitted when called inside a transaction.
/// Can be rolled back or committed when called inside a transaction.
pub(crate) fn clear_prefix(&mut self, prefix: &[u8]) {
self.top.clear(|key, _| key.starts_with(prefix), self.extrinsic_index());
}

/// Removes all key-value pairs which keys share the given prefix.
///
/// Can be rolled back or comitted when called inside a transaction
/// Can be rolled back or committed when called inside a transaction
pub(crate) fn clear_child_prefix(
&mut self,
child_info: &ChildInfo,
Expand All @@ -294,7 +294,7 @@ impl OverlayedChanges {

/// Returns the current nesting depth of the transaction stack.
///
/// A value of zero means that no transaction is open and changes are comitted on write.
/// A value of zero means that no transaction is open and changes are committed on write.
pub fn transaction_depth(&self) -> usize {
// The top changeset and all child changesets transact in lockstep and are
// therefore always at the same transaction depth.
Expand All @@ -307,7 +307,7 @@ impl OverlayedChanges {
/// transaction was open. Any transaction must be closed by one of the aforementioned
/// functions before this overlay can be converted into storage changes.
///
/// Changes made without any open transaction are comitted immediatly.
/// Changes made without any open transaction are committed immediatly.
pub fn start_transaction(&mut self) {
self.top.start_transaction();
for (_, (changeset, _)) in self.children.iter_mut() {
Expand Down
12 changes: 6 additions & 6 deletions primitives/state-machine/src/overlayed_changes/changeset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl OverlayedChangeSet {

/// Set a new value for the specified key.
///
/// Can be rolled back or comitted when called inside a transaction.
/// Can be rolled back or committed when called inside a transaction.
pub fn set(
&mut self,
key: StorageKey,
Expand All @@ -168,7 +168,7 @@ impl OverlayedChangeSet {

/// Get a mutable reference for a value.
///
/// Can be rolled back or comitted when called inside a transaction.
/// Can be rolled back or committed when called inside a transaction.
#[must_use = "A change was registered, so this value MUST be modified."]
pub fn modify(
&mut self,
Expand Down Expand Up @@ -196,7 +196,7 @@ impl OverlayedChangeSet {

/// Set all values to deleted which are matched by the predicate.
///
/// Can be rolled back or comitted when called inside a transaction.
/// Can be rolled back or committed when called inside a transaction.
pub fn clear(
&mut self,
predicate: impl Fn(&[u8], &OverlayedValue) -> bool,
Expand Down Expand Up @@ -230,7 +230,7 @@ impl OverlayedChangeSet {

/// Returns the current nesting depth of the transaction stack.
///
/// A value of zero means that no transaction is open and changes are comitted on write.
/// A value of zero means that no transaction is open and changes are committed on write.
pub fn transaction_depth(&self) -> usize {
self.dirty_keys.len()
}
Expand All @@ -241,7 +241,7 @@ impl OverlayedChangeSet {
/// transaction was open. Any transaction must be closed by one of the aforementioned
/// functions before this overlay can be converted into storage changes.
///
/// Changes made without any open transaction are comitted immediatly.
/// Changes made without any open transaction are committed immediatly.
pub fn start_transaction(&mut self) {
self.dirty_keys.push(Default::default());
}
Expand Down Expand Up @@ -481,7 +481,7 @@ mod test {
assert_eq!(changeset.transaction_depth(), 0);
let init = || b"valinit".to_vec();

// comitted set
// committed set
changeset.set(b"key0".to_vec(), Some(b"val0".to_vec()), Some(0));
changeset.set(b"key1".to_vec(), None, Some(1));
let val = changeset.modify(b"key3".to_vec(), init, Some(3));
Expand Down