Documentation ¶
Index ¶
- Constants
- Variables
- func ActiveSubscriptionForAddressKey(address sdk.AccAddress, i uint64) []byte
- func GetActiveSubscriptionForAddressKeyPrefix(address sdk.AccAddress) []byte
- func GetInactiveSubscriptionAtKeyPrefix(at time.Time) []byte
- func GetInactiveSubscriptionForAddressKeyPrefix(address sdk.AccAddress) []byte
- func GetQuotaKeyPrefix(id uint64) []byte
- func GetSubscriptionForNodeKeyPrefix(address hub.NodeAddress) []byte
- func GetSubscriptionForPlanKeyPrefix(id uint64) []byte
- func IDFromInactiveSubscriptionAtKey(key []byte) uint64
- func IDFromStatusSubscriptionForAddressKey(key []byte) uint64
- func IDFromSubscriptionForNodeKey(key []byte) uint64
- func IDFromSubscriptionForPlanKey(key []byte) uint64
- func InactiveSubscriptionAtKey(at time.Time, id uint64) []byte
- func InactiveSubscriptionForAddressKey(address sdk.AccAddress, i uint64) []byte
- func ParamsKeyTable() params.KeyTable
- func QuotaKey(id uint64, address sdk.AccAddress) []byte
- func RegisterCodec(cdc *codec.Codec)
- func SubscriptionForNodeKey(address hub.NodeAddress, id uint64) []byte
- func SubscriptionForPlanKey(p, s uint64) []byte
- func SubscriptionKey(id uint64) []byte
- type GenesisState
- type GenesisSubscription
- type GenesisSubscriptions
- type MsgAddQuota
- type MsgCancel
- type MsgSubscribeToNode
- type MsgSubscribeToPlan
- type MsgUpdateQuota
- type Params
- type QueryQuotaParams
- type QueryQuotasParams
- type QuerySubscriptionParams
- type QuerySubscriptionsForAddressParams
- type QuerySubscriptionsForNodeParams
- type QuerySubscriptionsForPlanParams
- type QuerySubscriptionsParams
- type Quota
- type Quotas
- type Subscription
- type Subscriptions
Constants ¶
View Source
const ( AttributeKeyOwner = "owner" AttributeKeyAddress = "address" AttributeKeyID = "id" AttributeKeyStatus = "status" AttributeKeyNode = "node" AttributeKeyCount = "count" AttributeKeyPlan = "plan" AttributeKeyConsumed = "consumed" AttributeKeyAllocated = "allocated" )
View Source
const ( ModuleName = "subscription" QuerierRoute = ModuleName )
View Source
const ( QuerySubscription = "Subscription" QuerySubscriptions = "Subscriptions" QuerySubscriptionsForNode = "SubscriptionsForNode" QuerySubscriptionsForPlan = "SubscriptionsForPlan" QuerySubscriptionsForAddress = "SubscriptionsForAddress" QueryQuota = "Quota" QueryQuotas = "Quotas" )
View Source
const (
DefaultInactiveDuration = 10 * time.Minute
)
Variables ¶
View Source
var ( ErrorMarshal = errors.Register(ModuleName, 101, "error occurred while marshalling") ErrorUnmarshal = errors.Register(ModuleName, 102, "error occurred while unmarshalling") ErrorUnknownMsgType = errors.Register(ModuleName, 103, "unknown message type") ErrorUnknownQueryType = errors.Register(ModuleName, 104, "unknown query type") ErrorInvalidField = errors.Register(ModuleName, 105, "invalid field") ErrorPlanDoesNotExist = errors.Register(ModuleName, 106, "plan does not exist") ErrorNodeDoesNotExist = errors.Register(ModuleName, 107, "node does not exist") ErrorInvalidPlanStatus = errors.Register(ModuleName, 109, "invalid plan status") ErrorPriceDoesNotExist = errors.Register(ModuleName, 110, "price does not exist") ErrorInvalidNodeStatus = errors.Register(ModuleName, 111, "invalid node status") ErrorSubscriptionDoesNotExist = errors.Register(ModuleName, 112, "subscription does not exist") ErrorInvalidSubscriptionStatus = errors.Register(ModuleName, 113, "invalid subscription status") ErrorCanNotSubscribe = errors.Register(ModuleName, 114, "can not subscribe") ErrorInvalidQuota = errors.Register(ModuleName, 115, "invalid quota") ErrorDuplicateQuota = errors.Register(ModuleName, 116, "duplicate quota") ErrorQuotaDoesNotExist = errors.Register(ModuleName, 117, "quota does not exist") ErrorCanNotAddQuota = errors.Register(ModuleName, 118, "can not add quota") )
View Source
var ( EventTypeSetCount = fmt.Sprintf("%s:set_count", ModuleName) EventTypeSet = fmt.Sprintf("%s:set", ModuleName) EventTypeCancel = fmt.Sprintf("%s:cancel", ModuleName) EventTypeAddQuota = fmt.Sprintf("%s:add_quota", ModuleName) EventTypeUpdateQuota = fmt.Sprintf("%s:update_quota", ModuleName) )
View Source
var ( ParamsSubspace = ModuleName RouterKey = ModuleName StoreKey = ModuleName )
View Source
var ( CountKey = []byte{0x00} SubscriptionKeyPrefix = []byte{0x10} SubscriptionForNodeKeyPrefix = []byte{0x11} SubscriptionForPlanKeyPrefix = []byte{0x12} ActiveSubscriptionForAddressKeyPrefix = []byte{0x20} InactiveSubscriptionForAddressKeyPrefix = []byte{0x21} InactiveSubscriptionAtKeyPrefix = []byte{0x30} QuotaKeyPrefix = []byte{0x40} )
View Source
var ( EventModuleName = sdk.NewEvent( sdk.EventTypeMessage, sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName), ) )
View Source
var (
KeyInactiveDuration = []byte("InactiveDuration")
)
View Source
var (
ModuleCdc *codec.Codec
)
Functions ¶
func ActiveSubscriptionForAddressKey ¶ added in v0.4.0
func ActiveSubscriptionForAddressKey(address sdk.AccAddress, i uint64) []byte
func GetActiveSubscriptionForAddressKeyPrefix ¶ added in v0.4.0
func GetActiveSubscriptionForAddressKeyPrefix(address sdk.AccAddress) []byte
func GetInactiveSubscriptionAtKeyPrefix ¶ added in v0.4.0
func GetInactiveSubscriptionForAddressKeyPrefix ¶ added in v0.4.0
func GetInactiveSubscriptionForAddressKeyPrefix(address sdk.AccAddress) []byte
func GetQuotaKeyPrefix ¶
func GetSubscriptionForNodeKeyPrefix ¶
func GetSubscriptionForNodeKeyPrefix(address hub.NodeAddress) []byte
func IDFromInactiveSubscriptionAtKey ¶ added in v0.4.0
func IDFromStatusSubscriptionForAddressKey ¶ added in v0.4.0
func IDFromSubscriptionForNodeKey ¶ added in v0.4.0
func IDFromSubscriptionForPlanKey ¶ added in v0.4.0
func InactiveSubscriptionAtKey ¶ added in v0.4.0
func InactiveSubscriptionForAddressKey ¶ added in v0.4.0
func InactiveSubscriptionForAddressKey(address sdk.AccAddress, i uint64) []byte
func ParamsKeyTable ¶
func RegisterCodec ¶
func SubscriptionForNodeKey ¶
func SubscriptionForNodeKey(address hub.NodeAddress, id uint64) []byte
func SubscriptionForPlanKey ¶
func SubscriptionKey ¶
Types ¶
type GenesisState ¶
type GenesisState struct { Subscriptions GenesisSubscriptions `json:"_"` Params Params `json:"params"` }
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
func NewGenesisState ¶
func NewGenesisState(subscriptions GenesisSubscriptions, params Params) GenesisState
type GenesisSubscription ¶
type GenesisSubscription struct { Subscription Subscription `json:"_"` Quotas Quotas `json:"quotas"` }
type GenesisSubscriptions ¶
type GenesisSubscriptions []GenesisSubscription
type MsgAddQuota ¶
type MsgAddQuota struct { From sdk.AccAddress `json:"from"` ID uint64 `json:"id"` Address sdk.AccAddress `json:"address"` Bytes sdk.Int `json:"bytes"` }
MsgAddQuota is for adding the bandwidth quota for an address.
func NewMsgAddQuota ¶
func NewMsgAddQuota(from sdk.AccAddress, id uint64, address sdk.AccAddress, bytes sdk.Int) MsgAddQuota
func (MsgAddQuota) GetSignBytes ¶
func (m MsgAddQuota) GetSignBytes() []byte
func (MsgAddQuota) GetSigners ¶
func (m MsgAddQuota) GetSigners() []sdk.AccAddress
func (MsgAddQuota) Route ¶
func (m MsgAddQuota) Route() string
func (MsgAddQuota) Type ¶
func (m MsgAddQuota) Type() string
func (MsgAddQuota) ValidateBasic ¶
func (m MsgAddQuota) ValidateBasic() error
type MsgCancel ¶
type MsgCancel struct { From sdk.AccAddress `json:"from"` ID uint64 `json:"id"` }
MsgCancel is for cancelling a subscription.
func NewMsgCancel ¶
func NewMsgCancel(from sdk.AccAddress, id uint64) MsgCancel
func (MsgCancel) GetSignBytes ¶
func (MsgCancel) GetSigners ¶
func (m MsgCancel) GetSigners() []sdk.AccAddress
func (MsgCancel) ValidateBasic ¶
type MsgSubscribeToNode ¶
type MsgSubscribeToNode struct { From sdk.AccAddress `json:"from"` Address hub.NodeAddress `json:"address"` Deposit sdk.Coin `json:"deposit"` }
MsgSubscribeToNode is for starting a node subscription.
func NewMsgSubscribeToNode ¶
func NewMsgSubscribeToNode(from sdk.AccAddress, address hub.NodeAddress, deposit sdk.Coin) MsgSubscribeToNode
func (MsgSubscribeToNode) GetSignBytes ¶
func (m MsgSubscribeToNode) GetSignBytes() []byte
func (MsgSubscribeToNode) GetSigners ¶
func (m MsgSubscribeToNode) GetSigners() []sdk.AccAddress
func (MsgSubscribeToNode) Route ¶
func (m MsgSubscribeToNode) Route() string
func (MsgSubscribeToNode) Type ¶
func (m MsgSubscribeToNode) Type() string
func (MsgSubscribeToNode) ValidateBasic ¶
func (m MsgSubscribeToNode) ValidateBasic() error
type MsgSubscribeToPlan ¶
type MsgSubscribeToPlan struct { From sdk.AccAddress `json:"from"` ID uint64 `json:"id"` Denom string `json:"denom"` }
MsgSubscribeToPlan is for starting a plan subscription.
func NewMsgSubscribeToPlan ¶
func NewMsgSubscribeToPlan(from sdk.AccAddress, id uint64, denom string) MsgSubscribeToPlan
func (MsgSubscribeToPlan) GetSignBytes ¶
func (m MsgSubscribeToPlan) GetSignBytes() []byte
func (MsgSubscribeToPlan) GetSigners ¶
func (m MsgSubscribeToPlan) GetSigners() []sdk.AccAddress
func (MsgSubscribeToPlan) Route ¶
func (m MsgSubscribeToPlan) Route() string
func (MsgSubscribeToPlan) Type ¶
func (m MsgSubscribeToPlan) Type() string
func (MsgSubscribeToPlan) ValidateBasic ¶
func (m MsgSubscribeToPlan) ValidateBasic() error
type MsgUpdateQuota ¶
type MsgUpdateQuota struct { From sdk.AccAddress `json:"from"` ID uint64 `json:"id"` Address sdk.AccAddress `json:"address"` Bytes sdk.Int `json:"bytes"` }
MsgUpdateQuota is for updating the bandwidth quota for an address.
func NewMsgUpdateQuota ¶
func NewMsgUpdateQuota(from sdk.AccAddress, id uint64, address sdk.AccAddress, bytes sdk.Int) MsgUpdateQuota
func (MsgUpdateQuota) GetSignBytes ¶
func (m MsgUpdateQuota) GetSignBytes() []byte
func (MsgUpdateQuota) GetSigners ¶
func (m MsgUpdateQuota) GetSigners() []sdk.AccAddress
func (MsgUpdateQuota) Route ¶
func (m MsgUpdateQuota) Route() string
func (MsgUpdateQuota) Type ¶
func (m MsgUpdateQuota) Type() string
func (MsgUpdateQuota) ValidateBasic ¶
func (m MsgUpdateQuota) ValidateBasic() error
type Params ¶
func DefaultParams ¶
func DefaultParams() Params
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
type QueryQuotaParams ¶
type QueryQuotaParams struct { ID uint64 `json:"id"` Address sdk.AccAddress `json:"address"` }
func NewQueryQuotaParams ¶
func NewQueryQuotaParams(id uint64, address sdk.AccAddress) QueryQuotaParams
type QueryQuotasParams ¶
type QueryQuotasParams struct { ID uint64 `json:"id"` Skip int `json:"skip"` Limit int `json:"limit"` }
func NewQueryQuotasParams ¶
func NewQueryQuotasParams(id uint64, skip, limit int) QueryQuotasParams
type QuerySubscriptionParams ¶
type QuerySubscriptionParams struct {
ID uint64 `json:"id"`
}
func NewQuerySubscriptionParams ¶
func NewQuerySubscriptionParams(id uint64) QuerySubscriptionParams
type QuerySubscriptionsForAddressParams ¶
type QuerySubscriptionsForAddressParams struct { Address sdk.AccAddress `json:"address"` Status hub.Status `json:"status"` Skip int `json:"skip"` Limit int `json:"limit"` }
func NewQuerySubscriptionsForAddressParams ¶
func NewQuerySubscriptionsForAddressParams(address sdk.AccAddress, status hub.Status, skip, limit int) QuerySubscriptionsForAddressParams
type QuerySubscriptionsForNodeParams ¶
type QuerySubscriptionsForNodeParams struct { Address hub.NodeAddress `json:"address"` Skip int `json:"skip"` Limit int `json:"limit"` }
func NewQuerySubscriptionsForNodeParams ¶
func NewQuerySubscriptionsForNodeParams(address hub.NodeAddress, skip, limit int) QuerySubscriptionsForNodeParams
type QuerySubscriptionsForPlanParams ¶
type QuerySubscriptionsForPlanParams struct { ID uint64 `json:"id"` Skip int `json:"skip"` Limit int `json:"limit"` }
func NewQuerySubscriptionsForPlanParams ¶
func NewQuerySubscriptionsForPlanParams(id uint64, skip, limit int) QuerySubscriptionsForPlanParams
type QuerySubscriptionsParams ¶
func NewQuerySubscriptionsParams ¶
func NewQuerySubscriptionsParams(skip, limit int) QuerySubscriptionsParams
type Quota ¶
type Subscription ¶
type Subscription struct { ID uint64 `json:"id"` Owner sdk.AccAddress `json:"owner"` Node hub.NodeAddress `json:"node,omitempty"` Price sdk.Coin `json:"price,omitempty"` Deposit sdk.Coin `json:"deposit,omitempty"` Plan uint64 `json:"plan,omitempty"` Expiry time.Time `json:"expiry,omitempty"` Free sdk.Int `json:"free"` Status hub.Status `json:"status"` StatusAt time.Time `json:"status_at"` }
func (Subscription) String ¶
func (s Subscription) String() string
func (Subscription) Validate ¶
func (s Subscription) Validate() error
type Subscriptions ¶
type Subscriptions []Subscription
Click to show internal directories.
Click to hide internal directories.