Help us shape the future of Go! Take the 2026 Go Developer Survey

live

package
v0.1.0-alpha.4 Latest Latest
Warning

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

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

Documentation

Overview

Package live provides the ephemeral real-time side of the event API. NATS carries wakeups and preview deltas; PostgreSQL remains authoritative.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

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

Broker owns one reconnecting Core NATS connection. Core NATS is deliberately used without JetStream: notifications and previews are ephemeral, while any missed persisted-event wakeup is repaired from PostgreSQL.

func Connect

func Connect(url string) (*Broker, error)

func (*Broker) Close

func (b *Broker) Close()

func (*Broker) NotifySession

func (b *Broker) NotifySession(_ context.Context, sessionID string) error

func (*Broker) PublishPreview

func (b *Broker) PublishPreview(
	_ context.Context,
	sessionID string,
	frame domain.PreviewFrame,
) error

PublishPreview emits a best-effort preview frame. A lost or duplicated preview never changes the authoritative event history.

type Stream

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

Stream turns NATS wakeups into cursor reads from PostgreSQL. It also forwards preview frames only to subscribers that opted into their event type.

func NewStream

func NewStream(
	store *pg.Store,
	broker *Broker,
	ids domain.IDGenerator,
	clock domain.Clock,
	reconcileInterval time.Duration,
) *Stream

func (*Stream) SubscribeContext

func (s *Stream) SubscribeContext(
	parent context.Context,
	sessionID string,
	deltaOptIn map[string]bool,
) (<-chan app.Frame, func(), error)

func (*Stream) SubscribeThreadContext

func (s *Stream) SubscribeThreadContext(
	parent context.Context,
	sessionID string,
	threadID string,
	deltaOptIn map[string]bool,
) (<-chan app.Frame, func(), error)

Jump to

Keyboard shortcuts

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