framedstdcopy

package
v3.3.3 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: AGPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FramedStdCopy

func FramedStdCopy(dstout, dsterr chan []byte, src io.Reader) (written int64, err error)

FramedStdCopy is a modified version of stdcopy.StdCopy. FramedStdCopy will demultiplex `src` in the same manner as StdCopy, but instead of using io.Writer for outputs, channels are used, since each frame payload may contain its own inner header (notably, timestamps). Frame payloads are not further parsed here, but are passed raw as individual slices through the output channel.

FramedStdCopy will read until it hits EOF on `src`. It will then return a nil error. In other words: if `err` is non nil, it indicates a real underlying error.

`written` will hold the total number of bytes written to `dstout` and `dsterr`.

func NoHeaderFramedStdCopy

func NoHeaderFramedStdCopy(dstout chan []byte, src io.Reader) (written int64, err error)

Specialized version of FramedStdCopy for when frames have no headers. This will happen for output from a container that has TTY set. In theory this makes it impossible to find the frame boundaries, which also does not matter if timestamps were not requested, but if they were requested, they will still be there at the start of every frame, which might be mid-line. In practice we can find most boundaries by looking for newlines, since these result in a new frame. Otherwise we rely on using the same max frame size as used in practice by docker.

Types

This section is empty.

Jump to

Keyboard shortcuts

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