api

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2016 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockingDriver

type BlockingDriver struct{}

BlockingDriver executes requests one-at-a-time

func (BlockingDriver) Run

func (bd BlockingDriver) Run(request *ExecRequest) (ExecResult, error)

type Decoder

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

Decoder reads data via protocol.Reader, gob decodes the payload, and returns the result

func WrapDecoder

func WrapDecoder(r io.Reader) Decoder

WrapDecoder configures a Decoder and Reader instance around a base io.Reader

func (Decoder) DecodeRequest

func (d Decoder) DecodeRequest(request *ExecRequest) error

DecodeRequest reads and decodes ExecRequests

func (Decoder) DecodeResult

func (d Decoder) DecodeResult(result *ExecResult) error

DecodeResult reads and decodes ExecResults

type Driver

type Driver interface {
	Run(*ExecRequest) (ExecResult, error)
}

Driver is the command execution interface

type Encoder

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

Encoder takes arbitrary Go data, gob encodes it, and uses protocol.Writer to write the resulting data

func WrapEncoder

func WrapEncoder(w io.Writer) Encoder

Encoder configures an Encoder and Writer instance around a base io.Writer

func (Encoder) EncodeRequest

func (e Encoder) EncodeRequest(request *ExecRequest) error

EncodeRequest encodes ExecRequests and writes them to the underlying transport via protocol.Writer

func (Encoder) EncodeResult

func (e Encoder) EncodeResult(result *ExecResult) error

EncodeResult encodes ExecResults and writes them to the underlying transport via protcol.Writer

type ExecRequest

type ExecRequest struct {
	Die        bool
	Executable string
	Env        map[string]string
	Stdin      []byte
}

func NewExecRequest

func NewExecRequest() *ExecRequest

func (*ExecRequest) ToExecCommand

func (er *ExecRequest) ToExecCommand() exec.Cmd

ToExecCommand builds a Go os/exec.Cmd from a source ExecRequest

type ExecResult

type ExecResult struct {
	Stdout  []byte
	Stderr  []byte
	Success bool
	Elapsed time.Duration
}

Jump to

Keyboard shortcuts

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