hydrated

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 8 Imported by: 1 module, 0 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 hydrated realizes bitwire decision 0019, the hydrated wire protocol's first edition, over bitwire's public hydrated declarations and its shared pure codec. The codec owns the grammar, validation and bounds; this package owns export ids and staging, reference recognition, liveness and endpoints.

A Scope is one participant's hydration state for one incarnation. Its dispatcher owns the participant's addressed receive slot and hands the Scope every value addressed to the participant's own path, with the received context the composition establishes. Domain code sees only Values, Wires and Endpoints.

Index

Constants

This section is empty.

Variables

View Source
var DefaultLimits = Limits{Exports: 64, Nodes: 4096, Depth: 64, Bytes: 1 << 20}

DefaultLimits are finite defaults; a composition configures its own.

Functions

func Items

Items observes any tuple's immutable children; it confers no authority.

func NewTuple

func NewTuple(items ...wire.HydratedValue) (wire.HydratedValue, error)

NewTuple captures immediate children under the runtime's sending-face policy.

Types

type Endpoint

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

Endpoint is a local HydratedEndpoint: one receiver, ordered non-inline dispatch, a bounded queue and an owner lifetime. Its sending face is what a value carries; closing it ends its export in every scope (D7).

func NewEndpoint

func NewEndpoint(limit int) *Endpoint

NewEndpoint creates an endpoint whose queue admits at most limit values. A bound below one is a programming error.

func (*Endpoint) Close

func (e *Endpoint) Close() error

Close ends the endpoint and withdraws its export from every scope.

func (*Endpoint) Closed

func (e *Endpoint) Closed() <-chan struct{}

Closed is closed when the endpoint closes.

func (*Endpoint) Receive

func (e *Endpoint) Receive(handler func(wire.HydratedValue, wire.ReceivedContext)) (detach func(), err error)

Receive attaches the one receiver. Values are dispatched in admission order, never inline with the admitting send.

func (*Endpoint) Send

func (e *Endpoint) Send(v wire.HydratedValue) error

Send admits a value locally, as its sending face does.

func (*Endpoint) Termination

func (e *Endpoint) Termination() wire.Termination

Termination reports how the endpoint ended, as bitwire's Endpoint contract does: "failed" with the receiver's failure, or "closed". It is the zero value while the endpoint is open. The first termination is final: it is set before Closed is closed, and a receiver failing after Close leaves it "closed".

func (*Endpoint) Wire

func (e *Endpoint) Wire() wire.HydratedWire

wire.HydratedWire is the endpoint's sending face.

type Limits

type Limits struct{ Exports, Nodes, Depth, Bytes int }

Limits bounds a scope (D8).

type Local

type Local struct{}

Local is the context of a send that never left the process.

type Namespace

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

Namespace identifies one set of participants addressed by absolute paths. Proxies remember theirs, so recognition is runtime-wide within it (D6).

func NewNamespace

func NewNamespace(name string) *Namespace

NewNamespace creates a namespace.

type Reference

type Reference struct {
	Path      wire.Path
	Scope, ID ontos.Atom
}

Reference is the ground form of a live wire.HydratedWire (D2, D3).

func ReadReference

func ReadReference(v ontos.Value) (Reference, error)

ReadReference reads a reference payload.

func (Reference) Payload

func (r Reference) Payload() (ontos.Value, error)

Payload is the reference's ground payload ((path...), scope, id), for composition bootstrap over ground data.

type Refusal

type Refusal string

Refusal names a refusal. At the owner it is a host diagnostic; at the sender it refuses the send before admission. It is never an outcome (D8).

const (
	MalformedFrame   Refusal = "malformed-frame"
	StaleScope       Refusal = "stale-scope"
	UnknownExport    Refusal = "unknown-export"
	Limit            Refusal = "limit"
	TargetRefused    Refusal = "target-refused"
	Unexportable     Refusal = "unexportable"
	ForeignNamespace Refusal = "foreign-namespace"
	ScopeEnded       Refusal = "scope-ended"
)

func (Refusal) Error

func (r Refusal) Error() string

type Scope

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

Scope is one participant's hydration state for one incarnation (Terms).

func NewScope

func NewScope(ns *Namespace, path wire.Path, sender wire.AddressedWire, limits Limits) (*Scope, error)

NewScope creates a scope at path in ns with a fresh random token. sender carries frames to owner paths; the composition supplies its routing.

func (*Scope) Close

func (s *Scope) Close()

Close ends the scope: its exports end and its references go stale. It closes no domain endpoint.

func (*Scope) Connect

func (s *Scope) Connect(r Reference) wire.HydratedWire

Connect returns a proxy for a reference, for composition bootstrap.

func (*Scope) Deliver

func (s *Scope) Deliver(path wire.Path, message ontos.Value, ctx wire.ReceivedContext) error

Deliver decides one value addressed to this participant's own path (D4). The returned refusal is a host diagnostic; nothing is sent back.

func (*Scope) Expose

func (s *Scope) Expose(e *Endpoint) (Reference, error)

Expose exports an endpoint's face for composition bootstrap, such as a service's well-known reference. Domain adapters never call it.

func (*Scope) Live

func (s *Scope) Live() int

Live reports the number of live exports.

func (*Scope) Token

func (s *Scope) Token() ontos.Atom

Token is the scope token.

Jump to

Keyboard shortcuts

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