zng21io

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: 12 Imported by: 0

Documentation

Overview

Package zng21io provides low performance, read-only for the old ZNG format prior to the changes introduced in January 2021.

Index

Constants

View Source
const (
	ReadSize  = 512 * 1024
	MaxSize   = 10 * 1024 * 1024
	TypeLimit = 10000
)

Variables

View Source
var (
	ErrNotContainer = errors.New("not a container")
	ErrNotSingleton = errors.New("not a single container")
)
View Source
var ErrTrunc = errors.New("truncated type value convert zng21 to zng")

Functions

func AppendUvarint

func AppendUvarint(dst []byte, u64 uint64) []byte

AppendUvarint is like encoding/binary.PutUvarint but appends to dst instead of writing into it.

Types

type AppMessage

type AppMessage struct {
	Code     int
	Encoding int
	Bytes    []byte
}

type Bytes

type Bytes []byte

Bytes is the serialized representation of a sequence of ZNG values.

func AppendAs

func AppendAs(dst Bytes, container bool, val []byte) Bytes

func AppendContainer

func AppendContainer(dst Bytes, val Bytes) Bytes

AppendContainer appends val to dst as a container value and returns the extended buffer.

func AppendNull

func AppendNull(dst Bytes) Bytes

AppendNull appends a null value to dst as either a primitive or container value and returns the extended buffer.

func AppendPrimitive

func AppendPrimitive(dst Bytes, val []byte) Bytes

AppendPrimitive appends val to dst as a primitive value and returns the extended buffer.

func (Bytes) Body

func (b Bytes) Body() (Bytes, error)

func (Bytes) ContainerBody

func (b Bytes) ContainerBody() (Bytes, error)

ContainerBody returns the body of the receiver, which must hold a single container. If the receiver is not a container, ErrNotContainer is returned. If the receiver is not a single container, ErrNotSingleton is returned.

func (Bytes) Iter

func (b Bytes) Iter() Iter

Iter returns an Iter for the receiver.

type Iter

type Iter Bytes

Iter iterates over the sequence of values encoded in Bytes.

func (*Iter) Done

func (i *Iter) Done() bool

Done returns true if no values remain.

func (*Iter) Next

func (i *Iter) Next() (Bytes, bool)

Next returns the body of the next value along with a boolean that is true if the value is a container. It returns an empty slice for an empty or zero-length value and nil for a Zed null value. The container boolean is not meaningful if the returned Bytes slice is nil. Next panics if the next value is malformed.

func (*Iter) NextTagAndBody

func (i *Iter) NextTagAndBody() (Bytes, bool)

NextTagAndBody returns the next value as a slice containing the value's undecoded tag followed by its body along with a boolean that is true if the value is a container. NextTagAndBody panics if the next value is malformed.

type Reader

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

func NewReader

func NewReader(sctx *zed.Context, reader io.Reader) *Reader

func NewReaderWithOpts

func NewReaderWithOpts(sctx *zed.Context, reader io.Reader, opts zngio.ReaderOpts) *Reader

func (*Reader) Read

func (r *Reader) Read() (*zed.Value, error)

func (*Reader) ReadByte

func (r *Reader) ReadByte() (byte, error)

ReadByte implements io.ByteReader.ReadByte.

func (*Reader) ReadPayload

func (r *Reader) ReadPayload() (*zed21.Value, *AppMessage, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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