-
Notifications
You must be signed in to change notification settings - Fork 34
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
Separate nodes and values #1770
base: master
Are you sure you want to change the base?
Conversation
…arate-nodes-and-values
class TrieNodeStorageBackend : public BufferStorage { | ||
public: | ||
~TrieStorageBackend() override = default; | ||
~TrieNodeStorageBackend() override = default; | ||
}; | ||
|
||
/** | ||
* Adapter for the trie value storage that allows to hide keyspace separation | ||
* along with root hash storing logic from the trie db component | ||
*/ | ||
class TrieValueStorageBackend : public BufferStorage { | ||
public: | ||
~TrieValueStorageBackend() override = default; |
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.
Remove TrieNodeStorageBackend
and TrieValueStorageBackend
.
Use BufferStorage
directly (or new simple interface TrieDb { get(Hash): Opt<Cow>; put(Hash, Cow); }
, maybe get
and put
can accept bool for value/node).
If you want strong type for injection, then
don't inherit interface (because you can't use parent interface implementation struct IDb{}; struct Db:IDb{}; struct IDb2:IDb{}; IDb2 idb2 = new Db{};
)
but wrapper struct (struct TrieDbNode { IDb _; }; struct TrieDbValue { IDb _; };
or struct TrieDb { IDb node, value; }
),
or don't inject
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?
Referenced issues
Description of the Change
Benefits
Possible Drawbacks
Usage Examples or Tests
Alternate Designs