tsdb: github.com/prometheus/tsdb/encoding Index | Files

package encoding

import "github.com/prometheus/tsdb/encoding"

Index

Package Files

encoding.go

Variables

var (
    ErrInvalidSize     = errors.New("invalid size")
    ErrInvalidChecksum = errors.New("invalid checksum")
)

type ByteSlice Uses

type ByteSlice interface {
    Len() int
    Range(start, end int) []byte
}

ByteSlice abstracts a byte slice.

type Decbuf Uses

type Decbuf struct {
    B   []byte
    E   error
}

Decbuf provides safe methods to extract data from a byte slice. It does all necessary bounds checking and advancing of the byte slice. Several datums can be extracted without checking for errors. However, before using any datum, the err() method must be checked.

func NewDecbufAt Uses

func NewDecbufAt(bs ByteSlice, off int, castagnoliTable *crc32.Table) Decbuf

NewDecbufAt returns a new decoding buffer. It expects the first 4 bytes after offset to hold the big endian encoded content length, followed by the contents and the expected checksum.

func NewDecbufUvarintAt Uses

func NewDecbufUvarintAt(bs ByteSlice, off int, castagnoliTable *crc32.Table) Decbuf

NewDecbufUvarintAt returns a new decoding buffer. It expects the first bytes after offset to hold the uvarint-encoded buffers length, followed by the contents and the expected checksum.

func (*Decbuf) Be32 Uses

func (d *Decbuf) Be32() uint32

func (*Decbuf) Be32int Uses

func (d *Decbuf) Be32int() int

func (*Decbuf) Be64 Uses

func (d *Decbuf) Be64() uint64

func (*Decbuf) Be64int64 Uses

func (d *Decbuf) Be64int64() int64

func (*Decbuf) Byte Uses

func (d *Decbuf) Byte() byte

func (*Decbuf) Crc32 Uses

func (d *Decbuf) Crc32(castagnoliTable *crc32.Table) uint32

Crc32 returns a CRC32 checksum over the remaining bytes.

func (*Decbuf) Err Uses

func (d *Decbuf) Err() error

func (*Decbuf) Get Uses

func (d *Decbuf) Get() []byte

func (*Decbuf) Len Uses

func (d *Decbuf) Len() int

func (*Decbuf) Uvarint Uses

func (d *Decbuf) Uvarint() int

func (*Decbuf) Uvarint64 Uses

func (d *Decbuf) Uvarint64() uint64

func (*Decbuf) UvarintStr Uses

func (d *Decbuf) UvarintStr() string

func (*Decbuf) Varint64 Uses

func (d *Decbuf) Varint64() int64

type Encbuf Uses

type Encbuf struct {
    B   []byte
    C   [binary.MaxVarintLen64]byte
}

Encbuf is a helper type to populate a byte slice with various types.

func (*Encbuf) Get Uses

func (e *Encbuf) Get() []byte

func (*Encbuf) Len Uses

func (e *Encbuf) Len() int

func (*Encbuf) PutBE32 Uses

func (e *Encbuf) PutBE32(x uint32)

func (*Encbuf) PutBE32int Uses

func (e *Encbuf) PutBE32int(x int)

func (*Encbuf) PutBE64 Uses

func (e *Encbuf) PutBE64(x uint64)

func (*Encbuf) PutBE64int64 Uses

func (e *Encbuf) PutBE64int64(x int64)

func (*Encbuf) PutByte Uses

func (e *Encbuf) PutByte(c byte)

func (*Encbuf) PutHash Uses

func (e *Encbuf) PutHash(h hash.Hash)

PutHash appends a hash over the buffers current contents to the buffer.

func (*Encbuf) PutString Uses

func (e *Encbuf) PutString(s string)

func (*Encbuf) PutUvarint Uses

func (e *Encbuf) PutUvarint(x int)

func (*Encbuf) PutUvarint32 Uses

func (e *Encbuf) PutUvarint32(x uint32)

func (*Encbuf) PutUvarint64 Uses

func (e *Encbuf) PutUvarint64(x uint64)

func (*Encbuf) PutUvarintStr Uses

func (e *Encbuf) PutUvarintStr(s string)

PutUvarintStr writes a string to the buffer prefixed by its varint length (in bytes!).

func (*Encbuf) PutVarint64 Uses

func (e *Encbuf) PutVarint64(x int64)

func (*Encbuf) Reset Uses

func (e *Encbuf) Reset()

Package encoding imports 5 packages (graph) and is imported by 8 packages. Updated 2019-04-14. Refresh now. Tools for package owners.