streaming

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventFilter

type EventFilter struct {
	WorkflowID string   `json:"workflow_id,omitempty"`
	EventTypes []string `json:"event_types,omitempty"`
}

EventFilter specifies which events a subscriber wants to receive.

type EventHub

type EventHub interface {
	Publish(ctx context.Context, event StreamEvent) error
	Subscribe(ctx context.Context, filter EventFilter) (<-chan StreamEvent, func(), error)
}

EventHub provides pub/sub for real-time workflow events.

type MemoryHub

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

MemoryHub is an in-memory EventHub implementation using channels.

func NewMemoryHub

func NewMemoryHub() *MemoryHub

NewMemoryHub creates a new MemoryHub.

func (*MemoryHub) Publish

func (h *MemoryHub) Publish(ctx context.Context, event StreamEvent) error

Publish sends an event to all matching subscribers. Non-blocking: if a subscriber's channel is full the event is dropped.

func (*MemoryHub) Subscribe

func (h *MemoryHub) Subscribe(ctx context.Context, filter EventFilter) (<-chan StreamEvent, func(), error)

Subscribe creates a new subscription filtered by the given EventFilter. Returns a receive-only channel, a cancel function, and any error.

type StreamEvent

type StreamEvent struct {
	WorkflowID string `json:"workflow_id"`
	StepID     string `json:"step_id,omitempty"`
	EventType  string `json:"event_type"`
	Payload    any    `json:"payload,omitempty"`
}

StreamEvent is a real-time event emitted during workflow execution.

Jump to

Keyboard shortcuts

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