keeper

package
v1.1.1-develop.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetResourceDataKeyBytes

func GetResourceDataKeyBytes(collectionID string, id string) []byte

GetResourceDataKeyBytes returns the byte representation of resource key

func GetResourceHeaderCollectionPrefixBytes

func GetResourceHeaderCollectionPrefixBytes(collectionID string) []byte

GetResourceHeaderCollectionPrefixBytes used to iterate over all resource headers in a collection

func GetResourceHeaderKeyBytes

func GetResourceHeaderKeyBytes(collectionID string, id string) []byte

GetResourceHeaderKeyBytes returns the byte representation of resource key

Types

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey) *Keeper

func (Keeper) GetAllResourceVersions

func (k Keeper) GetAllResourceVersions(ctx *sdk.Context, collectionID, name string) []*types.ResourceHeader

func (Keeper) GetAllResources

func (k Keeper) GetAllResources(ctx *sdk.Context) (list []types.Resource)

GetAllResources returns all resources as a list Loads everything in memory. Use only for genesis export!

func (Keeper) GetLastResourceVersionHeader

func (k Keeper) GetLastResourceVersionHeader(ctx *sdk.Context, collectionID, name, resourceType, mediaType string) (types.ResourceHeader, bool)

func (Keeper) GetResource

func (k Keeper) GetResource(ctx *sdk.Context, collectionID string, id string) (types.Resource, error)

GetResource returns a resource from its id

func (Keeper) GetResourceCollection

func (k Keeper) GetResourceCollection(ctx *sdk.Context, collectionID string) []*types.ResourceHeader

func (Keeper) GetResourceCount

func (k Keeper) GetResourceCount(ctx *sdk.Context) uint64

GetResourceCount get the total number of resource

func (Keeper) HasResource

func (k Keeper) HasResource(ctx *sdk.Context, collectionID string, id string) bool

HasResource checks if the resource exists in the store

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

func (Keeper) SetResource

func (k Keeper) SetResource(ctx *sdk.Context, resource *types.Resource) error

SetResource create or update a specific resource in the store

func (Keeper) SetResourceCount

func (k Keeper) SetResourceCount(ctx *sdk.Context, count uint64)

SetResourceCount set the total number of resource

func (Keeper) UpdateResourceHeader

func (k Keeper) UpdateResourceHeader(ctx *sdk.Context, header *types.ResourceHeader) error

UpdateResourceHeader update the header of a resource. Returns an error if the resource doesn't exist

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL