output

package
v1.7.5 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MultiWriter added in v1.7.0

func MultiWriter(writers ...io.Writer) io.Writer

MultiWriter creates a writer that duplicates its writes to all the provided writers, similar to the Unix tee(1) command.

Each write is written to each listed writer, one at a time. If a listed writer returns an error, that overall write operation stops and returns the error; it does not continue down the list.

func NewCockpitOutputWriter added in v1.6.4

func NewCockpitOutputWriter(t *task.Task, w io.Writer, close chan bool) *cockpitOutputDecorator

func NewPrefixedOutputWriter added in v1.6.4

func NewPrefixedOutputWriter(t *task.Task, w io.Writer) *prefixedOutputDecorator

Types

type DecoratedOutputWriter

type DecoratedOutputWriter interface {
	io.Writer // *SafeWriter
	WriteHeader() error
	WriteFooter() error
}

DecoratedOutputWriter is a decorator for task output. It extends io.Writer with methods to write header before output starts and footer after execution completes

type OutputEnum added in v1.6.4

type OutputEnum string
const (
	RawOutput      OutputEnum = "raw"
	CockpitOutput  OutputEnum = "cockpit"
	PrefixedOutput OutputEnum = "prefixed"
)

type SafeWriter added in v1.6.4

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

SafeWriter is a go routine safe implementation of any io.Writer.

Outside of os.File no other writer is concurrency safe,

bytes.Buffer, and so on will need a concurrency lock on writes, and reads

func NewSafeWriter added in v1.6.4

func NewSafeWriter(writerImpl io.Writer) *SafeWriter

NewSafeWriter initiates a new concurrency safe writer

func (*SafeWriter) Len added in v1.6.4

func (tw *SafeWriter) Len() int

Len returns the currently written bytes length Currently only used in tests

func (*SafeWriter) String added in v1.6.4

func (tw *SafeWriter) String() string

String returns the stringified version of bytes written Currently only used in tests

func (*SafeWriter) Write added in v1.6.4

func (tw *SafeWriter) Write(p []byte) (n int, err error)

type TaskOutput

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

TaskOutput connects given task with requested decorator

func NewTaskOutput

func NewTaskOutput(t *task.Task, format string, stdout, stderr io.Writer) (*TaskOutput, error)

NewTaskOutput creates new TaskOutput instance for given task.

func (*TaskOutput) Close added in v1.6.4

func (t *TaskOutput) Close()

Close releases resources and closes underlying decorators

func (TaskOutput) Finish

func (o TaskOutput) Finish() error

Finish should be called after task completes

func (TaskOutput) Start

func (o TaskOutput) Start() error

Start should be called before task's output starts

func (*TaskOutput) Stderr

func (o *TaskOutput) Stderr() io.Writer

Stderr returns io.Writer that can be used for Job's STDERR

func (*TaskOutput) Stdout

func (o *TaskOutput) Stdout() io.Writer

Stdout returns io.Writer that can be used for Job's STDOUT

func (*TaskOutput) WithCloseCh added in v1.6.4

func (t *TaskOutput) WithCloseCh(closeCh chan bool) *TaskOutput

Jump to

Keyboard shortcuts

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