cosmos-sdk/orm/internal/testkv/mem.go

28 lines
834 B
Go

package testkv
import (
dbm "github.com/tendermint/tm-db"
"github.com/cosmos/cosmos-sdk/orm/model/ormtable"
)
// NewSplitMemBackend returns a Backend instance
// which uses two separate memory stores to simulate behavior when there
// are really two separate backing stores.
func NewSplitMemBackend() ormtable.Backend {
return ormtable.NewBackend(ormtable.BackendOptions{
CommitmentStore: dbm.NewMemDB(),
IndexStore: dbm.NewMemDB(),
})
}
// NewSharedMemBackend returns a Backend instance
// which uses a single backing memory store to simulate legacy scenarios
// where only a single KV-store is available to modules.
func NewSharedMemBackend() ormtable.Backend {
return ormtable.NewBackend(ormtable.BackendOptions{
CommitmentStore: dbm.NewMemDB(),
// commit store is automatically used as the index store
})
}