sync

package
v0.19.950 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: AGPL-3.0 Imports: 3 Imported by: 1 module, 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

Index

Constants

View Source
const (
	// DefaultStateVersion is the current version of the state format
	DefaultStateVersion string = "v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionState added in v0.19.850

type ActionState struct {
	Name string `json:"name"`
	ID   string `json:"id"`
}

ActionState represents an action in the sync state

type ComponentState

type ComponentState struct {
	Name     string                  `json:"name"`
	ID       string                  `json:"id"`
	ConfigID string                  `json:"config_id"`
	Type     models.AppComponentType `json:"type"`
	Checksum string                  `json:"checksum"`
}

ComponentState represents the synchronized state of a component. This is stored in the app config's state field as JSON to track what was synced in each config version.

type State added in v0.19.850

type State struct {
	Version string `json:"version"`

	CfgID           string           `json:"config_id"`
	AppID           string           `json:"app_id"`
	InstallerID     string           `json:"installer_id"`
	RunnerConfigID  string           `json:"runner_config_id"`
	SandboxConfigID string           `json:"sandbox_config_id"`
	InputConfigID   string           `json:"input_config_id"`
	Components      []ComponentState `json:"components"`
	Actions         []ActionState    `json:"actions"`
}

State represents the synchronized state of an app config. This is stored as JSON in the app_configs.state column to track what was synced in each config version.

type SyncAPIErr

type SyncAPIErr struct {
	Resource string
	Err      error
}

func (SyncAPIErr) Error

func (s SyncAPIErr) Error() string

type SyncErr

type SyncErr struct {
	Resource    string
	Description string
}

func (SyncErr) Error

func (s SyncErr) Error() string

type SyncInternalErr

type SyncInternalErr struct {
	Description string
	Err         error
}

func (SyncInternalErr) Error

func (s SyncInternalErr) Error() string

type Syncer added in v0.19.850

type Syncer interface {
	// Sync performs the full synchronization operation, creating or updating
	// app configs, components, and their configurations.
	//
	// The context must contain org and account information set via cctx.SetOrgContext()
	// and cctx.SetAccountContext() before calling this method.
	//
	// Returns an error if the sync operation fails at any step.
	Sync(ctx context.Context) error

	// GetAppConfigID returns the ID of the app config that was created or updated
	// during the most recent sync operation.
	//
	// This should only be called after a successful Sync() operation.
	GetAppConfigID() string

	// GetComponentStateIds returns the IDs of all components that were synced
	// during the most recent sync operation.
	//
	// This should only be called after a successful Sync() operation.
	GetComponentStateIds() []string

	// GetActionStateIds returns the IDs of all actions that were synced
	// during the most recent sync operation.
	//
	// This should only be called after a successful Sync() operation.
	GetActionStateIds() []string

	// GetComponentsScheduled returns the components that had builds scheduled
	// during the most recent sync operation.
	//
	// The CLI uses this to poll build status after syncing.
	// This should only be called after a successful Sync() operation.
	GetComponentsScheduled() []ComponentState

	// OrphanedComponents returns a map of component names to IDs for components
	// that existed in the previous config but are no longer in the current config.
	//
	// This allows consumers to notify users about removed components.
	// This should only be called after a successful Sync() operation.
	OrphanedComponents() map[string]string

	// OrphanedActions returns a map of action names to IDs for actions that
	// existed in the previous config but are no longer in the current config.
	//
	// This allows consumers to notify users about removed actions.
	// This should only be called after a successful Sync() operation.
	OrphanedActions() map[string]string
}

Syncer defines the interface for syncing app configurations to a backing store. Implementations can sync via API calls (apisyncer) or direct database access (dbsyncer).

The Syncer interface provides a pluggable architecture that allows different sync strategies while maintaining a consistent API for consumers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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