Documentation
¶
Index ¶
- type AgePruner
- type BaseModule
- func (b BaseModule) HTTPHandler() HTTPIngestionHandler
- func (b BaseModule) OnEventStored(_ event.Event)
- func (b BaseModule) OnInit(_ *sql.DB) error
- func (b BaseModule) PreviewMapper() event.PreviewMapper
- func (b BaseModule) RegisterMigrations(_ *storage.Migrator) error
- func (b BaseModule) RegisterRoutes(_ *http.ServeMux, _ event.Store)
- func (b BaseModule) TCPServers() []tcp.ServerConfig
- type Broadcaster
- type Broadcasting
- type EventDeleteListener
- type HTTPIngestionHandler
- type Module
- type ProtectedRoutesRegistrar
- type Registry
- func (r *Registry) AgePruners() []AgePruner
- func (r *Registry) Handlers() []HTTPIngestionHandler
- func (r *Registry) Init(db *sql.DB, mux *http.ServeMux, store event.Store) error
- func (r *Registry) Modules() []Module
- func (r *Registry) NotifyEventStored(ev event.Event)
- func (r *Registry) NotifyEventsDeleted(uuids []string)
- func (r *Registry) Previews() *event.PreviewRegistry
- func (r *Registry) Register(m Module)
- func (r *Registry) RegisterProtectedRoutes(mux *http.ServeMux, protect func(http.Handler) http.Handler)
- func (r *Registry) TCPServers() []tcp.ServerConfig
- func (r *Registry) WireBroadcaster(b Broadcaster)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgePruner ¶ added in v2.11.0
AgePruner is an optional Module add-on for modules that keep rows with no event card (Sentry logs, metrics, traces). Retention with max_age calls it to delete those rows older than cutoff; it returns how many it deleted.
type BaseModule ¶
type BaseModule struct{}
BaseModule provides no-op defaults for optional Module methods.
func (BaseModule) HTTPHandler ¶
func (b BaseModule) HTTPHandler() HTTPIngestionHandler
func (BaseModule) OnEventStored ¶
func (b BaseModule) OnEventStored(_ event.Event)
func (BaseModule) PreviewMapper ¶
func (b BaseModule) PreviewMapper() event.PreviewMapper
func (BaseModule) RegisterMigrations ¶
func (b BaseModule) RegisterMigrations(_ *storage.Migrator) error
func (BaseModule) RegisterRoutes ¶
func (b BaseModule) RegisterRoutes(_ *http.ServeMux, _ event.Store)
func (BaseModule) TCPServers ¶
func (b BaseModule) TCPServers() []tcp.ServerConfig
type Broadcaster ¶
Broadcaster publishes an event on a WebSocket channel: the ws.Hub.
type Broadcasting ¶
type Broadcasting interface {
SetBroadcaster(b Broadcaster)
}
Broadcasting is implemented by a module that sends notices of its own to the browser, beside the events it stores through the EventService - for example that it stored rows that create no feed card. It is optional: WireBroadcaster hands every module that implements it the hub at startup.
type EventDeleteListener ¶
type EventDeleteListener interface {
OnEventsDeleted(uuids []string)
}
EventDeleteListener is an optional Module add-on for modules that keep data outside the events table (files, side tables). It is called after events were removed by a single delete, a clear-all or a batch delete.
type HTTPIngestionHandler ¶
type HTTPIngestionHandler interface {
// Priority determines ordering. Lower runs first. HttpDumps = 9999.
Priority() int
// Match returns true if this module should handle the request.
Match(r *http.Request) bool
// Handle processes the request and returns the event to store.
Handle(r *http.Request) (*event.Incoming, error)
}
HTTPIngestionHandler decides if an HTTP request belongs to a module.
type Module ¶
type Module interface {
// Name returns a human-readable module name (e.g., "Sentry").
Name() string
// Type returns the event type string stored in the events table.
Type() string
// RegisterRoutes adds module-specific API routes to the router.
RegisterRoutes(mux *http.ServeMux, store event.Store)
// HTTPHandler returns a handler that inspects an incoming request
// and either claims it or returns nil. Return nil if this module
// has no HTTP ingestion (e.g., TCP-only modules).
HTTPHandler() HTTPIngestionHandler
// TCPServers returns TCP server configurations this module needs.
TCPServers() []tcp.ServerConfig
// PreviewMapper returns the mapper for converting payloads to previews.
PreviewMapper() event.PreviewMapper
// RegisterMigrations registers module-specific SQL migration files.
RegisterMigrations(migrator *storage.Migrator) error
// OnInit is called once at startup after migrations are applied.
OnInit(db *sql.DB) error
// OnEventStored is called after any event is persisted.
OnEventStored(ev event.Event)
}
Module is the interface every event module must implement. Embed BaseModule to get no-op defaults for optional methods.
type ProtectedRoutesRegistrar ¶
type ProtectedRoutesRegistrar interface {
RegisterProtectedRoutes(mux *http.ServeMux, protect func(http.Handler) http.Handler)
}
ProtectedRoutesRegistrar is an optional Module add-on for API routes that must sit behind the API's auth middleware. It is called after the middleware is built, unlike RegisterRoutes.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry collects modules and provides access to their handlers.
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) AgePruners ¶ added in v2.11.0
AgePruners returns the modules that implement AgePruner.
func (*Registry) Handlers ¶
func (r *Registry) Handlers() []HTTPIngestionHandler
Handlers returns HTTP ingestion handlers sorted by priority.
func (*Registry) NotifyEventStored ¶
NotifyEventStored calls OnEventStored on all modules.
func (*Registry) NotifyEventsDeleted ¶
NotifyEventsDeleted calls OnEventsDeleted on modules that implement EventDeleteListener.
func (*Registry) Previews ¶
func (r *Registry) Previews() *event.PreviewRegistry
Previews returns the preview registry.
func (*Registry) RegisterProtectedRoutes ¶
func (r *Registry) RegisterProtectedRoutes(mux *http.ServeMux, protect func(http.Handler) http.Handler)
RegisterProtectedRoutes lets modules that implement ProtectedRoutesRegistrar add their API routes behind protect.
func (*Registry) TCPServers ¶
func (r *Registry) TCPServers() []tcp.ServerConfig
TCPServers returns all TCP server configs from all modules.
func (*Registry) WireBroadcaster ¶
func (r *Registry) WireBroadcaster(b Broadcaster)
WireBroadcaster gives the broadcaster to every registered module that implements Broadcasting.