workerclient

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package workerclient provides a way to communicate with a Wharf worker server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArtifactEvent

type ArtifactEvent = v1.StreamArtifactEventsResponse

ArtifactEvent is an alias for workerapi/v1.StreamArtifactEventsResponse.

type ArtifactEventsRequest

type ArtifactEventsRequest = v1.StreamArtifactEventsRequest

ArtifactEventsRequest is an alias for workerapi/v1.StreamArtifactEventsResponse.

type Client

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

Client is a HTTP (gRPC & REST) client that talks to wharf-cmd-worker. A new instance should be created via New to initiate it correctly.

func New

func New(baseURL string, opts Options) (Client, error)

New creates a new client that can communicate with a Wharf worker server.

Implements the Closer interface.

func (*Client) BuildID

func (c *Client) BuildID() uint

BuildID returns the worker's build ID. The value zero means the worker does not have an assigned build ID.

func (*Client) Close

func (c *Client) Close() error

Close will terminate all active connections. Currently only gRPC streams are affected.

func (*Client) DownloadArtifact

func (c *Client) DownloadArtifact(ctx context.Context, artifactID uint) (io.ReadCloser, error)

DownloadArtifact will open a stream to download an artifact BLOB.

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

Ping pongs.

func (*Client) StreamArtifactEvents

func (c *Client) StreamArtifactEvents(ctx context.Context, req *ArtifactEventsRequest, opts ...grpc.CallOption) (v1.Worker_StreamArtifactEventsClient, error)

StreamArtifactEvents returns a stream that will receive status events from the worker.

func (*Client) StreamLogs

func (c *Client) StreamLogs(ctx context.Context, req *LogsRequest, opts ...grpc.CallOption) (v1.Worker_StreamLogsClient, error)

StreamLogs returns a stream that will receive log lines from the worker.

func (*Client) StreamStatusEvents

func (c *Client) StreamStatusEvents(ctx context.Context, req *StatusEventsRequest, opts ...grpc.CallOption) (v1.Worker_StreamStatusEventsClient, error)

StreamStatusEvents returns a stream that will receive status events from the worker.

type LogLine

type LogLine = v1.StreamLogsResponse

LogLine is an alias for workerapi/v1.StreamLogsResponse.

type LogsRequest

type LogsRequest = v1.StreamLogsRequest

LogsRequest is an alias for workerapi/v1.StreamLogsRequest.

type Options

type Options struct {
	// InsecureSkipVerify disables cert verification if set to true.
	//
	// Should NOT be true in a production environment.
	InsecureSkipVerify bool

	// BuildID is the ID of the build from wharf-api.
	BuildID uint
}

Options contains options that can be used in the creation of a new client.

type StatusEvent

type StatusEvent = v1.StreamStatusEventsResponse

StatusEvent is an alias for workerapi/v1.StreamStatusEventsResponse.

type StatusEventsRequest

type StatusEventsRequest = v1.StreamStatusEventsRequest

StatusEventsRequest is an alias for workerapi/v1.StreamStatusEventsRequest.

Jump to

Keyboard shortcuts

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