recstream

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package recstream broadcasts pressure-driven RecommendationEvents from the daemon's ingest loop to subscribers (the /api/recommendations/live SSE handler and, in B3b, the ccx run --supervise process).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hub

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

Hub fans out RecommendationEvents to active subscribers.

func NewHub

func NewHub() *Hub

NewHub creates an empty recommendation event hub.

func (*Hub) Close

func (h *Hub) Close()

Close closes all subscriber channels and prevents future publishing.

func (*Hub) Publish

func (h *Hub) Publish(ev contracts.RecommendationEvent)

Publish broadcasts ev to subscribers without blocking on slow receivers.

func (*Hub) Subscribe

func (h *Hub) Subscribe(ctx context.Context) <-chan contracts.RecommendationEvent

Subscribe registers a subscriber until ctx is canceled or the hub closes.

type StateMachine

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

StateMachine tracks the last pressure band observed per profile.

func NewStateMachine

func NewStateMachine() *StateMachine

NewStateMachine creates a pressure-band state machine.

func (*StateMachine) Observe

func (sm *StateMachine) Observe(profile string, pct float64) (bool, contracts.RecommendationLevel)

Observe records profile's current pressure and reports upward threshold crossings.

Jump to

Keyboard shortcuts

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