types

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2020 License: Apache-2.0 Imports: 8 Imported by: 14

Documentation

Index

Constants

View Source
const (
	EventTypeSetCount  = "session:set_count"
	EventTypeSetActive = "session:set_active"
	EventTypeUpdate    = "session:update"
)
View Source
const (
	AttributeKeyCount        = "count"
	AttributeKeyID           = "id"
	AttributeKeySubscription = "subscription"
	AttributeKeyAddress      = "address"
)
View Source
const (
	ModuleName     = "session"
	ParamsSubspace = ModuleName
	QuerierRoute   = ModuleName
)
View Source
const (
	QuerySession                 = "session"
	QuerySessions                = "sessions"
	QuerySessionsForSubscription = "sessions_for_subscription"
	QuerySessionsForNode         = "sessions_for_node"
	QuerySessionsForAddress      = "sessions_for_address"

	QueryOngoingSession = "ongoing_session"
)
View Source
const (
	Codespace = sdk.CodespaceType("session")
)
View Source
const (
	DefaultInactiveDuration = 30 * time.Minute
)

Variables

View Source
var (
	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 (
	KeyInactiveDuration = []byte("InactiveDuration")
)
View Source
var (
	ModuleCdc *codec.Codec
)

Functions

func ActiveSessionAtKey

func ActiveSessionAtKey(at time.Time, id uint64) []byte

func ErrorInvalidBandwidth

func ErrorInvalidBandwidth() sdk.Error

func ErrorInvalidField

func ErrorInvalidField(v string) sdk.Error

func ErrorInvalidSubscriptionStatus

func ErrorInvalidSubscriptionStatus() sdk.Error

func ErrorMarshal

func ErrorMarshal() sdk.Error

func ErrorQuotaDoesNotExist

func ErrorQuotaDoesNotExist() sdk.Error

func ErrorSubscriptionDoesNotExit

func ErrorSubscriptionDoesNotExit() sdk.Error

func ErrorUnauthorized

func ErrorUnauthorized() sdk.Error

func ErrorUnknownMsgType

func ErrorUnknownMsgType(v string) sdk.Error

func ErrorUnknownQueryType

func ErrorUnknownQueryType(v string) sdk.Error

func ErrorUnmarshal

func ErrorUnmarshal() sdk.Error

func GetActiveSessionAtKeyPrefix

func GetActiveSessionAtKeyPrefix(at time.Time) []byte

func GetOngoingSessionPrefix

func GetOngoingSessionPrefix(id uint64) []byte

func GetSessionForAddressKeyPrefix

func GetSessionForAddressKeyPrefix(address sdk.AccAddress) []byte

func GetSessionForNodeKeyPrefix

func GetSessionForNodeKeyPrefix(address hub.NodeAddress) []byte

func GetSessionForSubscriptionKeyPrefix

func GetSessionForSubscriptionKeyPrefix(id uint64) []byte

func OngoingSessionKey

func OngoingSessionKey(id uint64, address sdk.AccAddress) []byte

func ParamsKeyTable

func ParamsKeyTable() params.KeyTable

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

func SessionForAddressKey

func SessionForAddressKey(address sdk.AccAddress, id uint64) []byte

func SessionForNodeKey

func SessionForNodeKey(address hub.NodeAddress, id uint64) []byte

func SessionForSubscriptionKey

func SessionForSubscriptionKey(subscription, id uint64) []byte

func SessionKey

func SessionKey(id uint64) []byte

Types

type GenesisState

type GenesisState struct {
	Sessions Sessions `json:"_"`
	Params   Params   `json:"params"`
}

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 (m MsgUpsert) GetSignBytes() []byte

func (MsgUpsert) GetSigners

func (m MsgUpsert) GetSigners() []sdk.AccAddress

func (MsgUpsert) Route

func (m MsgUpsert) Route() string

func (MsgUpsert) Type

func (m MsgUpsert) Type() string

func (MsgUpsert) ValidateBasic

func (m MsgUpsert) ValidateBasic() sdk.Error

type Params

type Params struct {
	InactiveDuration time.Duration `json:"inactive_duration"`
}

func DefaultParams

func DefaultParams() Params

func NewParams

func NewParams(inactiveDuration time.Duration) Params

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

func (Params) String

func (p Params) String() string

func (Params) Validate

func (p Params) Validate() error

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"`
	Page    int            `json:"page"`
	Limit   int            `json:"limit"`
}

func NewQuerySessionsForAddressParams

func NewQuerySessionsForAddressParams(address sdk.AccAddress, page, limit int) QuerySessionsForAddressParams

type QuerySessionsForNodeParams

type QuerySessionsForNodeParams struct {
	Address hub.NodeAddress `json:"address"`
	Page    int             `json:"page"`
	Limit   int             `json:"limit"`
}

func NewQuerySessionsForNodeParams

func NewQuerySessionsForNodeParams(address hub.NodeAddress, page, limit int) QuerySessionsForNodeParams

type QuerySessionsForSubscriptionParams

type QuerySessionsForSubscriptionParams struct {
	ID    uint64 `json:"id"`
	Page  int    `json:"page"`
	Limit int    `json:"limit"`
}

func NewQuerySessionsForSubscriptionParams

func NewQuerySessionsForSubscriptionParams(id uint64, page, limit int) QuerySessionsForSubscriptionParams

type QuerySessionsParams

type QuerySessionsParams struct {
	Page  int `json:"page"`
	Limit int `json:"limit"`
}

func NewQuerySessionsParams

func NewQuerySessionsParams(page, 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"`
}

func (Session) String

func (s Session) String() string

func (Session) Validate

func (s Session) Validate() error

type Sessions

type Sessions []Session

Jump to

Keyboard shortcuts

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