factory

package
v0.4.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: BSD-2-Clause Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package factory wires concrete dependencies for the maintainer-watcher-github-build binary.

Index

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).

func CreateWebhookHandler added in v0.4.0

func CreateWebhookHandler(
	sender command.TriggerBuildCheckCommandSender,
	secret string,
	metrics handler.WebhookMetrics,
	clock libtime.CurrentDateTimeGetter,
	minInterval time.Duration,
) handler.WebhookHandler

CreateWebhookHandler wires the thin webhook receiver that publishes a TriggerBuildCheckCommand to Kafka for each signature-verified workflow_run delivery on /webhook/github-build that completed with conclusion=failure on the repository's default branch and passes the per-repo debounce. Filter/trust work stays in the in-pod command consumer (shared with /trigger).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL