syncer

package
v0.19.1237 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: AGPL-3.0 Imports: 48 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDBSyncer

func NewDBSyncer(db *gorm.DB, appsHelpers *appshelpers.Helpers, componentHelpers *componenthelpers.Helpers, actionsHelpers *actionshelpers.Helpers, runbooksHelpers *runbookshelpers.Helpers, installHelpers *installhelpers.Helpers, vcsHelpers *vcshelpers.Helpers, tfClient terraform.Client, appID string, cfg *config.AppConfig, appConfigID string, opts ...Option) sync.Syncer

NewDBSyncer creates a database-backed syncer for use in Temporal workflows. The context must contain org and account information before calling Sync().

Types

type Metrics added in v0.19.1197

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

func NewMetrics added in v0.19.1197

func NewMetrics(provider metric.MeterProvider) *Metrics

type Option added in v0.19.1102

type Option func(*syncer)

Option configures optional syncer behaviour.

func WithBranchSync added in v0.19.1207

func WithBranchSync() Option

WithBranchSync makes the syncer create and update app branches from the branch definitions in the app config. It is off by default: branches are owned by `nuon branches sync`, and this option only exists as a rollback to the previous behaviour.

func WithComponentBuildDispatch added in v0.19.1102

func WithComponentBuildDispatch() Option

WithComponentBuildDispatch makes the syncer schedule component builds itself, the way the per-type Create*ComponentConfig handlers do: unchanged components reuse their existing config connection, changed components get config-created signals enqueued, and the scheduled set is reported through GetComponentsScheduled.

Leave this off for callers that schedule builds in a later step of their own — the app branch run does this in its builds step — otherwise components build twice.

func WithoutBranchSync deprecated added in v0.19.1191

func WithoutBranchSync() Option

Deprecated: branch sync is off by default; WithoutBranchSync is a no-op unless combined with WithBranchSync, in which case the last option wins.

type Params

type Params struct {
	fx.In

	DB *gorm.DB `name:"psql"`
}

Params defines the dependencies required by the syncer. This follows the FX dependency injection pattern used in ctl-api.

type RunDeps added in v0.19.1102

type RunDeps struct {
	DB               *gorm.DB
	AppsHelpers      *appshelpers.Helpers
	ComponentHelpers *componenthelpers.Helpers
	ActionsHelpers   *actionshelpers.Helpers
	RunbooksHelpers  *runbookshelpers.Helpers
	InstallHelpers   *installhelpers.Helpers
	VCSHelpers       *vcshelpers.Helpers
	TFClient         terraform.Client
	Metrics          *Metrics
	Logger           *zap.Logger
}

RunDeps carries everything the syncer needs to run against the database.

type RunRequest added in v0.19.1102

type RunRequest struct {
	AppID       string
	AppConfigID string

	// DispatchBuilds: see components.SyncComponentParams.DispatchBuilds.
	DispatchBuilds bool

	// SyncBranches opts in to writing app branches from the config; see WithBranchSync.
	SyncBranches bool

	// Deprecated: branches are not synced unless SyncBranches is set. When both
	// are set, SkipBranches wins.
	SkipBranches bool
}

type RunResult added in v0.19.1102

type RunResult struct {
	AppConfigID         string
	ComponentIDs        []string
	ActionIDs           []string
	RunbookIDs          []string
	ComponentsScheduled []configsync.ComponentState

	// Caller must provision these queues after Run returns; the sync is transactional.
	ComponentsCreated []string

	// Caller must provision these queues after Run returns; the sync is transactional.
	AppBranchesCreated []string

	AppBranchConfigsUpdated []configsync.AppBranchConfigState
}

func Run added in v0.19.1102

func Run(ctx context.Context, deps RunDeps, req RunRequest) (res *RunResult, retErr error)

Run syncs an app config from its stored intermediate config, driving the status through syncing to active or error. The single path from intermediate config to database records — the branch run and POST /configs/:id/sync both go through it.

Jump to

Keyboard shortcuts

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