Documentation ¶
Index ¶
- Constants
- Variables
- func CancelSubscriptionAtKey(at time.Time, id uint64) []byte
- func ErrorCanNotSubscribe() sdk.Error
- func ErrorDuplicateQuota() sdk.Error
- func ErrorInvalidField(v string) sdk.Error
- func ErrorInvalidNodeStatus() sdk.Error
- func ErrorInvalidPlanStatus() sdk.Error
- func ErrorInvalidQuota() sdk.Error
- func ErrorInvalidSubscriptionStatus() sdk.Error
- func ErrorMarshal() sdk.Error
- func ErrorNodeDoesNotExist() sdk.Error
- func ErrorPlanDoesNotExist() sdk.Error
- func ErrorPriceDoesNotExist() sdk.Error
- func ErrorQuotaDoesNotExist() sdk.Error
- func ErrorSubscriptionDoesNotExist() sdk.Error
- func ErrorUnauthorized() sdk.Error
- func ErrorUnknownMsgType(v string) sdk.Error
- func ErrorUnknownQueryType(v string) sdk.Error
- func ErrorUnmarshal() sdk.Error
- func GetCancelSubscriptionAtKeyPrefix(at time.Time) []byte
- func GetQuotaKeyPrefix(id uint64) []byte
- func GetSubscriptionForAddressKeyPrefix(address sdk.AccAddress) []byte
- func GetSubscriptionForNodeKeyPrefix(address hub.NodeAddress) []byte
- func GetSubscriptionForPlanKeyPrefix(id uint64) []byte
- func ParamsKeyTable() params.KeyTable
- func QuotaKey(id uint64, address sdk.AccAddress) []byte
- func RegisterCodec(cdc *codec.Codec)
- func SubscriptionForAddressKey(address sdk.AccAddress, i uint64) []byte
- 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 ( EventTypeSetCount = "subscription:set_count" EventTypeSet = "subscription:set" EventTypeCancel = "subscription:cancel" EventTypeAddQuota = "subscription:add_quota" EventTypeUpdateQuota = "subscription:update_quota" )
View Source
const ( AttributeKeyOwner = "owner" AttributeKeyAddress = "address" AttributeKeyID = "id" AttributeKeyNode = "node" AttributeKeyCount = "count" AttributeKeyPlan = "plan" AttributeKeyConsumed = "consumed" AttributeKeyAllocated = "allocated" )
View Source
const ( ModuleName = "subscription" ParamsSubspace = ModuleName QuerierRoute = ModuleName )
View Source
const ( QuerySubscription = "subscription" QuerySubscriptions = "subscriptions" QuerySubscriptionsForAddress = "subscriptions_for_address" QuerySubscriptionsForPlan = "subscriptions_for_plan" QuerySubscriptionsForNode = "subscriptions_for_node" QueryQuota = "quota" QueryQuotas = "quotas" )
View Source
const (
Codespace = sdk.CodespaceType(ModuleName)
)
View Source
const (
DefaultCancelDuration = 6 * time.Hour
)
Variables ¶
View Source
var ( RouterKey = ModuleName StoreKey = ModuleName )
View Source
var ( CountKey = []byte{0x00} SubscriptionKeyPrefix = []byte{0x01} SubscriptionForAddressKeyPrefix = []byte{0x02} SubscriptionForPlanKeyPrefix = []byte{0x03} SubscriptionForNodeKeyPrefix = []byte{0x04} CancelSubscriptionAtKeyPrefix = []byte{0x05} QuotaKeyPrefix = []byte{0x10} )
View Source
var ( EventModuleName = sdk.NewEvent( sdk.EventTypeMessage, sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName), ) )
View Source
var (
KeyCancelDuration = []byte("CancelDuration")
)
View Source
var (
ModuleCdc *codec.Codec
)
Functions ¶
func ErrorCanNotSubscribe ¶
func ErrorDuplicateQuota ¶
func ErrorInvalidField ¶
func ErrorInvalidNodeStatus ¶
func ErrorInvalidPlanStatus ¶
func ErrorInvalidQuota ¶
func ErrorMarshal ¶
func ErrorNodeDoesNotExist ¶
func ErrorPlanDoesNotExist ¶
func ErrorPriceDoesNotExist ¶
func ErrorQuotaDoesNotExist ¶
func ErrorUnauthorized ¶
func ErrorUnknownMsgType ¶
func ErrorUnknownQueryType ¶
func ErrorUnmarshal ¶
func GetQuotaKeyPrefix ¶
func GetSubscriptionForAddressKeyPrefix ¶
func GetSubscriptionForAddressKeyPrefix(address sdk.AccAddress) []byte
func GetSubscriptionForNodeKeyPrefix ¶
func GetSubscriptionForNodeKeyPrefix(address hub.NodeAddress) []byte
func ParamsKeyTable ¶
func RegisterCodec ¶
func SubscriptionForAddressKey ¶
func SubscriptionForAddressKey(address sdk.AccAddress, i uint64) []byte
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"` Bandwidth hub.Bandwidth `json:"bandwidth"` }
MsgAddQuota is for adding the bandwidth quota for an address.
func NewMsgAddQuota ¶
func NewMsgAddQuota(from sdk.AccAddress, id uint64, address sdk.AccAddress, bandwidth hub.Bandwidth) 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() sdk.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() sdk.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() sdk.Error
type MsgUpdateQuota ¶
type MsgUpdateQuota struct { From sdk.AccAddress `json:"from"` ID uint64 `json:"id"` Address sdk.AccAddress `json:"address"` Bandwidth hub.Bandwidth `json:"bandwidth"` }
MsgUpdateQuota is for updating the bandwidth quota for an address.
func NewMsgUpdateQuota ¶
func NewMsgUpdateQuota(from sdk.AccAddress, id uint64, address sdk.AccAddress, bandwidth hub.Bandwidth) 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() sdk.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"` Page int `json:"page"` Limit int `json:"limit"` }
func NewQueryQuotasParams ¶
func NewQueryQuotasParams(id uint64, page, 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"` Page int `json:"page"` Limit int `json:"limit"` }
func NewQuerySubscriptionsForAddressParams ¶
func NewQuerySubscriptionsForAddressParams(address sdk.AccAddress, page, limit int) QuerySubscriptionsForAddressParams
type QuerySubscriptionsForNodeParams ¶
type QuerySubscriptionsForNodeParams struct { Address hub.NodeAddress `json:"address"` Page int `json:"page"` Limit int `json:"limit"` }
func NewQuerySubscriptionsForNodeParams ¶
func NewQuerySubscriptionsForNodeParams(address hub.NodeAddress, page, limit int) QuerySubscriptionsForNodeParams
type QuerySubscriptionsForPlanParams ¶
type QuerySubscriptionsForPlanParams struct { ID uint64 `json:"id"` Page int `json:"page"` Limit int `json:"limit"` }
func NewQuerySubscriptionsForPlanParams ¶
func NewQuerySubscriptionsForPlanParams(id uint64, page, limit int) QuerySubscriptionsForPlanParams
type QuerySubscriptionsParams ¶
func NewQuerySubscriptionsParams ¶
func NewQuerySubscriptionsParams(page, limit int) QuerySubscriptionsParams
type Quota ¶
type Subscription ¶
type Subscription struct { ID uint64 `json:"id"` Owner sdk.AccAddress `json:"owner"` Plan uint64 `json:"plan,omitempty"` Expiry time.Time `json:"expiry,omitempty"` Node hub.NodeAddress `json:"node,omitempty"` Price sdk.Coin `json:"price,omitempty"` Deposit sdk.Coin `json:"deposit,omitempty"` Free hub.Bandwidth `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.