Documentation ¶
Overview ¶
package admproto describes the admission protocol
Index ¶
- Variables
- func AddChecksum(buf []byte) []byte
- func CheckChecksum(buf []byte) ([]byte, error)
- type FloatEncoding
- type Options
- type Reader
- type Writer
- func (w *Writer) Append(in []byte, key string, value float64) (out []byte, err error)
- func (w *Writer) AppendHeader(in, key, value []byte) (out []byte, err error)
- func (w *Writer) Begin(in []byte, application string, instance_id []byte, num_headers int) (out []byte, err error)
- func (w *Writer) Reset()
Constants ¶
This section is empty.
Variables ¶
var Error = errs.Class("admproto")
Error wraps all of the errors coming out of admproto.
Functions ¶
func AddChecksum ¶
AddChecksum appends a checksum to the byte slice.
func CheckChecksum ¶
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 ¶
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, num_headers int, err error)
Begin returns the header information out of the packet, and the remaining data in the packet.
func (*Reader) Next ¶
Next consumes bytes from in, returns the key and value, and returns the rest of the bytes as out.
func (*Reader) NextHeader ¶
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 ¶
NewWriterWith returns a Writer with the passed in options rather than the defaults.
func (*Writer) Append ¶
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) AppendHeader ¶
AppendHeader adds the key and value to the starting bytes of the packet