event

package
v0.0.0-...-113e83d Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 2 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 interface {
	Name() EventName
}

type EventHandler

type EventHandler interface {
	HandleEvent(database.Database, Event)
}

Implement same logic as in the net/http std lib

type EventHandlerFunc

type EventHandlerFunc func(database.Database, Event)

func (EventHandlerFunc) HandleEvent

func (f EventHandlerFunc) HandleEvent(db database.Database, e Event)

type EventName

type EventName string

EventName type

type EventRegistry

type EventRegistry interface {
	RegisterEventHandler(EventName, EventHandler)
	PushEvent(Event)
	Run(ctx context.Context)
}

EventRegistry is the central point for managing handlers for all kind of events

func NewEventRegistry

func NewEventRegistry(db database.Database) EventRegistry

NewEventRegistry returns an event registry where for each incoming event a list of handlers is called. We use a buffered channel for the worker go routines.

Jump to

Keyboard shortcuts

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