types

package
v0.4.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2021 License: Apache-2.0 Imports: 9 Imported by: 7

Documentation

Index

Constants

View Source
const (
	AttributeKeyAddress = "address"
	AttributeKeyID      = "id"
	AttributeKeyCount   = "count"
	AttributeKeyStatus  = "status"
)
View Source
const (
	ModuleName   = "plan"
	QuerierRoute = ModuleName
)
View Source
const (
	QueryPlan             = "Plan"
	QueryPlans            = "Plans"
	QueryPlansForProvider = "PlansForProvider"

	QueryNodesForPlan = "NodesForPlan"
)

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")
	ErrorProviderDoesNotExist = errors.Register(ModuleName, 106, "provider does not exist")
	ErrorPlanDoesNotExist     = errors.Register(ModuleName, 107, "plan does not exist")
	ErrorNodeDoesNotExist     = errors.Register(ModuleName, 108, "node does not exist")
	ErrorUnauthorized         = errors.Register(ModuleName, 109, "unauthorized")
)
View Source
var (
	EventTypeSetCount   = fmt.Sprintf("%s:set_count", ModuleName)
	EventTypeSet        = fmt.Sprintf("%s:set", ModuleName)
	EventTypeSetStatus  = fmt.Sprintf("%s:set_status", ModuleName)
	EventTypeAddNode    = fmt.Sprintf("%s:add_node", ModuleName)
	EventTypeRemoveNode = fmt.Sprintf("%s:remove_node", ModuleName)
)
View Source
var (
	RouterKey = ModuleName
	StoreKey  = ModuleName
)
View Source
var (
	CountKey = []byte{0x00}

	PlanKeyPrefix = []byte{0x10}

	ActivePlanKeyPrefix   = []byte{0x20}
	InactivePlanKeyPrefix = []byte{0x21}

	ActivePlanForProviderKeyPrefix   = []byte{0x30}
	InactivePlanForProviderKeyPrefix = []byte{0x31}

	NodeForPlanKeyPrefix = []byte{0x40}
)
View Source
var (
	ModuleCdc *codec.Codec
)

Functions

func ActivePlanForProviderKey added in v0.4.0

func ActivePlanForProviderKey(address hub.ProvAddress, id uint64) []byte

func ActivePlanKey added in v0.4.0

func ActivePlanKey(i uint64) []byte

func AddressFromNodeForPlanKey added in v0.4.0

func AddressFromNodeForPlanKey(key []byte) hub.NodeAddress

func GetActivePlanForProviderKeyPrefix added in v0.4.0

func GetActivePlanForProviderKeyPrefix(address hub.ProvAddress) []byte

func GetInactivePlanForProviderKeyPrefix added in v0.4.0

func GetInactivePlanForProviderKeyPrefix(address hub.ProvAddress) []byte

func GetNodeForPlanKeyPrefix

func GetNodeForPlanKeyPrefix(id uint64) []byte

func IDFromStatusPlanForProviderKey added in v0.4.0

func IDFromStatusPlanForProviderKey(key []byte) uint64

func IDFromStatusPlanKey added in v0.4.0

func IDFromStatusPlanKey(key []byte) uint64

func InactivePlanForProviderKey added in v0.4.0

func InactivePlanForProviderKey(address hub.ProvAddress, id uint64) []byte

func InactivePlanKey added in v0.4.0

func InactivePlanKey(i uint64) []byte

func NodeForPlanKey

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

func PlanKey

func PlanKey(i uint64) []byte

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Types

type GenesisPlan

type GenesisPlan struct {
	Plan  Plan              `json:"_"`
	Nodes []hub.NodeAddress `json:"nodes"`
}

type GenesisPlans

type GenesisPlans []GenesisPlan

type GenesisState

type GenesisState = GenesisPlans

func DefaultGenesisState

func DefaultGenesisState() GenesisState

func NewGenesisState

func NewGenesisState(plans GenesisPlans) GenesisState

type MsgAdd

type MsgAdd struct {
	From     hub.ProvAddress `json:"from"`
	Price    sdk.Coins       `json:"price"`
	Validity time.Duration   `json:"validity"`
	Bytes    sdk.Int         `json:"bytes"`
}

MsgAdd is for adding a subscription plan.

func NewMsgAdd

func NewMsgAdd(from hub.ProvAddress, price sdk.Coins, validity time.Duration, bytes sdk.Int) MsgAdd

func (MsgAdd) GetSignBytes

func (m MsgAdd) GetSignBytes() []byte

func (MsgAdd) GetSigners

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

func (MsgAdd) Route

func (m MsgAdd) Route() string

func (MsgAdd) Type

func (m MsgAdd) Type() string

func (MsgAdd) ValidateBasic

func (m MsgAdd) ValidateBasic() error

type MsgAddNode

type MsgAddNode struct {
	From    hub.ProvAddress `json:"from"`
	ID      uint64          `json:"id"`
	Address hub.NodeAddress `json:"address"`
}

MsgAddNode is for adding a node for a plan.

func NewMsgAddNode

func NewMsgAddNode(from hub.ProvAddress, id uint64, address hub.NodeAddress) MsgAddNode

func (MsgAddNode) GetSignBytes

func (m MsgAddNode) GetSignBytes() []byte

func (MsgAddNode) GetSigners

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

func (MsgAddNode) Route

func (m MsgAddNode) Route() string

func (MsgAddNode) Type

func (m MsgAddNode) Type() string

func (MsgAddNode) ValidateBasic

func (m MsgAddNode) ValidateBasic() error

type MsgRemoveNode

type MsgRemoveNode struct {
	From    hub.ProvAddress `json:"from"`
	ID      uint64          `json:"id"`
	Address hub.NodeAddress `json:"address"`
}

MsgRemoveNode is for removing a node for a plan.

func NewMsgRemoveNode

func NewMsgRemoveNode(from hub.ProvAddress, id uint64, address hub.NodeAddress) MsgRemoveNode

func (MsgRemoveNode) GetSignBytes

func (m MsgRemoveNode) GetSignBytes() []byte

func (MsgRemoveNode) GetSigners

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

func (MsgRemoveNode) Route

func (m MsgRemoveNode) Route() string

func (MsgRemoveNode) Type

func (m MsgRemoveNode) Type() string

func (MsgRemoveNode) ValidateBasic

func (m MsgRemoveNode) ValidateBasic() error

type MsgSetStatus

type MsgSetStatus struct {
	From   hub.ProvAddress `json:"from"`
	ID     uint64          `json:"id"`
	Status hub.Status      `json:"status"`
}

MsgSetStatus is for updating the status of a plan.

func NewMsgSetStatus

func NewMsgSetStatus(from hub.ProvAddress, id uint64, status hub.Status) MsgSetStatus

func (MsgSetStatus) GetSignBytes

func (m MsgSetStatus) GetSignBytes() []byte

func (MsgSetStatus) GetSigners

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

func (MsgSetStatus) Route

func (m MsgSetStatus) Route() string

func (MsgSetStatus) Type

func (m MsgSetStatus) Type() string

func (MsgSetStatus) ValidateBasic

func (m MsgSetStatus) ValidateBasic() error

type Plan

type Plan struct {
	ID       uint64          `json:"id"`
	Provider hub.ProvAddress `json:"provider"`
	Price    sdk.Coins       `json:"price"`
	Validity time.Duration   `json:"validity"`
	Bytes    sdk.Int         `json:"bytes"`
	Status   hub.Status      `json:"status"`
	StatusAt time.Time       `json:"status_at"`
}

func (Plan) PriceForDenom

func (p Plan) PriceForDenom(d string) (sdk.Coin, bool)

func (Plan) String

func (p Plan) String() string

func (Plan) Validate

func (p Plan) Validate() error

type Plans

type Plans []Plan

type QueryNodesForPlanParams

type QueryNodesForPlanParams struct {
	ID    uint64 `json:"id"`
	Skip  int    `json:"skip"`
	Limit int    `json:"limit"`
}

func NewQueryNodesForPlanParams

func NewQueryNodesForPlanParams(id uint64, skip, limit int) QueryNodesForPlanParams

type QueryPlanParams

type QueryPlanParams struct {
	ID uint64 `json:"id"`
}

func NewQueryPlanParams

func NewQueryPlanParams(id uint64) QueryPlanParams

type QueryPlansForProviderParams

type QueryPlansForProviderParams struct {
	Address hub.ProvAddress `json:"address"`
	Status  hub.Status      `json:"status"`
	Skip    int             `json:"skip"`
	Limit   int             `json:"limit"`
}

func NewQueryPlansForProviderParams

func NewQueryPlansForProviderParams(address hub.ProvAddress, status hub.Status, skip, limit int) QueryPlansForProviderParams

type QueryPlansParams

type QueryPlansParams struct {
	Status hub.Status `json:"status"`
	Skip   int        `json:"skip"`
	Limit  int        `json:"limit"`
}

func NewQueryPlansParams

func NewQueryPlansParams(status hub.Status, skip, limit int) QueryPlansParams

Jump to

Keyboard shortcuts

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