serialization

package
v2.0.3-beta1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const FieldSerializedLength = 6

Variables

View Source
var (
	ErrFormatting       = errors.New("formatting error")
	ErrEarlyEndOfStream = errors.New("early end of stream")
)

Functions

This section is empty.

Types

type CallTableFieldsIterator

type CallTableFieldsIterator struct {
	IndexInFieldsVec int
	ExpectedSize     int
	Field            *Field
	Bytes            []byte
	Parent           *CallTableSerializationEnvelope
}

func DeserializeAndMaybeNext

func DeserializeAndMaybeNext[T any, D encoding.FromBytes[T]](it *CallTableFieldsIterator, decoder D) (T, *CallTableFieldsIterator, error)

DeserializeAndMaybeNext deserializes the current field and returns the next iterator if available

func (*CallTableFieldsIterator) VerifyIndex

func (it *CallTableFieldsIterator) VerifyIndex(expectedIndex uint16) error

VerifyIndex verifies the index of the current field

type CallTableSerializationEnvelope

type CallTableSerializationEnvelope struct {
	Fields []Field
	Bytes  []byte
}

func (*CallTableSerializationEnvelope) EstimateSize

func (env *CallTableSerializationEnvelope) EstimateSize(fieldSizes []int) int

func (*CallTableSerializationEnvelope) FromBytes

func (env *CallTableSerializationEnvelope) FromBytes(maxExpectedFields uint32, inputBytes []byte) (*CallTableSerializationEnvelope, []byte, error)

FromBytes deserializes the envelope

func (*CallTableSerializationEnvelope) StartConsuming

type CallTableSerializationEnvelopeBuilder

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

CallTableSerializationEnvelopeBuilder is used to construct a serialization envelope.

func NewCallTableSerializationEnvelopeBuilder

func NewCallTableSerializationEnvelopeBuilder(expectedPayloadSizes []int) (*CallTableSerializationEnvelopeBuilder, error)

func (*CallTableSerializationEnvelopeBuilder) AddField

func (b *CallTableSerializationEnvelopeBuilder) AddField(fieldIndex uint16, value []byte) error

func (*CallTableSerializationEnvelopeBuilder) BinaryPayloadBytes

func (b *CallTableSerializationEnvelopeBuilder) BinaryPayloadBytes() ([]byte, error)

type Field

type Field struct {
	Index  uint16
	Offset uint32
}

Field represents an individual field in the serialization envelope.

func (Field) Bytes

func (f Field) Bytes() ([]byte, error)

func (Field) SerializedLength

func (f Field) SerializedLength() int

type FieldFromBytesDecoder

type FieldFromBytesDecoder struct{}

func (*FieldFromBytesDecoder) FromBytes

func (addr *FieldFromBytesDecoder) FromBytes(inputBytes []byte) (Field, []byte, error)

FromBytes function to deserialize a Field from bytes

type Fields

type Fields map[uint16][]byte

func NewFields

func NewFields() Fields

func (*Fields) AddField

func (f *Fields) AddField(key uint16, value encoding.ToBytes) error

func (*Fields) Bytes

func (f *Fields) Bytes() ([]byte, error)

Bytes serializes all fields in the slice into a single byte slice.

func (*Fields) SerializedLength

func (f *Fields) SerializedLength() int

func (*Fields) UnmarshalJSON

func (t *Fields) UnmarshalJSON(data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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