-
Notifications
You must be signed in to change notification settings - Fork 43
/
keys.go
36 lines (28 loc) · 1.06 KB
/
keys.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
package types
const (
// ModuleName defines the module name
ModuleName = "resource"
// StoreKey defines the primary module store key
StoreKey = ModuleName
// RouterKey is the message route for slashing
RouterKey = ModuleName
// QuerierRoute defines the module's query routing key
QuerierRoute = ModuleName
)
const (
ResourceMetadataKey = "resource-metadata:"
ResourceDataKey = "resource-data:"
ResourceCountKey = "resource-count:"
)
// GetResourceDataKey returns the byte representation of resource key
func GetResourceDataKey(collectionID string, id string) []byte {
return []byte(ResourceDataKey + collectionID + ":" + id)
}
// GetResourceMetadataKey returns the byte representation of resource key
func GetResourceMetadataKey(collectionID string, id string) []byte {
return []byte(ResourceMetadataKey + collectionID + ":" + id)
}
// GetResourceMetadataCollectionPrefix used to iterate over all resource metadatas in a collection
func GetResourceMetadataCollectionPrefix(collectionID string) []byte {
return []byte(ResourceMetadataKey + collectionID + ":")
}