manager

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package manager runs one merge-queue engine per discovered (repo, base), discovering opt-in repos by topic and ensuring their branch protection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Topic         string
	StatusCtx     string
	MergeStyle    string
	MaxBatch      int
	BatchLinger   time.Duration
	BatchTarget   int
	BisectFanout  int
	QueueComments bool
	WebhookURL    string
	WebhookSecret string
	InstanceURL   string
	PublicURL     string
	Token         string
	BotUser       string
	BotEmail      string
	Metrics       *metrics.Collector
	Checkpoint    engine.CheckpointStore
	Lease         engine.QueueLease
	LeaseHolderID string
	LeaseTTL      time.Duration
	Logger        *slog.Logger
	EngineLogger  *slog.Logger
	// MaxConcurrentReconciles caps how many engines may be reconciled
	// concurrently in a single Tick pass. Values ≤ 0 or 1 preserve today's
	// serial behaviour exactly. Values > 1 enable cross-repo parallelism.
	MaxConcurrentReconciles int
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func New

func New(fc *forge.Client, cfg Config) *Manager

func (*Manager) Refresh

func (m *Manager) Refresh(ctx context.Context) error

Refresh discovers topic repos and registers an engine per configured (repo, base), ensuring branch protection on first sight.

func (*Manager) Tick

func (m *Manager) Tick(ctx context.Context)

Tick reconciles every managed queue, bounded to m.maxConcurrent concurrent engines at a time. The default (maxConcurrent == 1) is serial and preserves exactly the same behaviour as the original single-goroutine loop.

Invariants:

  • At most one Reconcile call is ever in flight for a given engine at once. If a previous tick's Reconcile is still running (TryLock fails), this tick is skipped for that engine with a warning; this means SHUNT_POLL_INTERVAL is too short relative to the actual reconcile duration.
  • Tick blocks until every goroutine it started has returned, so the caller (the reconcile loop) can safely call Refresh immediately afterwards.

Jump to

Keyboard shortcuts

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