Documentation ¶
Index ¶
- Variables
- func DecodeEventRecordsWithIgnoreError(e types.EventRecordsRaw, m *types.Metadata, t interface{}) error
- type AccountInfo
- type AccountInfoCustom
- type ChainClient
- func (cc *ChainClient) AddResourceDuration(index uint64, duration int) error
- func (cc *ChainClient) CalculateInstanceOverdue(orderIndex uint64) time.Duration
- func (cc *ChainClient) CalculateProviderOverdue(agreementIndex uint64) time.Duration
- func (cc *ChainClient) CalculateResourceOverdue(expireBlock uint64) (time.Duration, error)
- func (cc *ChainClient) ChangeResourceStatus(index uint64) error
- func (cc *ChainClient) CheckExtrinsicSuccess(header *types.Header, call string) error
- func (cc *ChainClient) GetAccountInfo() (*AccountInfo, error)
- func (cc *ChainClient) GetAgreementIndex(orderIndex uint64) (uint64, error)
- func (cc *ChainClient) GetEvent(blockNumber uint64) (*MyEventRecords, error)
- func (cc *ChainClient) GetGatewayNodes() ([]string, error)
- func (cc *ChainClient) GetMarketStackInfo() (*StakingAmount, error)
- func (cc *ChainClient) GetOrder(orderIndex uint64) (*ComputingOrder, error)
- func (cc *ChainClient) GetResource(resourceIndex uint64) (*ComputingResource, error)
- func (cc *ChainClient) GetReward() (*MarketIncome, error)
- func (cc *ChainClient) GetStakingInfo() (*StakingAmount, error)
- func (cc *ChainClient) Heartbeat(agreementindex uint64) error
- func (cc *ChainClient) LoadKeyFromChain() ([]string, error)
- func (cc *ChainClient) ModifyResourcePrice(index uint64, unitPrice int64) error
- func (cc *ChainClient) OrderExec(orderIndex uint64) error
- func (cc *ChainClient) PayoutReward() error
- func (cc *ChainClient) ProcessApplyFreeResource(index uint64, peerId string) error
- func (cc *ChainClient) ReceiveIncome() error
- func (cc *ChainClient) ReceiveIncomeJudge() bool
- func (cc *ChainClient) RegisterResource(r ResourceInfo) error
- func (cc *ChainClient) ReleaseApplyFreeResource(index uint64) error
- func (cc *ChainClient) RemoveResource(index uint64) error
- func (cc *ChainClient) ReportStatus() error
- func (cc *ChainClient) StakingAmount(unitPrice int64) error
- func (cc *ChainClient) WithdrawStakingAmount(unitPrice int64) error
- type ComputingOrder
- type ComputingResource
- type Duration
- type EventBalancesWithdraw
- type EventMarketMoney
- type EventProviderRegisterResourceSuccess
- type EventResourceOrderCreateOrderSuccess
- type EventResourceOrderOrderExecSuccess
- type EventResourceOrderReNewOrderSuccess
- type EventResourceOrderWithdrawLockedOrderPriceSuccess
- type LinkClient
- func (c *LinkClient) AddResourceDuration(index uint64, duration int) error
- func (c *LinkClient) CalculateInstanceOverdue(agreementIndex uint64) time.Duration
- func (c *LinkClient) ChangeResourceStatus(index uint64) error
- func (c *LinkClient) Heartbeat(agreementindex uint64) error
- func (c *LinkClient) Heatbeat(agreementindex uint64) error
- func (c *LinkClient) LoadKeyFromChain() ([]string, error)
- func (c *LinkClient) LoadRegistryInfoFromChain() (*ResourceInfo, error)
- func (c *LinkClient) ModifyResourcePrice(index uint64, unitPrice int64) error
- func (c *LinkClient) OrderExec(orderIndex uint64) error
- func (c *LinkClient) RegisterResource(r ResourceInfo) error
- func (c *LinkClient) RemoveResource(index uint64) error
- type MarketIncome
- type MyEventRecords
- type OrderStatus
- type RentalAgreement
- type ReportClient
- type ResourceInfo
- type StakingAmount
- type Status
Constants ¶
This section is empty.
Variables ¶
View Source
var TypeMap = map[string]reflect.Type{ "u8": reflect.TypeOf(types.U8(0)), "u16": reflect.TypeOf(types.U16(0)), "u32": reflect.TypeOf(types.U32(0)), "u64": reflect.TypeOf(types.U64(0)), "u128": reflect.TypeOf(types.U128{}), "u256": reflect.TypeOf(types.U256{}), "i8": reflect.TypeOf(types.I8(0)), "i16": reflect.TypeOf(types.I16(0)), "i32": reflect.TypeOf(types.I32(0)), "i64": reflect.TypeOf(types.I64(0)), "i128": reflect.TypeOf(types.I128{}), "i256": reflect.TypeOf(types.I256{}), "bool": reflect.TypeOf(types.Bool(false)), "text": reflect.TypeOf(types.Text("")), "hash": reflect.TypeOf(types.Hash{}), "address": reflect.TypeOf(types.Address{}), "AccountId": reflect.TypeOf(types.AccountID{}), "BalanceOf<T>": reflect.TypeOf(types.U128{}), }
Functions ¶
func DecodeEventRecordsWithIgnoreError ¶ added in v1.2.0
func DecodeEventRecordsWithIgnoreError(e types.EventRecordsRaw, m *types.Metadata, t interface{}) error
Types ¶
type AccountInfo ¶ added in v1.1.0
type AccountInfoCustom ¶ added in v1.1.0
type ChainClient ¶
type ChainClient struct {
// contains filtered or unexported fields
}
ChainClient blockchain chain connection
func NewChainClient ¶
func NewChainClient(cm *config.ConfigManager, api *gsrpc.SubstrateAPI) (*ChainClient, error)
func (*ChainClient) AddResourceDuration ¶
func (cc *ChainClient) AddResourceDuration(index uint64, duration int) error
func (*ChainClient) CalculateInstanceOverdue ¶
func (cc *ChainClient) CalculateInstanceOverdue(orderIndex uint64) time.Duration
func (*ChainClient) CalculateProviderOverdue ¶
func (cc *ChainClient) CalculateProviderOverdue(agreementIndex uint64) time.Duration
calculate instance expiration time
func (*ChainClient) CalculateResourceOverdue ¶ added in v1.1.0
func (cc *ChainClient) CalculateResourceOverdue(expireBlock uint64) (time.Duration, error)
func (*ChainClient) ChangeResourceStatus ¶
func (cc *ChainClient) ChangeResourceStatus(index uint64) error
func (*ChainClient) CheckExtrinsicSuccess ¶
func (cc *ChainClient) CheckExtrinsicSuccess(header *types.Header, call string) error
CheckExtrinsicSuccess verify that the transaction is successful
func (*ChainClient) GetAccountInfo ¶ added in v1.1.0
func (cc *ChainClient) GetAccountInfo() (*AccountInfo, error)
func (*ChainClient) GetAgreementIndex ¶ added in v1.1.0
func (cc *ChainClient) GetAgreementIndex(orderIndex uint64) (uint64, error)
func (*ChainClient) GetEvent ¶
func (cc *ChainClient) GetEvent(blockNumber uint64) (*MyEventRecords, error)
func (*ChainClient) GetGatewayNodes ¶ added in v1.1.0
func (cc *ChainClient) GetGatewayNodes() ([]string, error)
func (*ChainClient) GetMarketStackInfo ¶ added in v1.3.0
func (cc *ChainClient) GetMarketStackInfo() (*StakingAmount, error)
func (*ChainClient) GetOrder ¶
func (cc *ChainClient) GetOrder(orderIndex uint64) (*ComputingOrder, error)
func (*ChainClient) GetResource ¶
func (cc *ChainClient) GetResource(resourceIndex uint64) (*ComputingResource, error)
func (*ChainClient) GetReward ¶ added in v1.3.0
func (cc *ChainClient) GetReward() (*MarketIncome, error)
func (*ChainClient) GetStakingInfo ¶ added in v1.1.0
func (cc *ChainClient) GetStakingInfo() (*StakingAmount, error)
func (*ChainClient) Heartbeat ¶
func (cc *ChainClient) Heartbeat(agreementindex uint64) error
func (*ChainClient) LoadKeyFromChain ¶
func (cc *ChainClient) LoadKeyFromChain() ([]string, error)
LoadKeyFromChain Get the public Yue of the current node from the chain
func (*ChainClient) ModifyResourcePrice ¶
func (cc *ChainClient) ModifyResourcePrice(index uint64, unitPrice int64) error
func (*ChainClient) OrderExec ¶
func (cc *ChainClient) OrderExec(orderIndex uint64) error
OrderExec order execution
func (*ChainClient) PayoutReward ¶ added in v1.3.0
func (cc *ChainClient) PayoutReward() error
func (*ChainClient) ProcessApplyFreeResource ¶ added in v1.2.0
func (cc *ChainClient) ProcessApplyFreeResource(index uint64, peerId string) error
func (*ChainClient) ReceiveIncome ¶ added in v1.1.0
func (cc *ChainClient) ReceiveIncome() error
func (*ChainClient) ReceiveIncomeJudge ¶ added in v1.1.0
func (cc *ChainClient) ReceiveIncomeJudge() bool
func (*ChainClient) RegisterResource ¶
func (cc *ChainClient) RegisterResource(r ResourceInfo) error
Register chain
func (*ChainClient) ReleaseApplyFreeResource ¶ added in v1.2.0
func (cc *ChainClient) ReleaseApplyFreeResource(index uint64) error
func (*ChainClient) RemoveResource ¶
func (cc *ChainClient) RemoveResource(index uint64) error
func (*ChainClient) ReportStatus ¶
func (cc *ChainClient) ReportStatus() error
ReportStatus Timing the virtual machine to report the service status
func (*ChainClient) StakingAmount ¶ added in v1.1.0
func (cc *ChainClient) StakingAmount(unitPrice int64) error
func (*ChainClient) WithdrawStakingAmount ¶ added in v1.1.0
func (cc *ChainClient) WithdrawStakingAmount(unitPrice int64) error
type ComputingOrder ¶
type ComputingResource ¶
type ComputingResource struct { Index types.U64 `json:"index"` AccountId types.AccountID `json:"accountId"` PeerId types.Text `json:"peerId"` Config struct { Cpu types.U64 `json:"cpu"` Memory types.U64 `json:"memory"` System types.Text `json:"system"` CpuModel types.Text `json:"cpuModel"` } `json:"config"` RentalStatistics struct { RentalCount types.U32 `json:"rentalCount"` RentalDuration types.U32 `json:"rentalDuration"` FaultCount types.U32 `json:"faultCount"` FaultDuration types.U32 `json:"faultDuration"` } `json:"rentalStatistics"` RentalInfo struct { RentPrice types.U128 `json:"rentPrice"` RentDuration types.U32 `json:"rentDuration"` EndOfRent types.U32 `json:"endOfRent"` } `json:"rentalInfo"` Status Status `json:"status"` }
type EventBalancesWithdraw ¶ added in v1.3.3
type EventMarketMoney ¶ added in v1.2.0
type LinkClient ¶
func (*LinkClient) AddResourceDuration ¶
func (c *LinkClient) AddResourceDuration(index uint64, duration int) error
func (*LinkClient) CalculateInstanceOverdue ¶
func (c *LinkClient) CalculateInstanceOverdue(agreementIndex uint64) time.Duration
func (*LinkClient) ChangeResourceStatus ¶
func (c *LinkClient) ChangeResourceStatus(index uint64) error
func (*LinkClient) Heartbeat ¶
func (c *LinkClient) Heartbeat(agreementindex uint64) error
func (*LinkClient) Heatbeat ¶
func (c *LinkClient) Heatbeat(agreementindex uint64) error
Heatbeat ReportStatus Timing the virtual machine to report the service status
func (*LinkClient) LoadKeyFromChain ¶
func (c *LinkClient) LoadKeyFromChain() ([]string, error)
LoadKeyFromChain Get the public Yue of the current node from the chain
func (*LinkClient) LoadRegistryInfoFromChain ¶
func (c *LinkClient) LoadRegistryInfoFromChain() (*ResourceInfo, error)
LoadRegistryInfoFromChain load registration information from the chain
func (*LinkClient) ModifyResourcePrice ¶
func (c *LinkClient) ModifyResourcePrice(index uint64, unitPrice int64) error
func (*LinkClient) OrderExec ¶
func (c *LinkClient) OrderExec(orderIndex uint64) error
func (*LinkClient) RegisterResource ¶
func (c *LinkClient) RegisterResource(r ResourceInfo) error
RegisterResource Register chain
func (*LinkClient) RemoveResource ¶
func (c *LinkClient) RemoveResource(index uint64) error
type MarketIncome ¶ added in v1.3.0
type MyEventRecords ¶
type MyEventRecords struct { types.EventRecords Provider_RegisterResourceSuccess []EventProviderRegisterResourceSuccess //nolint:stylecheck,golint ResourceOrder_CreateOrderSuccess []EventResourceOrderCreateOrderSuccess //nolint:stylecheck,golint ResourceOrder_OrderExecSuccess []EventResourceOrderOrderExecSuccess ResourceOrder_ReNewOrderSuccess []EventResourceOrderReNewOrderSuccess ResourceOrder_WithdrawLockedOrderPriceSuccess []EventResourceOrderWithdrawLockedOrderPriceSuccess Balances_Withdraw []EventBalancesWithdraw }
type OrderStatus ¶ added in v1.1.0
type RentalAgreement ¶
type RentalAgreement struct { Index types.U64 Provider types.AccountID TenantInfo struct { AccountId types.AccountID PublicKey string } PeerId string ResourceIndex types.U64 Config struct { Cpu types.U64 Memory types.U64 System string CpuModel string } RentalInfo struct { RentUnitPrice types.U128 RentDuration types.U32 EndOfRent types.U32 } Price types.U128 LockPrice types.U128 PenaltyAmount types.U128 ReceiveAmount types.U128 Start types.U32 End types.U32 Calculation types.U32 }
type ReportClient ¶
type ReportClient interface { // RegisterResource resource registration RegisterResource(ResourceInfo) error // RemoveResource resource deletion RemoveResource(index uint64) error // ModifyResourcePrice modify resource unit price ModifyResourcePrice(index uint64, unitPrice int64) error // ChangeResourceStatus modify resource status to unused ChangeResourceStatus(resourceIndex uint64) error // AddResourceDuration add resource rental time AddResourceDuration(index uint64, duration int) error // Heartbeat protocol heartbeat report Heartbeat(agreementindex uint64) error // OrderExec OrderExec(orderIndex uint64) error LoadKeyFromChain() ([]string, error) CalculateInstanceOverdue(orderIndex uint64) time.Duration GetAgreementIndex(orderIndex uint64) (uint64, error) //GetResource get vm resource GetResource(resourceIndex uint64) (*ComputingResource, error) CalculateResourceOverdue(expireBlock uint64) (time.Duration, error) ReceiveIncome() error GetAccountInfo() (*AccountInfo, error) GetStakingInfo() (*StakingAmount, error) GetMarketStackInfo() (*StakingAmount, error) StakingAmount(unitPrice int64) error WithdrawStakingAmount(unitPrice int64) error ReceiveIncomeJudge() bool GetGatewayNodes() ([]string, error) ProcessApplyFreeResource(index uint64, peerId string) error ReleaseApplyFreeResource(index uint64) error GetReward() (*MarketIncome, error) PayoutReward() error }
ReportClient data reporting interface
type ResourceInfo ¶
type ResourceInfo struct { PeerId string `json:"peerId"` Cpu uint64 `json:"cpu"` Memory uint64 `json:"memory"` System string `json:"system"` Image string `json:"image"` CpuModel string `json:"cpuModel"` VmType string `json:"vmType"` Creator string `json:"creator"` ExpireTime time.Time `json:"expireTime"` User string `json:"user"` Status int `json:"status"` Price uint64 `json:"price"` ResourceIndex uint64 `json:"resource_index"` }
ResourceInfo 资源信息
type StakingAmount ¶ added in v1.1.0
Click to show internal directories.
Click to hide internal directories.