-
Notifications
You must be signed in to change notification settings - Fork 139
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
Eliminate the DatabaseConsistencyError
.
#2557
Eliminate the DatabaseConsistencyError
.
#2557
Conversation
DatabseConsistencyError
.DatabaseConsistencyError
.
4c7a3f0
to
bff8379
Compare
0f58a84
to
420523b
Compare
* Separate the code for the store into a store.rs file. * Move the MIN_TAG_VIEW to the views. * Eliminate the DatabaseConsistencyError. * Avoid the abstraction leakage.
420523b
to
124ac79
Compare
linera-storage/src/db_storage.rs
Outdated
@@ -729,8 +727,7 @@ where | |||
impl<Store> DbStorage<Store, WallClock> | |||
where | |||
Store: KeyValueStore + Clone + Send + Sync + 'static, | |||
Store::Error: | |||
From<bcs::Error> + From<DatabaseConsistencyError> + Send + Sync + serde::ser::StdError, | |||
Store::Error: Send + Sync + serde::ser::StdError, |
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.
Not from this PR but why are we using serde::ser::StdError
? (an alias std::error::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 know. I addressed this is in another branch (not yet PR) on the dual store. The answer is that it is not needed.
Let me do this cleanup in this PR.
@@ -221,7 +235,7 @@ where | |||
impl<K> WritableKeyValueStore for ValueSplittingStore<K> | |||
where | |||
K: RestrictedKeyValueStore + Send + Sync, | |||
K::Error: From<bcs::Error> + From<DatabaseConsistencyError>, | |||
K::Error: 'static, |
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.
Is this 'static
needed? (also below)
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.
Yes.
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.
Thanks. Some minor comments but otherwise LGTM
let len = key.len(); | ||
if len < 4 { | ||
return Err(DatabaseConsistencyError::TooShortKey.into()); | ||
return Err(ValueSplittingError::<K::Error>::TooShortKey); |
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.
ValueSplittingError::TooShortKey
should be enough
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.
Correct.
Motivation
The
DatabaseConsistencyError
is a type that if objectively a leaky abstraction. This addresses #2536Proposal
Several changes are made:
common.rs
is moved to a newly createdstore.rs
.DatabaseConsistencyError
is eliminated.ValueSplittingError
is introduced.Test Plan
As it is purely a refactoring, only the CI should be affected. Performance should remain strictly
identical.
Release Plan
Not relevant.
Links
None