keeper

package
v12.0.0-rc9 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Keeper

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

func NewKeeper

func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, router *baseapp.MsgServiceRouter, authority, feeCollectorName string) Keeper

func (*Keeper) ActiveDuration

func (k *Keeper) ActiveDuration(ctx sdk.Context) time.Duration

ActiveDuration retrieves the active duration parameter from the module's parameters.

func (*Keeper) AddDeposit

func (k *Keeper) AddDeposit(ctx sdk.Context, addr sdk.AccAddress, coin sdk.Coin) error

func (*Keeper) BeginBlock

func (k *Keeper) BeginBlock(ctx sdk.Context)

BeginBlock is called at the beginning of each block to handle node-related operations.

func (*Keeper) DeleteActiveNode

func (k *Keeper) DeleteActiveNode(ctx sdk.Context, addr base.NodeAddress)

DeleteActiveNode removes an active node from the module's KVStore based on the node address.

func (*Keeper) DeleteInactiveNode

func (k *Keeper) DeleteInactiveNode(ctx sdk.Context, addr base.NodeAddress)

DeleteInactiveNode removes an inactive node from the module's KVStore based on the node address.

func (*Keeper) DeleteNodeForInactiveAt

func (k *Keeper) DeleteNodeForInactiveAt(ctx sdk.Context, at time.Time, addr base.NodeAddress)

DeleteNodeForInactiveAt removes a node's inactivity timestamp from the module's KVStore.

func (*Keeper) DeleteNodeForPlan

func (k *Keeper) DeleteNodeForPlan(ctx sdk.Context, id uint64, addr base.NodeAddress)

DeleteNodeForPlan removes a node associated with a plan from the module's KVStore based on the plan ID and node address.

func (*Keeper) DeleteSession

func (k *Keeper) DeleteSession(ctx sdk.Context, id uint64)

func (*Keeper) DeleteSessionForAccount

func (k *Keeper) DeleteSessionForAccount(ctx sdk.Context, addr sdk.AccAddress, id uint64)

func (*Keeper) DeleteSessionForNode

func (k *Keeper) DeleteSessionForNode(ctx sdk.Context, addr base.NodeAddress, id uint64)

func (*Keeper) Deposit

func (k *Keeper) Deposit(ctx sdk.Context) sdk.Coin

Deposit retrieves the deposit parameter from the module's parameters.

func (*Keeper) ExportGenesis

func (k *Keeper) ExportGenesis(ctx sdk.Context) *v3.GenesisState

func (*Keeper) FundCommunityPool

func (k *Keeper) FundCommunityPool(ctx sdk.Context, fromAddr sdk.AccAddress, coin sdk.Coin) error

func (*Keeper) GetActiveNode

func (k *Keeper) GetActiveNode(ctx sdk.Context, addr base.NodeAddress) (v v3.Node, found bool)

GetActiveNode retrieves an active node from the module's KVStore based on the node address. If the active node exists, it returns the node and 'found' as true; otherwise, it returns 'found' as false.

func (*Keeper) GetInactiveAt

func (k *Keeper) GetInactiveAt(ctx sdk.Context) time.Time

GetInactiveAt returns the inactive time by adding ActiveDuration to the current block time.

func (*Keeper) GetInactiveNode

func (k *Keeper) GetInactiveNode(ctx sdk.Context, addr base.NodeAddress) (v v3.Node, found bool)

GetInactiveNode retrieves an inactive node from the module's KVStore based on the node address. If the inactive node exists, it returns the node and 'found' as true; otherwise, it returns 'found' as false.

func (*Keeper) GetNode

func (k *Keeper) GetNode(ctx sdk.Context, addr base.NodeAddress) (node v3.Node, found bool)

GetNode retrieves a node from the module's KVStore based on the node address. It checks both active and inactive nodes and returns the node if found.

func (*Keeper) GetNodes

func (k *Keeper) GetNodes(ctx sdk.Context) (items []v3.Node)

GetNodes retrieves all nodes stored in the module's KVStore.

func (*Keeper) GetNodesForPlan

func (k *Keeper) GetNodesForPlan(ctx sdk.Context, id uint64) (items []v3.Node)

GetNodesForPlan retrieves all nodes associated with a plan stored in the module's KVStore based on the plan ID.

func (*Keeper) GetParams

func (k *Keeper) GetParams(ctx sdk.Context) (v v3.Params)

GetParams retrieves the node module parameters from the module's KVStore.

func (*Keeper) GetSession

func (k *Keeper) GetSession(ctx sdk.Context, id uint64) (sessiontypes.Session, bool)

func (*Keeper) GetSessionCount

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

func (*Keeper) GetSessionInactiveAt

func (k *Keeper) GetSessionInactiveAt(ctx sdk.Context) time.Time

func (*Keeper) HandleMsgRegisterNode

func (k *Keeper) HandleMsgRegisterNode(ctx sdk.Context, msg *v3.MsgRegisterNodeRequest) (*v3.MsgRegisterNodeResponse, error)

func (*Keeper) HandleMsgStartSession

func (k *Keeper) HandleMsgStartSession(ctx sdk.Context, msg *v3.MsgStartSessionRequest) (*v3.MsgStartSessionResponse, error)

func (*Keeper) HandleMsgUpdateNodeDetails

func (k *Keeper) HandleMsgUpdateNodeDetails(ctx sdk.Context, msg *v3.MsgUpdateNodeDetailsRequest) (*v3.MsgUpdateNodeDetailsResponse, error)

func (*Keeper) HandleMsgUpdateNodeStatus

func (k *Keeper) HandleMsgUpdateNodeStatus(ctx sdk.Context, msg *v3.MsgUpdateNodeStatusRequest) (*v3.MsgUpdateNodeStatusResponse, error)

func (*Keeper) HandleMsgUpdateParams

func (k *Keeper) HandleMsgUpdateParams(ctx sdk.Context, msg *v3.MsgUpdateParamsRequest) (*v3.MsgUpdateParamsResponse, error)

func (*Keeper) HandleQueryNode

func (k *Keeper) HandleQueryNode(ctx sdk.Context, req *v3.QueryNodeRequest) (*v3.QueryNodeResponse, error)

func (*Keeper) HandleQueryNodes

func (k *Keeper) HandleQueryNodes(ctx sdk.Context, req *v3.QueryNodesRequest) (res *v3.QueryNodesResponse, err error)

func (*Keeper) HandleQueryNodesForPlan

func (k *Keeper) HandleQueryNodesForPlan(ctx sdk.Context, req *v3.QueryNodesForPlanRequest) (*v3.QueryNodesForPlanResponse, error)

func (*Keeper) HandleQueryParams

func (k *Keeper) HandleQueryParams(ctx sdk.Context, _ *v3.QueryParamsRequest) (*v3.QueryParamsResponse, error)

func (*Keeper) HasActiveNode

func (k *Keeper) HasActiveNode(ctx sdk.Context, addr base.NodeAddress) bool

HasActiveNode checks if an active node exists in the module's KVStore based on the node address.

func (*Keeper) HasInactiveNode

func (k *Keeper) HasInactiveNode(ctx sdk.Context, addr base.NodeAddress) bool

HasInactiveNode checks if an inactive node exists in the module's KVStore based on the node address.

func (*Keeper) HasNode

func (k *Keeper) HasNode(ctx sdk.Context, addr base.NodeAddress) bool

HasNode checks if a node exists in the module's KVStore based on the node address.

func (*Keeper) HasNodeForPlan

func (k *Keeper) HasNodeForPlan(ctx sdk.Context, id uint64, addr base.NodeAddress) bool

HasNodeForPlan checks if a node associated with a plan exists in the module's KVStore based on the plan ID and node address.

func (*Keeper) InitGenesis

func (k *Keeper) InitGenesis(ctx sdk.Context, state *v3.GenesisState)

func (*Keeper) IsValidGigabytePrices

func (k *Keeper) IsValidGigabytePrices(ctx sdk.Context, prices v1base.Prices) bool

IsValidGigabytePrices checks if the provided gigabyte prices are valid based on the minimum prices defined in the module's parameters.

func (*Keeper) IsValidHourlyPrices

func (k *Keeper) IsValidHourlyPrices(ctx sdk.Context, prices v1base.Prices) bool

IsValidHourlyPrices checks if the provided hourly prices are valid based on the minimum prices defined in the module's parameters.

func (*Keeper) IsValidSessionGigabytes

func (k *Keeper) IsValidSessionGigabytes(ctx sdk.Context, gigabytes int64) bool

IsValidSessionGigabytes checks if the provided session gigabytes are within the valid range defined by the module's parameters.

func (*Keeper) IsValidSessionHours

func (k *Keeper) IsValidSessionHours(ctx sdk.Context, hours int64) bool

IsValidSessionHours checks if the provided session hours are within the valid range defined by the module's parameters.

func (*Keeper) IterateNodes

func (k *Keeper) IterateNodes(ctx sdk.Context, fn func(index int, item v3.Node) (stop bool))

IterateNodes iterates over all nodes stored in the module's KVStore and calls the provided function for each node. The iteration stops when the provided function returns 'true'.

func (*Keeper) IterateNodesForInactiveAt

func (k *Keeper) IterateNodesForInactiveAt(ctx sdk.Context, at time.Time, fn func(index int, item v3.Node) (stop bool))

IterateNodesForInactiveAt iterates over all nodes with inactivity timestamps stored in the module's KVStore and calls the provided function for each node. The iteration stops when the provided function returns 'true'.

func (*Keeper) Logger

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

func (*Keeper) MaxSessionGigabytes

func (k *Keeper) MaxSessionGigabytes(ctx sdk.Context) int64

MaxSessionGigabytes retrieves the maximum session gigabytes parameter from the module's parameters.

func (*Keeper) MaxSessionHours

func (k *Keeper) MaxSessionHours(ctx sdk.Context) int64

MaxSessionHours retrieves the maximum session hours parameter from the module's parameters.

func (*Keeper) MinGigabytePrices

func (k *Keeper) MinGigabytePrices(ctx sdk.Context) v1base.Prices

MinGigabytePrices retrieves the minimum gigabyte prices parameter from the module's parameters.

func (*Keeper) MinHourlyPrices

func (k *Keeper) MinHourlyPrices(ctx sdk.Context) v1base.Prices

MinHourlyPrices retrieves the minimum hourly prices parameter from the module's parameters.

func (*Keeper) MinSessionGigabytes

func (k *Keeper) MinSessionGigabytes(ctx sdk.Context) int64

MinSessionGigabytes retrieves the minimum session gigabytes parameter from the module's parameters.

func (*Keeper) MinSessionHours

func (k *Keeper) MinSessionHours(ctx sdk.Context) int64

MinSessionHours retrieves the minimum session hours parameter from the module's parameters.

func (*Keeper) NodeInactivePreHook

func (k *Keeper) NodeInactivePreHook(ctx sdk.Context, addr base.NodeAddress) error

func (*Keeper) QuotePriceFunc

func (k *Keeper) QuotePriceFunc(ctx sdk.Context, price sdk.DecCoin) (sdk.Coin, error)

func (*Keeper) SendCoinFromDepositToAccount

func (k *Keeper) SendCoinFromDepositToAccount(ctx sdk.Context, fromAddr, toAddr sdk.AccAddress, coin sdk.Coin) error

func (*Keeper) SendCoinFromDepositToModule

func (k *Keeper) SendCoinFromDepositToModule(ctx sdk.Context, fromAddr sdk.AccAddress, toModule string, coin sdk.Coin) error

func (*Keeper) SessionInactivePreHook

func (k *Keeper) SessionInactivePreHook(ctx sdk.Context, id uint64) error

SessionInactivePreHook handles operations when a session transitions to the inactive state.

func (*Keeper) SetActiveNode

func (k *Keeper) SetActiveNode(ctx sdk.Context, node v3.Node)

SetActiveNode stores an active node in the module's KVStore.

func (*Keeper) SetInactiveNode

func (k *Keeper) SetInactiveNode(ctx sdk.Context, node v3.Node)

SetInactiveNode stores an inactive node in the module's KVStore.

func (*Keeper) SetNode

func (k *Keeper) SetNode(ctx sdk.Context, node v3.Node)

SetNode stores a node in the module's KVStore based on its status (active or inactive).

func (*Keeper) SetNodeForInactiveAt

func (k *Keeper) SetNodeForInactiveAt(ctx sdk.Context, at time.Time, addr base.NodeAddress)

SetNodeForInactiveAt stores a node's inactivity timestamp in the module's KVStore.

func (*Keeper) SetNodeForPlan

func (k *Keeper) SetNodeForPlan(ctx sdk.Context, id uint64, addr base.NodeAddress)

SetNodeForPlan stores a node associated with a plan in the module's KVStore.

func (*Keeper) SetParams

func (k *Keeper) SetParams(ctx sdk.Context, params v3.Params)

SetParams stores the node module parameters in the module's KVStore.

func (*Keeper) SetSession

func (k *Keeper) SetSession(ctx sdk.Context, session sessiontypes.Session)

func (*Keeper) SetSessionCount

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

func (*Keeper) SetSessionForAccount

func (k *Keeper) SetSessionForAccount(ctx sdk.Context, addr sdk.AccAddress, id uint64)

func (*Keeper) SetSessionForInactiveAt

func (k *Keeper) SetSessionForInactiveAt(ctx sdk.Context, at time.Time, id uint64)

func (*Keeper) SetSessionForNode

func (k *Keeper) SetSessionForNode(ctx sdk.Context, addr base.NodeAddress, id uint64)

func (*Keeper) StakingShare

func (k *Keeper) StakingShare(ctx sdk.Context) sdkmath.LegacyDec

StakingShare retrieves the staking share parameter from the module's parameters.

func (*Keeper) Store

func (k *Keeper) Store(ctx sdk.Context) sdk.KVStore

func (*Keeper) SubtractDeposit

func (k *Keeper) SubtractDeposit(ctx sdk.Context, addr sdk.AccAddress, coin sdk.Coin) error

func (*Keeper) UpdateSessionMaxValues

func (k *Keeper) UpdateSessionMaxValues(_ sdk.Context, session sessiontypes.Session) error

UpdateSessionMaxValues checks the session type and updates its values if needed.

func (*Keeper) WithDepositKeeper

func (k *Keeper) WithDepositKeeper(keeper expected.DepositKeeper)

func (*Keeper) WithDistributionKeeper

func (k *Keeper) WithDistributionKeeper(keeper expected.DistributionKeeper)

func (*Keeper) WithLeaseKeeper

func (k *Keeper) WithLeaseKeeper(keeper expected.LeaseKeeper)

func (*Keeper) WithOracleKeeper

func (k *Keeper) WithOracleKeeper(keeper expected.OracleKeeper)

func (*Keeper) WithSessionKeeper

func (k *Keeper) WithSessionKeeper(keeper expected.SessionKeeper)

Jump to

Keyboard shortcuts

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