executor

package
v0.2.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Overview

Package executor runs guest programs for one dispatcher control session at a time.

A node holds what must survive a reconnect: the packet counter, the TESLA key schedule and this executor's configured identity. It reserves one session at a time, so a successor exists only after the previous session's cleanup has joined. A session owns what belongs to one control binding: the executor state, the control transport and the scheduler loop.

The transport decides whether a binding still holds authority. A binding is armed while its lease is valid; admission and each step of execution recheck it, and the scheduler's insert and start commits are guarded by it, because an Allocate reply, a compilation or a STARTED acknowledgement can return after the authority that ordered it has expired. Work keeps the binding it was admitted under: after a reconnect the successor quarantines the rows of the session it replaced instead of running them, and it neither delivers nor releases the terminal results that session retained.

Stopping a session cancels running work and starts both cleanup domains, the scheduler's and the transport's, before joining either. A bounded Wait that expires abandons neither: the local outcome stays unknown, the node reservation is kept, and nothing may be deleted, upgraded or closed on the strength of it. What storage still holds afterwards is that executor's disposition: accepted queued rows stay persisted and are never replayed, and a terminal result whose delivery was not acknowledged stays retained for a later reconciliation pass under its own binding.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNodeClosed = errors.New("executor node is closed")
	ErrNodeBusy   = errors.New("executor node has an unjoined session")
)

Functions

This section is empty.

Types

type Executor

type Executor struct {
	Bidi *rpc.BidiClient
	// contains filtered or unexported fields
}

func (*Executor) Listen

func (e *Executor) Listen(parent context.Context) error

func (*Executor) OnAbort

func (e *Executor) OnAbort(ctx context.Context, binding controlsession.Binding, req *pb.AbortRequest) (*pb.AbortResponse, error)

func (*Executor) OnBandwidth

func (e *Executor) OnBandwidth(ctx context.Context, binding controlsession.Binding, req *pb.BandwidthRequest) (*pb.BandwidthResponse, error)

func (*Executor) OnDebugletFailed

func (e *Executor) OnDebugletFailed(ctx context.Context, spec scheduler.Spec, err error) scheduler.Completion

func (*Executor) OnDebugletStart

func (e *Executor) OnDebugletStart(ctx context.Context, spec scheduler.Spec) scheduler.Completion

func (*Executor) OnHello

func (e *Executor) OnHello(ctx context.Context, req *pb.HelloRequest) (*pb.HelloResponse, error)

func (*Executor) OnInspectRetainedRun

OnInspectRetainedRun reads one stored run under the caller's exact session. It schedules, starts, finalizes, deletes and pays for nothing, and it never loads the stored program. A read failure or an unsupported backend is an error, never a successful missing-row answer.

func (*Executor) OnUpload

func (e *Executor) OnUpload(ctx context.Context, binding controlsession.Binding, req *pb.UploadRequest) (*pb.UploadResponse, error)

func (*Executor) WaitResourcesReady

func (e *Executor) WaitResourcesReady(ctx context.Context) error

WaitResourcesReady waits for the first successful positive-capacity Resources acknowledgement, or the terminal startup error. Discovery heartbeat readiness is deliberately a separate dispatcher state.

type Node

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

Node retains the resource identity which must survive network reconnects. Its one session reservation is lifecycle ownership, never lease authority.

func NewNode

func NewNode(cfg *config.ExecutorConfig, logger *zap.Logger, db *sql.DB) (*Node, error)

NewNode records the TESLA chain this start uses in db before it acquires the packet counter, so every chain the executor started is on record.

func (*Node) Close

func (n *Node) Close() error

Close permanently closes new node admission. A busy result consumes nothing: a later call still closes the resources once the session has joined.

type RunningDebuglet

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

type Session

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

Session owns local completion. Binding, deadlines and first loss cause exist only in executor.Bidi; this type never reconstructs lease authority.

func NewSession

func NewSession(node *Node, db *sql.DB) (*Session, error)

NewSession returns a session only once its scheduler guards and the one lease controller they commit under are wired. Its restore policy accepts no stored binding, so every row an earlier session left is quarantined.

func (*Session) Cause

func (s *Session) Cause() error

func (*Session) Lost

func (s *Session) Lost() <-chan struct{}

func (*Session) Run

func (s *Session) Run(parent context.Context) error

Run reports why this session ended; Wait separately reports whether all local work joined cleanly. Restore precedes all network and fresh queue execution.

func (*Session) Stop

func (s *Session) Stop(cause error)

Stop revokes the transport's eligibility at once and cancels running work, then starts both owned cleanup domains; cleanup joins them.

func (*Session) Wait

func (s *Session) Wait(ctx context.Context) error

Wait bounds only the caller's join. A timeout never abandons the cleanup that is running, releases the node reservation, or permits database closure underneath SQL.

A nil error is the join itself: local ownership finished and the retained state is nobody's any more. Any other outcome, an expired bound included, leaves the local outcome unknown, and nothing may be deleted, upgraded or closed on the strength of it. Either way what storage holds is this package's ordinary disposition of stopped work.

func (*Session) WaitResourcesReady

func (s *Session) WaitResourcesReady(ctx context.Context) error

Directories

Path Synopsis
netpolicy
Package netpolicy holds the one network policy the executor applies to guest traffic: which transports a guest may use, which destinations it may reach, and on which ports.
Package netpolicy holds the one network policy the executor applies to guest traffic: which transports a guest may use, which destinations it may reach, and on which ports.
wasm
Package wasm contains the WASM host function implementations that are imported by WASM modules at runtime.
Package wasm contains the WASM host function implementations that are imported by WASM modules at runtime.
app
cleanup
Package cleanup identifies packet-counter disposal failures without introducing a dependency between the counter implementations and their factory.
Package cleanup identifies packet-counter disposal failures without introducing a dependency between the counter implementations and their factory.
memory
Package memory is the in-memory admission core both executor schedulers use.
Package memory is the in-memory admission core both executor schedulers use.
sqlite
Package sqlite keeps one executor's persisted work and terminal results across restarts without silently running stored work again.
Package sqlite keeps one executor's persisted work and terminal results across restarts without silently running stored work again.
Package tagger provides a transparent IPv4 IPID tagger that injects a 16-bit TESLA-derived authentication tag into every outgoing IPv4 packet.
Package tagger provides a transparent IPv4 IPID tagger that injects a 16-bit TESLA-derived authentication tag into every outgoing IPv4 packet.
ebpf
Package ebpf provides an eBPF-based IPv4 IPID tagger for Linux.
Package ebpf provides an eBPF-based IPv4 IPID tagger for Linux.
tesla
Package tesla implements a TESLA-inspired hash-chain key schedule for delayed disclosure of packet authentication keys.
Package tesla implements a TESLA-inspired hash-chain key schedule for delayed disclosure of packet authentication keys.
transport
rpc

Jump to

Keyboard shortcuts

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