-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(store/v2): support rocks out of the box (#21649)
- Loading branch information
1 parent
aa8bf41
commit 72620a5
Showing
3 changed files
with
74 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
//go:build !rocksdb | ||
// +build !rocksdb | ||
|
||
package rocksdb | ||
|
||
import ( | ||
corestore "cosmossdk.io/core/store" | ||
"cosmossdk.io/store/v2" | ||
"cosmossdk.io/store/v2/storage" | ||
) | ||
|
||
var ( | ||
_ storage.Database = (*Database)(nil) | ||
_ store.UpgradableDatabase = (*Database)(nil) | ||
) | ||
|
||
type Database struct{} | ||
|
||
func New(dataDir string) (*Database, error) { | ||
return &Database{}, nil | ||
} | ||
|
||
func (db *Database) Close() error { | ||
return nil | ||
} | ||
|
||
func (db *Database) NewBatch(version uint64) (store.Batch, error) { | ||
panic("rocksdb requires a build flag") | ||
} | ||
|
||
func (db *Database) SetLatestVersion(version uint64) error { | ||
panic("rocksdb requires a build flag") | ||
} | ||
|
||
func (db *Database) GetLatestVersion() (uint64, error) { | ||
panic("rocksdb requires a build flag") | ||
} | ||
|
||
func (db *Database) Has(storeKey []byte, version uint64, key []byte) (bool, error) { | ||
panic("rocksdb requires a build flag") | ||
} | ||
|
||
func (db *Database) Get(storeKey []byte, version uint64, key []byte) ([]byte, error) { | ||
panic("rocksdb requires a build flag") | ||
} | ||
|
||
// Prune prunes all versions up to and including the provided version argument. | ||
// Internally, this performs a manual compaction, the data with older timestamp | ||
// will be GCed by compaction. | ||
func (db *Database) Prune(version uint64) error { | ||
panic("rocksdb requires a build flag") | ||
} | ||
|
||
func (db *Database) Iterator(storeKey []byte, version uint64, start, end []byte) (corestore.Iterator, error) { | ||
panic("rocksdb requires a build flag") | ||
} | ||
|
||
func (db *Database) ReverseIterator(storeKey []byte, version uint64, start, end []byte) (corestore.Iterator, error) { | ||
panic("rocksdb requires a build flag") | ||
} | ||
|
||
// PruneStoreKeys will do nothing for RocksDB, it will be pruned by compaction | ||
// when the version is pruned | ||
func (db *Database) PruneStoreKeys(_ []string, _ uint64) error { | ||
return nil | ||
} |