Documentation ¶
Index ¶
- Constants
- func ErrInvalidUsage() sdk.Error
- func ErrInvalidUsername() sdk.Error
- func ErrProviderNotFound() sdk.Error
- func ErrQueryFailed() sdk.Error
- func NewHandler(im InfraManager) sdk.Handler
- func NewQuerier(im InfraManager) sdk.Querier
- func RegisterWire(cdc *wire.Codec)
- type InfraManager
- func (im InfraManager) AddToInfraProviderList(ctx sdk.Context, username types.AccountKey) sdk.Error
- func (im *InfraManager) ClearUsage(ctx sdk.Context) sdk.Error
- func (im InfraManager) DoesInfraProviderExist(ctx sdk.Context, username types.AccountKey) bool
- func (im *InfraManager) Export(ctx sdk.Context) *model.InfraTables
- func (im *InfraManager) GetInfraProviderList(ctx sdk.Context) (*model.InfraProviderList, sdk.Error)
- func (im *InfraManager) GetUsageWeight(ctx sdk.Context, username types.AccountKey) (sdk.Dec, sdk.Error)
- func (im *InfraManager) Import(ctx sdk.Context, tb *model.InfraTablesIR)
- func (im InfraManager) InitGenesis(ctx sdk.Context) error
- func (im InfraManager) RegisterInfraProvider(ctx sdk.Context, username types.AccountKey) sdk.Error
- func (im InfraManager) RemoveFromProviderList(ctx sdk.Context, username types.AccountKey) sdk.Error
- func (im *InfraManager) ReportUsage(ctx sdk.Context, username types.AccountKey, usage int64) sdk.Error
- type ProviderReportMsg
- func (msg ProviderReportMsg) GetConsumeAmount() types.Coin
- func (msg ProviderReportMsg) GetPermission() types.Permission
- func (msg ProviderReportMsg) GetSignBytes() []byte
- func (msg ProviderReportMsg) GetSigners() []sdk.AccAddress
- func (msg ProviderReportMsg) Route() string
- func (msg ProviderReportMsg) String() string
- func (msg ProviderReportMsg) Type() string
- func (msg ProviderReportMsg) ValidateBasic() sdk.Error
Constants ¶
const ( // ModuleKey is the name of the module ModuleName = "infra" // RouterKey is the message route for gov RouterKey = ModuleName // QuerierRoute is the querier route for gov QuerierRoute = ModuleName QueryInfraProvider = "infra" QueryInfraList = "infraList" )
Variables ¶
This section is empty.
Functions ¶
func ErrInvalidUsage ¶
ErrInvalidUsage - error if report usgae is invalid
func ErrInvalidUsername ¶
ErrInvalidUsername - error if username is invalid
func ErrProviderNotFound ¶
ErrProviderNotFound - error if infra provider is not found
func ErrQueryFailed ¶ added in v0.2.0
ErrQueryFailed - error when query infra store failed
func NewHandler ¶
func NewHandler(im InfraManager) sdk.Handler
NewHandler - Handle all "infra" type messages.
func NewQuerier ¶ added in v0.2.0
func NewQuerier(im InfraManager) sdk.Querier
creates a querier for infra REST endpoints
func RegisterWire ¶
RegisterWire - register concrete types on wire codec
Types ¶
type InfraManager ¶
type InfraManager struct {
// contains filtered or unexported fields
}
InfraManager - infra manager
func NewInfraManager ¶
func NewInfraManager(key sdk.StoreKey, holder param.ParamHolder) InfraManager
NewInfraManager - create NewInfraManager
func (InfraManager) AddToInfraProviderList ¶
func (im InfraManager) AddToInfraProviderList(ctx sdk.Context, username types.AccountKey) sdk.Error
AddToInfraProviderList - add infra provider to list
func (*InfraManager) ClearUsage ¶
func (im *InfraManager) ClearUsage(ctx sdk.Context) sdk.Error
ClearUsage - clear all infra provider report usage
func (InfraManager) DoesInfraProviderExist ¶
func (im InfraManager) DoesInfraProviderExist(ctx sdk.Context, username types.AccountKey) bool
DoesInfraProviderExist - check if infra provide exists in KVStore or not
func (*InfraManager) Export ¶ added in v0.2.0
func (im *InfraManager) Export(ctx sdk.Context) *model.InfraTables
Export state of infra.
func (*InfraManager) GetInfraProviderList ¶
func (im *InfraManager) GetInfraProviderList(ctx sdk.Context) (*model.InfraProviderList, sdk.Error)
GetInfraProviderList - get the infra provider list
func (*InfraManager) GetUsageWeight ¶
func (im *InfraManager) GetUsageWeight(ctx sdk.Context, username types.AccountKey) (sdk.Dec, sdk.Error)
GetUsageWeight - get the usage percentage of given infra provider
func (*InfraManager) Import ¶ added in v0.2.0
func (im *InfraManager) Import(ctx sdk.Context, tb *model.InfraTablesIR)
Import state of infra.
func (InfraManager) InitGenesis ¶
func (im InfraManager) InitGenesis(ctx sdk.Context) error
InitGenesis - initialize infra manager
func (InfraManager) RegisterInfraProvider ¶
func (im InfraManager) RegisterInfraProvider(ctx sdk.Context, username types.AccountKey) sdk.Error
RegisterInfraProvider - register infra provider on KVStore
func (InfraManager) RemoveFromProviderList ¶
func (im InfraManager) RemoveFromProviderList(ctx sdk.Context, username types.AccountKey) sdk.Error
RemoveFromProviderList - remove infra provider from list
func (*InfraManager) ReportUsage ¶
func (im *InfraManager) ReportUsage(ctx sdk.Context, username types.AccountKey, usage int64) sdk.Error
ReportUsage - infra provider report usage and get reward
type ProviderReportMsg ¶
type ProviderReportMsg struct { Username types.AccountKey `json:"username"` Usage int64 `json:"usage"` }
ProviderReportMsg - infra provider report infra usage to blockchain
func NewProviderReportMsg ¶
func NewProviderReportMsg(provider string, usage int64) ProviderReportMsg
---------------------------------------- ReportMsg Msg Implementations NewProviderReportMsg - new ProviderReportMsg
func (ProviderReportMsg) GetConsumeAmount ¶
func (msg ProviderReportMsg) GetConsumeAmount() types.Coin
GetConsumeAmount - implements types.Msg
func (ProviderReportMsg) GetPermission ¶
func (msg ProviderReportMsg) GetPermission() types.Permission
GetPermission - implements types.Msg
func (ProviderReportMsg) GetSignBytes ¶
func (msg ProviderReportMsg) GetSignBytes() []byte
GetSignBytes - implements sdk.Msg
func (ProviderReportMsg) GetSigners ¶
func (msg ProviderReportMsg) GetSigners() []sdk.AccAddress
GetSigners - implements sdk.Msg
func (ProviderReportMsg) Route ¶ added in v0.2.0
func (msg ProviderReportMsg) Route() string
Route - implements sdk.Msg
func (ProviderReportMsg) String ¶
func (msg ProviderReportMsg) String() string
func (ProviderReportMsg) Type ¶
func (msg ProviderReportMsg) Type() string
Type - implements sdk.Msg
func (ProviderReportMsg) ValidateBasic ¶
func (msg ProviderReportMsg) ValidateBasic() sdk.Error
ValidateBasic - implements sdk.Msg