eventstream

package
v0.412.4 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event[View any] interface {

	// Handle applies the event to the view
	Handle(view View) (View, error)
}

type EventStream

type EventStream[View any, E Event[View]] interface {
	Publish(ctx context.Context, event E) error

	View() View

	Updates() *pubsub.Topic[E]
}

EventStream is a stream of events that can be published and subscribed to, that update a materialized view

func NewInMemory

func NewInMemory[View any, E Event[View]](initial View) EventStream[View, E]

type StreamView

type StreamView[View any] interface {
	View() View

	// Subscribe to the event stream. The channel will only receive events that are published after the subscription.
	Subscribe(ctx context.Context) <-chan Event[View]
}

StreamView is a view of an event stream that can be subscribed to, without modifying the stream.

type VerboseMessage

type VerboseMessage interface {
	VerboseMessage()
}

Jump to

Keyboard shortcuts

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