Documentation
¶
Overview ¶
Package eventbus provides a synchronous, typed event bus for decoupling components that currently rely on scattered SetXxxCallback() wiring.
Events are dispatched synchronously in registration order. The bus is safe for concurrent use; Subscribe takes a write lock, Publish takes a read lock.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SubscribeTyped ¶
SubscribeTyped is a generic helper that provides type-safe subscription. It registers a handler that automatically type-asserts the event before calling the typed handler function.
Types ¶
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
Bus is a synchronous typed event bus.
func (*Bus) Publish ¶
Publish sends an event to all registered handlers synchronously. If no handlers are registered for the event, it is silently ignored.
func (*Bus) Subscribe ¶
func (b *Bus) Subscribe(eventName string, handler HandlerFunc)
Subscribe registers a handler for a specific event name.
type ContentSavedEvent ¶
type ContentSavedEvent struct {
ID string
Collection string
Content string
Metadata map[string]string
Source string // "knowledge" or "memory"
}
ContentSavedEvent is published when knowledge or memory content is saved. Replaces: SetEmbedCallback, SetGraphCallback on knowledge and memory stores.
func (ContentSavedEvent) EventName ¶
func (e ContentSavedEvent) EventName() string
EventName implements Event.
type MemoryGraphEvent ¶
type MemoryGraphEvent struct {
Triples []Triple
SessionKey string
Type string // "observation" or "reflection"
}
MemoryGraphEvent is published when memory graph hooks fire. Replaces: memory.Store.SetGraphHooks.
func (MemoryGraphEvent) EventName ¶
func (e MemoryGraphEvent) EventName() string
EventName implements Event.
type ReputationChangedEvent ¶
ReputationChangedEvent is published when a peer's reputation changes. Replaces: reputation.Store.SetOnChangeCallback.
func (ReputationChangedEvent) EventName ¶
func (e ReputationChangedEvent) EventName() string
EventName implements Event.
type Triple ¶
Triple mirrors graph.Triple to avoid an import dependency on the graph package, keeping the eventbus package dependency-free.
type TriplesExtractedEvent ¶
type TriplesExtractedEvent struct {
Triples []Triple
Source string // e.g. "learning", "analysis", "librarian"
}
TriplesExtractedEvent is published when graph triples are extracted. Replaces: SetGraphCallback on learning engines and analyzers.
func (TriplesExtractedEvent) EventName ¶
func (e TriplesExtractedEvent) EventName() string
EventName implements Event.
type TurnCompletedEvent ¶
type TurnCompletedEvent struct {
SessionKey string
}
TurnCompletedEvent is published when a gateway turn completes. Replaces: Gateway.OnTurnComplete callbacks.
func (TurnCompletedEvent) EventName ¶
func (e TurnCompletedEvent) EventName() string
EventName implements Event.