nullio

package
v0.0.0-...-43ec871 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLinkTargetPermissionDenied = errors.New("permission denied for reading link target")
)
View Source
var ErrRegexMatching = errors.New("could not match content length")

Functions

This section is empty.

Types

type ContentLengthWriter

type ContentLengthWriter struct {
	Target http.ResponseWriter
	// contains filtered or unexported fields
}

ContentLengthWriter implements io.Writer. It parses the size from the first line as Content Length Header and streams the following data to the Target. The first line is expected to follow the format headerLineRegex.

func (*ContentLengthWriter) SendMonitoringData

func (w *ContentLengthWriter) SendMonitoringData(p *write.Point)

SendMonitoringData will send a monitoring event of the content length read and written.

func (*ContentLengthWriter) Write

func (w *ContentLengthWriter) Write(p []byte) (count int, err error)

type Ls2JsonWriter

type Ls2JsonWriter struct {
	Target io.Writer
	//nolint:containedctx // See #630.
	Ctx context.Context
	// contains filtered or unexported fields
}

Ls2JsonWriter implements io.Writer. It streams the passed data to the Target and transforms the data into the json format.

func (*Ls2JsonWriter) Close

func (w *Ls2JsonWriter) Close() error

func (*Ls2JsonWriter) HasStartedWriting

func (w *Ls2JsonWriter) HasStartedWriting() bool

func (*Ls2JsonWriter) Write

func (w *Ls2JsonWriter) Write(lsData []byte) (int, error)

type ReadWriter

type ReadWriter struct {
	Reader
}

ReadWriter implements io.ReadWriter. It does not return from Read and discards everything on Write.

func (*ReadWriter) Write

func (rw *ReadWriter) Write(p []byte) (int, error)

type Reader

type Reader struct {
	//nolint:containedctx // See #630.
	Ctx context.Context
}

Reader is a struct that implements the io.Reader interface. Read does not return when called until the context is done. It is used to avoid reading anything and returning io.EOF before the context has finished. For example the reader is used by the execution that fetches the stderr stream from Nomad. We do not have a stdin that we want to send to Nomad. But we still have to pass Nomad a reader. Normally readers send an io.EOF as soon as they have nothing more to read. But we want to avoid this, because in that case Nomad will abort (not the execution but) the transmission. Why should the reader not just always return 0, nil? Because Nomad reads in an endless loop and thus a busy waiting is avoided.

func (Reader) Read

func (r Reader) Read(_ []byte) (int, error)

Jump to

Keyboard shortcuts

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