-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat!: Add object store #25470
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
feat!: Add object store #25470
Conversation
generic interface generic btree generic cachekv generic transient store support ObjStore changelog Update CHANGELOG.md Signed-off-by: yihuang <[email protected]> object store key Apply review suggestions fix merge conflict fix snapshot revert dependers prefix store support object store (#236) Problem: snapshot for object store is not skipped (#585) resolve
fix and add test
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #25470 +/- ##
===========================================
+ Coverage 52.83% 67.46% +14.62%
===========================================
Files 798 853 +55
Lines 64955 68701 +3746
===========================================
+ Hits 34317 46346 +12029
+ Misses 30638 22355 -8283
🚀 New features to boost your workflow:
|
| func (cms Store) GetKVStore(key types.StoreKey) types.KVStore { | ||
| store, ok := cms.getCacheWrap(key).(types.KVStore) | ||
| if !ok { | ||
| panic(fmt.Sprintf("store with key %v is not KVStore", key)) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
| store := types.KVStore(s) | ||
| store, ok := s.(types.KVStore) | ||
| if !ok { | ||
| panic(fmt.Sprintf("store with key %v is not KVStore", key)) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
| // AssertValidValueGeneric checks if the value is valid(value is not nil and within length limit) | ||
| func AssertValidValueGeneric[V any](value V, isZero func(V) bool, valueLen func(V) int) { | ||
| if isZero(value) { | ||
| panic("value is nil") |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
| // AssertValidValueLength checks if the value length is within length limit | ||
| func AssertValidValueLength(l int) { | ||
| if l > MaxValueLength { | ||
| panic(errors.New("value is too large")) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
| store = cms.initStore(key, cms.parentStore(key)) | ||
| } | ||
| if key == nil || store == nil { | ||
| panic(fmt.Sprintf("kv store with key %v has not been registered in stores", key)) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
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.
LGTM. updating the title to include a ! since this is breaking
Description
Adds object store and refactors the store types to use generics for code re-use.
This is a preliminary PR which will enable us to integrate BlockSTM into the SDK for parallel transaction processing which requires us to be able to write arbitrary objects to transient stores in order to subsequently accumulate them in the end blocker.