zio

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: BSD-3-Clause Imports: 6 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseReaders

func CloseReaders(readers []Reader) error

func Copy

func Copy(dst Writer, src Reader) error

Copy copies src to dst a la io.Copy.

func CopyWithContext

func CopyWithContext(ctx context.Context, dst Writer, src Reader) error

func Extension

func Extension(format string) string

func NopCloser

func NopCloser(w io.Writer) io.WriteCloser

NopCloser returns a WriteCloser with a no-op Close method wrapping the provided Writer w.

Types

type Combiner

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

A Combiner is a Reader that returns records by reading from multiple Readers.

func NewCombiner

func NewCombiner(ctx context.Context, readers []Reader) *Combiner

func (*Combiner) Read

func (c *Combiner) Read() (*zed.Value, error)

type Counter

type Counter struct {
	Reader
	// contains filtered or unexported fields
}

Counter wraps a zio.Reader and provides a method to return the number of records read from the stream.

func NewCounter

func NewCounter(reader Reader, p *int64) *Counter

NewCounter provides a wrapper for Reader that tracks the number of records read in the variable pointed to by p. Atomic operations are carrried out on the count so the caller should use package atomic to read the referenced count while there is potential concurrency.

func (*Counter) Read

func (c *Counter) Read() (*zed.Value, error)

type Mapper

type Mapper struct {
	Reader
	// contains filtered or unexported fields
}

func NewMapper

func NewMapper(zctx *zed.Context, reader Reader) *Mapper

func (*Mapper) Read

func (m *Mapper) Read() (*zed.Value, error)

type Peeker

type Peeker struct {
	Reader
	// contains filtered or unexported fields
}

Peeker wraps a Stream while adding a Peek method, which allows inspection of the next item to be read without actually reading it.

func NewPeeker

func NewPeeker(reader Reader) *Peeker

func (*Peeker) Peek

func (p *Peeker) Peek() (*zed.Value, error)

func (*Peeker) Read

func (p *Peeker) Read() (*zed.Value, error)

type ReadCloser

type ReadCloser interface {
	Reader
	io.Closer
}

func NewReadCloser

func NewReadCloser(r Reader, c io.Closer) ReadCloser

func NopReadCloser

func NopReadCloser(r Reader) ReadCloser

type Reader

type Reader interface {
	Read() (val *zed.Value, err error)
}

Reader wraps the Read method.

Read returns the next value and a nil error, a nil value and the next error, or a nil value and nil error to indicate that no values remain.

Read never returns a non-nil value and non-nil error together, and it never returns io.EOF.

Implementations retain ownership of val and val.Bytes, and a subsequent Read may overwrite them. Clients that wish to use val or val.Bytes after the next Read must make a copy.

func ConcatReader

func ConcatReader(readers ...Reader) Reader

ConcatReader returns a Reader that is the logical concatenation of readers, which are read sequentially. Its Read methed returns any non-nil error returned by a reader and returns end of stream after all readers have returned end of stream.

type WriteCloser

type WriteCloser interface {
	Writer
	io.Closer
}

type Writer

type Writer interface {
	Write(val *zed.Value) error
}

Writer wraps the Write method.

Implementations must not retain val or val.Bytes.

func MultiWriter

func MultiWriter(writers ...Writer) Writer

Directories

Path Synopsis
Package zngio provides an API for reading and writing zng values and directives in binary zng format.
Package zngio provides an API for reading and writing zng values and directives in binary zng format.

Jump to

Keyboard shortcuts

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