Documentation
¶
Index ¶
Constants ¶
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
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 ¶
func (SyncAPIErr) Error ¶
func (s SyncAPIErr) Error() string
type SyncInternalErr ¶
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.