rpc

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: Apache-2.0, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chunk

type Chunk struct {
	Type    ChunkType   `json:"t"` // progress or result or error
	Payload interface{} `json:"p,omitempty"`
	Error   *Error      `json:"e,omitempty"`
}

Chunk is a response chunk sent from the Testground daemon to the Testground client. For a given request, clients should expect between 0 to `n` `progress` chunks, and exactly 1 `result` or `error` chunk before EOF.

type ChunkType

type ChunkType rune

ChunkType defines the type of a chunk.

const (
	ChunkTypeProgress ChunkType = 'p'
	ChunkTypeBinary   ChunkType = 'b'
	ChunkTypeResult   ChunkType = 'r'
	ChunkTypeError    ChunkType = 'e'
)

type Error

type Error struct {
	Msg string `json:"m"`
}

type OutputWriter

type OutputWriter struct {
	sync.Mutex
	*zap.SugaredLogger
	// contains filtered or unexported fields
}

func Discard

func Discard() *OutputWriter

func NewFileOutputWriter added in v0.6.0

func NewFileOutputWriter(w io.Writer) *OutputWriter

func NewOutputWriter

func NewOutputWriter(w http.ResponseWriter, r *http.Request) *OutputWriter

func NewStdoutWriter added in v0.6.0

func NewStdoutWriter() *OutputWriter

func (*OutputWriter) BinaryWriter

func (ow *OutputWriter) BinaryWriter() io.Writer

func (*OutputWriter) Flush

func (ow *OutputWriter) Flush()

func (*OutputWriter) InfoWriter

func (ow *OutputWriter) InfoWriter() io.Writer

InfoWriter returns an io.Writer that turns all writes into Info log statements in the underlying logger.

func (*OutputWriter) StdoutWriter

func (ow *OutputWriter) StdoutWriter() io.Writer

StdoutWriter returns an io.Writer that prints all writes into Stdout, and sends them to the client as a progress chunk.

func (*OutputWriter) With

func (ow *OutputWriter) With(args ...interface{}) *OutputWriter

With returns a new OutputWriter, replacing the SugaredLogger with the result from delegating to SugaredLogger.With.

func (*OutputWriter) WriteBinary

func (ow *OutputWriter) WriteBinary(b []byte) (n int, err error)

func (*OutputWriter) WriteError

func (ow *OutputWriter) WriteError(message string, keysAndValues ...interface{})

func (*OutputWriter) WriteProgress

func (ow *OutputWriter) WriteProgress(b []byte) (n int, err error)

func (*OutputWriter) WriteResult

func (ow *OutputWriter) WriteResult(res interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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