Documentation ¶
Overview ¶
Package binary implements the Thrift Binary protocol.
See "go.uber.org/thriftrw/protocol".Binary for a higher-level Encode/Decode API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDecodeError ¶
IsDecodeError checks if an error is a protocol decode error.
func ReturnWriter ¶
func ReturnWriter(w *Writer)
ReturnWriter returns a previously borrowed Writer back to the system.
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader implements a parser for the Thrift Binary Protocol based on an io.ReaderAt.
func (*Reader) ReadEnveloped ¶
ReadEnveloped reads an Apache Thrift envelope
Thrift supports two kinds of envelopes: strict, and non-strict.
Non-strict envelopes: Name (4 byte length prefixed string) Type ID (1 byte) Sequence ID (4 bytes)
Strict envelopes:
Version | Type ID (4 bytes) Name (4 byte length prefixed string) Sequence ID (4 bytes)
When reading payloads, we need to support both strict and non-strict payloads. To do this, we read the first 4 byte. Non-strict payloads will always have a size >= 0, while strict payloads have selected version numbers such that the value will always be negative.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer implements basic logic for writing the Thrift Binary Protocol to an io.Writer.
func BorrowWriter ¶
BorrowWriter fetches a Writer from the system that will write its output to the given io.Writer.
This Writer must be returned back using ReturnWriter.
func (*Writer) WriteEnveloped ¶
WriteEnveloped writes enveloped value using the strict envelope.
func (*Writer) WriteLegacyEnveloped ¶ added in v1.9.0
WriteLegacyEnveloped writes enveloped value using the non-strict envelope (non-strict lacks an envelope version).