-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Persistence] Adds Save and Load functionality to TreeStore #897
Conversation
f2ac214
to
9b68e36
Compare
0a6c72f
to
7de2528
Compare
2d53dc1
to
15d5c8a
Compare
9b68e36
to
99d12f4
Compare
15d5c8a
to
a6fe96f
Compare
99d12f4
to
7a271fe
Compare
7a271fe
to
fb904c9
Compare
788dbbe
to
c9caaa3
Compare
fb904c9
to
e6337f8
Compare
9de1b01
to
dc4f205
Compare
e6337f8
to
d27ee09
Compare
5b7af11
to
a1e0a10
Compare
8b4844c
to
4765b3a
Compare
29ad7df
to
0f87f0b
Compare
4765b3a
to
d6550f1
Compare
ec24322
to
0c6e894
Compare
* fulfills the Interruptable module interface to allow for control over the node stores lifecycle to enable save and load functionality * adds tests for the Start and Stop functionality * adds nil checks to GetTree function to make testing start and stop behavior predictable
7f3d341
to
2c6fb5c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments throughout but nothing "glaring" or blocking.
Thanks for getting this moving Dylan!
func setupStore(t *testing.T, store KVStore) { | ||
t.Helper() | ||
err := store.Set([]byte("foo"), []byte("bar")) | ||
require.NoError(t, err) | ||
err = store.Set([]byte("baz"), []byte("bin")) | ||
require.NoError(t, err) | ||
} | ||
|
||
func isEmpty(t *testing.T, dir string) (bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not go with an approach like this: https://stackoverflow.com/a/24102536/768439 ?
Seems shorter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beacuse the linter complains if ioutil
is used since it's officially deprecated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use
dirEntries, err := os.ReadDir(dir)
require.NoError(t, err)
if len(dirEntries) == 0 {
return true
}
return false
This is what ioutil
docs point to as the newer more efficient approach to the deprecated method
@dylanlott Can you "re-request" a review when its ready and I'll reply to all the comments/questions then? |
You beat me to it. I just finished up addressing your feedback, it's ready for re-review 👍 |
Description
Adds save and load functionality to the TreeStore.
This PR makes the
TreeStore
anInterruptable
module. This is necessary because the Persistence module needs to be able to tell theTreeStore
to relinquish its connection to thenodeStores
which are backed by BadgerDB.Issue
Related to #568
Type of change
Please mark the relevant option(s):
List of changes
worldState
from file directories.Testing
make develop_test
; if any code changes were mademake test_e2e
on k8s LocalNet; if any code changes were madee2e-devnet-test
passes tests on DevNet; if any code was changedRequired Checklist
godoc
format comments on touched members (see: tip.golang.org/doc/comment)If Applicable Checklist
shared/docs/*
if I updatedshared/*
README(s)