keeper

package
v2.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeploymentStateActivePrefixID       = byte(0x01)
	DeploymentStateClosedPrefixID       = byte(0x02)
	GroupStateOpenPrefixID              = byte(0x01)
	GroupStatePausedPrefixID            = byte(0x02)
	GroupStateInsufficientFundsPrefixID = byte(0x03)
	GroupStateClosedPrefixID            = byte(0x04)
)

Variables

View Source
var (
	DeploymentPrefix                  = []byte{0x11, 0x00}
	DeploymentStateActivePrefix       = []byte{DeploymentStateActivePrefixID}
	DeploymentStateClosedPrefix       = []byte{DeploymentStateClosedPrefixID}
	GroupPrefix                       = []byte{0x12, 0x00}
	GroupStateOpenPrefix              = []byte{GroupStateOpenPrefixID}
	GroupStatePausedPrefix            = []byte{GroupStatePausedPrefixID}
	GroupStateInsufficientFundsPrefix = []byte{GroupStateInsufficientFundsPrefixID}
	GroupStateClosedPrefix            = []byte{GroupStateClosedPrefixID}
)

Functions

func DeploymentKey

func DeploymentKey(statePrefix []byte, id v1.DeploymentID) ([]byte, error)

func DeploymentKeyLegacy

func DeploymentKeyLegacy(id v1.DeploymentID) []byte

func DeploymentStateToPrefix

func DeploymentStateToPrefix(state v1.Deployment_State) []byte

func GroupKey

func GroupKey(statePrefix []byte, id v1.GroupID) ([]byte, error)

GroupKey provides prefixed key for a Group's marshalled data.

func GroupKeyLegacy

func GroupKeyLegacy(id v1.GroupID) []byte

GroupKeyLegacy provides prefixed key for a Group's marshalled data.

func GroupStateToPrefix

func GroupStateToPrefix(state v1beta.Group_State) []byte

func GroupsKeyLegacy

func GroupsKeyLegacy(id v1.DeploymentID) []byte

GroupsKeyLegacy provides default store Key for Group data.

func MustDeploymentKey

func MustDeploymentKey(statePrefix []byte, id v1.DeploymentID) []byte

func MustGroupKey

func MustGroupKey(statePrefix []byte, id v1.GroupID) []byte

Types

type DeploymentIndexes

type DeploymentIndexes struct {
	// State indexes deployments by their state (Active, Closed)
	State *indexes.Multi[int32, keys.DeploymentPrimaryKey, v1.Deployment]
}

DeploymentIndexes defines the secondary indexes for the deployment IndexedMap

func NewDeploymentIndexes

func NewDeploymentIndexes(sb *collections.SchemaBuilder) DeploymentIndexes

NewDeploymentIndexes creates all secondary indexes for the deployment IndexedMap

func (DeploymentIndexes) IndexesList

type GroupIndexes

type GroupIndexes struct {
	// State indexes groups by their state (Open, Paused, InsufficientFunds, Closed)
	State *indexes.Multi[int32, keys.GroupPrimaryKey, types.Group]

	// Deployment indexes groups by their parent deployment (owner, dseq) for GetGroups queries
	Deployment *indexes.Multi[keys.DeploymentPrimaryKey, keys.GroupPrimaryKey, types.Group]
}

GroupIndexes defines the secondary indexes for the group IndexedMap

func NewGroupIndexes

func NewGroupIndexes(sb *collections.SchemaBuilder) GroupIndexes

NewGroupIndexes creates all secondary indexes for the group IndexedMap

func (GroupIndexes) IndexesList

type IKeeper

type IKeeper interface {
	StoreKey() storetypes.StoreKey
	Codec() codec.BinaryCodec
	GetDeployment(ctx sdk.Context, id v1.DeploymentID) (v1.Deployment, bool)
	GetGroup(ctx sdk.Context, id v1.GroupID) (types.Group, bool)
	GetGroups(ctx sdk.Context, id v1.DeploymentID) (types.Groups, error)
	SaveGroup(ctx sdk.Context, group types.Group) error
	Create(ctx sdk.Context, deployment v1.Deployment, groups []types.Group) error
	UpdateDeployment(ctx sdk.Context, deployment v1.Deployment) error
	CloseDeployment(ctx sdk.Context, deployment v1.Deployment) error
	OnCloseGroup(ctx sdk.Context, group types.Group, state types.Group_State) error
	OnPauseGroup(ctx sdk.Context, group types.Group) error
	OnStartGroup(ctx sdk.Context, group types.Group) error
	WithDeployments(ctx sdk.Context, fn func(v1.Deployment) bool) error
	OnBidClosed(ctx sdk.Context, id v1.GroupID) error
	OnLeaseClosed(ctx sdk.Context, id v1.GroupID) (types.Group, error)
	GetParams(ctx sdk.Context) (params types.Params)
	SetParams(ctx sdk.Context, params types.Params) error
	GetAuthority() string
	NewQuerier() Querier

	EndBlocker(context.Context) error

	AddPendingDenomMigration(ctx sdk.Context, did v1.DeploymentID) error
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	skey *storetypes.KVStoreKey,
	ekeeper dimports.EscrowKeeper,
	oracleKeeper dimports.OracleKeeper,
	marketKeeper dimports.MarketKeeper,
	authzKeeper dimports.AuthzKeeper,
	bankKeeper dimports.BankKeeper,
	authority string,
) IKeeper

NewKeeper creates and returns an instance for deployment keeper

type Keeper

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

Keeper of the deployment store

func (Keeper) AddPendingDenomMigration

func (k Keeper) AddPendingDenomMigration(ctx sdk.Context, did v1.DeploymentID) error

AddPendingDenomMigration marks a deployment for deferred denom migration.

func (Keeper) CloseDeployment

func (k Keeper) CloseDeployment(ctx sdk.Context, deployment v1.Deployment) error

CloseDeployment close deployment

func (Keeper) Codec

func (k Keeper) Codec() codec.BinaryCodec

Codec returns keeper codec

func (Keeper) Create

func (k Keeper) Create(ctx sdk.Context, deployment v1.Deployment, groups []types.Group) error

Create creates a new deployment with given deployment and group specifications

func (Keeper) Deployments

func (k Keeper) Deployments() *collections.IndexedMap[keys.DeploymentPrimaryKey, v1.Deployment, DeploymentIndexes]

Deployments returns the deployment IndexedMap for direct access (used by genesis and migration)

func (Keeper) EndBlocker

func (k Keeper) EndBlocker(ctx context.Context) error

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the x/deployment module's authority.

func (Keeper) GetDeployment

func (k Keeper) GetDeployment(ctx sdk.Context, id v1.DeploymentID) (v1.Deployment, bool)

GetDeployment returns deployment details with provided DeploymentID

func (Keeper) GetGroup

func (k Keeper) GetGroup(ctx sdk.Context, id v1.GroupID) (types.Group, bool)

GetGroup returns group details with given GroupID from deployment store

func (Keeper) GetGroups

func (k Keeper) GetGroups(ctx sdk.Context, id v1.DeploymentID) (types.Groups, error)

GetGroups returns all groups of a deployment with given DeploymentID from deployment store

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (p types.Params)

GetParams returns the current x/deployment module parameters.

func (Keeper) Groups

Groups returns the group IndexedMap for direct access (used by genesis and migration)

func (Keeper) IterateDeploymentFiltered

func (k Keeper) IterateDeploymentFiltered(ctx sdk.Context, state v1.Deployment_State, fn func(v1.Deployment) bool) error

IterateDeploymentFiltered iterates all deployments in deployment store

func (Keeper) NewQuerier

func (k Keeper) NewQuerier() Querier

func (Keeper) OnBidClosed

func (k Keeper) OnBidClosed(ctx sdk.Context, id v1.GroupID) error

OnBidClosed sets the group to state paused.

func (Keeper) OnCloseGroup

func (k Keeper) OnCloseGroup(ctx sdk.Context, group types.Group, state types.Group_State) error

OnCloseGroup provides shutdown API for a Group

func (Keeper) OnLeaseClosed

func (k Keeper) OnLeaseClosed(ctx sdk.Context, id v1.GroupID) (types.Group, error)

OnLeaseClosed keeps the group at state open

func (Keeper) OnPauseGroup

func (k Keeper) OnPauseGroup(ctx sdk.Context, group types.Group) error

OnPauseGroup provides pause API for a Group

func (Keeper) OnStartGroup

func (k Keeper) OnStartGroup(ctx sdk.Context, group types.Group) error

OnStartGroup provides start API for a Group

func (Keeper) SaveGroup

func (k Keeper) SaveGroup(ctx sdk.Context, group types.Group) error

SaveGroup persists a group to the store. Used during denom migration.

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error

SetParams sets the x/deployment module parameters.

func (Keeper) StoreKey

func (k Keeper) StoreKey() storetypes.StoreKey

StoreKey returns store key

func (Keeper) UpdateDeployment

func (k Keeper) UpdateDeployment(ctx sdk.Context, deployment v1.Deployment) error

UpdateDeployment updates deployment details

func (Keeper) WithDeployments

func (k Keeper) WithDeployments(ctx sdk.Context, fn func(v1.Deployment) bool) error

WithDeployments iterates all deployments in deployment store

type Querier

type Querier struct {
	Keeper
}

Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper

func (Querier) Deployment

Deployment returns deployment details based on DeploymentID

func (Querier) Deployments

Deployments returns deployments based on filters

func (Querier) Group

Group returns group details based on GroupID

func (Querier) Params

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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