codec

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package codec owns the canonical, bounded golem.event.v1 transport envelope. It wraps one already validated immutable golem.fact.v1 or golem.fact.v2 row; it never reinterprets or rewrites the nested fact bytes.

Index

Constants

View Source
const (
	FormatVersion uint16 = 1
	CodecIdentity        = "golem.event.v1"

	DefaultMaxEncodedBytes = 2 << 20
	HardMaxEncodedBytes    = 16 << 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Envelope

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

Envelope is one immutable validated transport event. Encoded returns an owned copy; Fact exposes the already schema-validated internal fact value to later internal P7 layers.

func Decode

func Decode(encoded []byte, resolver mutationfact.HistoricalSchemaResolver, limits Limits) (Envelope, error)

func EncodeStoredRow

func EncodeStoredRow(row mutationfact.OutboxRow, resolver mutationfact.HistoricalSchemaResolver, limits Limits) (Envelope, error)

EncodeStoredRow validates every duplicated immutable outbox column against its canonical nested fact before constructing golem.event.v1.

func (Envelope) Action

func (envelope Envelope) Action() golem.EventAction

func (Envelope) CausationID

func (envelope Envelope) CausationID() golem.CausationID

func (Envelope) CodecIdentity

func (envelope Envelope) CodecIdentity() string

func (Envelope) Encoded

func (envelope Envelope) Encoded() []byte

func (Envelope) EventID

func (envelope Envelope) EventID() golem.EventID

func (Envelope) EventSchemaDigest

func (envelope Envelope) EventSchemaDigest() (golem.EventSchemaDigest, bool)

func (Envelope) Fact

func (envelope Envelope) Fact() mutationfact.Envelope

func (Envelope) FormatVersion

func (envelope Envelope) FormatVersion() uint16

func (Envelope) GenerationDigest

func (envelope Envelope) GenerationDigest() golem.SchemaDigest

func (Envelope) ModelID

func (envelope Envelope) ModelID() golem.ModelID

func (Envelope) RecordedAt

func (envelope Envelope) RecordedAt() time.Time

func (Envelope) ResolvedEventSchemaDigest

func (envelope Envelope) ResolvedEventSchemaDigest() golem.EventSchemaDigest

ResolvedEventSchemaDigest is the logical event schema proven by the historical resolver. V1 does not carry this digest on wire, while V2 does; later typed delivery requires a non-zero value and compares it to the generated factory's schema.

func (Envelope) TransactionOrdinal

func (envelope Envelope) TransactionOrdinal() uint32

type Error

type Error struct {
	Offset int
	Detail string
}

Error is a sanitized hostile-input failure. Offset points only into the trusted event byte sequence and never contains fact, snapshot, or driver contents.

func (*Error) Error

func (failure *Error) Error() string

type Limits

type Limits struct {
	MaxEncodedBytes int
}

Jump to

Keyboard shortcuts

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