eventbus

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package eventbus publishes the app's events to the broker that lodge embeds (lodge ADR-0022, and hearth's events/broker).

The transport dials the broker on the first event, and it dials again after a dial that failed, so that frostmarksd starts and serves its API while the broker is not there yet: the outbox keeps each event, and the relay's next drain publishes it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn interface {
	// Transport publishes 1 event, and it returns nil only once the broker
	// holds it.
	events.Transport
	// Close closes the connection.
	Close()
}

Conn is a connection to the broker: hearth's broker transport, which closes its connection when the app stops.

type Transport

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

Transport is the app's transport to lodge's broker. It dials the broker when it has the first event to publish, and not before.

func New

func New(opts broker.Options) *Transport

New returns the transport to the broker on the socket of opts.

func (*Transport) Close

func (t *Transport) Close()

Close closes the connection to the broker, when the transport holds 1. The broker holds every event that Publish acknowledged, so a close loses no event.

func (*Transport) Publish

func (t *Transport) Publish(ctx context.Context, e events.Event) error

Publish publishes 1 event, and it dials the broker when the transport holds no connection.

A dial that fails returns its error, so the relay keeps the event's row and tries again at its next drain.

Jump to

Keyboard shortcuts

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