Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- func (t *Client) Close() error
- func (t *Client) Done(c context.Context, id string, state State) error
- func (t *Client) Extend(c context.Context, id string) error
- func (t *Client) Init(c context.Context, id string, state State) error
- func (t *Client) Log(c context.Context, id string, line *Line) error
- func (t *Client) Next(c context.Context, f Filter) (*Pipeline, error)
- func (t *Client) Update(c context.Context, id string, state State) error
- func (t *Client) Upload(c context.Context, id string, file *File) error
- func (t *Client) Wait(c context.Context, id string) error
- type File
- type Filter
- type Health
- type Line
- type LineWriter
- type Option
- type Peer
- type Pipeline
- type Server
- type State
Constants ¶
const ( LineStdout int = iota LineStderr LineExitCode LineMetadata LineProgress )
Identifies the type of line in the logs.
Variables ¶
var NoFilter = Filter{}
NoFilter is an empty filter.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client represents an rpc client.
type File ¶
type File struct { Name string `json:"name"` Proc string `json:"proc"` Mime string `json:"mime"` Time int64 `json:"time"` Size int `json:"size"` Data []byte `json:"data"` Meta map[string]string `json:"meta"` }
File defines a pipeline artifact.
type Health ¶
type Health interface { // Check returns if server is healthy or not Check(c context.Context) (bool, error) }
Health defines a health-check connection.
func NewGrpcHealthClient ¶
func NewGrpcHealthClient(conn *grpc.ClientConn) Health
NewGrpcHealthClient returns a new grpc Client.
type Line ¶
type Line struct { Proc string `json:"proc,omitempty"` Time int64 `json:"time,omitempty"` Type int `json:"type,omitempty"` Pos int `json:"pos,omityempty"` Out string `json:"out,omitempty"` }
Line is a line of console output.
type LineWriter ¶
type LineWriter struct {
// contains filtered or unexported fields
}
LineWriter sends logs to the client.
func NewLineWriter ¶
func NewLineWriter(peer Peer, id, name string, secret ...string) *LineWriter
NewLineWriter returns a new line reader.
type Option ¶
type Option func(*Client)
Option configures a client option.
func WithBackoff ¶
WithBackoff configures the backoff duration when attempting to re-connect to a server.
func WithHeader ¶
WithHeader configures the client header.
func WithRetryLimit ¶
WithRetryLimit configures the maximum number of retries when connecting to the server.
type Peer ¶
type Peer interface { // Next returns the next pipeline in the queue. Next(c context.Context, f Filter) (*Pipeline, error) // Wait blocks until the pipeline is complete. Wait(c context.Context, id string) error // Init signals the pipeline is initialized. Init(c context.Context, id string, state State) error // Done signals the pipeline is complete. Done(c context.Context, id string, state State) error // Extend extends the pipeline deadline Extend(c context.Context, id string) error // Update updates the pipeline state. Update(c context.Context, id string, state State) error // Upload uploads the pipeline artifact. Upload(c context.Context, id string, file *File) error // Log writes the pipeline log entry. Log(c context.Context, id string, line *Line) error }
Peer defines a peer-to-peer connection.
func NewGrpcClient ¶
func NewGrpcClient(conn *grpc.ClientConn) Peer
NewGrpcClient returns a new grpc Client.
type Pipeline ¶
type Pipeline struct { ID string `json:"id"` Config *backend.Config `json:"config"` Timeout int64 `json:"timeout"` }
Pipeline defines the pipeline execution details.