wire

package
v0.0.0-...-741f41f Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package wire implements FDB's custom FlatBuffers-inspired binary serialization format.

FDB protocol messages are serialized using a vtable-based layout defined in flow/flat_buffers.h in the FDB C++ source. This is NOT Google FlatBuffers — it's FDB's own format with the same core concepts: vtables for field offsets, relative offsets for variable-length data, and alignment padding.

The vtable determines where each field sits within the serialized object. Fields are sorted by size descending for optimal packing, and each offset includes a +4 adjustment for the vtable pointer at the start of the object.

Index

Constants

This section is empty.

Variables

View Source
var FakeRootVTable = VTable{6, 8, 4}

FakeRootVTable is the vtable for the FakeRoot wrapper object. C++ uses fake_root<T> with vtable {6, 8, 4} — always the same.

Functions

func BlobLayout

func BlobLayout(vt VTable) (objPos, oolPos, blobHeaderSize int)

BlobLayout computes the byte layout of a self-contained struct blob. Returns (objPos, oolPos, totalSize) relative to blob start.

func InitReader

func InitReader(data []byte, r *Reader) error

InitReader initializes a Reader in-place, avoiding heap allocation. The caller can stack-allocate: var r wire.Reader; wire.InitReader(data, &r) Returns error if the buffer is malformed.

func MarshalDirect

func MarshalDirect(t *MessageTemplate, measureFn func(int) int, writeFn func(*DirectWriter) int) []byte

MarshalDirect performs two-pass serialization. 1 allocation total.

measureFn: returns the end-offset contributed by all nested content (OOL data + nested structs), NOT including the root object itself.

writeFn: writes everything (OOL, nested structs, root object) into the DirectWriter's buffer. Returns the root object byte position.

func MeasureBytesOOL

func MeasureBytesOOL(endOff int, data []byte) int

MeasureBytesOOL returns the end-offset contribution of a WriteBytes field. C++ flat_buffers.h:518 PrecomputeSize::visitDynamicSize — ALWAYS allocates at least 4 bytes (the length prefix), even for nil/empty data. C++ has an emptyVector optimization (first empty field allocates 4 bytes, subsequent reuse the same offset) but we always allocate for simplicity. This may over-allocate by 4 bytes for types with multiple nil fields.

func MeasureObject

func MeasureObject(endOff int, vt VTable, maxAlign int) int

MeasureObject returns the end-offset after adding a nested object. C++ flat_buffers.h: nested objects just do current_buffer_size += vtable[1]. No alignment for nested objects — alignment only happens at the root (always to 8, in MarshalFDB). The maxAlign parameter is unused but kept for API compatibility. MeasureObject computes the end-offset after writing an object. C++ SaveVisitorLambda (flat_buffers.h:972):

RightAlign(current_buffer_size + vtable[1] - 4, max(4, fb_align<Members>...)) + 4

func MeasureRawOOL

func MeasureRawOOL(endOff int, data []byte) int

MeasureRawOOL returns the end-offset contribution of a WriteRawOOL field. C++ flat_buffers.h:518 visitDynamicSize treats ALL dynamic_size types the same: always [len(4)][data][pad], even for empty. Empty data still gets 4 bytes.

func PatchBlobRelOff

func PatchBlobRelOff(obj []byte, fieldOff int, objAbsPos int, targetAbsPos int)

PatchBlobRelOff writes a RelativeOffset within a blob's object.

func PatchRelOff

func PatchRelOff(obj []byte, fieldOff int, objPos int, targetPos int)

PatchRelOff writes a RelativeOffset at obj[fieldOff] pointing to targetPos.

func ReadErrorOrInto

func ReadErrorOrInto(data []byte, r *Reader) error

ReadErrorOrInto is like ReadErrorOr but writes the success Reader in-place, letting the caller stack-allocate it and avoid a heap alloc on the hot path:

var r wire.Reader
if err := wire.ReadErrorOrInto(data, &r); err != nil { ... }
reply.UnmarshalFromReader(&r)

func ReleasePrecomputeSize

func ReleasePrecomputeSize(ps *PrecomputeSize)

ReleasePrecomputeSize returns a PrecomputeSize to the pool for reuse.

func ReleaseWriteToBuffer

func ReleaseWriteToBuffer(wb *WriteToBuffer)

ReleaseWriteToBuffer returns a WriteToBuffer to the pool for reuse.

func RightAlign

func RightAlign(offset, alignment int) int

RightAlign — C++ flat_buffers.h:58

func UIDFromParts

func UIDFromParts(first, second uint64) [16]byte

UIDFromParts constructs a [16]byte UID from two uint64 halves (little-endian).

func WriteBlobVTable

func WriteBlobVTable(buf []byte, blobStart int, vt VTable) []byte

WriteBlobVTable writes a vtable + soffset at the given position in buf. Returns the object slice (buf[objPos:objPos+objSize]) for field writes.

Types

type BufferMessageWriter

type BufferMessageWriter struct {
	WB            *WriteToBuffer
	FinalLocation int // from writeToOffsets
	Size          int
}

BufferMessageWriter — C++ WriteToBuffer::MessageWriter (flat_buffers.h:583)

func (BufferMessageWriter) WriteRelativeOffset

func (mw BufferMessageWriter) WriteRelativeOffset(reloff int, fieldOffset int)

WriteRelativeOffset — C++ MessageWriter::write for RelativeOffset (flat_buffers.h:586) Converts the end-of-buffer relative offset to a forward relative offset.

func (BufferMessageWriter) WriteScalar

func (mw BufferMessageWriter) WriteScalar(src []byte, offset int)

WriteScalar — C++ MessageWriter::write for non-RelativeOffset types (flat_buffers.h:591)

func (BufferMessageWriter) WriteTo

func (mw BufferMessageWriter) WriteTo()

WriteTo — C++ MessageWriter::writeTo(writer) (flat_buffers.h:594)

func (BufferMessageWriter) WriteToAt

func (mw BufferMessageWriter) WriteToAt(offset int)

WriteToAt — C++ MessageWriter::writeTo(writer, offset) (flat_buffers.h:595)

type DirectWriter

type DirectWriter struct {
	Cursor    int // next available byte position, moves downward (high → low)
	VtablePos int
	Template  *MessageTemplate
	// contains filtered or unexported fields
}

DirectWriter supports two-pass zero-intermediate-buffer serialization. Pass 1: measureEndOff computes total size (arithmetic only, zero alloc). Pass 2: writeDirect writes everything into a single pre-allocated buffer. Result: exactly 1 allocation (the output buffer) regardless of nesting depth.

func (*DirectWriter) Init

func (dw *DirectWriter) Init(buf []byte, totalSize int, vtablePos int, t *MessageTemplate)

Init initializes a stack-allocated DirectWriter.

func (*DirectWriter) ReserveRawOOL

func (dw *DirectWriter) ReserveRawOOL(size int) (int, []byte)

ReserveRawOOL reserves `size` bytes below cursor (aligned to 4) and returns the start position + a slice into the buffer for direct writing. Used for inline vector block construction (header + blobs written by caller).

func (*DirectWriter) WriteBytesOOL

func (dw *DirectWriter) WriteBytesOOL(data []byte) int

WriteBytesOOL writes [len(4)][data][padding] below cursor. Returns the byte position of the length prefix (target for RelativeOffset). C++ flat_buffers.h:615 WriteToBuffer::visitDynamicSize

func (*DirectWriter) WriteObject

func (dw *DirectWriter) WriteObject(vt VTable, maxAlign int) (int, []byte)

WriteObject writes the soffset for an object and returns (objPos, obj slice). The caller fills in field values directly into the returned obj slice. Alignment is computed in end-offset space to match C++ layout exactly.

func (*DirectWriter) WriteRawOOL

func (dw *DirectWriter) WriteRawOOL(data []byte) int

WriteRawOOL writes [data][padding] below cursor (no length prefix). Returns the byte position of the data start.

type FDBError

type FDBError struct {
	Code int
}

FDBError is returned when an FDB ErrorOr response contains an error code. This is the canonical FDB error type — use errors.As() to extract it from wrapped errors. Equivalent to Java's FDBException.

func ReadInlineReplyError

func ReadInlineReplyError(r *Reader, tagSlot int) *FDBError

ReadInlineReplyError decodes the Optional<Error> that LoadBalancedReply-derived storage replies carry INLINE (GetValueReply, GetKeyReply, GetKeyValuesReply). r must be positioned at the reply object. The optional is two vtable slots: a uint8 present-tag at tagSlot and, at tagSlot+1, a RelativeOffset to a nested Error table whose uint16 error_code is at the Error table's own slot 0. Returns the decoded *FDBError, or nil if the field is absent.

FDB delivers wrong_shard_server / future_version / process_behind for reads through this field, not the ErrorOr root (C++ storageserver.actor.cpp sendErrorWithPenalty sets reply.error; LoadBalance.actor.h re-throws it). The generated reply structs mis-decode this field as a length-prefixed byte string (Optional<Error> wrongly classified as Optional<bytes>), so callers MUST use this helper and ignore the generated reply.Error field.

func (*FDBError) Error

func (e *FDBError) Error() string

type MessageTemplate

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

MessageTemplate pre-computes everything that is static per message type. Created once at init time from a VTableClosure. Used by DirectWriter for vtable offset lookup and pre-packed vtable bytes.

func NewMessageTemplate

func NewMessageTemplate(fileID uint32, msgVTable VTable, maxFieldAlign int, closure []VTable) *MessageTemplate

NewMessageTemplate pre-computes a MessageTemplate from a vtable closure. The closure must include ALL vtables transitively reachable from the message (from C++ get_vtableset). Call once at package init.

func (*MessageTemplate) PackedVTables

func (t *MessageTemplate) PackedVTables() []byte

PackedVTables returns the pre-packed vtable bytes.

func (*MessageTemplate) PackedVTablesLen

func (t *MessageTemplate) PackedVTablesLen() int

PackedVTablesLen returns the byte length of the pre-packed vtable data.

func (*MessageTemplate) VTableOffset

func (t *MessageTemplate) VTableOffset(vt VTable) int

VTableOffset returns the byte offset of vt within packed vtable data (exported for testing).

func (*MessageTemplate) WriteFakeRoot

func (t *MessageTemplate) WriteFakeRoot(buf []byte, fakeRootPos, vtablePos, msgObjPos int)

WriteFakeRoot writes the FakeRoot object at the given position.

func (*MessageTemplate) WriteRootUnionFooter

func (t *MessageTemplate) WriteRootUnionFooter(buf []byte, vtablePos, msgObjPos int)

WriteRootUnionFooter writes vtables + footer for root-union layout (no FakeRoot). Used by ErrorOr and other union_like_traits types at the root level.

func (*MessageTemplate) WriteVTablesAndFooter

func (t *MessageTemplate) WriteVTablesAndFooter(buf []byte, vtablePos, fakeRootPos int)

WriteVTablesAndFooter writes the vtable data and root footer.

type PrecomputeSize

type PrecomputeSize struct {
	CurrentBufferSize int
	WriteToOffsets    []int // records final position for each getMessageWriter call

	// C++ flat_buffers.h:551 — empty vector sentinel optimization.
	// Only the first empty dynamic_size field allocates 4 bytes;
	// subsequent ones re-use the same offset.
	EmptyVectorOffset int // -1 = not yet allocated
}

PrecomputeSize — C++ flat_buffers.h:502 Pass 1: computes total buffer size by accumulating field sizes. All offsets are measured from the END of the buffer.

func NewPrecomputeSize

func NewPrecomputeSize() *PrecomputeSize

func (*PrecomputeSize) GetMessageWriter

func (ps *PrecomputeSize) GetMessageWriter(size int) SizeNoop

GetMessageWriter — C++ PrecomputeSize::getMessageWriter (flat_buffers.h:538)

func (*PrecomputeSize) SaveObjectSize

func (ps *PrecomputeSize) SaveObjectSize(objSize int, maxAlign int) int

SaveObjectSize — C++ SaveVisitorLambda::operator() lines 972-977 Computes the aligned position for an object with the given vtable. objSize = vtable[1], maxAlign = max(4, fb_align<Members>...)

func (*PrecomputeSize) VisitDynamicSize

func (ps *PrecomputeSize) VisitDynamicSize(size int) bool

VisitDynamicSize — C++ PrecomputeSize::visitDynamicSize (flat_buffers.h:515) For bytes/string fields. Returns true if the field is empty and reuses the existing empty vector sentinel (caller should skip writing).

func (*PrecomputeSize) Write

func (ps *PrecomputeSize) Write(offset int)

Write — C++ PrecomputeSize::write (flat_buffers.h:512)

type Reader

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

Reader deserializes an FDB-format message.

The buffer has a FakeRoot wrapper (added by save_members):

root_offset → FakeRoot object → (RelativeOffset) → message object → fields

NewReader navigates both levels and positions the reader at the message object.

func NewReader

func NewReader(data []byte) (*Reader, error)

NewReader parses the buffer, navigates through the FakeRoot to the message object. Handles both formats:

  • With protocol version prefix: [version(8)][root_offset(4)][file_id(4)][data...]
  • Without prefix: [root_offset(4)][file_id(4)][data...]

func ReadErrorOr

func ReadErrorOr(data []byte) (*Reader, error)

ReadErrorOr unwraps an ErrorOr<T> response. On the value tag it returns a Reader positioned at T; on the error tag it returns the decoded *FDBError.

The success/error decision reads the explicit union tag — it does NOT infer from the nested object's field count. A one-field success T (e.g. SplitRangeReply, whose only field is SplitPoints) is structurally indistinguishable from a one-field Error table, so the old field-count heuristic silently misread such successes as errors.

func ReaderAtRootObject

func ReaderAtRootObject(data []byte) (*Reader, error)

ReaderAtRootObject positions a Reader at the object the footer's root_offset points to, WITHOUT NewReader's FakeRoot field-0 indirection. Exposed for tests that inspect a union/root object directly (e.g. an ErrorOr root, whose slot 0 tag + slot 1 nested Error mirror an inline reply error).

func (*Reader) FieldOffset

func (r *Reader) FieldOffset(vtableSlot int) int

FieldOffset returns the byte offset of a field within the object (exported version). Returns 0 if the field is absent.

func (*Reader) FieldPresent

func (r *Reader) FieldPresent(vtableSlot int) bool

FieldPresent returns true if the field at the given vtable slot has a non-zero offset.

func (*Reader) FileIdentifier

func (r *Reader) FileIdentifier() uint32

FileIdentifier reads the file_identifier from the root footer.

func (*Reader) ObjectBytes

func (r *Reader) ObjectBytes() []byte

ObjectBytes returns the slice of the buffer starting at the object position. Fields are at offsets within this slice.

func (*Reader) ObjectPos

func (r *Reader) ObjectPos() int

ObjectPos returns the absolute position of this reader's object in the buffer.

func (*Reader) RawData

func (r *Reader) RawData() []byte

RawData returns the full underlying buffer. Useful for low-level nested parsing.

func (*Reader) ReadBool

func (r *Reader) ReadBool(vtableSlot int) bool

ReadBool reads a bool from the given vtable slot.

func (*Reader) ReadBytes

func (r *Reader) ReadBytes(vtableSlot int) []byte

ReadBytes reads a length-prefixed byte slice from out-of-line data. The vtable slot contains a RelativeOffset pointing to [uint32 length][data...].

func (*Reader) ReadFloat64

func (r *Reader) ReadFloat64(vtableSlot int) float64

ReadFloat64 reads a float64 from the given vtable slot (LE IEEE754).

func (*Reader) ReadIPv4

func (r *Reader) ReadIPv4(vtableSlot int) uint32

func (*Reader) ReadInt8

func (r *Reader) ReadInt8(vtableSlot int) int8

ReadInt8 reads an int8 from the given vtable slot.

func (*Reader) ReadInt16

func (r *Reader) ReadInt16(vtableSlot int) int16

ReadInt16 reads an int16 from the given vtable slot.

func (*Reader) ReadInt32

func (r *Reader) ReadInt32(vtableSlot int) int32

ReadInt32 reads an int32 from the given vtable slot.

func (*Reader) ReadInt64

func (r *Reader) ReadInt64(vtableSlot int) int64

ReadInt64 reads an int64 from the given vtable slot.

func (*Reader) ReadNestedReader

func (r *Reader) ReadNestedReader(vtableSlot int) (*Reader, error)

ReadNestedReader returns a sub-Reader positioned at a nested struct object. The vtable slot must contain a RelativeOffset pointing to the struct.

func (*Reader) ReadOptionalInt32

func (r *Reader) ReadOptionalInt32(typeSlot, valueSlot int) (int32, bool)

ReadOptionalInt32 reads an Optional<int32>. Returns (value, present). Optional uses 2 vtable slots: typeSlot (uint8 tag) and valueSlot (RelativeOffset).

func (*Reader) ReadOptionalString

func (r *Reader) ReadOptionalString(typeSlot, valueSlot int) (string, bool)

ReadOptionalString reads an Optional<string>. Returns (value, present).

func (*Reader) ReadRelOffRaw

func (r *Reader) ReadRelOffRaw(vtableSlot int, n int) []byte

ReadIPv4 reads a uint32 IPv4 address from a RelativeOffset field and returns it as a "host:0" string. The uint32 is stored little-endian on wire but represents a network-byte-order IPv4 address. ReadRelOffRaw reads N raw bytes at a RelativeOffset target. Used for variant (union_like) values where the data at the RelOff is raw (no length prefix), unlike ReadBytes which expects [len][data].

func (*Reader) ReadRelOffUint32

func (r *Reader) ReadRelOffUint32(vtableSlot int) uint32

ReadRelOffUint32 reads a uint32 at a RelativeOffset target. Used for variant alternatives that are scalar uint32 (e.g., IPv4 in IPAddress).

func (*Reader) ReadRelOffUint64

func (r *Reader) ReadRelOffUint64(vtableSlot int) uint64

ReadRelOffUint64 reads a uint64 at a RelativeOffset target — the 8-byte sibling of ReadRelOffUint32. Used for Optional<scalar> / variant alternatives whose inner is an 8-byte scalar written bare out-of-line behind the union RelativeOffset (C++ SaveAlternative non-indirection arm, flat_buffers.h:848), e.g. Optional<Version> (int64) consistencyCheckStartVersion. Bounds-checked like the uint32 sibling: a short/absent buffer returns 0 rather than panicking (the generated decode must not panic on a truncated field).

func (*Reader) ReadString

func (r *Reader) ReadString(vtableSlot int) string

ReadString reads a length-prefixed string from out-of-line data.

func (*Reader) ReadUID

func (r *Reader) ReadUID(vtableSlot int) [16]byte

ReadUID reads a 16-byte UID from the given vtable slot (inline).

func (*Reader) ReadUIDPair

func (r *Reader) ReadUIDPair(vtableSlot int) (uint64, uint64)

ReadUIDPair reads a 16-byte UID as two uint64 values (first, second).

func (*Reader) ReadUint8

func (r *Reader) ReadUint8(vtableSlot int) uint8

ReadUint8 reads a uint8 from the given vtable slot.

func (*Reader) ReadUint16

func (r *Reader) ReadUint16(vtableSlot int) uint16

ReadUint16 reads a uint16 from the given vtable slot.

func (*Reader) ReadUint32

func (r *Reader) ReadUint32(vtableSlot int) uint32

ReadUint32 reads a uint32 from the given vtable slot.

func (*Reader) ReadUint64

func (r *Reader) ReadUint64(vtableSlot int) uint64

ReadUint64 reads a uint64 from the given vtable slot.

func (*Reader) ReadVectorBytes

func (r *Reader) ReadVectorBytes(vtableSlot, index int) ([]byte, error)

ReadVectorBytes reads the i-th element of a vector of length-prefixed byte strings — C++ VectorRef<KeyRef>/VectorRef<StringRef> with the default FlatBuffers strategy (flat_buffers.h save(VectorLike): [uint32 count] [RelativeOffset]*, each offset → [uint32 len][data]). NOT the VecSerStrategy::String inline format, which is a single dynamic blob.

func (*Reader) ReadVectorCount

func (r *Reader) ReadVectorCount(vtableSlot int) (int, error)

ReadVectorCount returns the number of elements in a vector-of-struct field.

func (*Reader) ReadVectorElementReader

func (r *Reader) ReadVectorElementReader(vtableSlot, index int) (*Reader, error)

ReadVectorElementReader returns a sub-Reader for the i-th element of a vector-of-struct. Elements are 4-byte RelativeOffsets at vector_start+4+i*4, each pointing to a FlatBuffers object.

func (*Reader) ReadVectorInt32

func (r *Reader) ReadVectorInt32(vtableSlot int) []int32

ReadVectorInt32 reads a vector of int32 from out-of-line data. Wire format: RelativeOffset → [uint32 count][int32 elem0][int32 elem1]...

func (*Reader) ReadVectorUint64

func (r *Reader) ReadVectorUint64(vtableSlot int) []uint64

ReadVectorUint64 reads a vector of uint64 from out-of-line data.

func (*Reader) VTableLength

func (r *Reader) VTableLength() int

VTableLength returns the number of vtable entries (including the 2-entry header).

type SizeNoop

type SizeNoop struct {
	Size         int
	WriteToIndex int
}

SizeNoop — C++ PrecomputeSize::Noop (flat_buffers.h:527) Represents a message writer during the size computation pass.

func (SizeNoop) WriteTo

func (n SizeNoop) WriteTo(ps *PrecomputeSize)

WriteTo — C++ PrecomputeSize::Noop::writeTo(writer) (flat_buffers.h:533) Default: places the object at current_buffer_size + size.

func (SizeNoop) WriteToAt

func (n SizeNoop) WriteToAt(ps *PrecomputeSize, offset int)

WriteToAt — C++ PrecomputeSize::Noop::writeTo(writer, offset) (flat_buffers.h:528) Places the object at a specific offset.

type VTable

type VTable []uint16

VTable describes the serialized layout of an FDB protocol message.

Layout:

vtable[0] = vtable byte size on wire (2 bytes per field + 4)
vtable[1] = object byte size (includes 4-byte vtable-pointer prefix)
vtable[2+i] = byte offset of field i within the object

A field offset of 0 means the field has zero size and is not present. Non-zero offsets include the +4 adjustment for the vtable pointer that occupies bytes [0,4) of the serialized object.

func GenerateVTable

func GenerateVTable(sizes, alignments []uint32) VTable

GenerateVTable computes the FDB FlatBuffers vtable layout for a message with the given field sizes and alignments.

This is a direct port of detail::generate_vtable() from foundationdb/flow/flat_buffers.cpp. The output must be byte-identical to what the C++ implementation produces — any divergence means wire incompatibility.

The algorithm:

  1. Pair each field with its original index
  2. Filter out zero-size fields
  3. Stable-sort by size descending (largest fields first for packing)
  4. Assign offsets with alignment, adding +4 for the vtable pointer

type VTableSet

type VTableSet = vTableSet

Exported VTableSet for testing.

func NewVTableSetForTest

func NewVTableSetForTest() *VTableSet

func (*VTableSet) Add

func (s *VTableSet) Add(vt VTable)

func (*VTableSet) GetOffset

func (s *VTableSet) GetOffset(vt VTable) int

func (*VTableSet) Pack

func (s *VTableSet) Pack() []byte

type WriteToBuffer

type WriteToBuffer struct {
	Buf               []byte
	BufferLength      int // = len(Buf)
	VTableStart       int // byte offset of vtable region from end
	CurrentBufferSize int
	WriteToOffsets    []int // from PrecomputeSize pass
	WriteToIdx        int   // current position in WriteToOffsets

	// C++ flat_buffers.h:637
	EmptyVectorOffset int // -1 = not yet allocated
}

WriteToBuffer — C++ flat_buffers.h:569 Pass 2: writes data into a pre-allocated buffer. All offsets are measured from the END of the buffer (written right-to-left).

func NewWriteToBuffer

func NewWriteToBuffer(buf []byte, vtableStart int, offsets []int) *WriteToBuffer

func (*WriteToBuffer) GetMessageWriter

func (wb *WriteToBuffer) GetMessageWriter(size int, zeroed bool) BufferMessageWriter

GetMessageWriter — C++ WriteToBuffer::getMessageWriter (flat_buffers.h:603)

func (*WriteToBuffer) VisitDynamicSize

func (wb *WriteToBuffer) VisitDynamicSize(data []byte) (int, bool)

VisitDynamicSize — C++ WriteToBuffer::visitDynamicSize (flat_buffers.h:615) Writes a dynamic-size field (bytes/string) into the buffer. Returns the end-of-buffer offset for the RelativeOffset, or -1 if reused empty.

func (*WriteToBuffer) Write

func (wb *WriteToBuffer) Write(src []byte, offset int)

Write — C++ WriteToBuffer::write (flat_buffers.h:569) Writes src at position measured from end of buffer.

func (*WriteToBuffer) WriteUint32

func (wb *WriteToBuffer) WriteUint32(val uint32, offset int)

WriteUint32 writes a uint32 at position measured from end of buffer.

func (*WriteToBuffer) WriteUint64

func (wb *WriteToBuffer) WriteUint64(val uint64, offset int)

WriteUint64 writes a uint64 at position measured from end of buffer — the 8-byte sibling of WriteUint32, for a bare out-of-line scalar behind a union RelativeOffset (C++ SaveAlternative non-indirection arm, flat_buffers.h:848).

func (*WriteToBuffer) WriteZeros

func (wb *WriteToBuffer) WriteZeros(offset, length int)

WriteZeros writes zero bytes at position measured from end of buffer.

Directories

Path Synopsis
Package types contains generated FDB FlatBuffers message types.
Package types contains generated FDB FlatBuffers message types.

Jump to

Keyboard shortcuts

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