Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncHook ¶
type AsyncHook interface {
EventChan() chan<- schema.Event
Filter() []string
Start(ctx context.Context) error
Stop(ctx context.Context) error
}
AsyncHook is an asynchronous event observer that receives events via a channel. Start and Stop manage the consumer goroutine lifecycle. Filter returns the event types this hook cares about. An empty slice means all events are delivered.
type Hook ¶
Hook is a synchronous event observer. OnEvent is called inline during dispatch and may be called concurrently from multiple goroutines; implementations must be safe for concurrent use and should be fast and non-blocking. Filter returns the event types this hook cares about. An empty slice means all events are delivered.
type HookFunc ¶
type HookFunc struct {
// contains filtered or unexported fields
}
HookFunc adapts a plain function into a Hook.
func NewHookFunc ¶
NewHookFunc creates a HookFunc with the given handler and optional event type filter.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager dispatches events to registered sync and async hooks. It is safe for concurrent use.
func (*Manager) Dispatch ¶
Dispatch sends an event to all matching hooks. Sync hooks are called sequentially; errors are logged but do not interrupt dispatch. Async hooks receive events via non-blocking channel send; full channels cause the event to be dropped with a warning log. Dispatch returns early if the context is cancelled. It is safe to call on a nil Manager.
func (*Manager) RegisterAsync ¶
RegisterAsync adds one or more asynchronous hooks.