refactor(core): core review (1/n) (#21193)

This commit is contained in:
Julien Robert 2024-08-07 14:04:53 +02:00 committed by GitHub
parent 6b4557ddb8
commit 72e77c3580
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 24 deletions

View File

@ -20,7 +20,7 @@ type QueryResponse struct {
Value []byte
}
type BlockRequest[T any] struct {
type BlockRequest[T transaction.Tx] struct {
Height uint64
Time time.Time
Hash []byte

View File

@ -1,23 +0,0 @@
package store
// DatabaseService provides access to the underlying database for CRUD operations of non-consensus data.
// WARNING: using this api will make your module unprovable for fraud and validity proofs
type DatabaseService interface {
Database() NonConsensusStore
}
// NonConsensusStore is a simple key-value store that is used to store non-consensus data.
// Note the non-consensus data is not committed to the blockchain and does not allow iteration
type NonConsensusStore interface {
// Get returns nil iff key doesn't exist. Errors on nil key.
Get(key []byte) ([]byte, error)
// Has checks if a key exists. Errors on nil key.
Has(key []byte) (bool, error)
// Set sets the key. Errors on nil key or value.
Set(key, value []byte) error
// Delete deletes the key. Errors on nil key.
Delete(key []byte) error
}

View File

@ -21,6 +21,8 @@ type MemoryStoreService interface {
// TransientStoreService represents a unique, non-forgeable handle to a memory-backed
// KVStore which is reset at the start of every block. It should be provided as
// a module-scoped dependency by the runtime module being used to build the app.
// WARNING: This service is not available in server/v2 apps. Store/v2 does not support
// transient stores.
type TransientStoreService interface {
// OpenTransientStore retrieves the transient store from the context.
OpenTransientStore(context.Context) KVStore