wire

package module
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 6 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package wire implements the optional ontos/wire value profile over deixis. C is an opaque, caller-supplied sending face. Capturing C does not recognize, attenuate, invoke or export it. The package has no runtime or type-system dependency.

Index

Constants

View Source
const PositionSpelling = pos.Profile
View Source
const Profile = "ontos/wire"
View Source
const Revision = 1

Variables

View Source
var ErrNativeValue = errors.New("ontos/wire: unqualified native value")

Functions

func Recover

func Recover[C any](value Value[C], limits Limits) (core.Value, error)

Recover returns a ground value exactly when the admitted input is wire-free. It never exports a handle or replaces it with a data reference. Failure has nil output; callers must not interpret Exhausted as proof of non-groundness.

Types

type Code

type Code string
const (
	Invalid       Code = "invalid"
	InvalidLimits Code = "invalid-limits"
	Exhausted     Code = "exhausted"
	NotGround     Code = "not-ground"
)

type Error

type Error struct {
	Code    Code
	Path    []int
	Message string
}

func (*Error) Error

func (e *Error) Error() string

type Kind

type Kind string
const (
	Atom       Kind = "atom"
	Tuple      Kind = "tuple"
	Capability Kind = "wire"
)

type Limits

type Limits struct {
	MaxDepth int
	MaxNodes int
	MaxBytes int
}

Limits count the unfolded tree: root depth zero, every node occurrence, every atom byte and every structural positional-key byte. Opaque handle internals are never visited. Limits are operational, not value semantics.

func DefaultLimits

func DefaultLimits() Limits

type NativeFactory

type NativeFactory[C any] struct {
	// contains filtered or unexported fields
}

NativeFactory composes a caller-owned leaf policy with shared immutable value structure. capture must recognize/attenuate a leaf without sending, exporting or testing liveness. Ontos never supplies a runtime capability policy.

func NewNativeFactory

func NewNativeFactory[C any](capture func(NativeValue) (C, error)) *NativeFactory[C]

func (*NativeFactory[C]) Capture

func (f *NativeFactory[C]) Capture(value NativeValue) (NativeValue, error)

Capture is shallow: a factory-owned immutable tuple already qualified its children. A tuple made under another policy is not proof under this policy.

func (*NativeFactory[C]) Tuple

func (f *NativeFactory[C]) Tuple(items ...NativeValue) (NativeValue, error)

Tuple captures only its immediate children. Wire-free tuples collapse to the original ground representation. Shared mixed descendants remain shared.

type NativeTuple

type NativeTuple[C any] struct {
	// contains filtered or unexported fields
}

NativeTuple owns structure, not authority. Its factory's private identity proves only that its immediate children were captured by that same policy. Native construction does not unfold sharing or apply Deixis conversion limits.

func (NativeTuple[C]) At

func (t NativeTuple[C]) At(i int) NativeValue

func (NativeTuple[C]) Items

func (t NativeTuple[C]) Items() []NativeValue

func (NativeTuple[C]) Len

func (t NativeTuple[C]) Len() int

type NativeValue

type NativeValue = any

NativeValue is the compact native realization: a ground Atom/Tuple, an immutable NativeTuple[C], or an opaque C recognized by its NativeFactory. The open Go union is checked by Capture; interface satisfaction is insufficient. Ground values keep their native identity. This is not a ground core.Value.

func NativeFromValue

func NativeFromValue[C any](factory *NativeFactory[C], value Value[C], limits Limits) (NativeValue, error)

NativeFromValue explicitly qualifies a bounded Deixis value under a native factory. An opaque handle in Value is never itself evidence of recognition.

func NativeItems

func NativeItems[C any](value NativeValue) ([]NativeValue, bool)

NativeItems observes structure, without establishing capability recognition.

type Payload

type Payload[C any] struct {
	// contains filtered or unexported fields
}

Payload is a closed sum. Its zero value is the tuple's None alternative. Atom storage is an immutable ground Atom; C is retained exactly as supplied. Runtime composition is responsible for supplying send-only faces, not owners.

func BytesPayload

func BytesPayload[C any](atom core.Atom) Payload[C]

func WirePayload

func WirePayload[C any](handle C) Payload[C]

func (Payload[C]) Bytes

func (p Payload[C]) Bytes() ([]byte, bool)

func (Payload[C]) Handle

func (p Payload[C]) Handle() (C, bool)

func (Payload[C]) Kind

func (p Payload[C]) Kind() Kind

type Value

type Value[C any] struct {
	// contains filtered or unexported fields
}

Value is an admitted, immutable mixed value. The zero value is invalid. It exposes no universal equality, hash, codec or operational Wire method. The cached measures count occurrences even when immutable storage is shared.

func Admit

func Admit[C any](node deixis.Node[Payload[C]], limits Limits) (Value[C], error)

Admit recognizes exactly the mixed profile, without normalization. It accepts native immutable deixis nodes rather than invoking arbitrary user tree methods. Known cardinality plus every exact positional key establishes a dense domain; Get avoids copying an unbounded child/key collection merely to check a limit.

func Embed

func Embed[C any](value core.Value, limits Limits) (Value[C], error)

Embed preserves ground values and their exact deixis positional layout. It is total semantically; operational budget exhaustion remains a refusal.

func NewAtom

func NewAtom[C any](bytes []byte, limits Limits) (Value[C], error)

func NewTuple

func NewTuple[C any](items []Value[C], limits Limits) (Value[C], error)

func NewWire

func NewWire[C any](handle C) Value[C]

NewWire does constant structural work: one node, depth zero, zero data/key bytes. Even a nil C is structurally opaque; runtime recognition is separate.

func ProjectNative

func ProjectNative[C any](factory *NativeFactory[C], value NativeValue, limits Limits) (Value[C], error)

ProjectNative explicitly converts a qualified compact value to the bounded Deixis representation. Its limits are structural, never a runtime send budget.

func (Value[C]) At

func (v Value[C]) At(index int, limits Limits) (Value[C], error)

At is a positional observation. Re-admission uses the supplied limits and returns no usable value on failure. This avoids hidden unbounded traversal.

func (Value[C]) Bytes

func (v Value[C]) Bytes() ([]byte, bool)

func (Value[C]) Handle

func (v Value[C]) Handle() (C, bool)

func (Value[C]) Kind

func (v Value[C]) Kind() Kind

func (Value[C]) Len

func (v Value[C]) Len() int

func (Value[C]) Node

func (v Value[C]) Node() (deixis.Node[Payload[C]], bool)

Node exposes the exact immutable deixis representation. Payload accessors copy bytes and preserve opaque C; keys/children are protected by deixis itself.

func (Value[C]) Valid

func (v Value[C]) Valid() bool

Jump to

Keyboard shortcuts

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