memory

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package memory provides an in-process backplane using Go channels. Intended for testing multi-node scenarios in a single process.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backplane

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

Backplane is an in-process backplane that broadcasts messages via Go channels. All subscribers in the same process receive every message.

func New

func New(nodeID string) *Backplane

New creates a standalone Backplane that only delivers to its own subscribers.

func NewWithHub

func NewWithHub(nodeID string, hub *Hub) *Backplane

NewWithHub creates a Backplane connected to hub so that published messages are delivered to all other backplanes registered on the same hub.

func (*Backplane) Close

func (b *Backplane) Close() error

func (*Backplane) Publish

func (b *Backplane) Publish(_ context.Context, msg backplane.Message) error

func (*Backplane) Subscribe

func (b *Backplane) Subscribe(handler backplane.Handler) (cancel func(), err error)

type Hub

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

Hub connects multiple in-process Backplane instances so that a message published by one is delivered to all others. Use NewHub to create a hub, then NewWithHub to create backplanes that share it.

func NewHub

func NewHub() *Hub

NewHub creates a shared hub for connecting multiple in-process backplanes.

Jump to

Keyboard shortcuts

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