types

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 3 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capacity

type Capacity struct {
	CRU uint64         `json:"cru"`
	SRU gridtypes.Unit `json:"sru"`
	HRU gridtypes.Unit `json:"hru"`
	MRU gridtypes.Unit `json:"mru"`
}

Capacity is the resources needed for workload(cpu, memory, SSD disk, HDD disks)

type CapacityResult

type CapacityResult struct {
	Total Capacity `json:"total_resources"`
	Used  Capacity `json:"used_resources"`
}

CapacityResult is the NodeData capacity results to unmarshal json in it

type Contract

type Contract struct {
	ContractID uint        `json:"contract_id"`
	TwinID     uint        `json:"twin_id"`
	State      string      `json:"state"`
	CreatedAt  uint        `json:"created_at"`
	Type       string      `json:"type"`
	Details    interface{} `json:"details"`
}

Contract represents a contract and its details after decoding to one of Details structs.

type ContractBilling

type ContractBilling struct {
	AmountBilled     uint64 `json:"amountBilled"`
	DiscountReceived string `json:"discountReceived"`
	Timestamp        uint64 `json:"timestamp"`
}

ContractBilling is contract billing info

type ContractFilter

type ContractFilter struct {
	ContractID        *uint64
	TwinID            *uint64
	NodeID            *uint64
	Type              *string
	State             *string
	Name              *string
	NumberOfPublicIps *uint64
	DeploymentData    *string
	DeploymentHash    *string
}

ContractFilter contract filters

type Farm

type Farm struct {
	Name              string     `json:"name"`
	FarmID            int        `json:"farmId"`
	TwinID            int        `json:"twinId"`
	PricingPolicyID   int        `json:"pricingPolicyId"`
	CertificationType string     `json:"certificationType"`
	StellarAddress    string     `json:"stellarAddress"`
	Dedicated         bool       `json:"dedicated"`
	PublicIps         []PublicIP `json:"publicIps"`
}

type FarmFilter

type FarmFilter struct {
	FreeIPs           *uint64
	TotalIPs          *uint64
	StellarAddress    *string
	PricingPolicyID   *uint64
	FarmID            *uint64
	TwinID            *uint64
	Name              *string
	NameContains      *string
	CertificationType *string
	Dedicated         *bool
	NodeFreeMRU       *uint64
	NodeFreeHRU       *uint64
	NodeFreeSRU       *uint64
	NodeStatus        *string
	NodeRentedBy      *uint64
	NodeAvailableFor  *uint64
	NodeHasGPU        *bool
	NodeCertified     *bool
	Country           *string
}

FarmFilter farm filters

type Limit

type Limit struct {
	Size      uint64
	Page      uint64
	RetCount  bool
	Randomize bool
}

Limit used for pagination

type Location

type Location struct {
	Country   string   `json:"country"`
	City      string   `json:"city"`
	Longitude *float64 `json:"longitude"`
	Latitude  *float64 `json:"latitude"`
}

type NameContractDetails

type NameContractDetails struct {
	Name string `json:"name"`
}

type Node

type Node struct {
	ID                string       `json:"id"`
	NodeID            int          `json:"nodeId"`
	FarmID            int          `json:"farmId"`
	TwinID            int          `json:"twinId"`
	Country           string       `json:"country"`
	GridVersion       int          `json:"gridVersion"`
	City              string       `json:"city"`
	Uptime            int64        `json:"uptime"`
	Created           int64        `json:"created"`
	FarmingPolicyID   int          `json:"farmingPolicyId"`
	UpdatedAt         int64        `json:"updatedAt"`
	TotalResources    Capacity     `json:"total_resources"`
	UsedResources     Capacity     `json:"used_resources"`
	Location          Location     `json:"location"`
	PublicConfig      PublicConfig `json:"publicConfig"`
	Status            string       `json:"status"` // added node status field for up or down
	CertificationType string       `json:"certificationType"`
	Dedicated         bool         `json:"dedicated"`
	RentContractID    uint         `json:"rentContractId"`
	RentedByTwinID    uint         `json:"rentedByTwinId"`
	SerialNumber      string       `json:"serialNumber"`
	Power             NodePower    `json:"power"`
	NumGPU            int          `json:"num_gpu"`
	ExtraFee          uint64       `json:"extraFee"`
}

Node is a struct holding the data for a Node for the nodes view

type NodeContractDetails

type NodeContractDetails struct {
	NodeID            uint   `json:"nodeId"`
	DeploymentData    string `json:"deployment_data"`
	DeploymentHash    string `json:"deployment_hash"`
	NumberOfPublicIps uint   `json:"number_of_public_ips"`
}

type NodeFilter

type NodeFilter struct {
	Status            *string
	FreeMRU           *uint64
	FreeHRU           *uint64
	FreeSRU           *uint64
	TotalMRU          *uint64
	TotalHRU          *uint64
	TotalSRU          *uint64
	TotalCRU          *uint64
	Country           *string
	CountryContains   *string
	City              *string
	CityContains      *string
	FarmName          *string
	FarmNameContains  *string
	FarmIDs           []uint64
	FreeIPs           *uint64
	IPv4              *bool
	IPv6              *bool
	Domain            *bool
	Dedicated         *bool
	Rentable          *bool
	Rented            *bool
	RentedBy          *uint64
	AvailableFor      *uint64
	NodeID            *uint64
	TwinID            *uint64
	CertificationType *string
	HasGPU            *bool
	GpuDeviceID       *string
	GpuDeviceName     *string
	GpuVendorID       *string
	GpuVendorName     *string
	GpuAvailable      *bool
	OwnedBy           *uint64
}

NodeFilter node filters

type NodeGPU

type NodeGPU struct {
	NodeTwinID uint32 `json:"-"`
	ID         string `json:"id"`
	Vendor     string `json:"vendor"`
	Device     string `json:"device"`
	Contract   int    `json:"contract"`
}

type NodePower

type NodePower struct {
	State  string `json:"state"`
	Target string `json:"target"`
}

NodePower struct is the farmerbot report for node status

type NodeStatistics

type NodeStatistics struct {
	System NodeStatisticsResources `json:"system"`
	Total  NodeStatisticsResources `json:"total"`
	Used   NodeStatisticsResources `json:"used"`
	Users  NodeStatisticsUsers     `json:"users"`
}

type NodeStatisticsResources

type NodeStatisticsResources struct {
	CRU   int `json:"cru"`
	HRU   int `json:"hru"`
	IPV4U int `json:"ipv4u"`
	MRU   int `json:"mru"`
	SRU   int `json:"sru"`
}

type NodeStatisticsUsers

type NodeStatisticsUsers struct {
	Deployments int `json:"deployments"`
	Workloads   int `json:"workloads"`
}

type NodeStatus

type NodeStatus struct {
	Status string `json:"status"`
}

NodeStatus is used for status endpoint to decode json in

func (*NodeStatus) Deserialize

func (n *NodeStatus) Deserialize(data []byte) error

Deserialize is the deserializer for node status struct

func (*NodeStatus) Serialize

func (n *NodeStatus) Serialize() (json.RawMessage, error)

Serialize is the serializer for node status struct

type NodeWithNestedCapacity

type NodeWithNestedCapacity struct {
	ID                string         `json:"id"`
	NodeID            int            `json:"nodeId"`
	FarmID            int            `json:"farmId"`
	TwinID            int            `json:"twinId"`
	Country           string         `json:"country"`
	GridVersion       int            `json:"gridVersion"`
	City              string         `json:"city"`
	Uptime            int64          `json:"uptime"`
	Created           int64          `json:"created"`
	FarmingPolicyID   int            `json:"farmingPolicyId"`
	UpdatedAt         int64          `json:"updatedAt"`
	Capacity          CapacityResult `json:"capacity"`
	Location          Location       `json:"location"`
	PublicConfig      PublicConfig   `json:"publicConfig"`
	Status            string         `json:"status"` // added node status field for up or down
	CertificationType string         `json:"certificationType"`
	Dedicated         bool           `json:"dedicated"`
	RentContractID    uint           `json:"rentContractId"`
	RentedByTwinID    uint           `json:"rentedByTwinId"`
	SerialNumber      string         `json:"serialNumber"`
	Power             NodePower      `json:"power"`
	NumGPU            int            `json:"num_gpu"`
	ExtraFee          uint64         `json:"extraFee"`
}

Node to be compatible with old view

type PublicConfig

type PublicConfig struct {
	Domain string `json:"domain"`
	Gw4    string `json:"gw4"`
	Gw6    string `json:"gw6"`
	Ipv4   string `json:"ipv4"`
	Ipv6   string `json:"ipv6"`
}

PublicConfig node public config

type PublicIP

type PublicIP struct {
	ID         string `json:"id"`
	IP         string `json:"ip"`
	FarmID     string `json:"farm_id"`
	ContractID int    `json:"contract_id"`
	Gateway    string `json:"gateway"`
}

PublicIP info about public ip in the farm

type RawContract added in v0.11.3

type RawContract struct {
	ContractID uint            `json:"contract_id"`
	TwinID     uint            `json:"twin_id"`
	State      string          `json:"state"`
	CreatedAt  uint            `json:"created_at"`
	Type       string          `json:"type"`
	Details    json.RawMessage `json:"details"`
}

RawContract represents a contract and its details in json RawMessage before decoding.

type RentContractDetails

type RentContractDetails struct {
	NodeID uint `json:"nodeId"`
}

type Stats added in v0.11.5

type Stats struct {
	Nodes             int64            `json:"nodes"`
	Farms             int64            `json:"farms"`
	Countries         int64            `json:"countries"`
	TotalCRU          int64            `json:"totalCru"`
	TotalSRU          int64            `json:"totalSru"`
	TotalMRU          int64            `json:"totalMru"`
	TotalHRU          int64            `json:"totalHru"`
	PublicIPs         int64            `json:"publicIps"`
	AccessNodes       int64            `json:"accessNodes"`
	Gateways          int64            `json:"gateways"`
	Twins             int64            `json:"twins"`
	Contracts         int64            `json:"contracts"`
	NodesDistribution map[string]int64 `json:"nodesDistribution" gorm:"-:all"`
	GPUs              int64            `json:"gpus"`
	DedicatedNodes    int64            `json:"dedicatedNodes"`
}

Stats contains aggregate info about the grid

type StatsFilter

type StatsFilter struct {
	Status *string
}

StatsFilter statistics filters

type Twin

type Twin struct {
	TwinID    uint   `json:"twinId"`
	AccountID string `json:"accountId"`
	Relay     string `json:"relay"`
	PublicKey string `json:"publicKey"`
}

type TwinFilter

type TwinFilter struct {
	TwinID    *uint64
	AccountID *string
	Relay     *string
	PublicKey *string
}

TwinFilter twin filters

type Version

type Version struct {
	Version string `json:"version"`
}

Jump to

Keyboard shortcuts

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