Skip to content

Instantly share code, notes, and snippets.

@Thegaram
Last active August 19, 2020 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Thegaram/6b6a2e5a8297053e227bc9a6750c8aab to your computer and use it in GitHub Desktop.
Save Thegaram/6b6a2e5a8297053e227bc9a6750c8aab to your computer and use it in GitHub Desktop.
state-db-checkpoint-example
example-1:
----------
cache: {}
> create checkpoint #0
> write k=1 v=2
cache: { 1: (original = 1, current = 2) }
> revert to checkpoint #0
cache:
Parity implementation: { 1: (original = 1, current = 1) }
our (new) implementation: {}
example-2:
----------
cache: { 1: (original = 1, current = 2) }
> create checkpoint #0
> write k=1, v=1
cache: { 1: (original = 1, current = 1) }
> create checkpoint #1
> write k=1, v=3
cache: { 1: (original = 1, current = 3) }
> revert to checkpoint #1
cache: { 1: (original = 1, current = 1) } --> if we delete from cache here, we will need another db load in the next step
> revert to checkpoint #0
cache: { 1: (original = 1, current = 2) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment