Help us shape the future of Go! Take the 2026 Go Developer Survey

engine

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package engine turns a config plus live provider state into an ordered plan, and executes it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Confirm

func Confirm(in io.Reader, out io.Writer, p plan.Plan) error

Confirm blocks until the operator retypes the affected domain names. It returns immediately when the plan deletes nothing. Mailbox deletion destroys stored mail irreversibly, so every object is named individually rather than summarised as a count.

Types

type Engine

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

func New

func New(cfg config.Config, zone dns.Provider, deployer *worker.Deployer, deps mail.Deps, opts Options) *Engine

New builds an engine. deployer may be nil when no domain deploys an MTA-STS policy Worker; a domain that asks for one then fails with a clear message.

func (*Engine) Apply

func (e *Engine) Apply(ctx context.Context, p plan.Plan, out io.Writer) error

Apply runs every executable action in order, writing one line per action.

func (*Engine) Desired

func (e *Engine) Desired(ctx context.Context, d config.Domain) ([]dns.Record, error)

Desired returns the DNS records mailctl wants published for a domain, without reading the zone or planning anything. audit uses it, and it applies the same collision guard planDomain does via unionDesiredDNS, so audit and plan cannot disagree about whether a config is legal.

func (*Engine) Domains

func (e *Engine) Domains() ([]config.Domain, error)

Domains returns the domains this run covers, honouring -domain.

func (*Engine) Plan

func (e *Engine) Plan(ctx context.Context) (plan.Plan, error)

Plan reads live state and returns everything that would change. It performs no writes.

func (*Engine) PlanDomain added in v0.1.1

func (e *Engine) PlanDomain(ctx context.Context, d config.Domain) (plan.Plan, error)

PlanDomain plans one domain on its own, for a caller that wants to spend provider calls on that domain only. It is exactly what Plan does per domain, so a scoped plan and the matching slice of a full one agree.

type Options

type Options struct {
	// Domains limits the run to these domain names. Empty means every domain.
	Domains []string
	// Prune plans deletion of provider-side objects absent from the config.
	Prune bool
	// PruneMailboxes allows Prune to plan mailbox deletion. It is a second
	// opt-in because deleting a mailbox destroys mail.
	PruneMailboxes bool
	// ReplaceDNS deletes conflicting DNS records instead of failing.
	ReplaceDNS bool
	// Secrets resolves mailbox credentials.
	Secrets *secret.Resolver
}

Jump to

Keyboard shortcuts

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