admproto

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

package admproto describes the admission protocol

Index

Constants

This section is empty.

Variables

View Source
var Error = errs.Class("admproto")

Error wraps all of the errors coming out of admproto.

Functions

func AddChecksum

func AddChecksum(buf []byte) []byte

AddChecksum appends a checksum to the byte slice.

func CheckChecksum

func CheckChecksum(buf []byte) ([]byte, error)

CheckChecksum removes an appended checksum and errors if either it cannot or if the checksum does not match.

Types

type FloatEncoding

type FloatEncoding int

FloatEncoding controls different types of encodings of floating point values.

const (
	Float16Encoding FloatEncoding = iota
	Float32Encoding
	Float64Encoding
)

type Options

type Options struct {
	// FloatEncoding is what kind of encoding to use for the floating point
	// values. The default is to use float16.
	FloatEncoding FloatEncoding
}

Options controls options for the Writer.

type Reader

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

Reader iterates over the key/value pairs in a buffer written by a Writer.

func NewReaderWith

func NewReaderWith(scratch []byte) Reader

NewReaderWith returns a Reader with some given scratch space as a buffer to avoid allocations.

func (*Reader) Begin

func (r *Reader) Begin(in []byte) (out, application, instance_id []byte, err error)

Begin returns the header information out of the packet, and the remaining data in the packet.

func (*Reader) Next

func (r *Reader) Next(in []byte) (out, key []byte, value float64, err error)

Next consumes bytes from in, returns the key and value, and returns the rest of the bytes as out.

func (*Reader) Reset

func (r *Reader) Reset()

Reset clears the state of the Reader.

type Writer

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

Writer is a type for encoding key/value pairs to a byte buffer.

func NewWriterWith

func NewWriterWith(options Options) Writer

NewWriterWith returns a Writer with the passed in options rather than the defaults.

func (*Writer) Append

func (w *Writer) Append(in []byte, key string, value float64) (out []byte, err error)

Append adds the key and value to the buffer using the last Append calls to reduce the amount of data it needs to write.

func (*Writer) Begin

func (w *Writer) Begin(in []byte, application string, instance_id []byte) (
	out []byte, err error)

Begin appends header information to the buffer.

func (*Writer) Reset

func (w *Writer) Reset()

Reset clears the state of the Writer.

Jump to

Keyboard shortcuts

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