Skip to content

Commit

Permalink
missing file
Browse files Browse the repository at this point in the history
  • Loading branch information
roysc committed Nov 11, 2021
1 parent fa8f347 commit 8efa2af
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions store/v2/utils.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
package types

import (
"fmt"
v1 "github.com/cosmos/cosmos-sdk/store/types"
)

var PrefixEndBytes = v1.PrefixEndBytes

// // Iterator over all the keys with a certain prefix in ascending order
// func KVStorePrefixIterator(kvs KVStore, prefix []byte) Iterator {
// return kvs.Iterator(prefix, PrefixEndBytes(prefix))
// }

// // Iterator over all the keys with a certain prefix in descending order.
// func KVStoreReversePrefixIterator(kvs KVStore, prefix []byte) Iterator {
// return kvs.ReverseIterator(prefix, PrefixEndBytes(prefix))
// }

func StoreKeyToType(key StoreKey) (typ StoreType, err error) {
switch key.(type) {
case *KVStoreKey:
typ = StoreTypePersistent
case *MemoryStoreKey:
typ = StoreTypeMemory
case *TransientStoreKey:
typ = StoreTypeTransient
default:
err = fmt.Errorf("unrecognized store key type: %T", key)
}
return
}

0 comments on commit 8efa2af

Please sign in to comment.