flow-emulator icon indicating copy to clipboard operation
flow-emulator copied to clipboard

Storage layer refactor & example new storage backend impl

Open bluesign opened this issue 3 years ago • 1 comments
trafficstars

Description

This is a proposed change to the storage layer, for which I drafted a simple version. We can discuss it, but it simplifies the storage layer and allows quickly adding new storage backends.

I implemented simple Redis server support for it (mostly related to #130 and similar requests ) redis/store.go is the simple implementation example for new backends.

Also, I want to move snapshot from badger DB to SQLite or something similar ( badger on windows is a bit problematic )


For contributor use:

  • [X] Targeted PR against master branch
  • [ ] Linked to GitHub issue with discussion and accepted design OR link to spec that describes this work
  • [X] Code follows the standards mentioned here
  • [ ] Updated relevant documentation
  • [X] Re-reviewed Files changed in the GitHub PR explorer
  • [ ] Added appropriate labels

bluesign avatar Oct 17 '22 16:10 bluesign

I forgot to mention this will be a breaking change, as the storage format is changing a bit. We can make it backwards compatible and little ugly, or decide to break compatibility.

bluesign avatar Oct 17 '22 18:10 bluesign

Sorry for taking longer, but will soon try to review this 🙏

devbugging avatar Nov 02 '22 11:11 devbugging

@bluesign just make sure to resolve the conflict and we merge it.

devbugging avatar Nov 17 '22 09:11 devbugging

@sideninja can you assist me here a bit, I am lost in git :(

edit: I had to do force push, but I think required with rebase.

bluesign avatar Nov 17 '22 10:11 bluesign

Codecov Report

Merging #221 (27cbc92) into master (dddefb8) will increase coverage by 1.45%. The diff coverage is 57.69%.

@@            Coverage Diff             @@
##           master     #221      +/-   ##
==========================================
+ Coverage   50.96%   52.42%   +1.45%     
==========================================
  Files          29       26       -3     
  Lines        2372     2041     -331     
==========================================
- Hits         1209     1070     -139     
+ Misses       1019      845     -174     
+ Partials      144      126      -18     
Flag Coverage Δ
unittests 52.42% <57.69%> (+1.45%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
server/server.go 48.50% <0.00%> (-0.74%) :arrow_down:
server/storage.go 41.02% <0.00%> (-8.98%) :arrow_down:
headers.go 21.42% <50.00%> (ø)
storage/store.go 54.54% <54.54%> (ø)
storage/encoding.go 82.60% <71.42%> (ø)
blockchain.go 74.83% <100.00%> (+0.04%) :arrow_up:
blocks.go 60.00% <100.00%> (ø)
storage/badger/store.go
storage/badger/config.go

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Nov 17 '22 11:11 codecov-commenter