client

package
v0.15.3 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: Apache-2.0 Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestPages added in v0.13.1

func RequestPages(r *http.Response) (uint64, error)

RequestPages returns the pages value from header response

Types

type Client

type Client interface {
	Ping() error
	DBClient
}

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(ctx context.Context, contractID uint32) (types.Contract, error)

Contract returns a single contract based on the contractID

func (*Clientimpl) ContractBills added in v0.11.3

func (g *Clientimpl) ContractBills(ctx context.Context, contractID uint32, limit types.Limit) ([]types.ContractBilling, uint, error)

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

func (*Clientimpl) Contracts

func (g *Clientimpl) Contracts(ctx context.Context, 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) Farms

func (g *Clientimpl) Farms(ctx context.Context, 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(ctx context.Context, nodeID uint32) (node types.NodeWithNestedCapacity, err error)

Node returns the node with the give id

func (*Clientimpl) NodeStatus

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

NodeStatus returns the node status up/down

func (*Clientimpl) Nodes

func (g *Clientimpl) Nodes(ctx context.Context, 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) Stats added in v0.11.5

func (g *Clientimpl) Stats(ctx context.Context, filter types.StatsFilter) (stats types.Stats, err error)

Stats return statistics about the grid

func (*Clientimpl) Twins

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

Twins returns twins with the given filters and pagination parameters

type DBClient added in v0.11.5

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

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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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) Farms

func (g *RetryingClient) Farms(ctx context.Context, 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(ctx context.Context, nodeID uint32) (res types.NodeWithNestedCapacity, err error)

Node returns the node with the give id

func (*RetryingClient) NodeStatus

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

Node returns the node with the give id

func (*RetryingClient) Nodes

func (g *RetryingClient) Nodes(ctx context.Context, 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) Stats added in v0.11.5

func (g *RetryingClient) Stats(ctx context.Context, filter types.StatsFilter) (res types.Stats, err error)

Stats returns statistics about the grid

func (*RetryingClient) Twins

func (g *RetryingClient) Twins(ctx context.Context, 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