forward

package
v0.0.0-...-1dd1f65 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package forward describes the JSON-based protocol used to 'forward' messages and errors from a machine node to its invoker, potentially over SSH.

Index

Constants

This section is empty.

Variables

View Source
var ErrRemote = errors.New("remote error")

Functions

This section is empty.

Types

type Forward

type Forward struct {
	// Error carries an error's Error string.
	Error string `json:"error,omitempty"`

	// Build carries information about a corpus build.
	Build *builder.Message `json:"build,omitempty"`

	// Action carries information about a machine-node action.
	Action *observer.Message `json:"action,omitempty"`
}

Forward describes a 'forwarded' message or error.

type Observer

type Observer struct {
	*json.Encoder
}

Observer wraps a JSON encoder, lifting it to an Observer that sends JSON-encoded Forwards.

func NewObserver

func NewObserver(w io.Writer) *Observer

NewObserver creates a forwarding observer over w.

func (*Observer) Error

func (o *Observer) Error(err error)

Error forwards err to this Observer's encoder.

func (*Observer) OnBuild

func (o *Observer) OnBuild(m builder.Message)

OnBuild sends a build message through this Observer's encoder.

func (*Observer) OnMachineNodeAction

func (o *Observer) OnMachineNodeAction(m observer.Message)

OnMachineNodeAction sends an action message through this Observer's encoder.

type Replayer

type Replayer struct {
	// Decoder is the decoder on which we are listening for messages to replay.
	Decoder *json.Decoder

	// Observers is the set of observers to which we are forwarding observations.
	Observers []observer.Observer
}

Replayer coordinates reading forwarded builder-status messages from a JSON decoder and replaying them to an observer.

func (*Replayer) Run

func (r *Replayer) Run(ctx context.Context) error

Run runs the replayer.

Jump to

Keyboard shortcuts

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