tail

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package tail provides support for tailing an io.Reader that isn't yet done filling up.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tee

type Tee struct {
	W io.Writer // destination (required)
	R io.Reader // source (required)

	// Maximum delay between retries. If the end of the source is reached,
	// we'll wait up to this much time before trying again. Defaults to 100
	// milliseconds.
	Delay time.Duration

	// Size of the copy buffer. Defaults to 32kB.
	BufferSize int

	Clock clock.Clock
	// contains filtered or unexported fields
}

Tee copies text from source to destination until the user closes the source or calls Tee.Stop.

func (*Tee) Start

func (t *Tee) Start()

Start begins tailing the source and copying blobs into destination until an error is encountered, source runs out, or Stop is called. If source reaches EOF but is not yet closed, Tee will try again after some delay (configurable via the Delay parameter).

Start returns immediately.

func (*Tee) Stop

func (t *Tee) Stop() error

Stop tells Tee to stop copying text. It blocks until it has cleaned up the background job. Returns errors encountered during run, if any.

If this freezes, make sure you closed the underlying file.

func (*Tee) Wait

func (t *Tee) Wait() error

Wait waits until the tee stops from an error or from Stop being called. Returns the error, if any.

Jump to

Keyboard shortcuts

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