eventbus

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: GPL-3.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package eventbus provides bounded, session-bound input delivery.

Index

Constants

View Source
const InteractionQueueSize = 64

Variables

View Source
var (
	ErrClosed              = errors.New("session input queue is closed")
	ErrTargetUnavailable   = errors.New("session input target is not configured")
	ErrSessionInvalidated  = errors.New("session input session is invalidated")
	ErrSessionInputOverrun = errors.New("session input queue overrun")
)

Functions

This section is empty.

Types

type Broker

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

func New

func New(deliver DeliveryFunc, failure FailureFunc) *Broker

func (*Broker) Apply

func (b *Broker) Apply(values []TargetSet)

Apply replaces the instance-to-plugin routing set. Sessions removed by the replacement are canceled without replaying or retaining their inputs.

func (*Broker) Cancel

func (b *Broker) Cancel(pluginID string, target protocol.InstanceRef, sessionToken string)

Cancel discards all queued input for one exact session and permits a future session with the same identity to start cleanly.

func (*Broker) Close

func (b *Broker) Close()

func (*Broker) Complete

func (b *Broker) Complete(pluginID string, target protocol.InstanceRef, sessionToken string)

Complete retires one exact session after allowing an already-admitted callback to return its disposition. Pending callbacks are discarded.

func (*Broker) PublishSessionInput

func (b *Broker) PublishSessionInput(target protocol.InstanceRef, sessionToken string, input *protocol.SessionInput, occurredAt time.Time) error

func (*Broker) PublishSessionInputAndWait

func (b *Broker) PublishSessionInputAndWait(
	ctx context.Context,
	target protocol.InstanceRef,
	sessionToken string,
	input *protocol.SessionInput,
	occurredAt time.Time,
) (protocol.SessionInputResult, error)

PublishSessionInputAndWait preserves FIFO ordering while waiting for the exact callback disposition. It is used only for Back press first refusal.

func (*Broker) Status

func (b *Broker) Status() []Status

type Failure

type Failure struct {
	PluginID string
	Request  protocol.SessionInputRequest
	Reason   FailureReason
	Err      error
}

type FailureFunc

type FailureFunc func(context.Context, Failure)

type FailureReason

type FailureReason string
const (
	FailureDelivery FailureReason = "delivery_failed"
	FailureOverrun  FailureReason = "overrun"
)

type Status

type Status struct {
	PluginID      string `json:"plugin_id"`
	QueueDepth    int    `json:"queue_depth"`
	LastSequence  uint64 `json:"last_sequence,omitempty"`
	Overruns      uint64 `json:"overruns"`
	LastErrorCode string `json:"last_error_code,omitempty"`
}

type TargetSet

type TargetSet struct {
	PluginID    string
	InstanceIDs []string
}

Jump to

Keyboard shortcuts

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