zio

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 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() (*zed.Value, error)
}

Reader wraps the Read method.

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

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

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.

func NewWarningReader

func NewWarningReader(zr Reader, w Warner) Reader

NewWarningReader returns a Reader that reads from zr. Any error encountered results in a call to w with the warning as prameter, and then a nil *zed.Record and nil error are returned.

type Warner

type Warner interface {
	Warn(msg string) error
}

type WarningReader

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

func (*WarningReader) Read

func (w *WarningReader) Read() (*zed.Value, error)

type WriteCloser

type WriteCloser interface {
	Writer
	io.Closer
}

type Writer

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

func MultiWriter

func MultiWriter(writers ...Writer) Writer

Directories

Path Synopsis
Package zng21io provides low performance, read-only for the old ZNG format prior to the changes introduced in January 2021.
Package zng21io provides low performance, read-only for the old ZNG format prior to the changes introduced in January 2021.
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