Documentation
¶
Overview ¶
Package factory wires concrete dependencies for the maintainer-watcher-github-build binary.
Index ¶
- func CreateAllowlistSnapshot(ghClient pkg.GitHubClient, repoAllowlist []string) (pkg.AllowlistSnapshot, run.Func, error)
- func CreateCommandConsumer(saramaClientProvider libkafka.SaramaClientProvider, ...) run.Func
- func CreateKafkaCompleteSender(syncProducer libkafka.SyncProducer, topicPrefix base.TopicPrefix) task.CompleteCommandSender
- func CreateKafkaCreateSender(syncProducer libkafka.SyncProducer, topicPrefix base.TopicPrefix) task.CreateCommandSender
- func CreateSyncProducer(ctx context.Context, brokers libkafka.Brokers) (libkafka.SyncProducer, func(), error)
- func CreateTriggerBuildCheckCommandSender(ctx context.Context, syncProducer libkafka.SyncProducer, ...) command.TriggerBuildCheckCommandSender
- func CreateTriggerBuildCheckHandler(sender command.TriggerBuildCheckCommandSender) handler.TriggerBuildCheckHandler
- func CreateWatcher(ctx context.Context, ghClient pkg.GitHubClient, brokers libkafka.Brokers, ...) (pkg.Watcher, libkafka.SyncProducer, func(), error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateAllowlistSnapshot ¶
func CreateAllowlistSnapshot( ghClient pkg.GitHubClient, repoAllowlist []string, ) (pkg.AllowlistSnapshot, run.Func, error)
CreateAllowlistSnapshot returns a snapshot provider and (optionally) a background refresh task for the daemon's run loop. If the input allowlist contains wildcards, a ResolvedAllowlist with a refresh goroutine is returned. Otherwise, a static snapshot with no background refresh is returned.
func CreateCommandConsumer ¶
func CreateCommandConsumer( saramaClientProvider libkafka.SaramaClientProvider, syncProducer libkafka.SyncProducer, db libkv.DB, watcher pkg.Watcher, topicPrefix base.TopicPrefix, ) run.Func
CreateCommandConsumer wires a run.Func that consumes TriggerBuildCheckCommand messages from the github-build watcher's request topic (identified by lib.GithubBuildV1SchemaID) and runs them through the shared Watcher.Poll(ctx) pipeline.
The function is pure composition: no business logic, no conditionals. It uses cdb.RunCommandConsumerTxDefault (auto-wraps the transaction) per the go-cqrs/auto-tx-wrapper-no-manual-wrap rule — do NOT manually wrap the executor with kv.NewTransactionMiddleware.
func CreateKafkaCompleteSender ¶ added in v0.2.0
func CreateKafkaCompleteSender( syncProducer libkafka.SyncProducer, topicPrefix base.TopicPrefix, ) task.CompleteCommandSender
CreateKafkaCompleteSender constructs a typed complete-task command sender backed by a pre-built Kafka sync producer. The caller owns the producer's lifecycle (created in main.go so it can be reused across senders).
func CreateKafkaCreateSender ¶
func CreateKafkaCreateSender( syncProducer libkafka.SyncProducer, topicPrefix base.TopicPrefix, ) task.CreateCommandSender
CreateKafkaCreateSender constructs a typed create-task command sender backed by a pre-built Kafka sync producer. The caller owns the producer's lifecycle (created in main.go so it can be reused across senders).
func CreateSyncProducer ¶
func CreateSyncProducer( ctx context.Context, brokers libkafka.Brokers, ) (libkafka.SyncProducer, func(), error)
CreateSyncProducer constructs a Kafka sync producer for the maintainer-watcher-github-build binary. The returned cleanup closes the producer on shutdown; main.go owns the lifecycle and defers the cleanup so the producer can be reused across senders (create-task, trigger).
func CreateTriggerBuildCheckCommandSender ¶
func CreateTriggerBuildCheckCommandSender( ctx context.Context, syncProducer libkafka.SyncProducer, topicPrefix base.TopicPrefix, ) command.TriggerBuildCheckCommandSender
CreateTriggerBuildCheckCommandSender constructs a typed trigger-build-check command sender backed by a Kafka sync producer. This is the HTTP-side sender: the /trigger handler publishes TriggerBuildCheckCommand messages through it.
CommandCreator and Initiator are built once here and reused across every SendCommand call (per cqrs/docs/producing-commands.md "Factory Wiring"; matches trading/frontend/command's reference impl).
func CreateTriggerBuildCheckHandler ¶
func CreateTriggerBuildCheckHandler( sender command.TriggerBuildCheckCommandSender, ) handler.TriggerBuildCheckHandler
CreateTriggerBuildCheckHandler wires the thin CQRS handler that publishes a TriggerBuildCheckCommand to Kafka for each /trigger request. All poll-cycle work lives in the in-pod command consumer (see pkg/command.NewTriggerBuildCheckCommandExecutor).
func CreateWatcher ¶
func CreateWatcher( ctx context.Context, ghClient pkg.GitHubClient, brokers libkafka.Brokers, topicPrefix base.TopicPrefix, inputAllowlist []string, resolved pkg.AllowlistSnapshot, cursorPath string, assignee string, taskStatus string, taskPhase string, stage string, maxTitleLen int, taskSuffix string, currentDateTime libtime.CurrentDateTimeGetter, ) (pkg.Watcher, libkafka.SyncProducer, func(), error)
CreateWatcher wires all dependencies and returns a ready-to-use Watcher plus the Kafka sync producer it built internally (so the caller can reuse it for additional senders, e.g. the HTTP-side trigger sender). The cleanup function closes the sync producer on shutdown — the caller must defer it (or wire it into its own shutdown sequence).
Types ¶
This section is empty.