coordination

package
v0.2.0-alpha.9 Latest Latest
Warning

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

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

Documentation

Overview

Package coordination adapts the shared Redis primitives in internal/infra/coordination to the server's own interfaces: the stream hub the SSE handler reads, the event bus the connection registry broadcasts through, and the turn locker the turn queue holds. It is the server-side half of docs/design/server-coordination.md; the infra half stays free of server types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventBus

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

EventBus is the Redis-backed connection-event fan-out. PublishEvent sends a broadcast to every replica; Incoming carries the broadcasts this replica must deliver to its own connections.

func NewEventBus

func NewEventBus(ctx context.Context, backend *infra.Backend) *EventBus

NewEventBus subscribes to the shared events channel for the server's lifetime.

func (*EventBus) Incoming

func (e *EventBus) Incoming() <-chan []byte

func (*EventBus) PublishEvent

func (e *EventBus) PublishEvent(payload []byte)

type StreamHub

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

StreamHub is the Redis-backed websocket.StreamHub.

func NewStreamHub

func NewStreamHub(ctx context.Context, backend *infra.Backend) *StreamHub

NewStreamHub returns a stream hub bound to the server's lifetime ctx.

func (*StreamHub) Append

func (h *StreamHub) Append(taskID, delta string)

func (*StreamHub) Buffer

func (h *StreamHub) Buffer(taskID string) string

func (*StreamHub) Done

func (h *StreamHub) Done(taskID string)

func (*StreamHub) Subscribe

func (h *StreamHub) Subscribe(taskID string) (<-chan string, func())

type TurnLocker

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

TurnLocker is the Redis-backed turnqueue.Locker.

func NewTurnLocker

func NewTurnLocker(backend *infra.Backend) *TurnLocker

NewTurnLocker returns a locker over the coordination backend.

func (*TurnLocker) Acquire

func (l *TurnLocker) Acquire(ctx context.Context, conversationID string) (turnqueue.Lease, error)

Jump to

Keyboard shortcuts

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