Documentation ¶
Index ¶
- Variables
- type EventBus
- func (eb *EventBus) Get(id int64) (events.Event, error)
- func (eb *EventBus) GetAll(reverse bool) <-chan events.Event
- func (eb *EventBus) Publish(evt events.EventTypeDetails) int64
- func (eb *EventBus) Subscribe(kind events.EventType) (Subscription, error)
- func (eb *EventBus) Unsubscribe(sub Subscription)
- type Subscription
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEventKindNotFound = errors.New("eventbus: event kind does not exist") ErrEventNotFound = errors.New("eventbus: event could not be found") )
Functions ¶
This section is empty.
Types ¶
type EventBus ¶
type EventBus struct {
// contains filtered or unexported fields
}
EventBus is a central handler for all things related to events within the application.
func New ¶
func New(storage storage.DB, retention time.Duration, pruneInterval time.Duration) (*EventBus, error)
New create a new instance of the eventbus and populates the log from disk.
func (*EventBus) Get ¶
Get returns a single event by id. Returns a eventbus.ErrEventNotFound if the event could not be located.
func (*EventBus) GetAll ¶
GetAll returns all events. Returns events from oldest to newest unless reverse parameter is set.
func (*EventBus) Publish ¶
func (eb *EventBus) Publish(evt events.EventTypeDetails) int64
Publish allows caller to emit a new event to the eventbus. Might block until it can publish to all listeners.
func (*EventBus) Subscribe ¶
func (eb *EventBus) Subscribe(kind events.EventType) (Subscription, error)
Subscribe returns a channel in which the caller can listen for all events of a particular type.
func (*EventBus) Unsubscribe ¶
func (eb *EventBus) Unsubscribe(sub Subscription)
type Subscription ¶
Subscription is a representation of a new Subscription to a certain topic.
Click to show internal directories.
Click to hide internal directories.