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: 12

Documentation

Index

Constants

View Source
const (
	AttributeKeyProvider = "provider"
	AttributeKeyAddress  = "address"
	AttributeKeyStatus   = "status"
)
View Source
const (
	ModuleName   = "node"
	QuerierRoute = ModuleName
)
View Source
const (
	QueryNode             = "Node"
	QueryNodes            = "Nodes"
	QueryNodesForProvider = "NodesForProvider"
)
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")
	ErrorProviderDoesNotExist = errors.Register(ModuleName, 106, "provider does not exist")
	ErrorDuplicateNode        = errors.Register(ModuleName, 107, "duplicate node")
	ErrorNodeDoesNotExist     = errors.Register(ModuleName, 108, "node does not exist")
)
View Source
var (
	EventTypeSet       = fmt.Sprintf("%s:set", ModuleName)
	EventTypeUpdate    = fmt.Sprintf("%s:update", ModuleName)
	EventTypeSetStatus = fmt.Sprintf("%s:set_status", ModuleName)
)
View Source
var (
	ParamsSubspace = ModuleName
	RouterKey      = ModuleName
	StoreKey       = ModuleName
)
View Source
var (
	NodeKeyPrefix = []byte{0x00}

	ActiveNodeKeyPrefix   = []byte{0x10}
	InactiveNodeKeyPrefix = []byte{0x11}

	ActiveNodeForProviderKeyPrefix   = []byte{0x20}
	InactiveNodeForProviderKeyPrefix = []byte{0x21}

	ActiveNodeAtKeyPrefix   = []byte{0x30}
	InactiveNodeAtKeyPrefix = []byte{0x31}
)
View Source
var (
	KeyInactiveDuration = []byte("InactiveDuration")
)
View Source
var (
	ModuleCdc *codec.Codec
)

Functions

func ActiveNodeAtKey

func ActiveNodeAtKey(at time.Time, address hub.NodeAddress) []byte

func ActiveNodeForProviderKey added in v0.4.0

func ActiveNodeForProviderKey(p hub.ProvAddress, n hub.NodeAddress) []byte

func ActiveNodeKey added in v0.4.0

func ActiveNodeKey(address hub.NodeAddress) []byte

func AddressFromStatusNodeAtKey added in v0.4.0

func AddressFromStatusNodeAtKey(key []byte) hub.NodeAddress

func AddressFromStatusNodeForProviderKey added in v0.4.0

func AddressFromStatusNodeForProviderKey(key []byte) hub.NodeAddress

func AddressFromStatusNodeKey added in v0.4.0

func AddressFromStatusNodeKey(key []byte) hub.NodeAddress

func GetActiveNodeAtKeyPrefix

func GetActiveNodeAtKeyPrefix(at time.Time) []byte

func GetActiveNodeForProviderKeyPrefix added in v0.4.0

func GetActiveNodeForProviderKeyPrefix(address hub.ProvAddress) []byte

func GetInactiveNodeAtKeyPrefix added in v0.4.0

func GetInactiveNodeAtKeyPrefix(at time.Time) []byte

func GetInactiveNodeForProviderKeyPrefix added in v0.4.0

func GetInactiveNodeForProviderKeyPrefix(address hub.ProvAddress) []byte

func InactiveNodeAtKey added in v0.4.0

func InactiveNodeAtKey(at time.Time, address hub.NodeAddress) []byte

func InactiveNodeForProviderKey added in v0.4.0

func InactiveNodeForProviderKey(p hub.ProvAddress, n hub.NodeAddress) []byte

func InactiveNodeKey added in v0.4.0

func InactiveNodeKey(address hub.NodeAddress) []byte

func NodeKey

func NodeKey(address hub.NodeAddress) []byte

func ParamsKeyTable

func ParamsKeyTable() params.KeyTable

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Types

type GenesisState

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

func DefaultGenesisState

func DefaultGenesisState() GenesisState

func NewGenesisState

func NewGenesisState(nodes Nodes, params Params) GenesisState

type MsgRegister

type MsgRegister struct {
	From      sdk.AccAddress  `json:"from"`
	Provider  hub.ProvAddress `json:"provider,omitempty"`
	Price     sdk.Coins       `json:"price,omitempty"`
	RemoteURL string          `json:"remote_url"`
}

MsgRegister is for registering a node.

func NewMsgRegister

func NewMsgRegister(from sdk.AccAddress, provider hub.ProvAddress, price sdk.Coins, remoteURL string) MsgRegister

func (MsgRegister) GetSignBytes

func (m MsgRegister) GetSignBytes() []byte

func (MsgRegister) GetSigners

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

func (MsgRegister) Route

func (m MsgRegister) Route() string

func (MsgRegister) Type

func (m MsgRegister) Type() string

func (MsgRegister) ValidateBasic

func (m MsgRegister) ValidateBasic() error

type MsgSetStatus

type MsgSetStatus struct {
	From   hub.NodeAddress `json:"from"`
	Status hub.Status      `json:"status"`
}

MsgSetStatus is for updating the status of a node.

func NewMsgSetStatus

func NewMsgSetStatus(from hub.NodeAddress, 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 MsgUpdate

type MsgUpdate struct {
	From      hub.NodeAddress `json:"from"`
	Provider  hub.ProvAddress `json:"provider,omitempty"`
	Price     sdk.Coins       `json:"price,omitempty"`
	RemoteURL string          `json:"remote_url,omitempty"`
}

MsgUpdate is for updating the information of a node.

func NewMsgUpdate

func NewMsgUpdate(from hub.NodeAddress, provider hub.ProvAddress, price sdk.Coins, remoteURL string) MsgUpdate

func (MsgUpdate) GetSignBytes

func (m MsgUpdate) GetSignBytes() []byte

func (MsgUpdate) GetSigners

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

func (MsgUpdate) Route

func (m MsgUpdate) Route() string

func (MsgUpdate) Type

func (m MsgUpdate) Type() string

func (MsgUpdate) ValidateBasic

func (m MsgUpdate) ValidateBasic() error

type Node

type Node struct {
	Address   hub.NodeAddress `json:"address"`
	Provider  hub.ProvAddress `json:"provider,omitempty"`
	Price     sdk.Coins       `json:"price,omitempty"`
	RemoteURL string          `json:"remote_url"`
	Status    hub.Status      `json:"status"`
	StatusAt  time.Time       `json:"status_at"`
}

func (Node) BytesForCoin added in v0.3.2

func (n Node) BytesForCoin(coin sdk.Coin) (sdk.Int, error)

func (Node) PriceForDenom

func (n Node) PriceForDenom(d string) (sdk.Coin, bool)

func (Node) String

func (n Node) String() string

func (Node) Validate

func (n Node) Validate() error

type Nodes

type Nodes []Node

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 QueryNodeParams

type QueryNodeParams struct {
	Address hub.NodeAddress `json:"address"`
}

func NewQueryNodeParams

func NewQueryNodeParams(address hub.NodeAddress) QueryNodeParams

type QueryNodesForProviderParams

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

func NewQueryNodesForProviderParams

func NewQueryNodesForProviderParams(address hub.ProvAddress, status hub.Status, skip, limit int) QueryNodesForProviderParams

type QueryNodesParams

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

func NewQueryNodesParams

func NewQueryNodesParams(status hub.Status, skip, limit int) QueryNodesParams

Jump to

Keyboard shortcuts

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