-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Replacement of KeyValueStoreView
by a direct version.
#4057
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
base: main
Are you sure you want to change the base?
Conversation
Except that hashing is going to force reading everything anyway |
// Copyright (c) Zefchain Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//! We implement a `KeyValueStoreView` implements View and the function of `KeyValueStore`. |
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.
This doesn't belong here, does it? Especially if we want to keep the unit tests.
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.
Also it could be called SmallKeyValueStoreView
if we want to keep the old implementation around for performance comparison (which are not done in this PR)
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.
As discussed, we'd like to
- keep the old KVSView in place
- have the new "small" data-structure in
linera-view
as well (if possible -- otherwise maybe that's ok for now). - make the change in
linera-execution
later, when we have benchmarks
Motivation
The existing
KeyValueStoreView
is a scalable design for implementing a Key-Value store, which is needed by the EVM smart contracts and the Wasm smart contracts. However, it is a slow design that is overkill for 99% of the use cases.Replacing it with an
enum Big/Small
might be a solution but it presents an inconvenient that we cannot easily transition from a Big sdesign to a small design if the storage use decreases. Also:KeyValueStoreView
.Proposal
The following is done:
BTreeMap<Vec<u8>, vec<u8>>
.RegisterView
, and this container is chosen accordingly. Note that this doubles the memory usage, but this was already the case for the small container in the now-closed PR.linera-views
. Therefore, the filekey_value_store_view.rs
is moved tolinera-execution
.ViewContainer
is eliminated and with it the corresponding tests.Test Plan
The CI was adequate for identifying problems with the design.
Release Plan
Links
None.