event

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentFatalEvent

type AgentFatalEvent struct {
	Reason string
	// contains filtered or unexported fields
}

func NewAgentFatal

func NewAgentFatal(id string, at time.Time, reason string) AgentFatalEvent

func (AgentFatalEvent) EventType

func (AgentFatalEvent) EventType() Type

func (AgentFatalEvent) ProcessID

func (e AgentFatalEvent) ProcessID() string

func (AgentFatalEvent) Timestamp

func (e AgentFatalEvent) Timestamp() time.Time

type BackpressureStallEvent

type BackpressureStallEvent struct {
	Endpoint    string
	WALSize     uint64
	WALSizeMax  uint64
	DroppedMsgs int
	// contains filtered or unexported fields
}

func NewBackpressureStall

func NewBackpressureStall(id string, at time.Time, endpoint string, size, sizeMax uint64, dropped int) BackpressureStallEvent

func (BackpressureStallEvent) EventType

func (BackpressureStallEvent) EventType() Type

func (BackpressureStallEvent) ProcessID

func (e BackpressureStallEvent) ProcessID() string

func (BackpressureStallEvent) Timestamp

func (e BackpressureStallEvent) Timestamp() time.Time

type Bus

type Bus interface {
	Publish(e Event)
	Subscribe(filter Filter) Subscription
}

Bus is the publish/subscribe API for cliwrap events.

Publish is non-blocking. Subscribe returns a Subscription whose Events channel the caller must either drain or Close. Slow subscribers are disconnected after repeated drops by the underlying implementation.

type CrashContext

type CrashContext struct {
	Source    string
	AgentExit int
	AgentSig  int
	ChildExit int
	ChildSig  int
	Reason    string
}

CrashContext summarizes the unified crash information reported to subscribers. It mirrors controller.CrashInfo without creating an import cycle.

type Event

type Event interface {
	EventType() Type
	ProcessID() string
	Timestamp() time.Time
	// contains filtered or unexported methods
}

Event is implemented by every concrete event type in this package. External packages can only consume events; they cannot implement Event.

type Filter

type Filter struct {
	Types      []Type
	ProcessIDs []string
}

Filter is applied by the bus to decide which events a subscriber receives. Empty slices mean "any" — a zero-value Filter matches all events.

func (Filter) Matches

func (f Filter) Matches(e Event) bool

Matches reports whether e satisfies the filter.

type LogChunkEvent

type LogChunkEvent struct {
	Stream uint8
	Size   int
	// contains filtered or unexported fields
}

func NewLogChunk

func NewLogChunk(id string, at time.Time, stream uint8, size int) LogChunkEvent

func (LogChunkEvent) EventType

func (LogChunkEvent) EventType() Type

func (LogChunkEvent) ProcessID

func (e LogChunkEvent) ProcessID() string

func (LogChunkEvent) Timestamp

func (e LogChunkEvent) Timestamp() time.Time

type LogOverflowEvent

type LogOverflowEvent struct {
	Reason string
	// contains filtered or unexported fields
}

func NewLogOverflow

func NewLogOverflow(id string, at time.Time, reason string) LogOverflowEvent

func (LogOverflowEvent) EventType

func (LogOverflowEvent) EventType() Type

func (LogOverflowEvent) ProcessID

func (e LogOverflowEvent) ProcessID() string

func (LogOverflowEvent) Timestamp

func (e LogOverflowEvent) Timestamp() time.Time

type ProcessCrashedEvent

type ProcessCrashedEvent struct {
	CrashContext  CrashContext
	WillRestart   bool
	NextAttemptIn time.Duration
	// contains filtered or unexported fields
}

func NewProcessCrashed

func NewProcessCrashed(id string, at time.Time, c CrashContext, willRestart bool, backoff time.Duration) ProcessCrashedEvent

func (ProcessCrashedEvent) EventType

func (ProcessCrashedEvent) EventType() Type

func (ProcessCrashedEvent) ProcessID

func (e ProcessCrashedEvent) ProcessID() string

func (ProcessCrashedEvent) Timestamp

func (e ProcessCrashedEvent) Timestamp() time.Time

type ProcessStartedEvent

type ProcessStartedEvent struct {
	AgentPID int
	ChildPID int
	// contains filtered or unexported fields
}

func NewProcessStarted

func NewProcessStarted(id string, at time.Time, agentPID, childPID int) ProcessStartedEvent

func (ProcessStartedEvent) EventType

func (ProcessStartedEvent) EventType() Type

func (ProcessStartedEvent) ProcessID

func (e ProcessStartedEvent) ProcessID() string

func (ProcessStartedEvent) Timestamp

func (e ProcessStartedEvent) Timestamp() time.Time

type ProcessStartingEvent

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

func NewProcessStarting

func NewProcessStarting(id string, at time.Time) ProcessStartingEvent

func (ProcessStartingEvent) EventType

func (ProcessStartingEvent) EventType() Type

func (ProcessStartingEvent) ProcessID

func (e ProcessStartingEvent) ProcessID() string

func (ProcessStartingEvent) Timestamp

func (e ProcessStartingEvent) Timestamp() time.Time

type ProcessStoppedEvent

type ProcessStoppedEvent struct {
	ExitCode int
	// contains filtered or unexported fields
}

func NewProcessStopped

func NewProcessStopped(id string, at time.Time, exitCode int) ProcessStoppedEvent

func (ProcessStoppedEvent) EventType

func (ProcessStoppedEvent) EventType() Type

func (ProcessStoppedEvent) ProcessID

func (e ProcessStoppedEvent) ProcessID() string

func (ProcessStoppedEvent) Timestamp

func (e ProcessStoppedEvent) Timestamp() time.Time

type Subscription

type Subscription interface {
	Events() <-chan Event
	Close() error
}

Subscription represents one active subscription. Close releases the underlying channel and goroutine references.

type Type

type Type string

Type identifies an event kind.

const (
	TypeProcessRegistered Type = "process.registered"
	TypeProcessStarting   Type = "process.starting"
	TypeProcessStarted    Type = "process.started"
	TypeProcessStopping   Type = "process.stopping"
	TypeProcessStopped    Type = "process.stopped"
	TypeProcessCrashed    Type = "process.crashed"
	TypeProcessRestarting Type = "process.restarting"
	TypeProcessFailed     Type = "process.failed"

	TypeAgentSpawned      Type = "agent.spawned"
	TypeAgentFatal        Type = "agent.fatal"
	TypeAgentDisconnected Type = "agent.disconnected"

	TypeLogChunk    Type = "log.chunk"
	TypeLogFileRef  Type = "log.file_ref"
	TypeLogOverflow Type = "log.overflow"

	TypeBackpressureStall Type = "reliability.backpressure_stall"

	TypeShutdownRequested  Type = "system.shutdown_requested"
	TypeShutdownIncomplete Type = "system.shutdown_incomplete"
)

Defined event types.

Jump to

Keyboard shortcuts

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