Documentation
¶
Index ¶
- Constants
- Variables
- func ConnectToInstance(ctx context.Context, opts *ConnectionOptions) (*pgx.Conn, error)
- func DatabaseStateModifiable(state DatabaseState) bool
- func DumpRolesResourceIdentifier(nodeName string) resource.Identifier
- func ExecuteScript(ctx context.Context, rc *resource.Context, conn *pgx.Conn, script *Script) error
- func GenerateDatabaseNetworkID(databaseID string) string
- func GenerateServiceInstanceID(databaseID, serviceID, hostID string) string
- func GetPrimaryInstanceID(ctx context.Context, patroniClient *patroni.Client, timeout time.Duration) (string, error)
- func InstanceIDFor(hostID, databaseID, nodeName string) string
- func InstanceResourceIdentifier(instanceID string) resource.Identifier
- func IsDatabaseNotCreated(rc *resource.Context) (bool, error)
- func LagTrackerCommitTSIdentifier(originNode, receiverNode, databaseName string) resource.Identifier
- func NodeResourceIdentifier(nodeName string) resource.Identifier
- func PostgresDatabaseResourceIdentifier(nodeName, dbName string) resource.Identifier
- func Provide(i *do.Injector)
- func RegisterResourceTypes(registry *resource.Registry)
- func ReplicationSlotAdvanceFromCTSResourceIdentifier(providerNode, subscriberNode, databaseName string) resource.Identifier
- func ReplicationSlotCreateResourceIdentifier(databaseName, providerNode, subscriberNode string) resource.Identifier
- func ReplicationSlotResourceIdentifier(providerNode, subscriberNode, databaseName string) resource.Identifier
- func RolesSourceResourceIdentifier(nodeName string) resource.Identifier
- func SanitizeRolesDump(in string) ([]string, []string)
- func SetScriptNeedsToRun(ctx context.Context, rc *resource.Context, script *Script) error
- func SubscriptionResourceIdentifier(providerNode, subscriberNode, databaseName string) resource.Identifier
- func SwitchoverResourceIdentifier(nodeName string) resource.Identifier
- func SyncEventResourceIdentifier(providerNode, subscriberNode, databaseName string) resource.Identifier
- func ValidateChangedSpec(current, updated *Spec) error
- func WaitForPatroniRunning(ctx context.Context, patroniClient *patroni.Client, timeout time.Duration) error
- func WaitForSyncEventResourceIdentifier(providerNode, subscriberNode, databaseName string) resource.Identifier
- type BackupConfig
- type BackupSchedule
- type BackupScheduleType
- type BuildServiceHostListParams
- type ConnectionInfo
- type ConnectionOptions
- type Database
- type DatabaseConnection
- type DatabaseState
- type DatabaseStore
- func (s *DatabaseStore) Create(item *StoredDatabase) storage.PutOp[*StoredDatabase]
- func (s *DatabaseStore) Delete(item *StoredDatabase) storage.DeleteValueOp[*StoredDatabase]
- func (s *DatabaseStore) ExistsByKey(databaseID string) storage.ExistsOp
- func (s *DatabaseStore) GetAll() storage.GetMultipleOp[*StoredDatabase]
- func (s *DatabaseStore) GetByKey(databaseID string) storage.GetOp[*StoredDatabase]
- func (s *DatabaseStore) GetByKeys(databaseIDs ...string) storage.GetMultipleOp[*StoredDatabase]
- func (s *DatabaseStore) Key(databaseID string) string
- func (s *DatabaseStore) Prefix() string
- func (s *DatabaseStore) Update(item *StoredDatabase) storage.PutOp[*StoredDatabase]
- type DumpRolesResource
- func (r *DumpRolesResource) Create(ctx context.Context, rc *resource.Context) error
- func (r *DumpRolesResource) Delete(ctx context.Context, rc *resource.Context) error
- func (r *DumpRolesResource) Dependencies() []resource.Identifier
- func (r *DumpRolesResource) DiffIgnore() []string
- func (r *DumpRolesResource) Executor() resource.Executor
- func (r *DumpRolesResource) Identifier() resource.Identifier
- func (r *DumpRolesResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (r *DumpRolesResource) ResourceVersion() string
- func (r *DumpRolesResource) TypeDependencies() []resource.Type
- func (r *DumpRolesResource) Update(ctx context.Context, rc *resource.Context) error
- type Extension
- type ExtraNetworkSpec
- type ExtraVolumesSpec
- type HealthCheckResult
- type Instance
- type InstancePaths
- func (p *InstancePaths) HostMvDataToRestoreCmd() []string
- func (p *InstancePaths) InstanceMvRestoreToDataCmd() []string
- func (p *InstancePaths) PgBackRestBackupCmd(command string, args ...string) pgbackrest.Cmd
- func (p *InstancePaths) PgBackRestRestoreCmd(command string, args ...string) pgbackrest.Cmd
- type InstanceResource
- func (r *InstanceResource) Connection(ctx context.Context, rc *resource.Context, dbName string) (*pgx.Conn, error)
- func (r *InstanceResource) Create(ctx context.Context, rc *resource.Context) error
- func (r *InstanceResource) Delete(ctx context.Context, rc *resource.Context) error
- func (r *InstanceResource) Dependencies() []resource.Identifier
- func (r *InstanceResource) DiffIgnore() []string
- func (r *InstanceResource) Executor() resource.Executor
- func (r *InstanceResource) Identifier() resource.Identifier
- func (r *InstanceResource) InstanceID() string
- func (r *InstanceResource) Paths(orchestrator Orchestrator) (InstancePaths, error)
- func (r *InstanceResource) PostgresVersion() (*ds.Version, error)
- func (r *InstanceResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (r *InstanceResource) ResourceVersion() string
- func (r *InstanceResource) TypeDependencies() []resource.Type
- func (r *InstanceResource) Update(ctx context.Context, rc *resource.Context) error
- func (r *InstanceResource) Validate() error
- type InstanceResources
- func (r *InstanceResources) AddDatabaseDependencies(resources ...resource.Resource) error
- func (r *InstanceResources) AddInstanceDependencies(resources ...resource.Resource) error
- func (r *InstanceResources) AddNodeDependents(resources ...resource.Resource) error
- func (r *InstanceResources) DatabaseDependencyIdentifiers() []resource.Identifier
- func (r *InstanceResources) DatabaseID() string
- func (r *InstanceResources) DatabaseName() string
- func (r *InstanceResources) HostID() string
- func (r *InstanceResources) InstanceID() string
- func (r *InstanceResources) InstanceState() (*resource.State, error)
- func (r *InstanceResources) NodeName() string
- type InstanceSpec
- type InstanceSpecChange
- type InstanceSpecStore
- func (s *InstanceSpecStore) DatabasePrefix(databaseID string) string
- func (s *InstanceSpecStore) DeleteByDatabaseID(databaseID string) storage.DeleteOp
- func (s *InstanceSpecStore) DeleteByKey(databaseID, instanceID string) storage.DeleteOp
- func (s *InstanceSpecStore) GetAll() storage.GetMultipleOp[*StoredInstanceSpec]
- func (s *InstanceSpecStore) GetByDatabaseID(databaseID string) storage.GetMultipleOp[*StoredInstanceSpec]
- func (s *InstanceSpecStore) GetByKey(databaseID, instanceID string) storage.GetOp[*StoredInstanceSpec]
- func (s *InstanceSpecStore) Key(databaseID, instanceID string) string
- func (s *InstanceSpecStore) Prefix() string
- func (s *InstanceSpecStore) Update(item *StoredInstanceSpec) storage.PutOp[*StoredInstanceSpec]
- type InstanceState
- type InstanceStateUpdateOptions
- type InstanceStatus
- type InstanceStatusStore
- func (s *InstanceStatusStore) DatabasePrefix(databaseID string) string
- func (s *InstanceStatusStore) DeleteByDatabaseID(databaseID string) storage.DeleteOp
- func (s *InstanceStatusStore) DeleteByKey(databaseID, instanceID string) storage.DeleteOp
- func (s *InstanceStatusStore) GetAll() storage.GetMultipleOp[*StoredInstanceStatus]
- func (s *InstanceStatusStore) GetByDatabaseID(databaseID string) storage.GetMultipleOp[*StoredInstanceStatus]
- func (s *InstanceStatusStore) GetByKey(databaseID, instanceID string) storage.GetOp[*StoredInstanceStatus]
- func (s *InstanceStatusStore) Key(databaseID, instanceID string) string
- func (s *InstanceStatusStore) Prefix() string
- func (s *InstanceStatusStore) Put(item *StoredInstanceStatus) storage.PutOp[*StoredInstanceStatus]
- type InstanceStore
- func (s *InstanceStore) DatabasePrefix(databaseID string) string
- func (s *InstanceStore) DeleteByDatabaseID(databaseID string) storage.DeleteOp
- func (s *InstanceStore) DeleteByKey(databaseID, instanceID string) storage.DeleteOp
- func (s *InstanceStore) GetAll() storage.GetMultipleOp[*StoredInstance]
- func (s *InstanceStore) GetByDatabaseID(databaseID string) storage.GetMultipleOp[*StoredInstance]
- func (s *InstanceStore) GetByKey(databaseID, instanceID string) storage.GetOp[*StoredInstance]
- func (s *InstanceStore) Key(databaseID, instanceID string) string
- func (s *InstanceStore) Prefix() string
- func (s *InstanceStore) Put(item *StoredInstance) storage.PutOp[*StoredInstance]
- type InstanceUpdateOptions
- type LagTrackerCommitTimestampResource
- func (r *LagTrackerCommitTimestampResource) Create(ctx context.Context, rc *resource.Context) error
- func (r *LagTrackerCommitTimestampResource) Delete(ctx context.Context, rc *resource.Context) error
- func (r *LagTrackerCommitTimestampResource) Dependencies() []resource.Identifier
- func (r *LagTrackerCommitTimestampResource) DiffIgnore() []string
- func (r *LagTrackerCommitTimestampResource) Executor() resource.Executor
- func (r *LagTrackerCommitTimestampResource) Identifier() resource.Identifier
- func (r *LagTrackerCommitTimestampResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (r *LagTrackerCommitTimestampResource) ResourceVersion() string
- func (r *LagTrackerCommitTimestampResource) TypeDependencies() []resource.Type
- func (r *LagTrackerCommitTimestampResource) Update(ctx context.Context, rc *resource.Context) error
- type MCPServiceConfig
- type MCPServiceUser
- type Node
- type NodeInstances
- type NodeResource
- func (n *NodeResource) Create(ctx context.Context, rc *resource.Context) error
- func (n *NodeResource) DSN(ctx context.Context, rc *resource.Context, fromInstance *InstanceResource, ...) (*postgres.DSN, error)
- func (n *NodeResource) Delete(ctx context.Context, rc *resource.Context) error
- func (n *NodeResource) Dependencies() []resource.Identifier
- func (n *NodeResource) DiffIgnore() []string
- func (n *NodeResource) Executor() resource.Executor
- func (n *NodeResource) Identifier() resource.Identifier
- func (n *NodeResource) PrimaryInstance(ctx context.Context, rc *resource.Context) (*InstanceResource, error)
- func (n *NodeResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (n *NodeResource) ResourceVersion() string
- func (n *NodeResource) TypeDependencies() []resource.Type
- func (n *NodeResource) Update(ctx context.Context, rc *resource.Context) error
- type Orchestrator
- type OrchestratorOpts
- type Paths
- func (p *Paths) Certificates() string
- func (p *Paths) Configs() string
- func (p *Paths) Data() string
- func (p *Paths) EtcdCaCert() string
- func (p *Paths) EtcdCertificates() string
- func (p *Paths) EtcdClientCert() string
- func (p *Paths) EtcdClientKey() string
- func (p *Paths) PatroniConfig() string
- func (p *Paths) PgBackRestConfig(confType pgbackrest.ConfigType) string
- func (p *Paths) PgData() string
- func (p *Paths) PgDataRestore() string
- func (p *Paths) PostgresCaCert() string
- func (p *Paths) PostgresCertificates() string
- func (p *Paths) PostgresReplicatorCert() string
- func (p *Paths) PostgresReplicatorKey() string
- func (p *Paths) PostgresServerCert() string
- func (p *Paths) PostgresServerKey() string
- func (p *Paths) PostgresSuperuserCert() string
- func (p *Paths) PostgresSuperuserKey() string
- type PortMapping
- type PostgRESTConnParams
- type PostgRESTServiceConfig
- type PostgresDatabaseResource
- func (p *PostgresDatabaseResource) Create(ctx context.Context, rc *resource.Context) error
- func (p *PostgresDatabaseResource) Delete(ctx context.Context, rc *resource.Context) error
- func (p *PostgresDatabaseResource) Dependencies() []resource.Identifier
- func (p *PostgresDatabaseResource) DiffIgnore() []string
- func (p *PostgresDatabaseResource) Executor() resource.Executor
- func (p *PostgresDatabaseResource) Identifier() resource.Identifier
- func (p *PostgresDatabaseResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (p *PostgresDatabaseResource) ResourceVersion() string
- func (p *PostgresDatabaseResource) TypeDependencies() []resource.Type
- func (p *PostgresDatabaseResource) Update(ctx context.Context, rc *resource.Context) error
- type RAGDefaults
- type RAGPipeline
- type RAGPipelineLLMConfig
- type RAGPipelineSearch
- type RAGPipelineTable
- type RAGServiceConfig
- type ReplicationSlotAdvanceFromCTSResource
- func (r *ReplicationSlotAdvanceFromCTSResource) Create(ctx context.Context, rc *resource.Context) error
- func (r *ReplicationSlotAdvanceFromCTSResource) Delete(ctx context.Context, rc *resource.Context) error
- func (r *ReplicationSlotAdvanceFromCTSResource) Dependencies() []resource.Identifier
- func (r *ReplicationSlotAdvanceFromCTSResource) DiffIgnore() []string
- func (r *ReplicationSlotAdvanceFromCTSResource) Executor() resource.Executor
- func (r *ReplicationSlotAdvanceFromCTSResource) Identifier() resource.Identifier
- func (r *ReplicationSlotAdvanceFromCTSResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (r *ReplicationSlotAdvanceFromCTSResource) ResourceVersion() string
- func (r *ReplicationSlotAdvanceFromCTSResource) TypeDependencies() []resource.Type
- func (r *ReplicationSlotAdvanceFromCTSResource) Update(ctx context.Context, rc *resource.Context) error
- type ReplicationSlotCreateResource
- func (r *ReplicationSlotCreateResource) Create(ctx context.Context, rc *resource.Context) error
- func (r *ReplicationSlotCreateResource) Delete(ctx context.Context, rc *resource.Context) error
- func (r *ReplicationSlotCreateResource) Dependencies() []resource.Identifier
- func (r *ReplicationSlotCreateResource) DiffIgnore() []string
- func (r *ReplicationSlotCreateResource) Executor() resource.Executor
- func (r *ReplicationSlotCreateResource) Identifier() resource.Identifier
- func (r *ReplicationSlotCreateResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (r *ReplicationSlotCreateResource) ResourceVersion() string
- func (r *ReplicationSlotCreateResource) TypeDependencies() []resource.Type
- func (r *ReplicationSlotCreateResource) Update(ctx context.Context, rc *resource.Context) error
- type ReplicationSlotResource
- func (r *ReplicationSlotResource) Create(ctx context.Context, rc *resource.Context) error
- func (r *ReplicationSlotResource) Delete(ctx context.Context, rc *resource.Context) error
- func (r *ReplicationSlotResource) Dependencies() []resource.Identifier
- func (r *ReplicationSlotResource) DiffIgnore() []string
- func (r *ReplicationSlotResource) Executor() resource.Executor
- func (r *ReplicationSlotResource) Identifier() resource.Identifier
- func (r *ReplicationSlotResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (r *ReplicationSlotResource) ResourceVersion() string
- func (r *ReplicationSlotResource) TypeDependencies() []resource.Type
- func (r *ReplicationSlotResource) Update(ctx context.Context, rc *resource.Context) error
- type RestoreConfig
- type RolesSourceResource
- func (r *RolesSourceResource) Create(ctx context.Context, rc *resource.Context) error
- func (r *RolesSourceResource) Delete(ctx context.Context, rc *resource.Context) error
- func (r *RolesSourceResource) Dependencies() []resource.Identifier
- func (r *RolesSourceResource) DiffIgnore() []string
- func (r *RolesSourceResource) Executor() resource.Executor
- func (r *RolesSourceResource) Identifier() resource.Identifier
- func (r *RolesSourceResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (r *RolesSourceResource) ResourceVersion() string
- func (r *RolesSourceResource) TypeDependencies() []resource.Type
- func (r *RolesSourceResource) Update(ctx context.Context, rc *resource.Context) error
- type Script
- type ScriptName
- type ScriptResult
- type ScriptResultStore
- func (s *ScriptResultStore) DatabasePrefix(databaseID string) string
- func (s *ScriptResultStore) DeleteByDatabaseID(databaseID string) storage.DeleteOp
- func (s *ScriptResultStore) GetByKey(databaseID string, scriptName ScriptName, nodeName string) storage.GetOp[*StoredScriptResult]
- func (s *ScriptResultStore) Key(databaseID string, scriptName ScriptName, nodeName string) string
- func (s *ScriptResultStore) Prefix() string
- func (s *ScriptResultStore) ScriptNamePrefix(databaseID string, name ScriptName) string
- func (s *ScriptResultStore) Update(item *StoredScriptResult) storage.PutOp[*StoredScriptResult]
- type ScriptStatements
- type Scripts
- type Service
- func (s *Service) CreateDatabase(ctx context.Context, spec *Spec) (*Database, error)
- func (s *Service) CreatePgBackRestBackup(ctx context.Context, w io.Writer, databaseID, instanceID string, ...) error
- func (s *Service) DeleteDatabase(ctx context.Context, databaseID string) error
- func (s *Service) DeleteInstance(ctx context.Context, databaseID, instanceID string) error
- func (s *Service) DeleteInstanceSpec(ctx context.Context, databaseID, instanceID string) error
- func (s *Service) DeleteServiceInstance(ctx context.Context, databaseID, serviceInstanceID string) error
- func (s *Service) DeleteServiceInstanceSpec(ctx context.Context, databaseID, serviceInstanceID string) error
- func (s *Service) GetAllInstances(ctx context.Context) ([]*Instance, error)
- func (s *Service) GetAllServiceInstances(ctx context.Context) ([]*ServiceInstance, error)
- func (s *Service) GetDatabase(ctx context.Context, databaseID string) (*Database, error)
- func (s *Service) GetDatabases(ctx context.Context) ([]*Database, error)
- func (s *Service) GetDatabasesByHostId(ctx context.Context, hostID string) ([]*Database, error)
- func (s *Service) GetInstance(ctx context.Context, databaseID, instanceID string) (*Instance, error)
- func (s *Service) GetInstanceConnectionInfo(ctx context.Context, databaseID, instanceID string) (*ConnectionInfo, error)
- func (s *Service) GetInstances(ctx context.Context, databaseID string) ([]*Instance, error)
- func (s *Service) GetScriptResult(ctx context.Context, databaseID string, scriptName ScriptName, nodeName string) (*ScriptResult, error)
- func (s *Service) GetServiceInstance(ctx context.Context, databaseID, serviceInstanceID string) (*ServiceInstance, error)
- func (s *Service) GetServiceInstances(ctx context.Context, databaseID string) ([]*ServiceInstance, error)
- func (s *Service) GetStoredDatabaseState(ctx context.Context, databaseID string) (DatabaseState, error)
- func (s *Service) GetStoredInstanceState(ctx context.Context, databaseID, instanceID string) (InstanceState, error)
- func (s *Service) InstanceCountForHost(ctx context.Context, hostID string) (int, error)
- func (s *Service) PopulateSpecDefaults(ctx context.Context, spec *Spec) error
- func (s *Service) ReconcileInstanceSpec(ctx context.Context, spec *InstanceSpec) (*InstanceSpec, error)
- func (s *Service) ReconcileServiceInstanceSpec(ctx context.Context, spec *ServiceInstanceSpec) (*ServiceInstanceSpec, error)
- func (s *Service) SetServiceInstanceState(ctx context.Context, databaseID, serviceInstanceID string, ...) error
- func (s *Service) UpdateDatabase(ctx context.Context, state DatabaseState, spec *Spec) (*Database, error)
- func (s *Service) UpdateDatabaseState(ctx context.Context, databaseID string, from, to DatabaseState) error
- func (s *Service) UpdateInstance(ctx context.Context, opts *InstanceUpdateOptions) error
- func (s *Service) UpdateInstanceState(ctx context.Context, opts *InstanceStateUpdateOptions) error
- func (s *Service) UpdateInstanceStatus(ctx context.Context, databaseID string, instanceID string, ...) error
- func (s *Service) UpdateScriptResult(ctx context.Context, result *ScriptResult) error
- func (s *Service) UpdateServiceInstance(ctx context.Context, opts *ServiceInstanceUpdateOptions) error
- func (s *Service) UpdateServiceInstanceState(ctx context.Context, serviceInstanceID string, ...) error
- func (s *Service) UpdateServiceInstanceStatus(ctx context.Context, databaseID string, serviceInstanceID string, ...) error
- type ServiceConnectionInfo
- type ServiceHostEntry
- type ServiceInstance
- type ServiceInstanceResources
- type ServiceInstanceSpec
- type ServiceInstanceSpecStore
- func (s *ServiceInstanceSpecStore) DatabasePrefix(databaseID string) string
- func (s *ServiceInstanceSpecStore) DeleteByDatabaseID(databaseID string) storage.DeleteOp
- func (s *ServiceInstanceSpecStore) DeleteByKey(databaseID, serviceInstanceID string) storage.DeleteOp
- func (s *ServiceInstanceSpecStore) GetByDatabaseID(databaseID string) storage.GetMultipleOp[*StoredServiceInstanceSpec]
- func (s *ServiceInstanceSpecStore) GetByKey(databaseID, serviceInstanceID string) storage.GetOp[*StoredServiceInstanceSpec]
- func (s *ServiceInstanceSpecStore) Key(databaseID, serviceInstanceID string) string
- func (s *ServiceInstanceSpecStore) Prefix() string
- func (s *ServiceInstanceSpecStore) Update(item *StoredServiceInstanceSpec) storage.PutOp[*StoredServiceInstanceSpec]
- type ServiceInstanceState
- type ServiceInstanceStateUpdate
- type ServiceInstanceStatus
- type ServiceInstanceStatusStore
- func (s *ServiceInstanceStatusStore) DatabasePrefix(databaseID string) string
- func (s *ServiceInstanceStatusStore) DeleteByKey(databaseID, serviceInstanceID string) storage.DeleteOp
- func (s *ServiceInstanceStatusStore) GetAll() storage.GetMultipleOp[*StoredServiceInstanceStatus]
- func (s *ServiceInstanceStatusStore) GetByDatabaseID(databaseID string) storage.GetMultipleOp[*StoredServiceInstanceStatus]
- func (s *ServiceInstanceStatusStore) GetByKey(databaseID, serviceInstanceID string) storage.GetOp[*StoredServiceInstanceStatus]
- func (s *ServiceInstanceStatusStore) Key(databaseID, serviceInstanceID string) string
- func (s *ServiceInstanceStatusStore) Prefix() string
- func (s *ServiceInstanceStatusStore) Put(item *StoredServiceInstanceStatus) storage.PutOp[*StoredServiceInstanceStatus]
- type ServiceInstanceStore
- func (s *ServiceInstanceStore) DatabasePrefix(databaseID string) string
- func (s *ServiceInstanceStore) DeleteByKey(databaseID, serviceInstanceID string) storage.DeleteOp
- func (s *ServiceInstanceStore) GetAll() storage.GetMultipleOp[*StoredServiceInstance]
- func (s *ServiceInstanceStore) GetByDatabaseID(databaseID string) storage.GetMultipleOp[*StoredServiceInstance]
- func (s *ServiceInstanceStore) GetByKey(databaseID, serviceInstanceID string) storage.GetOp[*StoredServiceInstance]
- func (s *ServiceInstanceStore) Key(databaseID, serviceInstanceID string) string
- func (s *ServiceInstanceStore) Prefix() string
- func (s *ServiceInstanceStore) Put(item *StoredServiceInstance) storage.PutOp[*StoredServiceInstance]
- type ServiceInstanceUpdateOptions
- type ServiceSpec
- type Spec
- func (s *Spec) Clone() *Spec
- func (s *Spec) DefaultOptionalFieldsFrom(other *Spec)
- func (s *Spec) Node(name string) (*Node, error)
- func (s *Spec) NodeInstances() ([]*NodeInstances, error)
- func (s *Spec) NodeNames() []string
- func (s *Spec) NormalizeBackupConfig()
- func (s *Spec) RemoveBackupConfigFrom(nodes ...string)
- func (s *Spec) RemoveHost(hostId string) (ok bool)
- func (s *Spec) ValidateNodeNames(names ...string) error
- type SpecStore
- func (s *SpecStore) Create(item *StoredSpec) storage.PutOp[*StoredSpec]
- func (s *SpecStore) Delete(item *StoredSpec) storage.DeleteValueOp[*StoredSpec]
- func (s *SpecStore) ExistsByKey(databaseID string) storage.ExistsOp
- func (s *SpecStore) GetAll() storage.GetMultipleOp[*StoredSpec]
- func (s *SpecStore) GetByKey(databaseID string) storage.GetOp[*StoredSpec]
- func (s *SpecStore) GetByKeys(databaseIDs ...string) storage.GetMultipleOp[*StoredSpec]
- func (s *SpecStore) Key(databaseID string) string
- func (s *SpecStore) Prefix() string
- func (s *SpecStore) Update(item *StoredSpec) storage.PutOp[*StoredSpec]
- type Store
- type StoredDatabase
- type StoredInstance
- type StoredInstanceSpec
- type StoredInstanceStatus
- type StoredScriptResult
- type StoredServiceInstance
- type StoredServiceInstanceSpec
- type StoredServiceInstanceStatus
- type StoredSpec
- type SubscriptionResource
- func (s *SubscriptionResource) Create(ctx context.Context, rc *resource.Context) error
- func (s *SubscriptionResource) Delete(ctx context.Context, rc *resource.Context) error
- func (s *SubscriptionResource) Dependencies() []resource.Identifier
- func (s *SubscriptionResource) DiffIgnore() []string
- func (s *SubscriptionResource) Executor() resource.Executor
- func (s *SubscriptionResource) Identifier() resource.Identifier
- func (s *SubscriptionResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (s *SubscriptionResource) ResourceVersion() string
- func (s *SubscriptionResource) TypeDependencies() []resource.Type
- func (s *SubscriptionResource) Update(ctx context.Context, rc *resource.Context) error
- type SubscriptionStatus
- type SwarmOpts
- type SwitchoverResource
- func (s *SwitchoverResource) Create(ctx context.Context, rc *resource.Context) error
- func (s *SwitchoverResource) Delete(ctx context.Context, rc *resource.Context) error
- func (s *SwitchoverResource) Dependencies() []resource.Identifier
- func (s *SwitchoverResource) DiffIgnore() []string
- func (s *SwitchoverResource) Executor() resource.Executor
- func (s *SwitchoverResource) Identifier() resource.Identifier
- func (s *SwitchoverResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (s *SwitchoverResource) ResourceVersion() string
- func (s *SwitchoverResource) TypeDependencies() []resource.Type
- func (s *SwitchoverResource) Update(ctx context.Context, rc *resource.Context) error
- type SyncEventResource
- func (r *SyncEventResource) Create(ctx context.Context, rc *resource.Context) error
- func (r *SyncEventResource) Delete(ctx context.Context, rc *resource.Context) error
- func (r *SyncEventResource) Dependencies() []resource.Identifier
- func (r *SyncEventResource) DiffIgnore() []string
- func (r *SyncEventResource) Executor() resource.Executor
- func (r *SyncEventResource) Identifier() resource.Identifier
- func (r *SyncEventResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (r *SyncEventResource) ResourceVersion() string
- func (r *SyncEventResource) TypeDependencies() []resource.Type
- func (r *SyncEventResource) Update(ctx context.Context, rc *resource.Context) error
- type User
- type ValidationResult
- type WaitForSyncEventResource
- func (r *WaitForSyncEventResource) Create(ctx context.Context, rc *resource.Context) error
- func (r *WaitForSyncEventResource) Delete(ctx context.Context, rc *resource.Context) error
- func (r *WaitForSyncEventResource) Dependencies() []resource.Identifier
- func (r *WaitForSyncEventResource) DiffIgnore() []string
- func (r *WaitForSyncEventResource) Executor() resource.Executor
- func (r *WaitForSyncEventResource) Identifier() resource.Identifier
- func (r *WaitForSyncEventResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (r *WaitForSyncEventResource) ResourceVersion() string
- func (r *WaitForSyncEventResource) TypeDependencies() []resource.Type
- func (r *WaitForSyncEventResource) Update(ctx context.Context, rc *resource.Context) error
Constants ¶
const ( EtcdCaCertName = "ca.crt" EtcdClientCertName = "client.crt" EtcdClientKeyName = "client.key" )
const ( PostgresCaCertName = "ca.crt" PostgresServerCertName = "server.crt" PostgresServerKeyName = "server.key" PostgresSuperuserCertName = "superuser.crt" PostgresSuperuserKeyName = "superuser.key" PostgresReplicatorCertName = "replication.crt" PostgresReplicatorKeyName = "replication.key" )
const ( TargetSessionAttrsPrimary = "primary" TargetSessionAttrsPreferStandby = "prefer-standby" TargetSessionAttrsStandby = "standby" TargetSessionAttrsReadWrite = "read-write" TargetSessionAttrsAny = "any" )
libpq target_session_attrs values (PG 14+). See: https://www.postgresql.org/docs/current/libpq-connect.html
const InstanceMonitorRefreshInterval = 5 * time.Second
const ResourceTypeDumpRoles resource.Type = "database.dump_roles"
const ResourceTypeInstance resource.Type = "database.instance"
const ResourceTypeLagTrackerCommitTS resource.Type = "database.lag_tracker_commit_ts"
const ResourceTypeNode resource.Type = "database.node"
const ResourceTypePostgresDatabase resource.Type = "database.postgres_database"
const ResourceTypeReplicationSlot resource.Type = "database.replication_slot"
const ResourceTypeReplicationSlotAdvanceFromCTS resource.Type = "database.replication_slot_advance_from_cts"
const ResourceTypeReplicationSlotCreate resource.Type = "database.replication_slot_create"
const ResourceTypeRolesSource resource.Type = "database.roles_source"
const ResourceTypeServiceInstance = "swarm.service_instance"
ResourceTypeServiceInstance is the resource type identifier for service instances. This constant is defined here to avoid import cycles between the orchestrator and workflow packages.
const ResourceTypeSubscription resource.Type = "database.subscription"
const ResourceTypeSwitchover resource.Type = "database.switchover"
const ResourceTypeSyncEvent resource.Type = "database.sync_event"
const ResourceTypeWaitForSyncEvent resource.Type = "database.wait_for_sync_event"
const ServiceInstanceMonitorRefreshInterval = 10 * time.Second
const VariableNameDatabaseNotCreated resource.VariableName = "database_not_created"
Variables ¶
var ( ErrDatabaseAlreadyExists = errors.New("database already exists") ErrDatabaseNotFound = errors.New("database not found") ErrDatabaseNotModifiable = errors.New("database not modifiable") ErrInstanceNotFound = errors.New("instance not found") ErrInstanceStopped = errors.New("instance stopped") ErrInvalidDatabaseUpdate = errors.New("invalid database update") ErrInvalidSourceNode = errors.New("invalid source node") ErrServiceInstanceNotFound = errors.New("service instance not found") )
var ErrNodeNotInDBSpec = errors.New("node not in db spec")
Functions ¶
func ConnectToInstance ¶
func DatabaseStateModifiable ¶
func DatabaseStateModifiable(state DatabaseState) bool
func DumpRolesResourceIdentifier ¶ added in v0.8.0
func DumpRolesResourceIdentifier(nodeName string) resource.Identifier
func ExecuteScript ¶ added in v0.8.0
func GenerateDatabaseNetworkID ¶ added in v0.7.0
GenerateDatabaseNetworkID creates the overlay network ID for a database. Format: {database_id}
func GenerateServiceInstanceID ¶ added in v0.7.0
GenerateServiceInstanceID creates a unique ID for a service instance. Format: {database_id}-{service_id}-{host_id}
func GetPrimaryInstanceID ¶
func InstanceIDFor ¶
func InstanceResourceIdentifier ¶
func InstanceResourceIdentifier(instanceID string) resource.Identifier
func IsDatabaseNotCreated ¶ added in v0.8.0
func LagTrackerCommitTSIdentifier ¶
func LagTrackerCommitTSIdentifier(originNode, receiverNode, databaseName string) resource.Identifier
func NodeResourceIdentifier ¶
func NodeResourceIdentifier(nodeName string) resource.Identifier
func PostgresDatabaseResourceIdentifier ¶ added in v0.8.0
func PostgresDatabaseResourceIdentifier(nodeName, dbName string) resource.Identifier
func RegisterResourceTypes ¶
func ReplicationSlotAdvanceFromCTSResourceIdentifier ¶
func ReplicationSlotAdvanceFromCTSResourceIdentifier(providerNode, subscriberNode, databaseName string) resource.Identifier
ReplicationSlotAdvanceFromCTSResourceIdentifier creates a stable identifier for this resource.
func ReplicationSlotCreateResourceIdentifier ¶
func ReplicationSlotCreateResourceIdentifier(databaseName, providerNode, subscriberNode string) resource.Identifier
func ReplicationSlotResourceIdentifier ¶ added in v0.7.0
func ReplicationSlotResourceIdentifier(providerNode, subscriberNode, databaseName string) resource.Identifier
func RolesSourceResourceIdentifier ¶ added in v0.8.0
func RolesSourceResourceIdentifier(nodeName string) resource.Identifier
func SanitizeRolesDump ¶ added in v0.8.0
func SetScriptNeedsToRun ¶ added in v0.8.0
func SubscriptionResourceIdentifier ¶
func SubscriptionResourceIdentifier(providerNode, subscriberNode, databaseName string) resource.Identifier
func SwitchoverResourceIdentifier ¶
func SwitchoverResourceIdentifier(nodeName string) resource.Identifier
func SyncEventResourceIdentifier ¶
func SyncEventResourceIdentifier(providerNode, subscriberNode, databaseName string) resource.Identifier
func ValidateChangedSpec ¶
func WaitForPatroniRunning ¶
func WaitForPatroniRunning(ctx context.Context, patroniClient *patroni.Client, timeout time.Duration) error
WaitForPatroniRunning polls the Patroni instance status endpoint until one of the following is true: - Patroni reports a running state - The context is canceled - The timeout has elapsed - We encounter more than 3 connection errors Giving a timeout of 0 will disable the timeout condition.
func WaitForSyncEventResourceIdentifier ¶
func WaitForSyncEventResourceIdentifier(providerNode, subscriberNode, databaseName string) resource.Identifier
Types ¶
type BackupConfig ¶
type BackupConfig struct {
Repositories []*pgbackrest.Repository `json:"repositories"`
Schedules []*BackupSchedule `json:"schedules"`
}
func (*BackupConfig) Clone ¶
func (b *BackupConfig) Clone() *BackupConfig
func (*BackupConfig) DefaultOptionalFieldsFrom ¶
func (b *BackupConfig) DefaultOptionalFieldsFrom(other *BackupConfig)
DefaultOptionalFieldsFrom will default this config's optional fields to the values from the given config.
type BackupSchedule ¶
type BackupSchedule struct {
ID string `json:"id"`
Type BackupScheduleType `json:"type"`
CronExpression string `json:"cron_expression"`
}
func (*BackupSchedule) Clone ¶
func (b *BackupSchedule) Clone() *BackupSchedule
type BackupScheduleType ¶
type BackupScheduleType string
const ( BackupScheduleTypeFull BackupScheduleType = "full" BackupScheduleTypeIncremental BackupScheduleType = "incr" )
type BuildServiceHostListParams ¶ added in v0.7.0
type BuildServiceHostListParams struct {
ServiceHostID string // Host where the service instance runs
NodeInstances []*NodeInstances // All database instances, grouped by node
TargetNodes []string // Optional ordered node filter (from database_connection.target_nodes)
TargetSessionAttrs string // Caller-provided: "primary", "prefer-standby", etc.
}
BuildServiceHostListParams holds the inputs for BuildServiceHostList.
type ConnectionInfo ¶
type ConnectionInfo struct {
AdminHost string
AdminPort int
PeerHost string
PeerPort int
PeerSSLCert string
PeerSSLKey string
PeerSSLRootCert string
PatroniPort int
ClientAddresses []string
ClientPort int
InstanceHostname string
}
func (*ConnectionInfo) PatroniURL ¶
func (c *ConnectionInfo) PatroniURL() *url.URL
type Database ¶
type DatabaseConnection ¶ added in v0.7.0
type DatabaseConnection struct {
TargetNodes []string `json:"target_nodes,omitempty"`
TargetSessionAttrs string `json:"target_session_attrs,omitempty"`
}
DatabaseConnection controls how a service connects to the database.
func (*DatabaseConnection) Clone ¶ added in v0.7.0
func (r *DatabaseConnection) Clone() *DatabaseConnection
type DatabaseState ¶
type DatabaseState string
const ( DatabaseStateCreating DatabaseState = "creating" DatabaseStateModifying DatabaseState = "modifying" DatabaseStateAvailable DatabaseState = "available" DatabaseStateDeleting DatabaseState = "deleting" DatabaseStateDegraded DatabaseState = "degraded" DatabaseStateFailed DatabaseState = "failed" DatabaseStateRestoring DatabaseState = "restoring" DatabaseStateUnknown DatabaseState = "unknown" )
func (DatabaseState) IsInProgress ¶ added in v0.8.0
func (d DatabaseState) IsInProgress() bool
type DatabaseStore ¶
type DatabaseStore struct {
// contains filtered or unexported fields
}
func NewDatabaseStore ¶
func NewDatabaseStore(client *clientv3.Client, root string) *DatabaseStore
func (*DatabaseStore) Create ¶
func (s *DatabaseStore) Create(item *StoredDatabase) storage.PutOp[*StoredDatabase]
func (*DatabaseStore) Delete ¶
func (s *DatabaseStore) Delete(item *StoredDatabase) storage.DeleteValueOp[*StoredDatabase]
func (*DatabaseStore) ExistsByKey ¶
func (s *DatabaseStore) ExistsByKey(databaseID string) storage.ExistsOp
func (*DatabaseStore) GetAll ¶
func (s *DatabaseStore) GetAll() storage.GetMultipleOp[*StoredDatabase]
func (*DatabaseStore) GetByKey ¶
func (s *DatabaseStore) GetByKey(databaseID string) storage.GetOp[*StoredDatabase]
func (*DatabaseStore) GetByKeys ¶
func (s *DatabaseStore) GetByKeys(databaseIDs ...string) storage.GetMultipleOp[*StoredDatabase]
func (*DatabaseStore) Key ¶
func (s *DatabaseStore) Key(databaseID string) string
func (*DatabaseStore) Prefix ¶
func (s *DatabaseStore) Prefix() string
func (*DatabaseStore) Update ¶
func (s *DatabaseStore) Update(item *StoredDatabase) storage.PutOp[*StoredDatabase]
type DumpRolesResource ¶ added in v0.8.0
type DumpRolesResource struct {
NodeName string `json:"node_name"`
Roles []string `json:"roles"`
Statements []string `json:"statements"`
}
func (*DumpRolesResource) Dependencies ¶ added in v0.8.0
func (r *DumpRolesResource) Dependencies() []resource.Identifier
func (*DumpRolesResource) DiffIgnore ¶ added in v0.8.0
func (r *DumpRolesResource) DiffIgnore() []string
func (*DumpRolesResource) Executor ¶ added in v0.8.0
func (r *DumpRolesResource) Executor() resource.Executor
func (*DumpRolesResource) Identifier ¶ added in v0.8.0
func (r *DumpRolesResource) Identifier() resource.Identifier
func (*DumpRolesResource) ResourceVersion ¶ added in v0.8.0
func (r *DumpRolesResource) ResourceVersion() string
func (*DumpRolesResource) TypeDependencies ¶ added in v0.8.0
func (r *DumpRolesResource) TypeDependencies() []resource.Type
type ExtraNetworkSpec ¶
type ExtraVolumesSpec ¶
type HealthCheckResult ¶ added in v0.7.0
type Instance ¶
type Instance struct {
InstanceID string `json:"instance_id"`
DatabaseID string `json:"database_id"`
HostID string `json:"host_id"`
NodeName string `json:"node_name"`
State InstanceState `json:"state"`
Status *InstanceStatus `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Port *int `json:"port"`
PatroniPort *int `json:"patroni_port"`
PgEdgeVersion *ds.PgEdgeVersion `json:"pgedge_version"`
Error string `json:"error,omitempty"`
}
type InstancePaths ¶ added in v0.8.0
type InstancePaths struct {
Instance Paths `json:"instance"`
Host Paths `json:"host"`
PgBackRestPath string `json:"pg_backrest_path"`
PatroniPath string `json:"patroni_path"`
}
func (*InstancePaths) HostMvDataToRestoreCmd ¶ added in v0.8.0
func (p *InstancePaths) HostMvDataToRestoreCmd() []string
func (*InstancePaths) InstanceMvRestoreToDataCmd ¶ added in v0.8.0
func (p *InstancePaths) InstanceMvRestoreToDataCmd() []string
func (*InstancePaths) PgBackRestBackupCmd ¶ added in v0.8.0
func (p *InstancePaths) PgBackRestBackupCmd(command string, args ...string) pgbackrest.Cmd
func (*InstancePaths) PgBackRestRestoreCmd ¶ added in v0.8.0
func (p *InstancePaths) PgBackRestRestoreCmd(command string, args ...string) pgbackrest.Cmd
type InstanceResource ¶
type InstanceResource struct {
Spec *InstanceSpec `json:"spec"`
InstanceHostname string `json:"instance_hostname"`
PrimaryInstanceID string `json:"primary_instance_id"`
OrchestratorDependencies []resource.Identifier `json:"dependencies"`
ConnectionInfo *ConnectionInfo `json:"connection_info"`
PostInit *Script `json:"post_init"`
}
func GetAllInstances ¶
func GetPrimaryInstance ¶
func (*InstanceResource) Connection ¶
func (*InstanceResource) Dependencies ¶
func (r *InstanceResource) Dependencies() []resource.Identifier
func (*InstanceResource) DiffIgnore ¶
func (r *InstanceResource) DiffIgnore() []string
func (*InstanceResource) Executor ¶
func (r *InstanceResource) Executor() resource.Executor
func (*InstanceResource) Identifier ¶
func (r *InstanceResource) Identifier() resource.Identifier
func (*InstanceResource) InstanceID ¶ added in v0.8.0
func (r *InstanceResource) InstanceID() string
func (*InstanceResource) Paths ¶ added in v0.8.0
func (r *InstanceResource) Paths(orchestrator Orchestrator) (InstancePaths, error)
func (*InstanceResource) PostgresVersion ¶ added in v0.8.0
func (r *InstanceResource) PostgresVersion() (*ds.Version, error)
func (*InstanceResource) ResourceVersion ¶
func (r *InstanceResource) ResourceVersion() string
func (*InstanceResource) TypeDependencies ¶ added in v0.7.0
func (r *InstanceResource) TypeDependencies() []resource.Type
func (*InstanceResource) Validate ¶
func (r *InstanceResource) Validate() error
type InstanceResources ¶
type InstanceResources struct {
Instance *InstanceResource
InstanceDependencies []*resource.ResourceData
DatabaseDependencies []*resource.ResourceData
NodeDependents []*resource.ResourceData
}
func NewInstanceResources ¶
func NewInstanceResources( instance *InstanceResource, instanceDependencies []resource.Resource, databaseDependencies []resource.Resource, nodeDependents []resource.Resource, ) (*InstanceResources, error)
func (*InstanceResources) AddDatabaseDependencies ¶ added in v0.8.0
func (r *InstanceResources) AddDatabaseDependencies(resources ...resource.Resource) error
func (*InstanceResources) AddInstanceDependencies ¶ added in v0.8.0
func (r *InstanceResources) AddInstanceDependencies(resources ...resource.Resource) error
func (*InstanceResources) AddNodeDependents ¶ added in v0.8.0
func (r *InstanceResources) AddNodeDependents(resources ...resource.Resource) error
func (*InstanceResources) DatabaseDependencyIdentifiers ¶ added in v0.8.0
func (r *InstanceResources) DatabaseDependencyIdentifiers() []resource.Identifier
func (*InstanceResources) DatabaseID ¶
func (r *InstanceResources) DatabaseID() string
func (*InstanceResources) DatabaseName ¶
func (r *InstanceResources) DatabaseName() string
func (*InstanceResources) HostID ¶
func (r *InstanceResources) HostID() string
func (*InstanceResources) InstanceID ¶
func (r *InstanceResources) InstanceID() string
func (*InstanceResources) InstanceState ¶ added in v0.8.0
func (r *InstanceResources) InstanceState() (*resource.State, error)
func (*InstanceResources) NodeName ¶
func (r *InstanceResources) NodeName() string
type InstanceSpec ¶
type InstanceSpec struct {
InstanceID string `json:"instance_id"`
TenantID *string `json:"tenant_id,omitempty"`
DatabaseID string `json:"database_id"`
HostID string `json:"host_id"`
DatabaseName string `json:"database_name"`
NodeName string `json:"node_name"`
NodeOrdinal int `json:"node_ordinal"`
PgEdgeVersion *ds.PgEdgeVersion `json:"pg_edge_version"`
Port *int `json:"port"`
PatroniPort *int `json:"patroni_port"`
CPUs float64 `json:"cpus"`
MemoryBytes uint64 `json:"memory"`
DatabaseUsers []*User `json:"database_users"`
BackupConfig *BackupConfig `json:"backup_config"`
RestoreConfig *RestoreConfig `json:"restore_config"`
PostgreSQLConf map[string]any `json:"postgresql_conf"`
ClusterSize int `json:"cluster_size"`
OrchestratorOpts *OrchestratorOpts `json:"orchestrator_opts,omitempty"`
InPlaceRestore bool `json:"in_place_restore,omitempty"`
AllHostIDs []string `json:"all_host_ids"` // All host IDs in the database
}
func (*InstanceSpec) Clone ¶
func (s *InstanceSpec) Clone() *InstanceSpec
func (*InstanceSpec) CopySettingsFrom ¶ added in v0.7.0
func (s *InstanceSpec) CopySettingsFrom(current *InstanceSpec)
type InstanceSpecChange ¶ added in v0.5.1
type InstanceSpecChange struct {
Previous *InstanceSpec
Current *InstanceSpec
}
type InstanceSpecStore ¶ added in v0.7.0
type InstanceSpecStore struct {
// contains filtered or unexported fields
}
func NewInstanceSpecStore ¶ added in v0.7.0
func NewInstanceSpecStore(client *clientv3.Client, root string) *InstanceSpecStore
func (*InstanceSpecStore) DatabasePrefix ¶ added in v0.7.0
func (s *InstanceSpecStore) DatabasePrefix(databaseID string) string
func (*InstanceSpecStore) DeleteByDatabaseID ¶ added in v0.7.0
func (s *InstanceSpecStore) DeleteByDatabaseID(databaseID string) storage.DeleteOp
func (*InstanceSpecStore) DeleteByKey ¶ added in v0.7.0
func (s *InstanceSpecStore) DeleteByKey(databaseID, instanceID string) storage.DeleteOp
func (*InstanceSpecStore) GetAll ¶ added in v0.7.0
func (s *InstanceSpecStore) GetAll() storage.GetMultipleOp[*StoredInstanceSpec]
func (*InstanceSpecStore) GetByDatabaseID ¶ added in v0.7.0
func (s *InstanceSpecStore) GetByDatabaseID(databaseID string) storage.GetMultipleOp[*StoredInstanceSpec]
func (*InstanceSpecStore) GetByKey ¶ added in v0.7.0
func (s *InstanceSpecStore) GetByKey(databaseID, instanceID string) storage.GetOp[*StoredInstanceSpec]
func (*InstanceSpecStore) Key ¶ added in v0.7.0
func (s *InstanceSpecStore) Key(databaseID, instanceID string) string
func (*InstanceSpecStore) Prefix ¶ added in v0.7.0
func (s *InstanceSpecStore) Prefix() string
func (*InstanceSpecStore) Update ¶ added in v0.7.0
func (s *InstanceSpecStore) Update(item *StoredInstanceSpec) storage.PutOp[*StoredInstanceSpec]
type InstanceState ¶
type InstanceState string
const ( InstanceStateCreating InstanceState = "creating" InstanceStateModifying InstanceState = "modifying" InstanceStateDeleting InstanceState = "deleting" InstanceStateBackingUp InstanceState = "backing_up" InstanceStateAvailable InstanceState = "available" InstanceStateDegraded InstanceState = "degraded" InstanceStateFailed InstanceState = "failed" InstanceStateStopped InstanceState = "stopped" InstanceStateUnknown InstanceState = "unknown" )
func (InstanceState) IsInProgress ¶ added in v0.7.0
func (i InstanceState) IsInProgress() bool
type InstanceStateUpdateOptions ¶ added in v0.8.0
type InstanceStatus ¶
type InstanceStatus struct {
PostgresVersion *string `json:"postgres_version,omitempty"`
SpockVersion *string `json:"spock_version,omitempty"`
Addresses []string `json:"addresses,omitempty"`
Port *int `json:"port,omitempty"`
PatroniState *patroni.State `json:"patroni_state,omitempty"`
Role *patroni.InstanceRole `json:"role,omitempty"`
ReadOnly *string `json:"read_only,omitempty"`
PendingRestart *bool `json:"pending_restart,omitempty"`
PatroniPaused *bool `json:"patroni_paused,omitempty"`
StatusUpdatedAt *time.Time `json:"status_updated_at,omitempty"`
Stopped *bool `json:"stopped,omitempty"`
Subscriptions []SubscriptionStatus `json:"subscriptions,omitempty"`
Error *string `json:"error,omitempty"`
}
func (*InstanceStatus) IsPrimary ¶
func (s *InstanceStatus) IsPrimary() bool
type InstanceStatusStore ¶
type InstanceStatusStore struct {
// contains filtered or unexported fields
}
func NewInstanceStatusStore ¶
func NewInstanceStatusStore(client *clientv3.Client, root string) *InstanceStatusStore
func (*InstanceStatusStore) DatabasePrefix ¶
func (s *InstanceStatusStore) DatabasePrefix(databaseID string) string
func (*InstanceStatusStore) DeleteByDatabaseID ¶ added in v0.7.0
func (s *InstanceStatusStore) DeleteByDatabaseID(databaseID string) storage.DeleteOp
func (*InstanceStatusStore) DeleteByKey ¶
func (s *InstanceStatusStore) DeleteByKey(databaseID, instanceID string) storage.DeleteOp
func (*InstanceStatusStore) GetAll ¶
func (s *InstanceStatusStore) GetAll() storage.GetMultipleOp[*StoredInstanceStatus]
func (*InstanceStatusStore) GetByDatabaseID ¶
func (s *InstanceStatusStore) GetByDatabaseID(databaseID string) storage.GetMultipleOp[*StoredInstanceStatus]
func (*InstanceStatusStore) GetByKey ¶
func (s *InstanceStatusStore) GetByKey(databaseID, instanceID string) storage.GetOp[*StoredInstanceStatus]
func (*InstanceStatusStore) Key ¶
func (s *InstanceStatusStore) Key(databaseID, instanceID string) string
func (*InstanceStatusStore) Prefix ¶
func (s *InstanceStatusStore) Prefix() string
func (*InstanceStatusStore) Put ¶
func (s *InstanceStatusStore) Put(item *StoredInstanceStatus) storage.PutOp[*StoredInstanceStatus]
type InstanceStore ¶
type InstanceStore struct {
// contains filtered or unexported fields
}
func NewInstanceStore ¶
func NewInstanceStore(client *clientv3.Client, root string) *InstanceStore
func (*InstanceStore) DatabasePrefix ¶
func (s *InstanceStore) DatabasePrefix(databaseID string) string
func (*InstanceStore) DeleteByDatabaseID ¶ added in v0.7.0
func (s *InstanceStore) DeleteByDatabaseID(databaseID string) storage.DeleteOp
func (*InstanceStore) DeleteByKey ¶
func (s *InstanceStore) DeleteByKey(databaseID, instanceID string) storage.DeleteOp
func (*InstanceStore) GetAll ¶
func (s *InstanceStore) GetAll() storage.GetMultipleOp[*StoredInstance]
func (*InstanceStore) GetByDatabaseID ¶
func (s *InstanceStore) GetByDatabaseID(databaseID string) storage.GetMultipleOp[*StoredInstance]
func (*InstanceStore) GetByKey ¶
func (s *InstanceStore) GetByKey(databaseID, instanceID string) storage.GetOp[*StoredInstance]
func (*InstanceStore) Key ¶
func (s *InstanceStore) Key(databaseID, instanceID string) string
func (*InstanceStore) Prefix ¶
func (s *InstanceStore) Prefix() string
func (*InstanceStore) Put ¶
func (s *InstanceStore) Put(item *StoredInstance) storage.PutOp[*StoredInstance]
type InstanceUpdateOptions ¶
type InstanceUpdateOptions struct {
InstanceID string `json:"instance_id"`
DatabaseID string `json:"database_id"`
HostID string `json:"host_id"`
NodeName string `json:"node_name"`
State InstanceState `json:"state"`
Port *int `json:"port"`
PatroniPort *int `json:"patroni_port"`
PgEdgeVersion *ds.PgEdgeVersion `json:"pgedge_version"`
Error string `json:"error,omitempty"`
Now time.Time `json:"now"`
}
type LagTrackerCommitTimestampResource ¶
type LagTrackerCommitTimestampResource struct {
// Planner fields
OriginNode string `json:"origin_node"`
ReceiverNode string `json:"receiver_node"`
DatabaseName string `json:"database_name"`
// Dependency wiring
ExtraDependencies []resource.Identifier `json:"dependent_resources,omitempty"`
// Output (filled at Refresh/Create time)
CommitTimestamp *time.Time `json:"commit_timestamp,omitempty"`
}
func (*LagTrackerCommitTimestampResource) Dependencies ¶
func (r *LagTrackerCommitTimestampResource) Dependencies() []resource.Identifier
func (*LagTrackerCommitTimestampResource) DiffIgnore ¶
func (r *LagTrackerCommitTimestampResource) DiffIgnore() []string
func (*LagTrackerCommitTimestampResource) Executor ¶
func (r *LagTrackerCommitTimestampResource) Executor() resource.Executor
func (*LagTrackerCommitTimestampResource) Identifier ¶
func (r *LagTrackerCommitTimestampResource) Identifier() resource.Identifier
func (*LagTrackerCommitTimestampResource) ResourceVersion ¶
func (r *LagTrackerCommitTimestampResource) ResourceVersion() string
func (*LagTrackerCommitTimestampResource) TypeDependencies ¶ added in v0.7.0
func (r *LagTrackerCommitTimestampResource) TypeDependencies() []resource.Type
type MCPServiceConfig ¶ added in v0.7.0
type MCPServiceConfig struct {
// Optional - LLM proxy for web client (default: false)
LLMEnabled *bool `json:"llm_enabled,omitempty"`
// Required when llm_enabled is true
LLMProvider string `json:"llm_provider"`
LLMModel string `json:"llm_model"`
AnthropicAPIKey *string `json:"anthropic_api_key,omitempty"`
OpenAIAPIKey *string `json:"openai_api_key,omitempty"`
OllamaURL *string `json:"ollama_url,omitempty"`
// Optional - security
AllowWrites *bool `json:"allow_writes,omitempty"`
InitToken *string `json:"init_token,omitempty"`
InitUsers []MCPServiceUser `json:"init_users,omitempty"`
// Optional - embeddings
EmbeddingProvider *string `json:"embedding_provider,omitempty"`
EmbeddingModel *string `json:"embedding_model,omitempty"`
EmbeddingAPIKey *string `json:"embedding_api_key,omitempty"`
// Optional - LLM tuning (overridable defaults)
LLMTemperature *float64 `json:"llm_temperature,omitempty"`
LLMMaxTokens *int `json:"llm_max_tokens,omitempty"`
// Optional - connection pool (overridable defaults)
PoolMaxConns *int `json:"pool_max_conns,omitempty"`
// Optional - tool toggles (all enabled by default)
DisableQueryDatabase *bool `json:"disable_query_database,omitempty"`
DisableGetSchemaInfo *bool `json:"disable_get_schema_info,omitempty"`
DisableSimilaritySearch *bool `json:"disable_similarity_search,omitempty"`
DisableExecuteExplain *bool `json:"disable_execute_explain,omitempty"`
DisableGenerateEmbedding *bool `json:"disable_generate_embedding,omitempty"`
DisableSearchKnowledgebase *bool `json:"disable_search_knowledgebase,omitempty"`
DisableCountRows *bool `json:"disable_count_rows,omitempty"`
}
MCPServiceConfig is the typed internal representation of MCP service configuration. It is parsed from the ServiceSpec.Config map[string]any and validated.
func ParseMCPServiceConfig ¶ added in v0.7.0
func ParseMCPServiceConfig(config map[string]any, isUpdate bool) (*MCPServiceConfig, []error)
ParseMCPServiceConfig parses and validates a config map into a typed MCPServiceConfig. If isUpdate is true, bootstrap-only fields (init_token, init_users) are rejected.
type MCPServiceUser ¶ added in v0.7.0
MCPServiceUser represents a bootstrap user account for the MCP service.
type Node ¶
type Node struct {
Name string `json:"name"`
HostIDs []string `json:"host_ids"`
PostgresVersion string `json:"postgres_version"`
Port *int `json:"port"`
PatroniPort *int `json:"patroni_port"`
CPUs float64 `json:"cpus"`
MemoryBytes uint64 `json:"memory"`
PostgreSQLConf map[string]any `json:"postgresql_conf"`
BackupConfig *BackupConfig `json:"backup_config"`
RestoreConfig *RestoreConfig `json:"restore_config"`
OrchestratorOpts *OrchestratorOpts `json:"orchestrator_opts,omitempty"`
SourceNode string `json:"source_node,omitempty"`
}
func (*Node) DefaultOptionalFieldsFrom ¶
DefaultOptionalFieldsFrom will default this node's optional fields to the values from the given node.
type NodeInstances ¶
type NodeInstances struct {
DatabaseID string `json:"database_id"`
DatabaseOwner string `json:"database_owner"`
DatabaseName string `json:"database_name"`
NodeName string `json:"node_name"`
SourceNode string `json:"source_node"`
Instances []*InstanceSpec `json:"instances"`
RestoreConfig *RestoreConfig `json:"restore_config"`
Scripts *ScriptStatements `json:"scripts"`
}
func (*NodeInstances) InstanceIDs ¶
func (n *NodeInstances) InstanceIDs() []string
type NodeResource ¶
type NodeResource struct {
Name string `json:"name"`
InstanceIDs []string `json:"instance_ids"`
PrimaryInstanceID string `json:"primary_instance_id"`
}
func (*NodeResource) DSN ¶ added in v0.8.0
func (n *NodeResource) DSN( ctx context.Context, rc *resource.Context, fromInstance *InstanceResource, dbName string, ) (*postgres.DSN, error)
func (*NodeResource) Dependencies ¶
func (n *NodeResource) Dependencies() []resource.Identifier
func (*NodeResource) DiffIgnore ¶
func (n *NodeResource) DiffIgnore() []string
func (*NodeResource) Executor ¶
func (n *NodeResource) Executor() resource.Executor
func (*NodeResource) Identifier ¶
func (n *NodeResource) Identifier() resource.Identifier
func (*NodeResource) PrimaryInstance ¶ added in v0.8.0
func (n *NodeResource) PrimaryInstance(ctx context.Context, rc *resource.Context) (*InstanceResource, error)
func (*NodeResource) ResourceVersion ¶
func (n *NodeResource) ResourceVersion() string
func (*NodeResource) TypeDependencies ¶ added in v0.7.0
func (n *NodeResource) TypeDependencies() []resource.Type
type Orchestrator ¶
type Orchestrator interface {
GenerateInstanceResources(spec *InstanceSpec, scripts Scripts) (*InstanceResources, error)
GenerateInstanceRestoreResources(spec *InstanceSpec, taskID uuid.UUID) (*InstanceResources, error)
GenerateServiceInstanceResources(spec *ServiceInstanceSpec) (*ServiceInstanceResources, error)
GetInstanceConnectionInfo(ctx context.Context,
databaseID, instanceID string,
postgresPort, patroniPort *int,
pgEdgeVersion *ds.PgEdgeVersion) (*ConnectionInfo, error)
GetServiceInstanceStatus(ctx context.Context, serviceInstanceID string) (*ServiceInstanceStatus, error)
CreatePgBackRestBackup(ctx context.Context, w io.Writer, spec *InstanceSpec, options *pgbackrest.BackupOptions) error
ExecuteInstanceCommand(ctx context.Context, w io.Writer, databaseID, instanceID string, args ...string) error
ValidateInstanceSpecs(ctx context.Context, changes []*InstanceSpecChange) ([]*ValidationResult, error)
StopInstance(ctx context.Context, instanceID string) error
StartInstance(ctx context.Context, instanceID string) error
NodeDSN(ctx context.Context, rc *resource.Context, nodeName string, fromInstanceID string, dbName string) (*postgres.DSN, error)
InstancePaths(pgVersion *ds.Version, instanceID string) (InstancePaths, error)
}
type OrchestratorOpts ¶
type OrchestratorOpts struct {
Swarm *SwarmOpts `json:"docker,omitempty"`
}
func (*OrchestratorOpts) Clone ¶
func (o *OrchestratorOpts) Clone() *OrchestratorOpts
type Paths ¶ added in v0.8.0
type Paths struct {
BaseDir string `json:"base_dir"`
}
func (*Paths) Certificates ¶ added in v0.8.0
func (*Paths) EtcdCaCert ¶ added in v0.8.0
func (*Paths) EtcdCertificates ¶ added in v0.8.0
func (*Paths) EtcdClientCert ¶ added in v0.8.0
func (*Paths) EtcdClientKey ¶ added in v0.8.0
func (*Paths) PatroniConfig ¶ added in v0.8.0
func (*Paths) PgBackRestConfig ¶ added in v0.8.0
func (p *Paths) PgBackRestConfig(confType pgbackrest.ConfigType) string
func (*Paths) PgDataRestore ¶ added in v0.8.0
func (*Paths) PostgresCaCert ¶ added in v0.8.0
func (*Paths) PostgresCertificates ¶ added in v0.8.0
func (*Paths) PostgresReplicatorCert ¶ added in v0.8.0
func (*Paths) PostgresReplicatorKey ¶ added in v0.8.0
func (*Paths) PostgresServerCert ¶ added in v0.8.0
func (*Paths) PostgresServerKey ¶ added in v0.8.0
func (*Paths) PostgresSuperuserCert ¶ added in v0.8.0
func (*Paths) PostgresSuperuserKey ¶ added in v0.8.0
type PortMapping ¶ added in v0.7.0
type PostgRESTConnParams ¶ added in v0.8.0
type PostgRESTConnParams struct {
Username string
Password string
DatabaseName string
DatabaseHosts []ServiceHostEntry
TargetSessionAttrs string
}
PostgRESTConnParams holds the connection and credential details needed to generate a complete postgrest.conf. These are kept separate from PostgRESTServiceConfig because they are runtime-provisioned values (not user-supplied configuration).
type PostgRESTServiceConfig ¶ added in v0.7.0
type PostgRESTServiceConfig struct {
DBSchemas string `json:"db_schemas"` // default: "public"
DBAnonRole string `json:"db_anon_role"` // required: no default
DBPool int `json:"db_pool"` // default: 10, range: 1-30
MaxRows int `json:"max_rows"` // default: 1000, range: 1-10000
JWTSecret *string `json:"jwt_secret,omitempty"`
JWTAud *string `json:"jwt_aud,omitempty"`
JWTRoleClaimKey *string `json:"jwt_role_claim_key,omitempty"`
ServerCORSAllowedOrigins *string `json:"server_cors_allowed_origins,omitempty"`
}
PostgRESTServiceConfig is the typed internal representation of PostgREST service configuration. Parsed from ServiceSpec.Config map[string]any. DBAnonRole is required; all other fields are optional with defaults applied when absent.
func ParsePostgRESTServiceConfig ¶ added in v0.7.0
func ParsePostgRESTServiceConfig(config map[string]any) (*PostgRESTServiceConfig, []error)
ParsePostgRESTServiceConfig parses and validates a config map into a typed PostgRESTServiceConfig. All fields are optional with sensible defaults.
func (*PostgRESTServiceConfig) GenerateConf ¶ added in v0.8.0
func (c *PostgRESTServiceConfig) GenerateConf(conn PostgRESTConnParams) ([]byte, error)
GenerateConf renders a postgrest.conf file from the service config and the runtime connection parameters. The db-uri (including credentials) is written into the file; no credentials are exposed as environment variables.
type PostgresDatabaseResource ¶ added in v0.8.0
type PostgresDatabaseResource struct {
DatabaseID string `json:"database_id"`
NodeName string `json:"node_name"`
DatabaseName string `json:"database_name"`
Owner string `json:"owner"`
RenameFrom string `json:"rename_from"`
HasRestoreConfig bool `json:"has_restore_config"`
ExtraDependencies []resource.Identifier `json:"extra_dependencies"`
PostDatabaseCreate *Script `json:"post_database_create,omitempty"`
}
func (*PostgresDatabaseResource) Dependencies ¶ added in v0.8.0
func (p *PostgresDatabaseResource) Dependencies() []resource.Identifier
func (*PostgresDatabaseResource) DiffIgnore ¶ added in v0.8.0
func (p *PostgresDatabaseResource) DiffIgnore() []string
func (*PostgresDatabaseResource) Executor ¶ added in v0.8.0
func (p *PostgresDatabaseResource) Executor() resource.Executor
func (*PostgresDatabaseResource) Identifier ¶ added in v0.8.0
func (p *PostgresDatabaseResource) Identifier() resource.Identifier
func (*PostgresDatabaseResource) ResourceVersion ¶ added in v0.8.0
func (p *PostgresDatabaseResource) ResourceVersion() string
func (*PostgresDatabaseResource) TypeDependencies ¶ added in v0.8.0
func (p *PostgresDatabaseResource) TypeDependencies() []resource.Type
type RAGDefaults ¶ added in v0.8.0
type RAGDefaults struct {
TokenBudget *int `json:"token_budget,omitempty"`
TopN *int `json:"top_n,omitempty"`
}
RAGDefaults represents default values applied to all pipelines.
type RAGPipeline ¶ added in v0.8.0
type RAGPipeline struct {
Name string `json:"name"`
Description *string `json:"description,omitempty"`
Tables []RAGPipelineTable `json:"tables"`
EmbeddingLLM RAGPipelineLLMConfig `json:"embedding_llm"`
RAGLLM RAGPipelineLLMConfig `json:"rag_llm"`
TokenBudget *int `json:"token_budget,omitempty"`
TopN *int `json:"top_n,omitempty"`
SystemPrompt *string `json:"system_prompt,omitempty"`
Search *RAGPipelineSearch `json:"search,omitempty"`
}
RAGPipeline represents a single RAG pipeline configuration.
type RAGPipelineLLMConfig ¶ added in v0.8.0
type RAGPipelineLLMConfig struct {
Provider string `json:"provider"`
Model string `json:"model"`
APIKey *string `json:"api_key,omitempty"`
BaseURL *string `json:"base_url,omitempty"`
}
RAGPipelineLLMConfig represents LLM configuration for an embedding or RAG step.
type RAGPipelineSearch ¶ added in v0.8.0
type RAGPipelineSearch struct {
HybridEnabled *bool `json:"hybrid_enabled,omitempty"`
VectorWeight *float64 `json:"vector_weight,omitempty"`
}
RAGPipelineSearch represents search tuning for a pipeline.
type RAGPipelineTable ¶ added in v0.8.0
type RAGPipelineTable struct {
Table string `json:"table"`
TextColumn string `json:"text_column"`
VectorColumn string `json:"vector_column"`
IDColumn *string `json:"id_column,omitempty"`
}
RAGPipelineTable represents a table configuration for a pipeline.
type RAGServiceConfig ¶ added in v0.8.0
type RAGServiceConfig struct {
Pipelines []RAGPipeline `json:"pipelines"`
Defaults *RAGDefaults `json:"defaults,omitempty"`
}
RAGServiceConfig is the typed internal representation of RAG service configuration. It is parsed from the ServiceSpec.Config map[string]any and validated.
func ParseRAGServiceConfig ¶ added in v0.8.0
func ParseRAGServiceConfig(config map[string]any, _ bool) (*RAGServiceConfig, []error)
ParseRAGServiceConfig parses and validates a config map into a typed RAGServiceConfig.
type ReplicationSlotAdvanceFromCTSResource ¶
type ReplicationSlotAdvanceFromCTSResource struct {
DatabaseName string `json:"database_name"`
ProviderNode string `json:"provider_node"` // slot lives here
SubscriberNode string `json:"subscriber_node"` // target/receiver node
}
ReplicationSlotAdvanceFromCTSResource advances the replication slot on the provider to the LSN derived from the commit timestamp captured in lag_tracker.
func (*ReplicationSlotAdvanceFromCTSResource) Dependencies ¶
func (r *ReplicationSlotAdvanceFromCTSResource) Dependencies() []resource.Identifier
func (*ReplicationSlotAdvanceFromCTSResource) DiffIgnore ¶
func (r *ReplicationSlotAdvanceFromCTSResource) DiffIgnore() []string
No diff-ignore fields needed; this always executes idempotently when asked.
func (*ReplicationSlotAdvanceFromCTSResource) Executor ¶
func (r *ReplicationSlotAdvanceFromCTSResource) Executor() resource.Executor
Execute on the provider node (the slot exists there).
func (*ReplicationSlotAdvanceFromCTSResource) Identifier ¶
func (r *ReplicationSlotAdvanceFromCTSResource) Identifier() resource.Identifier
func (*ReplicationSlotAdvanceFromCTSResource) ResourceVersion ¶
func (r *ReplicationSlotAdvanceFromCTSResource) ResourceVersion() string
func (*ReplicationSlotAdvanceFromCTSResource) TypeDependencies ¶ added in v0.7.0
func (r *ReplicationSlotAdvanceFromCTSResource) TypeDependencies() []resource.Type
type ReplicationSlotCreateResource ¶
type ReplicationSlotCreateResource struct {
DatabaseName string `json:"database_name"`
ProviderNode string `json:"provider_node"`
SubscriberNode string `json:"subscriber_node"`
}
func (*ReplicationSlotCreateResource) Dependencies ¶
func (r *ReplicationSlotCreateResource) Dependencies() []resource.Identifier
func (*ReplicationSlotCreateResource) DiffIgnore ¶
func (r *ReplicationSlotCreateResource) DiffIgnore() []string
func (*ReplicationSlotCreateResource) Executor ¶
func (r *ReplicationSlotCreateResource) Executor() resource.Executor
func (*ReplicationSlotCreateResource) Identifier ¶
func (r *ReplicationSlotCreateResource) Identifier() resource.Identifier
func (*ReplicationSlotCreateResource) ResourceVersion ¶
func (r *ReplicationSlotCreateResource) ResourceVersion() string
func (*ReplicationSlotCreateResource) TypeDependencies ¶ added in v0.7.0
func (r *ReplicationSlotCreateResource) TypeDependencies() []resource.Type
type ReplicationSlotResource ¶ added in v0.7.0
type ReplicationSlotResource struct {
DatabaseName string `json:"database_name"`
ProviderNode string `json:"provider_node"`
SubscriberNode string `json:"subscriber_node"`
}
ReplicationSlotResource represents the replication slot on a provider node that serves a subscription from a subscriber node. It only implements the Delete lifecycle method: when a subscription is removed, this resource ensures the corresponding replication slot is dropped on the provider, preventing orphaned slots from accumulating WAL.
func (*ReplicationSlotResource) Dependencies ¶ added in v0.7.0
func (r *ReplicationSlotResource) Dependencies() []resource.Identifier
func (*ReplicationSlotResource) DiffIgnore ¶ added in v0.7.0
func (r *ReplicationSlotResource) DiffIgnore() []string
func (*ReplicationSlotResource) Executor ¶ added in v0.7.0
func (r *ReplicationSlotResource) Executor() resource.Executor
func (*ReplicationSlotResource) Identifier ¶ added in v0.7.0
func (r *ReplicationSlotResource) Identifier() resource.Identifier
func (*ReplicationSlotResource) ResourceVersion ¶ added in v0.7.0
func (r *ReplicationSlotResource) ResourceVersion() string
func (*ReplicationSlotResource) TypeDependencies ¶ added in v0.7.0
func (r *ReplicationSlotResource) TypeDependencies() []resource.Type
type RestoreConfig ¶
type RestoreConfig struct {
SourceDatabaseID string `json:"source_database_id"`
SourceNodeName string `json:"source_node_name"`
SourceDatabaseName string `json:"source_database_name"`
Repository *pgbackrest.Repository `json:"repository"`
RestoreOptions map[string]string `json:"restore_options"`
}
func (*RestoreConfig) Clone ¶
func (r *RestoreConfig) Clone() *RestoreConfig
func (*RestoreConfig) DefaultOptionalFieldsFrom ¶
func (r *RestoreConfig) DefaultOptionalFieldsFrom(other *RestoreConfig)
DefaultOptionalFieldsFrom will default this config's optional fields to the values from the given config.
type RolesSourceResource ¶ added in v0.8.0
type RolesSourceResource struct {
NodeName string `json:"node_name"`
SourceNodeName string `json:"source_node_name"`
}
func (*RolesSourceResource) Dependencies ¶ added in v0.8.0
func (r *RolesSourceResource) Dependencies() []resource.Identifier
func (*RolesSourceResource) DiffIgnore ¶ added in v0.8.0
func (r *RolesSourceResource) DiffIgnore() []string
func (*RolesSourceResource) Executor ¶ added in v0.8.0
func (r *RolesSourceResource) Executor() resource.Executor
func (*RolesSourceResource) Identifier ¶ added in v0.8.0
func (r *RolesSourceResource) Identifier() resource.Identifier
func (*RolesSourceResource) ResourceVersion ¶ added in v0.8.0
func (r *RolesSourceResource) ResourceVersion() string
func (*RolesSourceResource) TypeDependencies ¶ added in v0.8.0
func (r *RolesSourceResource) TypeDependencies() []resource.Type
type Script ¶ added in v0.8.0
type Script struct {
DatabaseID string `json:"database_id"`
NodeName string `json:"node_name"`
Name ScriptName `json:"name"`
Statements []string `json:"statements"`
Succeeded bool `json:"succeeded"`
// NeedsToRun is used to trigger a resource diff. Resources should call
// SetScriptNeedsToRun to set it.
NeedsToRun bool `json:"needs_to_run"`
}
type ScriptName ¶ added in v0.8.0
type ScriptName string
const ( ScriptNamePostInit ScriptName = "post_init" ScriptNamePostDatabaseCreate ScriptName = "post_database_create" )
func (ScriptName) String ¶ added in v0.8.0
func (s ScriptName) String() string
type ScriptResult ¶ added in v0.8.0
type ScriptResult struct {
DatabaseID string `json:"database_id"`
ScriptName ScriptName `json:"script_name"`
NodeName string `json:"node_name"`
Succeeded bool `json:"succeeded"`
StartedAt time.Time `json:"started_at"`
CompletedAt time.Time `json:"completed_at"`
Error string `json:"error"`
}
func NewScriptResult ¶ added in v0.8.0
func NewScriptResult(databaseID string, scriptName ScriptName, nodeName string) *ScriptResult
func (*ScriptResult) Validate ¶ added in v0.8.0
func (s *ScriptResult) Validate() error
type ScriptResultStore ¶ added in v0.8.0
type ScriptResultStore struct {
// contains filtered or unexported fields
}
func NewScriptResultStore ¶ added in v0.8.0
func NewScriptResultStore(client *clientv3.Client, root string) *ScriptResultStore
func (*ScriptResultStore) DatabasePrefix ¶ added in v0.8.0
func (s *ScriptResultStore) DatabasePrefix(databaseID string) string
func (*ScriptResultStore) DeleteByDatabaseID ¶ added in v0.8.0
func (s *ScriptResultStore) DeleteByDatabaseID(databaseID string) storage.DeleteOp
func (*ScriptResultStore) GetByKey ¶ added in v0.8.0
func (s *ScriptResultStore) GetByKey(databaseID string, scriptName ScriptName, nodeName string) storage.GetOp[*StoredScriptResult]
func (*ScriptResultStore) Key ¶ added in v0.8.0
func (s *ScriptResultStore) Key(databaseID string, scriptName ScriptName, nodeName string) string
func (*ScriptResultStore) Prefix ¶ added in v0.8.0
func (s *ScriptResultStore) Prefix() string
func (*ScriptResultStore) ScriptNamePrefix ¶ added in v0.8.0
func (s *ScriptResultStore) ScriptNamePrefix(databaseID string, name ScriptName) string
func (*ScriptResultStore) Update ¶ added in v0.8.0
func (s *ScriptResultStore) Update(item *StoredScriptResult) storage.PutOp[*StoredScriptResult]
type ScriptStatements ¶ added in v0.8.0
type ScriptStatements struct {
PostInit []string `json:"post_init"`
PostDatabaseCreate []string `json:"post_database_create"`
}
func (*ScriptStatements) Clone ¶ added in v0.8.0
func (s *ScriptStatements) Clone() *ScriptStatements
type Scripts ¶ added in v0.8.0
type Scripts map[ScriptName]*Script
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) CreateDatabase ¶
func (*Service) CreatePgBackRestBackup ¶ added in v0.8.0
func (s *Service) CreatePgBackRestBackup(ctx context.Context, w io.Writer, databaseID, instanceID string, options *pgbackrest.BackupOptions) error
func (*Service) DeleteDatabase ¶
func (*Service) DeleteInstance ¶
func (*Service) DeleteInstanceSpec ¶ added in v0.7.0
func (*Service) DeleteServiceInstance ¶ added in v0.7.0
func (*Service) DeleteServiceInstanceSpec ¶ added in v0.8.0
func (*Service) GetAllInstances ¶
func (*Service) GetAllServiceInstances ¶ added in v0.7.0
func (s *Service) GetAllServiceInstances(ctx context.Context) ([]*ServiceInstance, error)
func (*Service) GetDatabase ¶
func (*Service) GetDatabases ¶
func (*Service) GetDatabasesByHostId ¶ added in v0.6.0
func (*Service) GetInstance ¶
func (*Service) GetInstanceConnectionInfo ¶ added in v0.7.0
func (*Service) GetInstances ¶
func (*Service) GetScriptResult ¶ added in v0.8.0
func (s *Service) GetScriptResult(ctx context.Context, databaseID string, scriptName ScriptName, nodeName string) (*ScriptResult, error)
func (*Service) GetServiceInstance ¶ added in v0.7.0
func (*Service) GetServiceInstances ¶ added in v0.7.0
func (*Service) GetStoredDatabaseState ¶ added in v0.8.0
func (*Service) GetStoredInstanceState ¶
func (*Service) InstanceCountForHost ¶
func (*Service) PopulateSpecDefaults ¶
func (*Service) ReconcileInstanceSpec ¶ added in v0.7.0
func (s *Service) ReconcileInstanceSpec(ctx context.Context, spec *InstanceSpec) (*InstanceSpec, error)
func (*Service) ReconcileServiceInstanceSpec ¶ added in v0.8.0
func (s *Service) ReconcileServiceInstanceSpec(ctx context.Context, spec *ServiceInstanceSpec) (*ServiceInstanceSpec, error)
func (*Service) SetServiceInstanceState ¶ added in v0.7.0
func (s *Service) SetServiceInstanceState( ctx context.Context, databaseID, serviceInstanceID string, state ServiceInstanceState, ) error
SetServiceInstanceState performs a targeted state update using a direct key lookup instead of scanning all service instances.
func (*Service) UpdateDatabase ¶
func (*Service) UpdateDatabaseState ¶
func (*Service) UpdateInstance ¶
func (s *Service) UpdateInstance(ctx context.Context, opts *InstanceUpdateOptions) error
func (*Service) UpdateInstanceState ¶ added in v0.8.0
func (s *Service) UpdateInstanceState(ctx context.Context, opts *InstanceStateUpdateOptions) error
func (*Service) UpdateInstanceStatus ¶
func (*Service) UpdateScriptResult ¶ added in v0.8.0
func (s *Service) UpdateScriptResult(ctx context.Context, result *ScriptResult) error
func (*Service) UpdateServiceInstance ¶ added in v0.7.0
func (s *Service) UpdateServiceInstance(ctx context.Context, opts *ServiceInstanceUpdateOptions) error
func (*Service) UpdateServiceInstanceState ¶ added in v0.7.0
func (*Service) UpdateServiceInstanceStatus ¶ added in v0.7.0
type ServiceConnectionInfo ¶ added in v0.7.0
type ServiceConnectionInfo struct {
Hosts []ServiceHostEntry
TargetSessionAttrs string
}
ServiceConnectionInfo holds the ordered host list and connection parameters for a service instance's database connection.
func BuildServiceHostList ¶ added in v0.7.0
func BuildServiceHostList(params *BuildServiceHostListParams) (*ServiceConnectionInfo, error)
BuildServiceHostList produces an ordered list of database host:port entries for a service instance's connection string. The ordering is determined by co-location with the service host and optional node filtering.
Algorithm:
- Determine node list and ordering: - If TargetNodes is set: use only listed nodes in that order, ignoring co-location - If TargetNodes is not set: all nodes, with the local node (containing a co-located instance) first, then remaining nodes in iteration order
- Build host list, grouped by node: - For each node group: co-located instance first (same host as service), then remaining - Hostname format: "postgres-{instanceID}" (swarm overlay convention) - Port: always 5432 (internal container port via overlay network)
- Pass through TargetSessionAttrs unchanged.
Invariant: Only database instances from NodeInstances generate entries. ServiceHostID affects ordering only, never membership. A service on a dedicated host (no database instance on that host) does not add the service host to the list.
type ServiceHostEntry ¶ added in v0.7.0
ServiceHostEntry represents a single host:port pair in an ordered host list.
type ServiceInstance ¶ added in v0.7.0
type ServiceInstance struct {
ServiceInstanceID string `json:"service_instance_id"`
ServiceID string `json:"service_id"`
DatabaseID string `json:"database_id"`
HostID string `json:"host_id"`
State ServiceInstanceState `json:"state"`
Status *ServiceInstanceStatus `json:"status,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Error string `json:"error,omitempty"`
}
type ServiceInstanceResources ¶ added in v0.7.0
type ServiceInstanceResources struct {
ServiceInstance *ServiceInstance
Resources []*resource.ResourceData
}
type ServiceInstanceSpec ¶ added in v0.7.0
type ServiceInstanceSpec struct {
ServiceInstanceID string
ServiceSpec *ServiceSpec
PgEdgeVersion *ds.PgEdgeVersion // Database version, used for compatibility validation
DatabaseID string
DatabaseName string
HostID string
CohortMemberID string
DatabaseNetworkID string
NodeName string // Database node name for PrimaryExecutor routing
DatabaseHosts []ServiceHostEntry // Ordered list of Postgres host:port entries
TargetSessionAttrs string // libpq target_session_attrs value
Port *int // Service instance published port (optional, 0 = random)
DatabaseNodes []*NodeInstances // All database nodes; used to create per-node resources
ConnectAsUsername string // Username from database_users (resolved from ServiceSpec.ConnectAs)
ConnectAsPassword string // Password from database_users (resolved from ServiceSpec.ConnectAs)
}
ServiceInstanceSpec contains the specification for generating service instance resources.
func (*ServiceInstanceSpec) CopyPortFrom ¶ added in v0.8.0
func (s *ServiceInstanceSpec) CopyPortFrom(current *ServiceInstanceSpec)
CopyPortFrom copies the port from the current (persisted) spec to this spec, retaining any previously allocated stable random port. This mirrors the reconcilePort logic used by InstanceSpec.CopySettingsFrom.
type ServiceInstanceSpecStore ¶ added in v0.8.0
type ServiceInstanceSpecStore struct {
// contains filtered or unexported fields
}
func NewServiceInstanceSpecStore ¶ added in v0.8.0
func NewServiceInstanceSpecStore(client *clientv3.Client, root string) *ServiceInstanceSpecStore
func (*ServiceInstanceSpecStore) DatabasePrefix ¶ added in v0.8.0
func (s *ServiceInstanceSpecStore) DatabasePrefix(databaseID string) string
func (*ServiceInstanceSpecStore) DeleteByDatabaseID ¶ added in v0.8.0
func (s *ServiceInstanceSpecStore) DeleteByDatabaseID(databaseID string) storage.DeleteOp
func (*ServiceInstanceSpecStore) DeleteByKey ¶ added in v0.8.0
func (s *ServiceInstanceSpecStore) DeleteByKey(databaseID, serviceInstanceID string) storage.DeleteOp
func (*ServiceInstanceSpecStore) GetByDatabaseID ¶ added in v0.8.0
func (s *ServiceInstanceSpecStore) GetByDatabaseID(databaseID string) storage.GetMultipleOp[*StoredServiceInstanceSpec]
func (*ServiceInstanceSpecStore) GetByKey ¶ added in v0.8.0
func (s *ServiceInstanceSpecStore) GetByKey(databaseID, serviceInstanceID string) storage.GetOp[*StoredServiceInstanceSpec]
func (*ServiceInstanceSpecStore) Key ¶ added in v0.8.0
func (s *ServiceInstanceSpecStore) Key(databaseID, serviceInstanceID string) string
func (*ServiceInstanceSpecStore) Prefix ¶ added in v0.8.0
func (s *ServiceInstanceSpecStore) Prefix() string
func (*ServiceInstanceSpecStore) Update ¶ added in v0.8.0
func (s *ServiceInstanceSpecStore) Update(item *StoredServiceInstanceSpec) storage.PutOp[*StoredServiceInstanceSpec]
type ServiceInstanceState ¶ added in v0.7.0
type ServiceInstanceState string
const ( ServiceInstanceStateCreating ServiceInstanceState = "creating" ServiceInstanceStateRunning ServiceInstanceState = "running" ServiceInstanceStateFailed ServiceInstanceState = "failed" ServiceInstanceStateDeleting ServiceInstanceState = "deleting" )
type ServiceInstanceStateUpdate ¶ added in v0.7.0
type ServiceInstanceStateUpdate struct {
DatabaseID string `json:"database_id,omitempty"`
State ServiceInstanceState `json:"state"`
Status *ServiceInstanceStatus `json:"status,omitempty"`
Error string `json:"error,omitempty"`
}
type ServiceInstanceStatus ¶ added in v0.7.0
type ServiceInstanceStatus struct {
ContainerID *string `json:"container_id,omitempty"`
ImageVersion *string `json:"image_version,omitempty"`
Addresses []string `json:"addresses,omitempty"`
Ports []PortMapping `json:"ports,omitempty"`
HealthCheck *HealthCheckResult `json:"health_check,omitempty"`
LastHealthAt *time.Time `json:"last_health_at,omitempty"`
ServiceReady *bool `json:"service_ready,omitempty"`
}
type ServiceInstanceStatusStore ¶ added in v0.7.0
type ServiceInstanceStatusStore struct {
// contains filtered or unexported fields
}
func NewServiceInstanceStatusStore ¶ added in v0.7.0
func NewServiceInstanceStatusStore(client *clientv3.Client, root string) *ServiceInstanceStatusStore
func (*ServiceInstanceStatusStore) DatabasePrefix ¶ added in v0.7.0
func (s *ServiceInstanceStatusStore) DatabasePrefix(databaseID string) string
func (*ServiceInstanceStatusStore) DeleteByKey ¶ added in v0.7.0
func (s *ServiceInstanceStatusStore) DeleteByKey(databaseID, serviceInstanceID string) storage.DeleteOp
func (*ServiceInstanceStatusStore) GetAll ¶ added in v0.7.0
func (s *ServiceInstanceStatusStore) GetAll() storage.GetMultipleOp[*StoredServiceInstanceStatus]
func (*ServiceInstanceStatusStore) GetByDatabaseID ¶ added in v0.7.0
func (s *ServiceInstanceStatusStore) GetByDatabaseID(databaseID string) storage.GetMultipleOp[*StoredServiceInstanceStatus]
func (*ServiceInstanceStatusStore) GetByKey ¶ added in v0.7.0
func (s *ServiceInstanceStatusStore) GetByKey(databaseID, serviceInstanceID string) storage.GetOp[*StoredServiceInstanceStatus]
func (*ServiceInstanceStatusStore) Key ¶ added in v0.7.0
func (s *ServiceInstanceStatusStore) Key(databaseID, serviceInstanceID string) string
func (*ServiceInstanceStatusStore) Prefix ¶ added in v0.7.0
func (s *ServiceInstanceStatusStore) Prefix() string
func (*ServiceInstanceStatusStore) Put ¶ added in v0.7.0
func (s *ServiceInstanceStatusStore) Put(item *StoredServiceInstanceStatus) storage.PutOp[*StoredServiceInstanceStatus]
type ServiceInstanceStore ¶ added in v0.7.0
type ServiceInstanceStore struct {
// contains filtered or unexported fields
}
func NewServiceInstanceStore ¶ added in v0.7.0
func NewServiceInstanceStore(client *clientv3.Client, root string) *ServiceInstanceStore
func (*ServiceInstanceStore) DatabasePrefix ¶ added in v0.7.0
func (s *ServiceInstanceStore) DatabasePrefix(databaseID string) string
func (*ServiceInstanceStore) DeleteByKey ¶ added in v0.7.0
func (s *ServiceInstanceStore) DeleteByKey(databaseID, serviceInstanceID string) storage.DeleteOp
func (*ServiceInstanceStore) GetAll ¶ added in v0.7.0
func (s *ServiceInstanceStore) GetAll() storage.GetMultipleOp[*StoredServiceInstance]
func (*ServiceInstanceStore) GetByDatabaseID ¶ added in v0.7.0
func (s *ServiceInstanceStore) GetByDatabaseID(databaseID string) storage.GetMultipleOp[*StoredServiceInstance]
func (*ServiceInstanceStore) GetByKey ¶ added in v0.7.0
func (s *ServiceInstanceStore) GetByKey(databaseID, serviceInstanceID string) storage.GetOp[*StoredServiceInstance]
func (*ServiceInstanceStore) Key ¶ added in v0.7.0
func (s *ServiceInstanceStore) Key(databaseID, serviceInstanceID string) string
func (*ServiceInstanceStore) Prefix ¶ added in v0.7.0
func (s *ServiceInstanceStore) Prefix() string
func (*ServiceInstanceStore) Put ¶ added in v0.7.0
func (s *ServiceInstanceStore) Put(item *StoredServiceInstance) storage.PutOp[*StoredServiceInstance]
type ServiceInstanceUpdateOptions ¶ added in v0.7.0
type ServiceSpec ¶ added in v0.7.0
type ServiceSpec struct {
ServiceID string `json:"service_id"`
ServiceType string `json:"service_type"`
Version string `json:"version"`
HostIDs []string `json:"host_ids"`
Config map[string]any `json:"config"`
Port *int `json:"port,omitempty"`
CPUs *float64 `json:"cpus,omitempty"`
MemoryBytes *uint64 `json:"memory,omitempty"`
OrchestratorOpts *OrchestratorOpts `json:"orchestrator_opts,omitempty"`
DatabaseConnection *DatabaseConnection `json:"database_connection,omitempty"`
ConnectAs string `json:"connect_as"`
}
func (*ServiceSpec) Clone ¶ added in v0.7.0
func (s *ServiceSpec) Clone() *ServiceSpec
type Spec ¶
type Spec struct {
DatabaseID string `json:"database_id"`
TenantID *string `json:"tenant_id,omitempty"`
DatabaseName string `json:"database_name"`
PostgresVersion string `json:"postgres_version"`
SpockVersion string `json:"spock_version"`
Port *int `json:"port"`
PatroniPort *int `json:"patroni_port"`
CPUs float64 `json:"cpus"`
MemoryBytes uint64 `json:"memory"`
Nodes []*Node `json:"nodes"`
DatabaseUsers []*User `json:"database_users"`
Services []*ServiceSpec `json:"services,omitempty"`
BackupConfig *BackupConfig `json:"backup_config"`
RestoreConfig *RestoreConfig `json:"restore_config"`
PostgreSQLConf map[string]any `json:"postgresql_conf"`
OrchestratorOpts *OrchestratorOpts `json:"orchestrator_opts,omitempty"`
Scripts *ScriptStatements `json:"scripts,omitempty"`
}
func (*Spec) DefaultOptionalFieldsFrom ¶
DefaultOptionalFieldsFrom will default this spec's optional fields to the values from the given spec.
func (*Spec) NodeInstances ¶
func (s *Spec) NodeInstances() ([]*NodeInstances, error)
func (*Spec) NormalizeBackupConfig ¶
func (s *Spec) NormalizeBackupConfig()
NormalizeBackupConfig normalizes the backup config so that its defined per-node rather than at the database level. This is useful as a preliminary step if we need to modify the backup configs on the user's behalf.
func (*Spec) RemoveBackupConfigFrom ¶
RemoveBackupConfigFrom removes backup configuration from the given nodes. It normalizes the backup configuration first to ensure that only the given nodes are affected.
func (*Spec) RemoveHost ¶ added in v0.6.0
RemoveHost removes hostId from Spec.Nodes.HostIDs (if present). If this results in an empty Node, then the Node is removed from Spec.Nodes. Return true if hostId was found and removed, false otherwise.
func (*Spec) ValidateNodeNames ¶
type SpecStore ¶
type SpecStore struct {
// contains filtered or unexported fields
}
func (*SpecStore) Create ¶
func (s *SpecStore) Create(item *StoredSpec) storage.PutOp[*StoredSpec]
func (*SpecStore) Delete ¶
func (s *SpecStore) Delete(item *StoredSpec) storage.DeleteValueOp[*StoredSpec]
func (*SpecStore) GetAll ¶
func (s *SpecStore) GetAll() storage.GetMultipleOp[*StoredSpec]
func (*SpecStore) GetByKey ¶
func (s *SpecStore) GetByKey(databaseID string) storage.GetOp[*StoredSpec]
func (*SpecStore) GetByKeys ¶
func (s *SpecStore) GetByKeys(databaseIDs ...string) storage.GetMultipleOp[*StoredSpec]
func (*SpecStore) Update ¶
func (s *SpecStore) Update(item *StoredSpec) storage.PutOp[*StoredSpec]
type Store ¶
type Store struct {
Spec *SpecStore
Database *DatabaseStore
Instance *InstanceStore
InstanceStatus *InstanceStatusStore
InstanceSpec *InstanceSpecStore
ScriptResult *ScriptResultStore
ServiceInstance *ServiceInstanceStore
ServiceInstanceStatus *ServiceInstanceStatusStore
ServiceInstanceSpec *ServiceInstanceSpecStore
// contains filtered or unexported fields
}
type StoredDatabase ¶
type StoredDatabase struct {
storage.StoredValue
DatabaseID string `json:"database_id"`
TenantID *string `json:"tenant_id,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
State DatabaseState `json:"state"`
NotCreated bool `json:"not_created"`
}
type StoredInstance ¶
type StoredInstance struct {
storage.StoredValue
InstanceID string `json:"instance_id"`
DatabaseID string `json:"database_id"`
HostID string `json:"host_id"`
NodeName string `json:"node_name"`
State InstanceState `json:"state"`
CreatedAt time.Time `json:"created_at"`
UpdateAt time.Time `json:"updated_at"`
Port *int `json:"port"`
PatroniPort *int `json:"patroni_port"`
PgEdgeVersion *ds.PgEdgeVersion `json:"pgedge_version"`
Error string `json:"error,omitempty"`
}
func NewStoredInstance ¶
func NewStoredInstance(opts *InstanceUpdateOptions) *StoredInstance
func (*StoredInstance) Update ¶
func (i *StoredInstance) Update(opts *InstanceUpdateOptions)
func (*StoredInstance) UpdateState ¶ added in v0.8.0
func (i *StoredInstance) UpdateState(opts *InstanceStateUpdateOptions)
type StoredInstanceSpec ¶ added in v0.7.0
type StoredInstanceSpec struct {
storage.StoredValue
Spec *InstanceSpec `json:"spec"`
}
type StoredInstanceStatus ¶
type StoredInstanceStatus struct {
storage.StoredValue
DatabaseID string `json:"database_id"`
InstanceID string `json:"instance_id"`
Status *InstanceStatus `json:"status"`
}
type StoredScriptResult ¶ added in v0.8.0
type StoredScriptResult struct {
storage.StoredValue
Result *ScriptResult `json:"script_result"`
}
type StoredServiceInstance ¶ added in v0.7.0
type StoredServiceInstance struct {
storage.StoredValue
ServiceInstanceID string `json:"service_instance_id"`
ServiceID string `json:"service_id"`
DatabaseID string `json:"database_id"`
HostID string `json:"host_id"`
State ServiceInstanceState `json:"state"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Error string `json:"error,omitempty"`
}
func NewStoredServiceInstance ¶ added in v0.7.0
func NewStoredServiceInstance(opts *ServiceInstanceUpdateOptions) *StoredServiceInstance
func (*StoredServiceInstance) Update ¶ added in v0.7.0
func (s *StoredServiceInstance) Update(opts *ServiceInstanceUpdateOptions)
type StoredServiceInstanceSpec ¶ added in v0.8.0
type StoredServiceInstanceSpec struct {
storage.StoredValue
Spec *ServiceInstanceSpec `json:"spec"`
}
type StoredServiceInstanceStatus ¶ added in v0.7.0
type StoredServiceInstanceStatus struct {
storage.StoredValue
DatabaseID string `json:"database_id"`
ServiceInstanceID string `json:"service_instance_id"`
Status *ServiceInstanceStatus `json:"status"`
}
type StoredSpec ¶
type StoredSpec struct {
storage.StoredValue
*Spec
}
type SubscriptionResource ¶
type SubscriptionResource struct {
DatabaseName string `json:"database_name"`
SubscriberNode string `json:"subscriber_node"`
ProviderNode string `json:"provider_node"`
Disabled bool `json:"disabled"`
SyncStructure bool `json:"sync_structure"`
SyncData bool `json:"sync_data"`
ExtraDependencies []resource.Identifier `json:"extra_dependencies"`
NeedsUpdate bool `json:"needs_update"`
}
func (*SubscriptionResource) Dependencies ¶
func (s *SubscriptionResource) Dependencies() []resource.Identifier
func (*SubscriptionResource) DiffIgnore ¶
func (s *SubscriptionResource) DiffIgnore() []string
func (*SubscriptionResource) Executor ¶
func (s *SubscriptionResource) Executor() resource.Executor
func (*SubscriptionResource) Identifier ¶
func (s *SubscriptionResource) Identifier() resource.Identifier
func (*SubscriptionResource) ResourceVersion ¶
func (s *SubscriptionResource) ResourceVersion() string
func (*SubscriptionResource) TypeDependencies ¶ added in v0.7.0
func (s *SubscriptionResource) TypeDependencies() []resource.Type
type SubscriptionStatus ¶
type SwarmOpts ¶
type SwarmOpts struct {
ExtraVolumes []ExtraVolumesSpec `json:"extra_volumes,omitempty"`
ExtraNetworks []ExtraNetworkSpec `json:"extra_networks,omitempty"`
ExtraLabels map[string]string `json:"extra_labels,omitempty"` // optional, used for custom labels on the swarm service
}
type SwitchoverResource ¶
type SwitchoverResource struct {
HostID string `json:"host_id"`
InstanceID string `json:"instance_id"`
TargetRole patroni.InstanceRole `json:"target_role"`
}
func (*SwitchoverResource) Dependencies ¶
func (s *SwitchoverResource) Dependencies() []resource.Identifier
func (*SwitchoverResource) DiffIgnore ¶
func (s *SwitchoverResource) DiffIgnore() []string
func (*SwitchoverResource) Executor ¶
func (s *SwitchoverResource) Executor() resource.Executor
func (*SwitchoverResource) Identifier ¶
func (s *SwitchoverResource) Identifier() resource.Identifier
func (*SwitchoverResource) ResourceVersion ¶
func (s *SwitchoverResource) ResourceVersion() string
func (*SwitchoverResource) TypeDependencies ¶ added in v0.7.0
func (s *SwitchoverResource) TypeDependencies() []resource.Type
type SyncEventResource ¶
type SyncEventResource struct {
DatabaseName string `json:"database_name"`
ProviderNode string `json:"provider_node"`
SubscriberNode string `json:"subscriber_node"`
SyncEventLsn string `json:"sync_event_lsn"`
ExtraDependencies []resource.Identifier `json:"extra_dependencies"`
}
func (*SyncEventResource) Dependencies ¶
func (r *SyncEventResource) Dependencies() []resource.Identifier
func (*SyncEventResource) DiffIgnore ¶
func (r *SyncEventResource) DiffIgnore() []string
func (*SyncEventResource) Executor ¶
func (r *SyncEventResource) Executor() resource.Executor
func (*SyncEventResource) Identifier ¶
func (r *SyncEventResource) Identifier() resource.Identifier
func (*SyncEventResource) Refresh ¶
Confirm synchronization by sending sync_event from provider and waiting for it on subscriber
func (*SyncEventResource) ResourceVersion ¶
func (r *SyncEventResource) ResourceVersion() string
func (*SyncEventResource) TypeDependencies ¶ added in v0.7.0
func (r *SyncEventResource) TypeDependencies() []resource.Type
type User ¶
type User struct {
Username string `json:"username"`
Password string `json:"password"`
DBOwner bool `json:"db_owner,omitempty"`
Attributes []string `json:"attributes,omitempty"`
Roles []string `json:"roles,omitempty"`
}
func (*User) DefaultOptionalFieldsFrom ¶
DefaultOptionalFieldsFrom will default this user's optional fields to the values from the given user.
type ValidationResult ¶
type WaitForSyncEventResource ¶
type WaitForSyncEventResource struct {
DatabaseName string `json:"database_name"`
SubscriberNode string `json:"subscriber_node"`
ProviderNode string `json:"provider_node"`
}
func (*WaitForSyncEventResource) Dependencies ¶
func (r *WaitForSyncEventResource) Dependencies() []resource.Identifier
func (*WaitForSyncEventResource) DiffIgnore ¶
func (r *WaitForSyncEventResource) DiffIgnore() []string
func (*WaitForSyncEventResource) Executor ¶
func (r *WaitForSyncEventResource) Executor() resource.Executor
func (*WaitForSyncEventResource) Identifier ¶
func (r *WaitForSyncEventResource) Identifier() resource.Identifier
func (*WaitForSyncEventResource) Refresh ¶
Confirm synchronization by sending sync_event from provider and waiting for it on subscriber
func (*WaitForSyncEventResource) ResourceVersion ¶
func (r *WaitForSyncEventResource) ResourceVersion() string
func (*WaitForSyncEventResource) TypeDependencies ¶ added in v0.7.0
func (r *WaitForSyncEventResource) TypeDependencies() []resource.Type
Source Files
¶
- connection.go
- database.go
- database_store.go
- dump_roles.go
- instance.go
- instance_resource.go
- instance_spec_store.go
- instance_status_store.go
- instance_store.go
- lag_tracker_commit_ts_resource.go
- mcp_service_config.go
- node_resource.go
- orchestrator.go
- paths.go
- postgres_database.go
- postgrest_service_config.go
- provide.go
- rag_service_config.go
- replication_slot_advance_from_cts_resource.go
- replication_slot_create_resource.go
- replication_slot_resource.go
- resources.go
- roles_source.go
- script.go
- script_result_store.go
- service.go
- service_connection.go
- service_instance.go
- service_instance_spec_store.go
- service_instance_status_store.go
- service_instance_store.go
- spec.go
- spec_store.go
- status.go
- store.go
- subscription_resource.go
- switchover_resource.go
- sync_event_resource.go
- utils.go
- wait_for_sync_event_resource.go