types

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: Apache-2.0 Imports: 10 Imported by: 14

Documentation

Index

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")
	ErrorUnauthorized              = errors.Register(ModuleName, 108, "unauthorized")
	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 (
	KeyInactiveDuration = []byte("InactiveDuration")
)
View Source
var (
	ModuleCdc *codec.Codec
)

Functions

func ActiveSessionAtKey

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

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 IDFromActiveSessionAtKey added in v0.4.0

func IDFromActiveSessionAtKey(key []byte) uint64

func IDFromSessionForAddressKey added in v0.4.0

func IDFromSessionForAddressKey(key []byte) uint64

func IDFromSessionForNodeKey added in v0.4.0

func IDFromSessionForNodeKey(key []byte) uint64

func IDFromSessionForSubscriptionKey added in v0.4.0

func IDFromSessionForSubscriptionKey(key []byte) uint64

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() 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"`
	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

type QuerySessionsParams struct {
	Skip  int `json:"skip"`
	Limit int `json:"limit"`
}

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"`
}

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