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
Apply Two Layer Trie and Refactor WorkingSet #1892
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1892 +/- ##
==========================================
+ Coverage 61.53% 61.57% +0.03%
==========================================
Files 164 164
Lines 13504 13462 -42
==========================================
- Hits 8310 8289 -21
+ Misses 4142 4129 -13
+ Partials 1052 1044 -8
Continue to review full report at Codecov.
|
2871e2c
to
c6e4b49
Compare
default: | ||
return nil, err | ||
} | ||
dbForTrie, err := db.NewKVStoreForTrie(ArchiveTrieNamespace, dao) |
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.
so if the kvstore exist already, this NewKVStoreForTrie
doesn't have any side effect?
getStateFunc: func(ns string, key []byte, s interface{}) error { | ||
return readState(tlt, ns, key, s) | ||
}, | ||
putStateFunc: func(ns string, key []byte, s interface{}) error { | ||
ss, err := state.Serialize(s) | ||
if err != nil { | ||
return errors.Wrapf(err, "failed to convert account %v to bytes", s) | ||
} | ||
flusher.KVStoreWithBuffer().MustPut(ns, key, ss) | ||
nsHash := hash.Hash160b([]byte(ns)) | ||
|
||
return tlt.Upsert(nsHash[:], key, ss) | ||
}, | ||
delStateFunc: func(ns string, key []byte) error { | ||
flusher.KVStoreWithBuffer().MustDelete(ns, key) | ||
nsHash := hash.Hash160b([]byte(ns)) | ||
|
||
return tlt.Delete(nsHash[:], key) | ||
}, | ||
digestFunc: func() hash.Hash256 { | ||
return hash.Hash256b(flusher.SerializeQueue()) | ||
}, | ||
finalizeFunc: func(h uint64) error { | ||
if finalized { |
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.
imo define all these callback/closure is not as clear as defining methods on a given struct.
@@ -28,6 +28,18 @@ import ( | |||
"github.com/iotexproject/iotex-core/pkg/log" | |||
) | |||
|
|||
func processOptions(opts ...protocol.StateOption) (bool, uint64, string, []byte, 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.
i think just return cfg, make this function simpler to read and use
This is based on #1881