client

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2023 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Ping() error
	Nodes(filter types.NodeFilter, pagination types.Limit) (res []types.Node, totalCount int, err error)
	Farms(filter types.FarmFilter, pagination types.Limit) (res []types.Farm, totalCount int, err error)
	Contracts(filter types.ContractFilter, pagination types.Limit) (res []types.Contract, totalCount int, err error)
	Contract(contractID uint32) (types.Contract, error)
	ContractBills(contractID uint32, limit types.Limit) ([]types.ContractBilling, uint, error)
	Twins(filter types.TwinFilter, pagination types.Limit) (res []types.Twin, totalCount int, err error)
	Node(nodeID uint32) (res types.NodeWithNestedCapacity, err error)
	NodeStatus(nodeID uint32) (res types.NodeStatus, err error)
	Counters(filter types.StatsFilter) (res types.Counters, err error)
}

Client a client to communicate with the grid proxy

func NewClient

func NewClient(endpoint string) Client

NewClient grid proxy client constructor

func NewRetryingClient

func NewRetryingClient(cl Client) Client

NewRetryingClient retrying grid proxy client constructor

func NewRetryingClientWithTimeout

func NewRetryingClientWithTimeout(cl Client, timeout time.Duration) Client

NewRetryingClient retrying grid proxy client constructor with a timeout as a parameter

type Clientimpl

type Clientimpl struct {
	// contains filtered or unexported fields
}

Clientimpl concrete implementation of the client to communicate with the grid proxy

func (*Clientimpl) Contract added in v0.11.3

func (g *Clientimpl) Contract(contractID uint32) (res types.Contract, err error)

Contract returns a single contract based on the contractID

func (*Clientimpl) ContractBills added in v0.11.3

func (g *Clientimpl) ContractBills(contractID uint32, limit types.Limit) (res []types.ContractBilling, totalCount uint, err error)

ContractBills returns all bills for a single contract based on contractID and pagination params

func (*Clientimpl) Contracts

func (g *Clientimpl) Contracts(filter types.ContractFilter, limit types.Limit) (contracts []types.Contract, totalCount int, err error)

Contracts returns contracts with the given filters and pagination parameters

func (*Clientimpl) Counters

func (g *Clientimpl) Counters(filter types.StatsFilter) (counters types.Counters, err error)

Counters return statistics about the grid

func (*Clientimpl) Farms

func (g *Clientimpl) Farms(filter types.FarmFilter, limit types.Limit) (farms []types.Farm, totalCount int, err error)

Farms returns farms with the given filters and pagination parameters

func (*Clientimpl) Node

func (g *Clientimpl) Node(nodeID uint32) (node types.NodeWithNestedCapacity, err error)

Node returns the node with the give id

func (*Clientimpl) NodeStatus

func (g *Clientimpl) NodeStatus(nodeID uint32) (status types.NodeStatus, err error)

NodeStatus returns the node status up/down

func (*Clientimpl) Nodes

func (g *Clientimpl) Nodes(filter types.NodeFilter, limit types.Limit) (nodes []types.Node, totalCount int, err error)

Nodes returns nodes with the given filters and pagination parameters

func (*Clientimpl) Ping

func (g *Clientimpl) Ping() error

Ping makes sure the server is up

func (*Clientimpl) Twins

func (g *Clientimpl) Twins(filter types.TwinFilter, limit types.Limit) (twins []types.Twin, totalCount int, err error)

Twins returns twins with the given filters and pagination parameters

type ErrorReply

type ErrorReply struct {
	Error string `json:"error"`
}

type RetryingClient

type RetryingClient struct {
	// contains filtered or unexported fields
}

RetryingClient wraps the given client and does the actions with retrying

func (*RetryingClient) Contract added in v0.11.3

func (g *RetryingClient) Contract(contractID uint32) (res types.Contract, err error)

Contract returns the contract with the give id

func (*RetryingClient) ContractBills added in v0.11.3

func (g *RetryingClient) ContractBills(contractID uint32, limit types.Limit) (res []types.ContractBilling, totalCount uint, err error)

ContractBills returns the contract bills with the give id

func (*RetryingClient) Contracts

func (g *RetryingClient) Contracts(filter types.ContractFilter, pagination types.Limit) (res []types.Contract, totalCount int, err error)

Contracts returns contracts with the given filters and pagination parameters

func (*RetryingClient) Counters

func (g *RetryingClient) Counters(filter types.StatsFilter) (res types.Counters, err error)

Counters returns statistics about the grid

func (*RetryingClient) Farms

func (g *RetryingClient) Farms(filter types.FarmFilter, pagination types.Limit) (res []types.Farm, totalCount int, err error)

Farms returns farms with the given filters and pagination parameters

func (*RetryingClient) Node

func (g *RetryingClient) Node(nodeID uint32) (res types.NodeWithNestedCapacity, err error)

Node returns the node with the give id

func (*RetryingClient) NodeStatus

func (g *RetryingClient) NodeStatus(nodeID uint32) (res types.NodeStatus, err error)

Node returns the node with the give id

func (*RetryingClient) Nodes

func (g *RetryingClient) Nodes(filter types.NodeFilter, pagination types.Limit) (res []types.Node, totalCount int, err error)

Nodes returns nodes with the given filters and pagination parameters

func (*RetryingClient) Ping

func (g *RetryingClient) Ping() error

Ping makes sure the server is up

func (*RetryingClient) Twins

func (g *RetryingClient) Twins(filter types.TwinFilter, pagination types.Limit) (res []types.Twin, totalCount int, err error)

Twins returns twins with the given filters and pagination parameters

Jump to

Keyboard shortcuts

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