types

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 5 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" sort:"contract_id"`
	TwinID     uint        `json:"twin_id" sort:"twin_id"`
	State      string      `json:"state" sort:"state"`
	CreatedAt  uint        `json:"created_at" sort:"created_at"`
	Type       string      `json:"type" sort:"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 ContractDetails added in v0.11.8

type ContractDetails interface {
	RentContractDetails | NameContractDetails | NodeContractDetails
}

ContractDetails represent details for all contract types

type ContractFilter

type ContractFilter struct {
	ContractID        *uint64 `schema:"contract_id,omitempty"`
	TwinID            *uint64 `schema:"twin_id,omitempty"`
	NodeID            *uint64 `schema:"node_id,omitempty"`
	Type              *string `schema:"type,omitempty"`
	State             *string `schema:"state,omitempty"`
	Name              *string `schema:"name,omitempty"`
	NumberOfPublicIps *uint64 `schema:"number_of_public_ips,omitempty"`
	DeploymentData    *string `schema:"deployment_data,omitempty"`
	DeploymentHash    *string `schema:"deployment_hash,omitempty"`
}

ContractFilter contract filters

type Farm

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

Farm info about the farm

type FarmFilter

type FarmFilter struct {
	FreeIPs           *uint64 `schema:"free_ips,omitempty"`
	TotalIPs          *uint64 `schema:"total_ips,omitempty"`
	StellarAddress    *string `schema:"stellar_address,omitempty"`
	PricingPolicyID   *uint64 `schema:"pricing_policy_id,omitempty"`
	FarmID            *uint64 `schema:"farm_id,omitempty"`
	TwinID            *uint64 `schema:"twin_id,omitempty"`
	Name              *string `schema:"name,omitempty"`
	NameContains      *string `schema:"name_contains,omitempty"`
	CertificationType *string `schema:"certification_type,omitempty"`
	Dedicated         *bool   `schema:"dedicated,omitempty"`
	NodeFreeMRU       *uint64 `schema:"node_free_mru,omitempty"`
	NodeFreeHRU       *uint64 `schema:"node_free_hru,omitempty"`
	NodeFreeSRU       *uint64 `schema:"node_free_sru,omitempty"`
	NodeTotalCRU      *uint64 `schema:"node_total_cru,omitempty"`
	NodeStatus        *string `schema:"node_status,omitempty"`
	NodeRentedBy      *uint64 `schema:"node_rented_by,omitempty"`
	NodeAvailableFor  *uint64 `schema:"node_available_for,omitempty"`
	NodeHasGPU        *bool   `schema:"node_has_gpu,omitempty"`
	NodeCertified     *bool   `schema:"node_certified,omitempty"`
	Country           *string `schema:"country,omitempty"`
	Region            *string `schema:"region,omitempty"`
}

FarmFilter farm filters

type HealthReport added in v0.13.5

type HealthReport struct {
	NodeTwinId uint32
	Healthy    bool
}

HeathReport holds the info of node health

type Limit

type Limit struct {
	Size      uint64    `schema:"size,omitempty"`
	Page      uint64    `schema:"page,omitempty"`
	RetCount  bool      `schema:"ret_count,omitempty"`
	Randomize bool      `schema:"randomize,omitempty"`
	SortBy    SortBy    `schema:"sort_by,omitempty"`
	SortOrder SortOrder `schema:"sort_order,omitempty"`
}

Limit used for pagination

func DefaultLimit added in v0.11.8

func DefaultLimit() Limit

DefaultLimit returns the default values for the pagination

func (*Limit) Valid added in v0.11.8

func (l *Limit) Valid(typ interface{}) error

Valid validates the sorting values

type Location

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

Location represent the geographic info about the node

type NameContractDetails

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

NameContractDetails name contract details

type Node

type Node struct {
	ID                string       `json:"id"`
	NodeID            int          `json:"nodeId" sort:"node_id"`
	FarmID            int          `json:"farmId" sort:"farm_id"`
	FarmName          string       `json:"farmName"`
	TwinID            int          `json:"twinId" sort:"twin_id"`
	Country           string       `json:"country" sort:"country"`
	GridVersion       int          `json:"gridVersion"`
	City              string       `json:"city" sort:"city"`
	Uptime            int64        `json:"uptime" sort:"uptime"`
	Created           int64        `json:"created" sort:"created"`
	FarmingPolicyID   int          `json:"farmingPolicyId"`
	UpdatedAt         int64        `json:"updatedAt" sort:"updated_at"`
	TotalResources    Capacity     `json:"total_resources" sort:"total_"`
	UsedResources     Capacity     `json:"used_resources" sort:"used_"`
	Location          Location     `json:"location"`
	PublicConfig      PublicConfig `json:"publicConfig"`
	Status            string       `json:"status" sort:"status"`
	CertificationType string       `json:"certificationType"`
	Dedicated         bool         `json:"dedicated"`
	InDedicatedFarm   bool         `json:"inDedicatedFarm" sort:"dedicated_farm"`
	RentContractID    uint         `json:"rentContractId" sort:"rent_contract_id"`
	RentedByTwinID    uint         `json:"rentedByTwinId"`
	SerialNumber      string       `json:"serialNumber"`
	Power             NodePower    `json:"power"`
	NumGPU            int          `json:"num_gpu" sort:"num_gpu"`
	ExtraFee          uint64       `json:"extraFee" sort:"extra_fee"`
	Healthy           bool         `json:"healthy"`
}

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"`
}

NodeContractDetails node contract details

type NodeFilter

type NodeFilter struct {
	Status            *string  `schema:"status,omitempty"`
	FreeMRU           *uint64  `schema:"free_mru,omitempty"`
	FreeHRU           *uint64  `schema:"free_hru,omitempty"`
	FreeSRU           *uint64  `schema:"free_sru,omitempty"`
	TotalMRU          *uint64  `schema:"total_mru,omitempty"`
	TotalHRU          *uint64  `schema:"total_hru,omitempty"`
	TotalSRU          *uint64  `schema:"total_sru,omitempty"`
	TotalCRU          *uint64  `schema:"total_cru,omitempty"`
	Country           *string  `schema:"country,omitempty"`
	CountryContains   *string  `schema:"country_contains,omitempty"`
	City              *string  `schema:"city,omitempty"`
	CityContains      *string  `schema:"city_contains,omitempty"`
	Region            *string  `schema:"region,omitempty"`
	FarmName          *string  `schema:"farm_name,omitempty"`
	FarmNameContains  *string  `schema:"farm_name_contains,omitempty"`
	FarmIDs           []uint64 `schema:"farm_ids,omitempty"`
	FreeIPs           *uint64  `schema:"free_ips,omitempty"`
	IPv4              *bool    `schema:"ipv4,omitempty"`
	IPv6              *bool    `schema:"ipv6,omitempty"`
	Domain            *bool    `schema:"domain,omitempty"`
	Dedicated         *bool    `schema:"dedicated,omitempty"`
	InDedicatedFarm   *bool    `schema:"in_dedicated_farm,omitempty"`
	Rentable          *bool    `schema:"rentable,omitempty"`
	OwnedBy           *uint64  `schema:"owned_by,omitempty"`
	Rented            *bool    `schema:"rented,omitempty"`
	RentedBy          *uint64  `schema:"rented_by,omitempty"`
	AvailableFor      *uint64  `schema:"available_for,omitempty"`
	NodeID            *uint64  `schema:"node_id,omitempty"`
	TwinID            *uint64  `schema:"twin_id,omitempty"`
	CertificationType *string  `schema:"certification_type,omitempty"`
	HasGPU            *bool    `schema:"has_gpu,omitempty"`
	GpuDeviceID       *string  `schema:"gpu_device_id,omitempty"`
	GpuDeviceName     *string  `schema:"gpu_device_name,omitempty"`
	GpuVendorID       *string  `schema:"gpu_vendor_id,omitempty"`
	GpuVendorName     *string  `schema:"gpu_vendor_name,omitempty"`
	GpuAvailable      *bool    `schema:"gpu_available,omitempty"`
	Healthy           *bool    `schema:"healthy,omitempty"`
	Excluded          []uint64 `schema:"excluded,omitempty"`
}

NodeFilter node filters

type NodeGPU

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

NodeGPU holds the info about gpu card

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"`
}

NodeStatistics node statistics info

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"`
}

NodeStatisticsResources resources returned on node statistics

type NodeStatisticsUsers

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

NodeStatisticsUsers users info returned on node statistics

type NodeStatus

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

NodeStatus is used for status endpoint to decode json in

type NodeWithNestedCapacity

type NodeWithNestedCapacity struct {
	ID                string         `json:"id"`
	NodeID            int            `json:"nodeId"`
	FarmID            int            `json:"farmId"`
	FarmName          string         `json:"farmName"`
	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"`
	InDedicatedFarm   bool           `json:"inDedicatedFarm"`
	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"`
	Healthy           bool           `json:"healthy"`
}

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"`
}

RentContractDetails rent contract details

type SortBy added in v0.11.8

type SortBy string

SortBy is the sorted by filed

type SortOrder added in v0.11.8

type SortOrder string

SortOrder is the direction of sorting

const (
	SortOrderAsc  SortOrder = "ASC"
	SortOrderDesc SortOrder = "DESC"
)

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 `schema:"status,omitempty"`
}

StatsFilter statistics filters

type Twin

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

Twin is the twin info

type TwinFilter

type TwinFilter struct {
	TwinID    *uint64 `schema:"twin_id,omitempty"`
	AccountID *string `schema:"account_id,omitempty"`
	Relay     *string `schema:"relay,omitempty"`
	PublicKey *string `schema:"public_key,omitempty"`
}

TwinFilter twin filters

type Version

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

Version represent the deployed version of gridproxy

Jump to

Keyboard shortcuts

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