Documentation
¶
Overview ¶
Package consume drives the consume-side half of the events pipeline.
Index ¶
- func CheckRemoteConnections(ctx context.Context, client APIClient) (int, error)
- func CompileJQ(expr string) (*gojq.Code, error)
- func ComputeSubscriptionID(def *event.KeyDefinition, params map[string]string) string
- func EnsureBus(ctx context.Context, tr transport.IPC, appID, profileName, domain string, ...) (net.Conn, error)
- func Run(ctx context.Context, tr transport.IPC, appID, profileName, domain string, ...) error
- type APIClient
- type DirSink
- type Options
- type Sink
- type WriterSink
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckRemoteConnections ¶
CheckRemoteConnections returns the count of active WebSocket connections for this app.
func CompileJQ ¶
CompileJQ compiles once for hot-path reuse; exported so callers can preflight before side effects.
func ComputeSubscriptionID ¶ added in v1.0.52
func ComputeSubscriptionID(def *event.KeyDefinition, params map[string]string) string
ComputeSubscriptionID delegates to the catalog's scope derivation so every layer (application decision, bus accounting, this host) computes the same identity from the same declaration.
func EnsureBus ¶
func EnsureBus(ctx context.Context, tr transport.IPC, appID, profileName, domain string, apiClient APIClient, errOut io.Writer) (net.Conn, error)
EnsureBus dials the bus daemon for appID, forking a new one if none is running. apiClient nil skips remote-connection probe. Local-bus hits skip remote check (see `event status`).
Types ¶
type DirSink ¶
type DirSink struct {
Dir string
// contains filtered or unexported fields
}
DirSink writes one JSON file per event; nanos+pid+seq filename avoids cross-process collisions.
type Options ¶
type Options struct {
EventKey string
// Def is the resolved declaration for EventKey. The caller resolves it
// from the compiled catalog; this package validates and consumes it but
// never looks anything up itself.
Def *event.KeyDefinition
Params map[string]string
// ParamsNormalized marks Params as already normalized by the declaration's
// NormalizeParams hook (the deciding layer runs it on these exact values).
// The host then skips the hook, keeping its run-once-per-consumer contract.
ParamsNormalized bool
JQExpr string
Quiet bool
OutputDir string
Runtime event.APIClient
// Prepare, when set, replaces the declaration's PreConsume hook as the
// preparation to run when this consumer is first for its scope. The
// application layer injects it so the strategy that was decided is the
// strategy that executes; when nil, the declaration's own hook runs.
Prepare func(ctx context.Context) (func() error, error)
Out io.Writer // nil falls back to os.Stdout
ErrOut io.Writer
RemoteAPIClient APIClient // nil disables remote-connection preflight
MaxEvents int // 0 = unlimited
Timeout time.Duration // 0 = no timeout
IsTTY bool
// contains filtered or unexported fields
}
type Sink ¶
type Sink interface {
Write(data json.RawMessage) error
}
type WriterSink ¶
type WriterSink struct {
W io.Writer
Pretty bool
ErrOut io.Writer
// contains filtered or unexported fields
}
WriterSink writes one JSON event per line; mu serialises concurrent worker writes.
func (*WriterSink) Write ¶
func (s *WriterSink) Write(data json.RawMessage) error