Help us shape the future of Go! Take the 2026 Go Developer Survey

bus

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

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

Bus wraps either an embedded NATS server or an external connection. It exposes a plain *nats.Conn, two JetStream KV buckets, a proto.actor ActorSystem, a CodecRegistry, and a NATSPublisher.

func New

func New(cfg Config) (*Bus, error)

New creates and starts a Bus according to cfg.

func (*Bus) ActorSystem

func (b *Bus) ActorSystem() *actor.ActorSystem

ActorSystem returns the proto.actor ActorSystem.

func (*Bus) AgentKV

func (b *Bus) AgentKV() nats.KeyValue

AgentKV returns the KV bucket for agent/humanoid persistence.

func (*Bus) ClientPort

func (b *Bus) ClientPort() int

ClientPort returns the TCP port external CLI clients can connect to. Returns 0 if no TCP listener is available (e.g. external NATS mode).

func (*Bus) Close

func (b *Bus) Close()

Close shuts down the ActorSystem, drains the connection, and shuts down the embedded server (if any).

func (*Bus) Codecs

func (b *Bus) Codecs() *msg.CodecRegistry

Codecs returns the CodecRegistry.

func (*Bus) Conn

func (b *Bus) Conn() *nats.Conn

Conn returns the underlying NATS connection.

func (*Bus) JS

func (b *Bus) JS() nats.JetStreamContext

JS returns the JetStream context.

func (*Bus) PaneKV

func (b *Bus) PaneKV() nats.KeyValue

PaneKV returns the KV bucket for pane snapshots.

func (*Bus) PipelineKV

func (b *Bus) PipelineKV() nats.KeyValue

PipelineKV returns the KV bucket for pipeline prompt persistence.

func (*Bus) Publisher

func (b *Bus) Publisher() *msg.NATSPublisher

Publisher returns the NATSPublisher for sending typed messages.

func (*Bus) SecretKV

func (b *Bus) SecretKV() nats.KeyValue

SecretKV returns the per-session secret store bucket. It may be nil when JetStream is unavailable, in which case secret resolution falls back to config + environment only.

func (*Bus) VariableKV

func (b *Bus) VariableKV() nats.KeyValue

VariableKV returns the per-session variable store bucket. It may be nil when JetStream is unavailable, in which case variable resolution falls back to config + environment only.

func (*Bus) WorkspaceKV

func (b *Bus) WorkspaceKV() nats.KeyValue

WorkspaceKV returns the KV bucket for workspace state.

type Config

type Config struct {
	Mode        string // "embedded" or "external"
	URL         string // NATS URL, used when Mode == "external"
	DataDir     string // JetStream storage directory (empty = auto)
	SessionName string // used to isolate data dirs per session
	Port        int    // TCP port for embedded NATS server (0 = auto)
}

Config holds the settings needed to initialise a Bus.

Jump to

Keyboard shortcuts

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