Documentation ¶
Index ¶
- Constants
- Variables
- func ActiveSessionAtKey(at time.Time, id uint64) []byte
- func GetActiveSessionAtKeyPrefix(at time.Time) []byte
- func GetOngoingSessionPrefix(id uint64) []byte
- func GetSessionForAddressKeyPrefix(address sdk.AccAddress) []byte
- func GetSessionForNodeKeyPrefix(address hub.NodeAddress) []byte
- func GetSessionForSubscriptionKeyPrefix(id uint64) []byte
- func IDFromActiveSessionAtKey(key []byte) uint64
- func IDFromSessionForAddressKey(key []byte) uint64
- func IDFromSessionForNodeKey(key []byte) uint64
- func IDFromSessionForSubscriptionKey(key []byte) uint64
- func OngoingSessionKey(id uint64, address sdk.AccAddress) []byte
- func ParamsKeyTable() params.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- func SessionForAddressKey(address sdk.AccAddress, id uint64) []byte
- func SessionForNodeKey(address hub.NodeAddress, id uint64) []byte
- func SessionForSubscriptionKey(subscription, id uint64) []byte
- func SessionKey(id uint64) []byte
- type GenesisState
- type MsgUpsert
- type Params
- type QueryOngoingSessionParams
- type QuerySessionParams
- type QuerySessionsForAddressParams
- type QuerySessionsForNodeParams
- type QuerySessionsForSubscriptionParams
- type QuerySessionsParams
- type Session
- type Sessions
Constants ¶
View Source
const ( AttributeKeyCount = "count" AttributeKeyID = "id" AttributeKeySubscription = "subscription" AttributeKeyAddress = "address" )
View Source
const ( ModuleName = "session" QuerierRoute = ModuleName )
View Source
const ( QuerySession = "Session" QuerySessions = "Sessions" QuerySessionsForSubscription = "SessionsForSubscription" QuerySessionsForNode = "SessionsForNode" QuerySessionsForAddress = "SessionsForAddress" QueryOngoingSession = "OngoingSession" )
View Source
const (
DefaultInactiveDuration = 5 * 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") ErrorSubscriptionDoesNotExit = errors.Register(ModuleName, 106, "subscription does not exist") ErrorInvalidSubscriptionStatus = errors.Register(ModuleName, 107, "invalid subscription status") ErrorQuotaDoesNotExist = errors.Register(ModuleName, 109, "quota does not exist") ErrorInvalidBandwidth = errors.Register(ModuleName, 110, "invalid bandwidth") )
View Source
var ( EventTypeSetCount = fmt.Sprintf("%s:set_count", ModuleName) EventTypeSetActive = fmt.Sprintf("%s:set_active", ModuleName) EventTypeUpdate = fmt.Sprintf("%s:update", ModuleName) )
View Source
var ( ParamsSubspace = ModuleName RouterKey = ModuleName StoreKey = ModuleName )
View Source
var ( CountKey = []byte{0x00} SessionKeyPrefix = []byte{0x01} SessionForSubscriptionKeyPrefix = []byte{0x02} SessionForNodeKeyPrefix = []byte{0x03} SessionForAddressKeyPrefix = []byte{0x04} OngoingSessionKeyPrefix = []byte{0x05} ActiveSessionAtKeyPrefix = []byte{0x06} )
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 GetOngoingSessionPrefix ¶
func GetSessionForAddressKeyPrefix ¶
func GetSessionForAddressKeyPrefix(address sdk.AccAddress) []byte
func GetSessionForNodeKeyPrefix ¶
func GetSessionForNodeKeyPrefix(address hub.NodeAddress) []byte
func IDFromActiveSessionAtKey ¶ added in v0.4.0
func IDFromSessionForAddressKey ¶ added in v0.4.0
func IDFromSessionForNodeKey ¶ added in v0.4.0
func IDFromSessionForSubscriptionKey ¶ added in v0.4.0
func OngoingSessionKey ¶
func OngoingSessionKey(id uint64, address sdk.AccAddress) []byte
func ParamsKeyTable ¶
func RegisterCodec ¶
func SessionForAddressKey ¶
func SessionForAddressKey(address sdk.AccAddress, id uint64) []byte
func SessionForNodeKey ¶
func SessionForNodeKey(address hub.NodeAddress, id uint64) []byte
func SessionKey ¶
Types ¶
type GenesisState ¶
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
func NewGenesisState ¶
func NewGenesisState(sessions Sessions, params Params) GenesisState
type MsgUpsert ¶
type MsgUpsert struct { From hub.NodeAddress `json:"from"` ID uint64 `json:"id"` Address sdk.AccAddress `json:"address"` Duration time.Duration `json:"duration"` Bandwidth hub.Bandwidth `json:"bandwidth"` }
MsgUpsert is for updating or inserting a session of a plan.
func NewMsgUpsert ¶
func NewMsgUpsert(from hub.NodeAddress, id uint64, address sdk.AccAddress, duration time.Duration, bandwidth hub.Bandwidth) MsgUpsert
func (MsgUpsert) GetSignBytes ¶
func (MsgUpsert) GetSigners ¶
func (m MsgUpsert) GetSigners() []sdk.AccAddress
func (MsgUpsert) ValidateBasic ¶
type Params ¶
func DefaultParams ¶
func DefaultParams() Params
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
type QueryOngoingSessionParams ¶
type QueryOngoingSessionParams struct { ID uint64 `json:"id"` Address sdk.AccAddress `json:"address"` }
func NewQueryOngoingSessionParams ¶
func NewQueryOngoingSessionParams(id uint64, address sdk.AccAddress) QueryOngoingSessionParams
type QuerySessionParams ¶
type QuerySessionParams struct {
ID uint64 `json:"id"`
}
func NewQuerySessionParams ¶
func NewQuerySessionParams(id uint64) QuerySessionParams
type QuerySessionsForAddressParams ¶
type QuerySessionsForAddressParams struct { Address sdk.AccAddress `json:"address"` Skip int `json:"skip"` Limit int `json:"limit"` }
func NewQuerySessionsForAddressParams ¶
func NewQuerySessionsForAddressParams(address sdk.AccAddress, skip, limit int) QuerySessionsForAddressParams
type QuerySessionsForNodeParams ¶
type QuerySessionsForNodeParams struct { Address hub.NodeAddress `json:"address"` Skip int `json:"skip"` Limit int `json:"limit"` }
func NewQuerySessionsForNodeParams ¶
func NewQuerySessionsForNodeParams(address hub.NodeAddress, skip, limit int) QuerySessionsForNodeParams
type QuerySessionsForSubscriptionParams ¶
type QuerySessionsForSubscriptionParams struct { ID uint64 `json:"id"` Skip int `json:"skip"` Limit int `json:"limit"` }
func NewQuerySessionsForSubscriptionParams ¶
func NewQuerySessionsForSubscriptionParams(id uint64, skip, limit int) QuerySessionsForSubscriptionParams
type QuerySessionsParams ¶
func NewQuerySessionsParams ¶
func NewQuerySessionsParams(skip, limit int) QuerySessionsParams
type Session ¶
type Session struct { ID uint64 `json:"id"` Subscription uint64 `json:"subscription"` Node hub.NodeAddress `json:"node"` Address sdk.AccAddress `json:"address"` Duration time.Duration `json:"duration"` Bandwidth hub.Bandwidth `json:"bandwidth"` Status hub.Status `json:"status"` StatusAt time.Time `json:"status_at"` }
Click to show internal directories.
Click to hide internal directories.