spinesink

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package spinesink adapts the dispatch waist to the event spine: it implements dispatch.EventSink by translating each dispatched action's lifecycle events into spine events on a run's stream. It is the glue between two ports, so it lives outside both - keeping the spine core free of any dependency on dispatch or state (which would otherwise form an import cycle).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EgressSink

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

EgressSink records netguard's egress decisions onto a run's spine stream as net.egress events, so a run's outbound network verdicts are part of the same recorded history as its governed actions. Construct one per run with that run's stream id and install it on the run's context with netguard.WithObserver, so every dial netguard makes under that context reports here. A run that makes no netguard-gated egress (a local, loopback model, say) records nothing, so the egress row stays silent.

func NewEgress

func NewEgress(log spine.Log, stream string) *EgressSink

NewEgress returns an EgressSink that writes egress decisions to log on the given stream, attributed to the agent.

func (*EgressSink) Observe

func (s *EgressSink) Observe(d netguard.Decision)

Observe is a netguard.Observer: it appends one net.egress event per decision, naming the destination host, the verdict (allowed or blocked), and the reason. It runs on a dial goroutine, so it uses a background context (a cancelled dial still records its verdict) and drops a failed append rather than surfacing it: the record is observability, and the dial's own allow/deny already enforced the policy.

type Sink

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

Sink records the dispatch waist's lifecycle events (start/end/rejected) onto a spine stream. Construct one per run with that run's stream id, then pass it via dispatch.WithEventSink - every action that run dispatches is then captured on the spine.

func New

func New(log spine.Log, stream string) *Sink

New returns a Sink that writes dispatch events to log on the given stream, attributed to the agent.

func (*Sink) Append

func (s *Sink) Append(ctx context.Context, e dispatch.Event) error

Append implements dispatch.EventSink by translating a dispatch event into a spine event. The dispatcher's timestamp (e.At, unix nanos) is preserved so the two layers agree on time.

Jump to

Keyboard shortcuts

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