-
Notifications
You must be signed in to change notification settings - Fork 0
/
memorystore.go
41 lines (32 loc) · 1.15 KB
/
memorystore.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package store
import (
sdk "github.com/ci123chain/ci123chain/pkg/abci/types"
dbm "github.com/tendermint/tm-db"
)
var (
_ sdk.KVStore = (*MemoryStore)(nil)
_ sdk.Committer = (*MemoryStore)(nil)
)
// Store implements an in-memory only KVStore. Entries are persisted between
// commits and thus between blocks. State in Memory store is not committed as part of app state but maintained privately by each node
type MemoryStore struct {
dbStoreAdapter
}
func NewMemoryStore() *MemoryStore {
return &MemoryStore{
dbStoreAdapter{dbm.NewMemDB()},
}
}
// Implements Store.
func (ts MemoryStore) GetStoreType() StoreType {
return sdk.StoreTypeMemory
}
func (m MemoryStore) Gas(meter GasMeter, config GasConfig) KVStore {
return NewGasKVStore(meter, config, m)
}
func (s MemoryStore) LastCommitID() (id sdk.CommitID) { return }
func (s *MemoryStore) Commit() (id sdk.CommitID) { return }
func (s *MemoryStore) SetPruning(pruning PruningStrategy) {}
// GetPruning is a no-op as pruning options cannot be directly set on this store.
// They must be set on the root commit multi-store.
//func (s *MemoryStore) GetPruning() PruningStrategy { return PruningStrategy{} }