keeper

package
v12.0.0-rc8 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 24 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) BeginBlock

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

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

func (*Keeper) DeleteAllocation

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

DeleteAllocation removes the allocation for a given ID and address from the KVStore.

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) DeleteSessionForAllocation

func (k *Keeper) DeleteSessionForAllocation(ctx sdk.Context, subscriptionID uint64, addr sdk.AccAddress, sessionID uint64)

func (*Keeper) DeleteSessionForNode

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

func (*Keeper) DeleteSessionForPlanByNode

func (k *Keeper) DeleteSessionForPlanByNode(ctx sdk.Context, planID uint64, addr base.NodeAddress, sessionID uint64)

func (*Keeper) DeleteSessionForSubscription

func (k *Keeper) DeleteSessionForSubscription(ctx sdk.Context, subscriptionID, sessionID uint64)

func (*Keeper) DeleteSubscription

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

DeleteSubscription removes a subscription from the module's KVStore based on the subscription ID.

func (*Keeper) DeleteSubscriptionForAccount

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

DeleteSubscriptionForAccount removes the association between a subscription ID and an account address from the module's KVStore.

func (*Keeper) DeleteSubscriptionForInactiveAt

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

DeleteSubscriptionForInactiveAt removes the inactive subscription record from the module's KVStore based on the specified time and subscription ID.

func (*Keeper) DeleteSubscriptionForPlan

func (k *Keeper) DeleteSubscriptionForPlan(ctx sdk.Context, planID, subscriptionID uint64)

DeleteSubscriptionForPlan removes the association between a subscription ID and a plan ID from the module's KVStore.

func (*Keeper) DeleteSubscriptionForRenewalAt

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

DeleteSubscriptionForRenewalAt removes the renewal subscription record from the module's KVStore based on the specified time and subscription ID.

func (*Keeper) ExportGenesis

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

func (*Keeper) GetAllocation

func (k *Keeper) GetAllocation(ctx sdk.Context, id uint64, addr sdk.AccAddress) (alloc v2.Allocation, found bool)

GetAllocation retrieves the allocation for a given ID and address from the KVStore. It returns the allocation and a boolean indicating if the allocation was found.

func (*Keeper) GetAllocationsForSubscription

func (k *Keeper) GetAllocationsForSubscription(ctx sdk.Context, id uint64) (items v2.Allocations)

GetAllocationsForSubscription retrieves all allocations for a given subscription ID.

func (*Keeper) GetInactiveAt

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

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

func (*Keeper) GetNode

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

func (*Keeper) GetParams

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

GetParams retrieves the parameters from the module's KVStore.

func (*Keeper) GetPlan

func (k *Keeper) GetPlan(ctx sdk.Context, id uint64) (plantypes.Plan, bool)

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) GetSubscription

func (k *Keeper) GetSubscription(ctx sdk.Context, id uint64) (subscription v3.Subscription, found bool)

GetSubscription retrieves a subscription from the module's KVStore based on the subscription ID. Returns the subscription and a boolean indicating if it was found.

func (*Keeper) GetSubscriptionCount

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

GetSubscriptionCount retrieves the count value from the KVStore. If the count value does not exist, it returns 0 as the default.

func (*Keeper) GetSubscriptions

func (k *Keeper) GetSubscriptions(ctx sdk.Context) (items []v3.Subscription)

GetSubscriptions retrieves all subscriptions from the module's KVStore.

func (*Keeper) GetSubscriptionsForAccount

func (k *Keeper) GetSubscriptionsForAccount(ctx sdk.Context, addr sdk.AccAddress) (items []v3.Subscription)

GetSubscriptionsForAccount retrieves all subscriptions associated with a specific account address.

func (*Keeper) GetSubscriptionsForPlan

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

GetSubscriptionsForPlan retrieves all subscriptions associated with a specific plan ID.

func (*Keeper) HandleMsgCancelSubscription

func (k *Keeper) HandleMsgCancelSubscription(ctx sdk.Context, msg *v3.MsgCancelSubscriptionRequest) (*v3.MsgCancelSubscriptionResponse, error)

func (*Keeper) HandleMsgRenewSubscription

func (k *Keeper) HandleMsgRenewSubscription(ctx sdk.Context, msg *v3.MsgRenewSubscriptionRequest) (*v3.MsgRenewSubscriptionResponse, error)

func (*Keeper) HandleMsgShareSubscription

func (k *Keeper) HandleMsgShareSubscription(ctx sdk.Context, msg *v3.MsgShareSubscriptionRequest) (*v3.MsgShareSubscriptionResponse, error)

func (*Keeper) HandleMsgStartSession

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

func (*Keeper) HandleMsgStartSubscription

func (k *Keeper) HandleMsgStartSubscription(ctx sdk.Context, msg *v3.MsgStartSubscriptionRequest) (*v3.MsgStartSubscriptionResponse, error)

func (*Keeper) HandleMsgUpdateParams

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

func (*Keeper) HandleMsgUpdateSubscription

func (k *Keeper) HandleMsgUpdateSubscription(ctx sdk.Context, msg *v3.MsgUpdateSubscriptionRequest) (*v3.MsgUpdateSubscriptionResponse, error)

func (*Keeper) HandleQueryAllocation

func (k *Keeper) HandleQueryAllocation(ctx sdk.Context, req *v2.QueryAllocationRequest) (*v2.QueryAllocationResponse, error)

func (*Keeper) HandleQueryAllocations

func (k *Keeper) HandleQueryAllocations(ctx sdk.Context, req *v2.QueryAllocationsRequest) (*v2.QueryAllocationsResponse, error)

func (*Keeper) HandleQueryParams

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

func (*Keeper) HandleQuerySubscription

func (k *Keeper) HandleQuerySubscription(ctx sdk.Context, req *v3.QuerySubscriptionRequest) (*v3.QuerySubscriptionResponse, error)

func (*Keeper) HandleQuerySubscriptions

func (k *Keeper) HandleQuerySubscriptions(ctx sdk.Context, req *v3.QuerySubscriptionsRequest) (*v3.QuerySubscriptionsResponse, error)

func (*Keeper) HandleQuerySubscriptionsForPlan

func (k *Keeper) HandleQuerySubscriptionsForPlan(ctx sdk.Context, req *v3.QuerySubscriptionsForPlanRequest) (*v3.QuerySubscriptionsForPlanResponse, error)

func (*Keeper) HasAllocation

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

HasAllocation checks if an allocation for a given ID and address exists in the KVStore.

func (*Keeper) HasSubscriptionForAccount

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

HasSubscriptionForAccount checks if there is a subscription ID associated with a given account address.

func (*Keeper) HasSubscriptionForPlan

func (k *Keeper) HasSubscriptionForPlan(ctx sdk.Context, planID, subscriptionID uint64) bool

HasSubscriptionForPlan checks if there is a subscription ID associated with a given plan ID.

func (*Keeper) InitGenesis

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

func (*Keeper) IterateAllocationsForSubscription

func (k *Keeper) IterateAllocationsForSubscription(ctx sdk.Context, id uint64, fn func(index int, item v2.Allocation) (stop bool))

IterateAllocationsForSubscription iterates over all allocations for a given subscription ID, calling the provided function for each allocation.

func (*Keeper) IterateSubscriptions

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

IterateSubscriptions iterates over all subscriptions in the module's KVStore and calls the provided function for each subscription. The iteration stops when the provided function returns 'true'.

func (*Keeper) IterateSubscriptionsForInactiveAt

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

IterateSubscriptionsForInactiveAt iterates over all subscriptions that will be inactive before a specified time and calls the provided function for each subscription. The iteration stops when the provided function returns 'true'.

func (*Keeper) IterateSubscriptionsForRenewalAt

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

IterateSubscriptionsForRenewalAt iterates over all subscriptions that will be renewed before a specified time and calls the provided function for each subscription. The iteration stops when the provided function returns 'true'.

func (*Keeper) Logger

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

func (*Keeper) ProviderStakingShare

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

func (*Keeper) QuotePriceFunc

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

func (*Keeper) SendCoin

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

func (*Keeper) SendCoinFromAccountToModule

func (k *Keeper) SendCoinFromAccountToModule(ctx sdk.Context, from sdk.AccAddress, to string, coin sdk.Coin) error

func (*Keeper) SessionInactivePreHook

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

SessionInactivePreHook handles the necessary operations when a session becomes inactive.

func (*Keeper) SetAllocation

func (k *Keeper) SetAllocation(ctx sdk.Context, alloc v2.Allocation)

SetAllocation sets the allocation for a given ID and address in the KVStore.

func (*Keeper) SetParams

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

SetParams stores the given 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) SetSessionForAllocation

func (k *Keeper) SetSessionForAllocation(ctx sdk.Context, subscriptionID uint64, addr sdk.AccAddress, sessionID 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) SetSessionForPlanByNode

func (k *Keeper) SetSessionForPlanByNode(ctx sdk.Context, planID uint64, addr base.NodeAddress, sessionID uint64)

func (*Keeper) SetSessionForSubscription

func (k *Keeper) SetSessionForSubscription(ctx sdk.Context, subscriptionID, sessionID uint64)

func (*Keeper) SetSubscription

func (k *Keeper) SetSubscription(ctx sdk.Context, subscription v3.Subscription)

SetSubscription stores a subscription in the module's KVStore.

func (*Keeper) SetSubscriptionCount

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

SetSubscriptionCount sets the count value in the KVStore.

func (*Keeper) SetSubscriptionForAccount

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

SetSubscriptionForAccount links a subscription ID to an account address in the module's KVStore.

func (*Keeper) SetSubscriptionForInactiveAt

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

SetSubscriptionForInactiveAt sets a subscription to be inactive at a specified time in the module's KVStore.

func (*Keeper) SetSubscriptionForPlan

func (k *Keeper) SetSubscriptionForPlan(ctx sdk.Context, planID, subscriptionID uint64)

SetSubscriptionForPlan links a subscription ID to a plan ID in the module's KVStore.

func (*Keeper) SetSubscriptionForRenewalAt

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

SetSubscriptionForRenewalAt sets a subscription to be renewed at a specified time in the module's KVStore.

func (*Keeper) StatusChangeDelay

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

StatusChangeDelay returns the delay for status changes from the module's parameters.

func (*Keeper) Store

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

func (*Keeper) SubscriptionInactivePendingPreHook

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

func (*Keeper) WithBankKeeper

func (k *Keeper) WithBankKeeper(keeper expected.BankKeeper)

func (*Keeper) WithNodeKeeper

func (k *Keeper) WithNodeKeeper(keeper expected.NodeKeeper)

func (*Keeper) WithOracleKeeper

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

func (*Keeper) WithPlanKeeper

func (k *Keeper) WithPlanKeeper(keeper expected.PlanKeeper)

func (*Keeper) WithProviderKeeper

func (k *Keeper) WithProviderKeeper(keeper expected.ProviderKeeper)

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