factory

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: BSD-2-Clause Imports: 15 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCommandConsumer added in v0.2.0

func CreateCommandConsumer(
	saramaClientProvider libkafka.SaramaClientProvider,
	syncProducer libkafka.SyncProducer,
	db libkv.DB,
	ghClient pkg.GitHubClient,
	createSender task.CreateCommandSender,
	taskCfg pkg.TaskConfig,
	metrics pkg.Metrics,
	topicPrefix base.TopicPrefix,
	currentDateTime libtime.CurrentDateTimeGetter,
) run.Func

CreateCommandConsumer wires a run.Func that consumes TriggerCommand messages from the github-dark-factory watcher's request topic and runs them through the single-PR implement pipeline (GitHub fetch → candidate gate → publish).

currentDateTime is the injected libtime.CurrentDateTimeGetter passed through to the trigger executor so it can derive a time-salted task identifier when the TriggerCommand has Force=true. The non-force path does not consult the clock.

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 CreateGitHubAppClient

func CreateGitHubAppClient(
	ctx context.Context,
	appID int64,
	installationID int64,
	pemKey []byte,
) (*http.Client, error)

CreateGitHubAppClient creates an HTTP client authenticated as a GitHub App installation.

func CreateKafkaSender

func CreateKafkaSender(
	syncProducer libkafka.SyncProducer,
	topicPrefix base.TopicPrefix,
) task.CreateCommandSender

CreateKafkaSender constructs a typed create-task command sender backed by a Kafka sync producer.

func CreateWatcher

func CreateWatcher(
	ghClient pkg.GitHubClient,
	createSender task.CreateCommandSender,
	metrics pkg.Metrics,
	cursorPath string,
	startTime libtime.DateTime,
	scope string,
	scopeFilter filter.TaskCreationFilter,
	cfg pkg.TaskConfig,
) pkg.Watcher

CreateWatcher wires all dependencies and returns a ready-to-use Watcher.

Types

This section is empty.

Jump to

Keyboard shortcuts

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