brokerclient

package
v0.0.0-...-c0b5b33 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the outer handle for the broker HTTP client.

func New

func New(cc Config) *Client

New constructs a new http client from the configuration provided.

func (*Client) Add

func (c *Client) Add(ctx context.Context, p *spinbroker.AddPayload) (string, error)

Add adds a command to the package. The ID here is the package UUID, not the one of the command. The UUID of the newly added command will be returned as a part of this call.

func (*Client) Complete

func (c *Client) Complete(ctx context.Context, uuid string, status bool, reason *string) error

Complete completes a command, with the UUID being that of the command, the status being a pass/fail and the reason provided if the status failed.

func (*Client) Enqueue

func (c *Client) Enqueue(ctx context.Context, uuid string) ([]string, error)

Enqueue enqueues the package in the resource queues.

func (*Client) New

func (c *Client) New(ctx context.Context) (string, error)

New creates a new package.

func (*Client) Next

func (c *Client) Next(ctx context.Context, resource string) (*spinbroker.NextResult, error)

Next returns the next item in the queue by resource. If there are no items, broker.ErrRecordNotFound will be returned.

func (*Client) Status

func (c *Client) Status(ctx context.Context, uuid string) (*spinbroker.StatusResult, error)

Status checks the status of a package by UUID. It returns a StatusResult on a successful fetch, which may contain a failed value. If the status is failed, the StatusReason may have further information.

type Config

type Config struct {
	Host    string
	Timeout int
}

Config is the configuration struct for the HTTP client. Timeout is in seconds. Host should contain a port if not port 80.

Jump to

Keyboard shortcuts

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