Documentation
¶
Index ¶
- Constants
- Variables
- func GetIdentityWithKeyType(mnemonicOrSeed, keyType string) (identity substrate.Identity, err error)
- type Config
- type FarmerBot
- type NodeFilterOption
- type NodeReport
- type ProxyClient
- type RMB
- type RMBNodeClient
- func (r *RMBNodeClient) GetStoragePools(ctx context.Context, nodeTwin uint32) (pools []pkg.PoolMetrics, err error)
- func (r *RMBNodeClient) ListGPUs(ctx context.Context, nodeTwin uint32) (gpus []pkg.GPU, err error)
- func (r *RMBNodeClient) Statistics(ctx context.Context, nodeTwin uint32) (stats pkg.Counters, err error)
- type Substrate
- type ThresholdPercentages
Constants ¶
View Source
const ( MainNetwork string = "main" TestNetwork string = "test" DevNetwork string = "dev" QaNetwork string = "qa" )
Variables ¶
View Source
var SubstrateURLs = map[string][]string{ TestNetwork: {"wss://tfchain.test.grid.tf/ws", "wss://tfchain.test.grid.tf:443"}, MainNetwork: {"wss://tfchain.grid.tf/ws", "wss://tfchain.grid.tf:443"}, DevNetwork: {"wss://tfchain.dev.grid.tf/ws", "wss://tfchain.dev.grid.tf:443"}, QaNetwork: {"wss://tfchain.qa.grid.tf/ws", "wss://tfchain.qa.grid.tf:443"}, }
SubstrateURLs for substrate urls
Functions ¶
Types ¶
type Config ¶
type Config struct {
FarmID uint32 `yaml:"farm_id"`
IncludedNodes []uint32 `yaml:"included_nodes"`
ExcludedNodes []uint32 `yaml:"excluded_nodes"`
PriorityNodes []uint32 `yaml:"priority_nodes"`
NeverShutDownNodes []uint32 `yaml:"never_shutdown_nodes"`
Power power `yaml:"power"`
ContinueOnPoweringOnErr bool
}
Config is the inputs for configuration for farmerbot
type FarmerBot ¶
type FarmerBot struct {
// contains filtered or unexported fields
}
FarmerBot for managing farms
type NodeFilterOption ¶
type NodeFilterOption struct {
NodesExcluded []uint32 `json:"nodes_excluded,omitempty"`
NumGPU uint8 `json:"num_gpu,omitempty"`
GPUVendors []string `json:"gpu_vendors,omitempty"`
GPUDevices []string `json:"gpu_devices,omitempty"`
GPUVram uint64 `json:"gpu_vram,omitempty"`
Certified bool `json:"certified,omitempty"`
Dedicated bool `json:"dedicated,omitempty"`
PublicConfig bool `json:"public_config,omitempty"`
PublicIPs uint64 `json:"public_ips,omitempty"`
HRU uint64 `json:"hru,omitempty"` // in GB
SRU uint64 `json:"sru,omitempty"` // in GB
CRU uint64 `json:"cru,omitempty"`
MRU uint64 `json:"mru,omitempty"` // in GB
}
NodeFilterOption represents the options to find a node
type NodeReport ¶
type NodeReport struct {
ID uint32 `json:"id"`
State string `json:"state"`
HasActiveRentContract bool `json:"rented"`
HasActiveContracts bool `json:"has_active_contracts"`
Dedicated bool `json:"dedicated"`
PublicConfig bool `json:"public_config"`
CRUUsagePercentage uint8 `json:"cru_usage_percentage"`
SRUUsagePercentage uint8 `json:"sru_usage_percentage"`
MRUUsagePercentage uint8 `json:"mru_usage_percentage"`
HRUUsagePercentage uint8 `json:"hru_usage_percentage"`
TimesRandomWakeUps int `json:"random_wakeups"`
SincePowerStateChanged time.Duration `json:"since_power_state_changed"`
SinceLastTimeAwake time.Duration `json:"since_last_time_awake"`
LastTimePeriodicWakeUp time.Time `json:"last_time_periodic_wakeup"`
UntilClaimedResourcesTimeout time.Duration `json:"until_claimed_resources_timeout"`
}
NodeReport is a report for some node info
type ProxyClient ¶
type ProxyClient interface {
Node(ctx context.Context, nodeID uint32) (res types.NodeWithNestedCapacity, err error)
}
Substrate is substrate client interface
type RMB ¶
type RMB interface {
Statistics(ctx context.Context, nodeTwin uint32) (stats pkg.Counters, err error)
GetStoragePools(ctx context.Context, nodeTwin uint32) (pools []pkg.PoolMetrics, err error)
ListGPUs(ctx context.Context, nodeTwin uint32) (gpus []pkg.GPU, err error)
}
RMB is an rmb abstract client interface.
type RMBNodeClient ¶
type RMBNodeClient struct {
// contains filtered or unexported fields
}
func NewRmbNodeClient ¶
func NewRmbNodeClient(rmb rmb.Client) *RMBNodeClient
func (*RMBNodeClient) GetStoragePools ¶
func (r *RMBNodeClient) GetStoragePools(ctx context.Context, nodeTwin uint32) (pools []pkg.PoolMetrics, err error)
GetStoragePools executes zos system version cmd
func (*RMBNodeClient) Statistics ¶
func (r *RMBNodeClient) Statistics(ctx context.Context, nodeTwin uint32) (stats pkg.Counters, err error)
Statistics returns some node statistics. Including total and available cpu, memory, storage, etc...
type Substrate ¶
type Substrate interface {
SetNodePowerTarget(identity substrate.Identity, nodeID uint32, up bool) (hash types.Hash, err error)
GetPowerTarget(nodeID uint32) (power substrate.NodePower, err error)
GetNodeRentContract(nodeID uint32) (uint64, error)
GetNodeContracts(nodeID uint32) ([]types.U64, error)
GetNode(nodeID uint32) (*substrate.Node, error)
GetFarm(id uint32) (*substrate.Farm, error)
GetNodes(farmID uint32) ([]uint32, error)
GetDedicatedNodePrice(nodeID uint32) (uint64, error)
GetTwinByPubKey(publicKey []byte) (uint32, error)
}
Substrate is substrate client interface
Click to show internal directories.
Click to hide internal directories.