-
Notifications
You must be signed in to change notification settings - Fork 328
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
[db] KvWithVersion to handle both versioned and non-versioned namespace #4518
base: master
Are you sure you want to change the base?
Conversation
Quality Gate failedFailed conditions |
if b.versioned[ns] { | ||
return b.db.Put(b.version, ns, key, value) | ||
} | ||
return b.kvBase.Put(ns, key, value) |
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.
Using kvBase in kvWithVersion is strange, I would recommend splitting it up. for example:
KvVersioned interface{
Version(string, []byte) (uint64, error)
SetVersion(uint64) KVStore
Plain() KVStore
}
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.
do you mean add a Plain()
interface?
this is internal implementation, for non-versioned namespace, it is a regular Put/Get/Delete
, same as now
kv := KvWithVersion{ | ||
db: b.db, | ||
kvBase: b.kvBase, | ||
versioned: make(map[string]bool), |
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.
same as db
and kvBase
, if versioned
will not be updated, passing pointer is fine.
db: db, | ||
kvBase: db.Base(), |
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.
We may need to review the implementation of BoltDBWithVersion. From the name, BoltDBWithVersion
sounds like an implementation of KVStoreWithVersion
. Moreover, db.Base()
is a weird interface.
Description
as title.
based on (#4517)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: