listwire

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const KindBatchItem zapv1.KindByte = 0x22

KindBatchItem is the wire discriminator for BatchItem.

View Source
const KindBatchTx zapv1.KindByte = 0x21

KindBatchTx is the wire discriminator for BatchTx.

View Source
const OffsetBatchItem_ID = 0

OffsetBatchItem_ID is the byte offset of the ID field.

View Source
const OffsetBatchItem_Value = 8

OffsetBatchItem_Value is the byte offset of the Value field.

View Source
const OffsetBatchTx_ID = 1

OffsetBatchTx_ID is the byte offset of the ID field.

View Source
const OffsetBatchTx_Items = 9

OffsetBatchTx_Items is the byte offset of the Items field.

View Source
const SizeBatchItem = 16

SizeBatchItem is the fixed object payload size in bytes.

View Source
const SizeBatchTx = 17

SizeBatchTx is the fixed object payload size in bytes.

Variables

View Source
var BatchSchemaFields = struct {
	ID zapv1.Field[BatchSchema, uint64]
}{
	ID: zapv1.At[BatchSchema, uint64](1),
}

BatchSchemaFields is the namespace of every scalar field accessor for BatchTx. Use with zapv1.Read / zapv1.Write for type-safe access. Byte-array fields are emitted as standalone functions, see below.

View Source
var ItemSchemaFields = struct {
	ID    zapv1.Field[ItemSchema, uint64]
	Value zapv1.Field[ItemSchema, uint64]
}{
	ID:    zapv1.At[ItemSchema, uint64](0),
	Value: zapv1.At[ItemSchema, uint64](8),
}

ItemSchemaFields is the namespace of every scalar field accessor for BatchItem. Use with zapv1.Read / zapv1.Write for type-safe access. Byte-array fields are emitted as standalone functions, see below.

Functions

func BatchTxItems

func BatchTxItems(v zapv1.View[BatchSchema]) zapv1.List[ItemSchema]

BatchTxItems returns the variable-length Items list of BatchTx as a range-over-func-ready zapv1.ListItemSchema. Zero-copy: each element view indexes straight into the underlying buffer.

for it := range BatchTxItems(view).All() {
    // zapv1.Read(it, ItemSchemaFields.X)
}

func NewBatchItem

func NewBatchItem(iD uint64, value uint64) (zapv1.View[ItemSchema], []byte)

NewBatchItem builds a fresh BatchItem in a ZAP buffer.

Hand-rolled fast path: inlines v1 primitives (zap.NewBuilder, [*Builder.StartObject], [*ObjectBuilder.Set*], [*Builder.Finish]) so the entire build expands at the call site. Scalars and fixed byte arrays live in the fixed payload; variable-length string/bytes go in the object tail (the fixed payload holds their 8-byte pointers).

func NewBatchTx

func NewBatchTx(iD uint64, items []Item) (zapv1.View[BatchSchema], []byte)

NewBatchTx builds a fresh BatchTx in a ZAP buffer.

Hand-rolled fast path: inlines v1 primitives (zap.NewBuilder, [*Builder.StartObject], [*ObjectBuilder.Set*], [*Builder.Finish]) so the entire build expands at the call site. Scalars and fixed byte arrays live in the fixed payload; variable-length string/bytes go in the object tail (the fixed payload holds their 8-byte pointers).

func WrapBatchItem

func WrapBatchItem(b []byte) (zapv1.View[ItemSchema], error)

WrapBatchItem parses a ZAP buffer into a typed [zapv1.View[BatchItem]]. Validates the wire frame and the kind discriminator at offset 0; returns *zapv1.SchemaError on kind mismatch.

Hand-rolled fast path: inlines zap.Parse (which is itself inlineable). Zero heap allocs on the happy path; matches v1 hand-rolled performance.

func WrapBatchTx

func WrapBatchTx(b []byte) (zapv1.View[BatchSchema], error)

WrapBatchTx parses a ZAP buffer into a typed [zapv1.View[BatchTx]]. Validates the wire frame and the kind discriminator at offset 0; returns *zapv1.SchemaError on kind mismatch.

Hand-rolled fast path: inlines zap.Parse (which is itself inlineable). Zero heap allocs on the happy path; matches v1 hand-rolled performance.

Types

type BatchSchema

type BatchSchema struct{}

BatchSchema is the v2 schema marker for BatchTx. Methods are constant- returning so concrete-typed [zapv1.Wrap[BatchSchema]] calls fold to literals at the call site.

func (BatchSchema) Kind

func (BatchSchema) Kind() zapv1.KindByte

func (BatchSchema) Name

func (BatchSchema) Name() string

func (BatchSchema) Size

func (BatchSchema) Size() int

type Item

type Item struct {
	ID    uint64
	Value uint64
}

Item is the per-element input for the BatchTx.Items list.

type ItemSchema

type ItemSchema struct{}

ItemSchema is the v2 schema marker for BatchItem. Methods are constant- returning so concrete-typed [zapv1.Wrap[ItemSchema]] calls fold to literals at the call site.

func (ItemSchema) Kind

func (ItemSchema) Kind() zapv1.KindByte

func (ItemSchema) Name

func (ItemSchema) Name() string

func (ItemSchema) Size

func (ItemSchema) Size() int

Jump to

Keyboard shortcuts

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