Documentation
¶
Index ¶
- Constants
- func ListRepairable(ctx context.Context, store interfaces.SchemaOperationsStore, projectID string, ...) ([]*models.SchemaOperation, error)
- func PhysicalDDLRequired(ctx context.Context) bool
- func ReconcileOneOperation(h Hooks, in ReconcileInput) (*models.SchemaOperation, error)
- func Run(h Hooks, in RunInput) error
- func RunBackgroundReconciler(ctx context.Context, h Hooks, projectID string, interval time.Duration)
- func StoreFromSystemDriver(sys interfaces.ApitoSystemDB) interfaces.SchemaOperationsStore
- func WithPhysicalDDLRequired(ctx context.Context, required bool) context.Context
- type Hooks
- type ReconcileInput
- type RunInput
Constants ¶
const ( StepBaseProjectDDL = "base_project_ddl" StepTenantDDL = "tenant_ddl" StepSystemSchema = "system_schema" StepCache = "cache" )
Variables ¶
This section is empty.
Functions ¶
func ListRepairable ¶
func ListRepairable(ctx context.Context, store interfaces.SchemaOperationsStore, projectID string, limit int) ([]*models.SchemaOperation, error)
ListRepairable returns operations that need reconciliation for a project.
func PhysicalDDLRequired ¶
PhysicalDDLRequired reports whether project/tenant sync flush is needed after schema commit.
func ReconcileOneOperation ¶
func ReconcileOneOperation(h Hooks, in ReconcileInput) (*models.SchemaOperation, error)
ReconcileOneOperation retries idempotent steps for failed / needs_repair / applying operations.
func Run ¶
Run executes base DDL → tenant DDL → system persist → cache with optional ledger + compensation.
func RunBackgroundReconciler ¶
func RunBackgroundReconciler(ctx context.Context, h Hooks, projectID string, interval time.Duration)
RunBackgroundReconciler periodically lists repairable operations for observability. Full automatic replay requires operation-specific handlers; mutations remain synchronous.
func StoreFromSystemDriver ¶
func StoreFromSystemDriver(sys interfaces.ApitoSystemDB) interfaces.SchemaOperationsStore
StoreFromSystemDriver returns SchemaOperationsStore when the system driver implements it.
Types ¶
type Hooks ¶
type Hooks struct {
SchemaIterate func(ctx context.Context, project *models.Project, fn func(ctx context.Context, driver interface{}) error) error
Store interfaces.SchemaOperationsStore
// AfterCommit runs after all orchestration steps succeed (base DDL, tenants, system persist, cache).
AfterCommit func(in RunInput)
}
Hooks wires tenant propagation and optional ledger persistence.
type ReconcileInput ¶
type ReconcileInput struct {
Ctx context.Context
Op *models.SchemaOperation
BaseDriver interfaces.ProjectDBInterface
ApplyDDL func(driver interfaces.ProjectDBInterface) error
PersistSystem func() error
RefreshCache func() error
Compensate func(driver interfaces.ProjectDBInterface) error
}
ReconcileInput retries or reports repair for one ledger operation.
type RunInput ¶
type RunInput struct {
Ctx context.Context
Project *models.Project
OperationType string
Request interface{}
BaseDriver interfaces.ProjectDBInterface
SkipBaseDDL bool
ApplyDDL func(driver interfaces.ProjectDBInterface) error
PersistSystem func() error
RefreshCache func() error
// Compensate runs on base project driver after partial success (best-effort).
Compensate func(driver interfaces.ProjectDBInterface) error
// PhysicalDDLRequired when true tells PostSchemaChangeHook to flush project/tenant replicas.
PhysicalDDLRequired bool
}
RunInput is one synchronous schema mutation coordinated by the orchestrator.