Documentation
¶
Overview ¶
Package messaging delivers intermediate input through dispatcher Effects. Message freezes one recipient, optional WaitKey, and payload. Dispatcher derives a SignalID from the sending EffectID and uses one host-bound DeliveryPort to admit it. The recipient's Log owns deduplication and admission.
The port must authorize sender and recipient, validate the receiver's contract, and preserve the concrete destination across replay. A duplicate admission is successful delivery. Every port error remains uncertain because it cannot disprove an earlier admission, including when the recipient is now terminal. A port can reconcile exact SignalAdmitted records before reporting an error. A missing record in a stale Log establishes nothing.
SameIdentity replay retains the exact Signal. No cross-tree transaction or runtime-attested origin is implied. Strategies controlling direct children use run.NewChildSignalEffect instead; this capability serves host-authorized delivery across other ownership boundaries.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidMessage = errors.New("messaging: invalid message")
var ErrNilDeliveryPort = errors.New("messaging: delivery port is required")
ErrNilDeliveryPort rejects construction without a delivery authority.
Functions ¶
This section is empty.
Types ¶
type DeliveryPort ¶
type DeliveryPort interface {
Deliver(ctx context.Context, sender, recipient run.ProcessID, signal run.Signal) error
}
DeliveryPort admits one Signal to the supplied concrete recipient. The implementation owns destination authority and payload validation, preserves the recipient across replay, and uses atomic single-Signal admission. A nil error confirms that this exact Signal was admitted, either by this call or an earlier identical delivery. New and duplicate admissions share the same acknowledgment contract; the mailbox owns admission accounting. Errors never prove the message was not admitted by this attempt or a previous one. Calls must honor ctx, be bounded and concurrency-safe, and may reconcile authoritative receipts before reporting a terminal recipient error. Retention must preserve identity conflicts and admission evidence for the entire replay obligation.
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher delivers each frozen Message under one Effect-derived SignalID. It owns no retry loop, mailbox, routing registry, or background work. For valid Runtime requests, local rejection settles Failed with a typed diagnostic. Success carries Receipt; every DeliveryPort error remains unknown because it cannot disprove an earlier admission.
func NewDispatcher ¶
func NewDispatcher(config DispatcherConfig) (*Dispatcher, error)
func (*Dispatcher) Dispatch ¶
func (d *Dispatcher) Dispatch(ctx context.Context, request run.EffectRequest, _ run.DeltaEmitter) (run.Settlement, error)
Dispatch requires a non-nil context and panics if ctx is nil.
func (*Dispatcher) Policy ¶ added in v0.44.0
func (d *Dispatcher) Policy(effect run.Effect) run.EffectPolicy
type DispatcherConfig ¶
type DispatcherConfig struct {
Port DeliveryPort
}
DispatcherConfig binds the only delivery authority used by this Dispatcher. Its policy and routing configuration belong in the Program's exact binding.
type Message ¶
type Message struct {
Recipient run.ProcessID `json:"recipient"`
WaitKey *run.WaitKey `json:"wait_key,omitzero"`
Payload run.Payload `json:"payload"`
}
Message is a request to deliver one input to a concrete Process address. Recipient and WaitKey must remain bound to this payload across restoration.