loops

package
v1.19.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RootFactory         = loop.New[EventRoot](64)
	CategoryFactory     = loop.New[EventCategory](32)
	InstanceFactory     = loop.New[EventInstance](8)
	MCPServerFactory    = loop.New[EventMCPServer](8)
	HTTPEndpointFactory = loop.New[EventHTTPEndpoint](8)
)

Factories pool segments and loops to reduce GC pressure under load. Segment sizes match the expected event rate at each level.

Functions

This section is empty.

Types

type AddHTTPEndpoint

type AddHTTPEndpoint struct {
	Endpoint httpendpointsapi.HTTPEndpoint
	Result   chan<- error
	// contains filtered or unexported fields
}

AddHTTPEndpoint adds an HTTP endpoint. Routed by the root loop to the per-name HTTPEndpoint loop so events for one endpoint name serialise in submission order. The event satisfies both EventRoot (so callers enqueue at the root) and EventHTTPEndpoint (so the per-name loop can pull it).

type AddMCPServer

type AddMCPServer struct {
	Server mcpserverapi.MCPServer
	Result chan<- error
	// contains filtered or unexported fields
}

AddMCPServer adds an MCP server. Routed by the root loop to the per-name MCPServer loop so that all events for a given name serialise in submission order. The event satisfies both EventRoot (so callers can enqueue at the root) and EventMCPServer (so the per-name loop can pull it off its queue).

type Barrier

type Barrier struct {
	Done chan struct{}
	// contains filtered or unexported fields
}

Barrier resolves once it has been processed by the root loop. Used to flush outstanding events without blocking on a per-resource result.

type Close

type Close struct {
	Component compapi.Component
	Result    chan<- error
	// contains filtered or unexported fields
}

Close asks the named instance to close a component. Result receives one error and is buffered cap 1.

type DeleteMCPServer

type DeleteMCPServer struct {
	Name string
	Done chan struct{}
	// contains filtered or unexported fields
}

DeleteMCPServer removes an MCP server by name. Same routing rules as AddMCPServer: enqueued at the root, processed on the per-name loop, so Delete strictly follows any Adds that were enqueued before it.

type EventCategory

type EventCategory interface {
	// contains filtered or unexported methods
}

EventCategory is the universe of events a per-category loop handles.

type EventHTTPEndpoint

type EventHTTPEndpoint interface {
	// contains filtered or unexported methods
}

EventHTTPEndpoint is the universe of events a per-name HTTPEndpoint loop handles. Same reasoning as EventMCPServer: HTTPEndpoint secret resolution can do real network I/O against the configured secret store, so events for one endpoint name run on their own lane.

type EventInstance

type EventInstance interface {
	// contains filtered or unexported methods
}

EventInstance is the universe of events a per-instance loop handles.

type EventMCPServer

type EventMCPServer interface {
	// contains filtered or unexported methods
}

EventMCPServer is the universe of events a per-name MCPServer loop handles. MCPServers have no component category but still need per-name FIFO ordering so that an Add followed by a Delete (or two Adds) for the same name are processed in submission order.

type EventRoot

type EventRoot interface {
	// contains filtered or unexported methods
}

EventRoot is the universe of events the root processor loop handles.

type HTTPEndpointAdded

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

HTTPEndpointAdded is the per-name HTTPEndpoint loop's notification back to the root loop that an Add has finished (secret resolution + compstore write). Used to decrement the root's in-flight counter so Barrier completion can fire once every queued Add has drained.

type Init

type Init struct {
	Component compapi.Component
	Result    chan<- error
	Internal  bool
	Timeout   time.Duration
	// contains filtered or unexported fields
}

Init asks the named instance to initialise a component. Result receives one error and is buffered cap 1. Internal is set when the root loop re-enqueues a dependent component after its parent secret store comes online; it suppresses double counting in the root's in-flight counter. Timeout bounds the actual component init on the instance loop; when zero the instance applies no deadline.

type InitProgrammaticSubscriptions

type InitProgrammaticSubscriptions struct {
	Result chan<- error
	// contains filtered or unexported fields
}

type InstanceInitDone

type InstanceInitDone struct {
	Category string
	Name     string
	Err      error
	UserChan chan<- error
	// contains filtered or unexported fields
}

InstanceInitDone is sent from the root's finalizer goroutine back into the root loop after a category/instance init completes. The root uses this to flush dependents waiting on a secret store coming online.

type MCPServerRegistered

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

MCPServerRegistered is the per-name MCPServer loop's notification back to the root loop that an Add has finished its slow path (secret resolution + compstore write + workflow registration). The root uses it to decrement its in-flight counter so Barrier completion can fire once every queued Add has drained.

type ReloadDeclaredAppSubscription

type ReloadDeclaredAppSubscription struct {
	Name       string
	PubSubName string
	Result     chan<- error
	// contains filtered or unexported fields
}

type ReloadPubSub

type ReloadPubSub struct {
	Name   string
	Result chan<- error
	// contains filtered or unexported fields
}

type Shutdown

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

Shutdown is the sentinel passed to loop.Close at every level.

type StartAppSubscriptions

type StartAppSubscriptions struct {
	Result chan<- error
	// contains filtered or unexported fields
}

type StartInput

type StartInput struct {
	Result chan<- error
	// contains filtered or unexported fields
}

StartInput tells one binding instance to begin reading from the underlying input binding.

type StartReadingFromBindings

type StartReadingFromBindings struct {
	Result chan<- error
	// contains filtered or unexported fields
}

StartReadingFromBindings enables app reads for every binding instance.

type StartStreamerSubscription

type StartStreamerSubscription struct {
	Subscription *subapi.Subscription
	ConnectionID rtpubsub.ConnectionID
	Result       chan<- error
	// contains filtered or unexported fields
}

type StopAllSubscriptionsForever

type StopAllSubscriptionsForever struct {
	Done chan struct{}
	// contains filtered or unexported fields
}

type StopAppSubscriptions

type StopAppSubscriptions struct {
	Done chan struct{}
	// contains filtered or unexported fields
}

type StopInput

type StopInput struct {
	Done chan struct{}
	// contains filtered or unexported fields
}

StopInput tells one binding instance to stop reading.

type StopPubSub

type StopPubSub struct {
	Name string
	Done chan struct{}
	// contains filtered or unexported fields
}

type StopReadingFromBindings

type StopReadingFromBindings struct {
	Forever bool
	Done    chan struct{}
	// contains filtered or unexported fields
}

StopReadingFromBindings stops every binding instance. Forever marks the category as permanently stopped so future Init events do not start reading.

type StopStreamerSubscription

type StopStreamerSubscription struct {
	Subscription *subapi.Subscription
	ConnectionID rtpubsub.ConnectionID
	Done         chan struct{}
	// contains filtered or unexported fields
}

type SubscriptionAdd

type SubscriptionAdd struct {
	Subscription subapi.Subscription
	Result       chan<- error
	// contains filtered or unexported fields
}

SubscriptionAdd adds a declarative subscription. Routes to the pubsub category loop.

type SubscriptionClose

type SubscriptionClose struct {
	Subscription subapi.Subscription
	Result       chan<- error
	// contains filtered or unexported fields
}

SubscriptionClose closes a declarative subscription.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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