Documentation
¶
Index ¶
- Constants
- Variables
- func CheckWillRestartIdentifier(instanceID string) resource.Identifier
- func DatabaseServiceSpec(instance *database.InstanceSpec, options *HostOptions) (swarm.ServiceSpec, error)
- func GenerateEmptyTokenFile() ([]byte, error)
- func GenerateEmptyUserFile() ([]byte, error)
- func GenerateMCPConfig(params *MCPConfigParams) ([]byte, error)
- func GenerateRAGConfig(params *RAGConfigParams) ([]byte, error)
- func GenerateTokenFile(initToken string) ([]byte, error)
- func GenerateUserFile(users []database.MCPServiceUser) ([]byte, error)
- func GetPostgresContainer(ctx context.Context, dockerClient *docker.Docker, instanceID string) (types.Container, error)
- func GetServiceContainer(ctx context.Context, dockerClient *docker.Docker, serviceInstanceID string) (types.Container, error)
- func MCPConfigResourceIdentifier(serviceInstanceID string) resource.Identifier
- func NetworkResourceIdentifier(name string) resource.Identifier
- func PatroniConfigIdentifier(instanceID string) resource.Identifier
- func PgBackRestBackupCmd(command string, args ...string) pgbackrest.Cmd
- func PgBackRestRestoreCmd(command string, args ...string) pgbackrest.Cmd
- func PgBackRestRestoreResourceIdentifier(instanceID string) resource.Identifier
- func PostgRESTAuthenticatorIdentifier(serviceID, nodeName string) resource.Identifier
- func PostgRESTConfigResourceIdentifier(serviceInstanceID string) resource.Identifier
- func PostgRESTPreflightResourceIdentifier(serviceID string) resource.Identifier
- func PostgresContainerExec(ctx context.Context, w io.Writer, dockerClient *docker.Docker, ...) error
- func PostgresServiceResourceIdentifier(instanceID string) resource.Identifier
- func PostgresServiceSpecResourceIdentifier(instanceID string) resource.Identifier
- func Provide(i *do.Injector)
- func RAGConfigResourceIdentifier(serviceInstanceID string) resource.Identifier
- func RAGPreflightResourceIdentifier(serviceInstanceID string) resource.Identifier
- func RAGServiceKeysResourceIdentifier(serviceInstanceID string) resource.Identifier
- func RegisterResourceTypes(registry *resource.Registry)
- func ScaleServiceResourceIdentifier(instanceID string, direction ScaleDirection) resource.Identifier
- func ServiceContainerSpec(opts *ServiceContainerSpecOptions) (swarm.ServiceSpec, error)
- func ServiceInstanceName(databaseID, serviceID, hostID string) string
- func ServiceInstanceResourceIdentifier(serviceInstanceID string) resource.Identifier
- func ServiceInstanceSpecResourceIdentifier(serviceInstanceID string) resource.Identifier
- func SwitchoverResourceIdentifier(instanceID string) resource.Identifier
- type Allocator
- type CheckWillRestart
- func (c *CheckWillRestart) Create(ctx context.Context, rc *resource.Context) error
- func (c *CheckWillRestart) Delete(ctx context.Context, rc *resource.Context) error
- func (c *CheckWillRestart) Dependencies() []resource.Identifier
- func (c *CheckWillRestart) DiffIgnore() []string
- func (c *CheckWillRestart) Executor() resource.Executor
- func (c *CheckWillRestart) Identifier() resource.Identifier
- func (c *CheckWillRestart) Refresh(ctx context.Context, rc *resource.Context) error
- func (c *CheckWillRestart) ResourceVersion() string
- func (c *CheckWillRestart) TypeDependencies() []resource.Type
- func (c *CheckWillRestart) Update(ctx context.Context, rc *resource.Context) error
- type HostOptions
- type Images
- type Instance
- type MCPConfigParams
- type MCPConfigResource
- func (r *MCPConfigResource) Create(ctx context.Context, rc *resource.Context) error
- func (r *MCPConfigResource) Delete(ctx context.Context, rc *resource.Context) error
- func (r *MCPConfigResource) Dependencies() []resource.Identifier
- func (r *MCPConfigResource) DiffIgnore() []string
- func (r *MCPConfigResource) Executor() resource.Executor
- func (r *MCPConfigResource) Identifier() resource.Identifier
- func (r *MCPConfigResource) PostDeploy(ctx context.Context, rc *resource.Context)
- func (r *MCPConfigResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (r *MCPConfigResource) ResourceVersion() string
- func (r *MCPConfigResource) TypeDependencies() []resource.Type
- func (r *MCPConfigResource) Update(ctx context.Context, rc *resource.Context) error
- type ManifestLoader
- type Network
- func (n *Network) Create(ctx context.Context, rc *resource.Context) error
- func (n *Network) Delete(ctx context.Context, rc *resource.Context) error
- func (n *Network) Dependencies() []resource.Identifier
- func (n *Network) DiffIgnore() []string
- func (n *Network) Executor() resource.Executor
- func (n *Network) Identifier() resource.Identifier
- func (n *Network) Refresh(ctx context.Context, rc *resource.Context) error
- func (n *Network) ResourceVersion() string
- func (n *Network) TypeDependencies() []resource.Type
- func (n *Network) Update(ctx context.Context, rc *resource.Context) error
- func (n *Network) Validate() error
- type Orchestrator
- func (o *Orchestrator) AvailableUpgrades(current *ds.PgEdgeVersion) []*database.AvailableUpgrade
- func (o *Orchestrator) CreatePgBackRestBackup(ctx context.Context, w io.Writer, spec *database.InstanceSpec, ...) error
- func (o *Orchestrator) ExecuteInstanceCommand(ctx context.Context, w io.Writer, databaseID, instanceID string, ...) error
- func (o *Orchestrator) FindUpgrade(current *ds.PgEdgeVersion, targetImage string) (*database.AvailableUpgrade, error)
- func (o *Orchestrator) GenerateInstanceResources(spec *database.InstanceSpec, scripts database.Scripts) (*database.InstanceResources, error)
- func (o *Orchestrator) GenerateInstanceRestoreResources(spec *database.InstanceSpec, taskID uuid.UUID) (*database.InstanceResources, error)
- func (o *Orchestrator) GenerateServiceInstanceResources(spec *database.ServiceInstanceSpec) (*database.ServiceInstanceResources, error)
- func (o *Orchestrator) GetInstanceConnectionInfo(ctx context.Context, databaseID, instanceID string, ...) (*database.ConnectionInfo, error)
- func (o *Orchestrator) GetServiceInstanceStatus(ctx context.Context, serviceInstanceID string) (*database.ServiceInstanceStatus, error)
- func (o *Orchestrator) InstancePaths(_ *ds.Version, instanceID string) (database.InstancePaths, error)
- func (o *Orchestrator) NodeDSN(ctx context.Context, rc *resource.Context, nodeName string, ...) (*postgres.DSN, error)
- func (o *Orchestrator) PopulateHost(ctx context.Context, h *host.Host) error
- func (o *Orchestrator) PopulateHostStatus(ctx context.Context, status *host.HostStatus) error
- func (o *Orchestrator) ReconcileInstanceSpec(old, new *database.InstanceSpec) error
- func (o *Orchestrator) ReconcileServiceInstanceSpec(old, new *database.ServiceInstanceSpec) error
- func (o *Orchestrator) Start(_ context.Context) error
- func (o *Orchestrator) StartInstance(ctx context.Context, instanceID string) error
- func (o *Orchestrator) StopInstance(ctx context.Context, instanceID string) error
- func (o *Orchestrator) ValidateInstanceSpecs(ctx context.Context, changes []*database.InstanceSpecChange) ([]*database.ValidationResult, error)
- func (o *Orchestrator) WorkerQueues() ([]workflow.Queue, error)
- type Paths
- type PatroniConfig
- func (c *PatroniConfig) Create(ctx context.Context, rc *resource.Context) error
- func (c *PatroniConfig) Delete(ctx context.Context, rc *resource.Context) error
- func (c *PatroniConfig) Dependencies() []resource.Identifier
- func (c *PatroniConfig) DiffIgnore() []string
- func (c *PatroniConfig) Executor() resource.Executor
- func (c *PatroniConfig) Identifier() resource.Identifier
- func (c *PatroniConfig) Refresh(ctx context.Context, rc *resource.Context) error
- func (c *PatroniConfig) ResourceVersion() string
- func (r *PatroniConfig) TypeDependencies() []resource.Type
- func (c *PatroniConfig) Update(ctx context.Context, rc *resource.Context) error
- type PgBackRestRestore
- func (p *PgBackRestRestore) Create(ctx context.Context, rc *resource.Context) error
- func (p *PgBackRestRestore) Delete(ctx context.Context, rc *resource.Context) error
- func (p *PgBackRestRestore) Dependencies() []resource.Identifier
- func (p *PgBackRestRestore) DiffIgnore() []string
- func (p *PgBackRestRestore) Executor() resource.Executor
- func (p *PgBackRestRestore) Identifier() resource.Identifier
- func (p *PgBackRestRestore) Refresh(ctx context.Context, rc *resource.Context) error
- func (p *PgBackRestRestore) ResourceVersion() string
- func (p *PgBackRestRestore) TypeDependencies() []resource.Type
- func (p *PgBackRestRestore) Update(ctx context.Context, rc *resource.Context) error
- type PostgRESTAuthenticatorResource
- func (r *PostgRESTAuthenticatorResource) Create(ctx context.Context, rc *resource.Context) error
- func (r *PostgRESTAuthenticatorResource) Delete(_ context.Context, _ *resource.Context) error
- func (r *PostgRESTAuthenticatorResource) Dependencies() []resource.Identifier
- func (r *PostgRESTAuthenticatorResource) DiffIgnore() []string
- func (r *PostgRESTAuthenticatorResource) Executor() resource.Executor
- func (r *PostgRESTAuthenticatorResource) Identifier() resource.Identifier
- func (r *PostgRESTAuthenticatorResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (r *PostgRESTAuthenticatorResource) ResourceVersion() string
- func (r *PostgRESTAuthenticatorResource) TypeDependencies() []resource.Type
- func (r *PostgRESTAuthenticatorResource) Update(ctx context.Context, rc *resource.Context) error
- type PostgRESTConfigResource
- func (r *PostgRESTConfigResource) Create(ctx context.Context, rc *resource.Context) error
- func (r *PostgRESTConfigResource) Delete(ctx context.Context, rc *resource.Context) error
- func (r *PostgRESTConfigResource) Dependencies() []resource.Identifier
- func (r *PostgRESTConfigResource) DiffIgnore() []string
- func (r *PostgRESTConfigResource) Executor() resource.Executor
- func (r *PostgRESTConfigResource) Identifier() resource.Identifier
- func (r *PostgRESTConfigResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (r *PostgRESTConfigResource) ResourceVersion() string
- func (r *PostgRESTConfigResource) TypeDependencies() []resource.Type
- func (r *PostgRESTConfigResource) Update(ctx context.Context, rc *resource.Context) error
- type PostgRESTPreflightResource
- func (r *PostgRESTPreflightResource) Create(ctx context.Context, rc *resource.Context) error
- func (r *PostgRESTPreflightResource) Delete(ctx context.Context, rc *resource.Context) error
- func (r *PostgRESTPreflightResource) Dependencies() []resource.Identifier
- func (r *PostgRESTPreflightResource) DiffIgnore() []string
- func (r *PostgRESTPreflightResource) Executor() resource.Executor
- func (r *PostgRESTPreflightResource) Identifier() resource.Identifier
- func (r *PostgRESTPreflightResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (r *PostgRESTPreflightResource) ResourceVersion() string
- func (r *PostgRESTPreflightResource) TypeDependencies() []resource.Type
- func (r *PostgRESTPreflightResource) Update(ctx context.Context, rc *resource.Context) error
- type PostgresService
- func (s *PostgresService) Create(ctx context.Context, rc *resource.Context) error
- func (s *PostgresService) Delete(ctx context.Context, rc *resource.Context) error
- func (s *PostgresService) Dependencies() []resource.Identifier
- func (s *PostgresService) DiffIgnore() []string
- func (s *PostgresService) Executor() resource.Executor
- func (s *PostgresService) Identifier() resource.Identifier
- func (s *PostgresService) Refresh(ctx context.Context, rc *resource.Context) error
- func (s *PostgresService) ResourceVersion() string
- func (s *PostgresService) TypeDependencies() []resource.Type
- func (s *PostgresService) Update(ctx context.Context, rc *resource.Context) error
- type PostgresServiceSpecResource
- func (s *PostgresServiceSpecResource) Create(ctx context.Context, rc *resource.Context) error
- func (s *PostgresServiceSpecResource) Delete(ctx context.Context, rc *resource.Context) error
- func (s *PostgresServiceSpecResource) Dependencies() []resource.Identifier
- func (s *PostgresServiceSpecResource) DiffIgnore() []string
- func (s *PostgresServiceSpecResource) Executor() resource.Executor
- func (s *PostgresServiceSpecResource) Identifier() resource.Identifier
- func (s *PostgresServiceSpecResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (s *PostgresServiceSpecResource) ResourceVersion() string
- func (s *PostgresServiceSpecResource) TypeDependencies() []resource.Type
- func (s *PostgresServiceSpecResource) Update(ctx context.Context, rc *resource.Context) error
- type RAGConfigParams
- type RAGConfigResource
- func (r *RAGConfigResource) Create(ctx context.Context, rc *resource.Context) error
- func (r *RAGConfigResource) Delete(ctx context.Context, rc *resource.Context) error
- func (r *RAGConfigResource) Dependencies() []resource.Identifier
- func (r *RAGConfigResource) DiffIgnore() []string
- func (r *RAGConfigResource) Executor() resource.Executor
- func (r *RAGConfigResource) Identifier() resource.Identifier
- func (r *RAGConfigResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (r *RAGConfigResource) ResourceVersion() string
- func (r *RAGConfigResource) TypeDependencies() []resource.Type
- func (r *RAGConfigResource) Update(ctx context.Context, rc *resource.Context) error
- type RAGPreflightResource
- func (r *RAGPreflightResource) Create(ctx context.Context, rc *resource.Context) error
- func (r *RAGPreflightResource) Delete(ctx context.Context, rc *resource.Context) error
- func (r *RAGPreflightResource) Dependencies() []resource.Identifier
- func (r *RAGPreflightResource) DiffIgnore() []string
- func (r *RAGPreflightResource) Executor() resource.Executor
- func (r *RAGPreflightResource) Identifier() resource.Identifier
- func (r *RAGPreflightResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (r *RAGPreflightResource) ResourceVersion() string
- func (r *RAGPreflightResource) TypeDependencies() []resource.Type
- func (r *RAGPreflightResource) Update(ctx context.Context, rc *resource.Context) error
- type RAGServiceKeysResource
- func (r *RAGServiceKeysResource) Create(ctx context.Context, rc *resource.Context) error
- func (r *RAGServiceKeysResource) Delete(ctx context.Context, rc *resource.Context) error
- func (r *RAGServiceKeysResource) Dependencies() []resource.Identifier
- func (r *RAGServiceKeysResource) DiffIgnore() []string
- func (r *RAGServiceKeysResource) Executor() resource.Executor
- func (r *RAGServiceKeysResource) Identifier() resource.Identifier
- func (r *RAGServiceKeysResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (r *RAGServiceKeysResource) ResourceVersion() string
- func (r *RAGServiceKeysResource) TypeDependencies() []resource.Type
- func (r *RAGServiceKeysResource) Update(ctx context.Context, rc *resource.Context) error
- type ScaleDirection
- type ScaleService
- func (s *ScaleService) Create(ctx context.Context, rc *resource.Context) error
- func (s *ScaleService) Delete(ctx context.Context, rc *resource.Context) error
- func (s *ScaleService) Dependencies() []resource.Identifier
- func (s *ScaleService) DiffIgnore() []string
- func (s *ScaleService) Executor() resource.Executor
- func (s *ScaleService) Identifier() resource.Identifier
- func (s *ScaleService) Refresh(ctx context.Context, rc *resource.Context) error
- func (s *ScaleService) ResourceVersion() string
- func (s *ScaleService) TypeDependencies() []resource.Type
- func (s *ScaleService) Update(ctx context.Context, rc *resource.Context) error
- type ServiceContainerSpecOptions
- type ServiceImage
- type ServiceInstanceResource
- func (s *ServiceInstanceResource) Create(ctx context.Context, rc *resource.Context) error
- func (s *ServiceInstanceResource) Delete(ctx context.Context, rc *resource.Context) error
- func (s *ServiceInstanceResource) Dependencies() []resource.Identifier
- func (s *ServiceInstanceResource) DiffIgnore() []string
- func (s *ServiceInstanceResource) Executor() resource.Executor
- func (s *ServiceInstanceResource) Identifier() resource.Identifier
- func (s *ServiceInstanceResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (s *ServiceInstanceResource) ResourceVersion() string
- func (s *ServiceInstanceResource) TypeDependencies() []resource.Type
- func (s *ServiceInstanceResource) Update(ctx context.Context, rc *resource.Context) error
- type ServiceInstanceSpecResource
- func (s *ServiceInstanceSpecResource) Create(ctx context.Context, rc *resource.Context) error
- func (s *ServiceInstanceSpecResource) Delete(ctx context.Context, rc *resource.Context) error
- func (s *ServiceInstanceSpecResource) Dependencies() []resource.Identifier
- func (s *ServiceInstanceSpecResource) DiffIgnore() []string
- func (s *ServiceInstanceSpecResource) Executor() resource.Executor
- func (s *ServiceInstanceSpecResource) Identifier() resource.Identifier
- func (s *ServiceInstanceSpecResource) PostDeploy(ctx context.Context, rc *resource.Context)
- func (s *ServiceInstanceSpecResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (s *ServiceInstanceSpecResource) ResourceVersion() string
- func (s *ServiceInstanceSpecResource) TypeDependencies() []resource.Type
- func (s *ServiceInstanceSpecResource) Update(ctx context.Context, rc *resource.Context) error
- type ServiceVersions
- type Switchover
- func (s *Switchover) Create(ctx context.Context, rc *resource.Context) error
- func (s *Switchover) Delete(ctx context.Context, rc *resource.Context) error
- func (s *Switchover) Dependencies() []resource.Identifier
- func (s *Switchover) DiffIgnore() []string
- func (s *Switchover) Executor() resource.Executor
- func (s *Switchover) Identifier() resource.Identifier
- func (s *Switchover) Refresh(ctx context.Context, rc *resource.Context) error
- func (s *Switchover) ResourceVersion() string
- func (s *Switchover) TypeDependencies() []resource.Type
- func (s *Switchover) Update(ctx context.Context, rc *resource.Context) error
- type Versions
- func (v *Versions) AvailableUpgrades(current *ds.PgEdgeVersion) []*database.AvailableUpgrade
- func (v Versions) Default() *ds.PgEdgeVersion
- func (v *Versions) FindByImage(image string) (*ds.PgEdgeVersion, *Images, bool)
- func (v Versions) GetImages(version *ds.PgEdgeVersion) (*Images, error)
- func (v Versions) Supported() []*ds.PgEdgeVersion
Constants ¶
const ( OverlayDriver = "overlay" DefaultDatabaseOwnerUID int = 26 DefaultDatabaseOwnerGID int = DefaultDatabaseOwnerUID )
const ( PostgresContainerPort int = 5432 PatroniContainerPort int = 8888 )
Each of these constants represents the port exposed by the container. These are separate from the published ports, which are user-specified and optional.
const ResourceTypeCheckWillRestart resource.Type = "swarm.check_will_restart"
const ResourceTypeMCPConfig resource.Type = "swarm.mcp_config"
const ResourceTypeNetwork resource.Type = "swarm.network"
const ResourceTypePatroniConfig resource.Type = "swarm.patroni_config"
const ResourceTypePgBackRestRestore resource.Type = "swarm.pgbackrest_restore"
const ResourceTypePostgRESTAuthenticator resource.Type = "swarm.postgrest_authenticator"
const ResourceTypePostgRESTConfig resource.Type = "swarm.postgrest_config"
const ResourceTypePostgRESTPreflightResource resource.Type = "swarm.postgrest_preflight"
const ResourceTypePostgresService resource.Type = "swarm.postgres_service"
const ResourceTypePostgresServiceSpec resource.Type = "swarm.postgres_service_spec"
const ResourceTypeRAGConfig resource.Type = "swarm.rag_config"
const ResourceTypeRAGPreflightResource resource.Type = "swarm.rag_preflight"
const ResourceTypeRAGServiceKeys resource.Type = "swarm.rag_service_keys"
const ResourceTypeScaleService resource.Type = "swarm.scale_service"
const ResourceTypeServiceInstance resource.Type = database.ResourceTypeServiceInstance
const ResourceTypeServiceInstanceSpec resource.Type = "swarm.service_instance_spec"
const ResourceTypeSwitchover resource.Type = "swarm.switchover"
Variables ¶
Functions ¶
func CheckWillRestartIdentifier ¶
func CheckWillRestartIdentifier(instanceID string) resource.Identifier
func DatabaseServiceSpec ¶
func DatabaseServiceSpec( instance *database.InstanceSpec, options *HostOptions, ) (swarm.ServiceSpec, error)
func GenerateEmptyTokenFile ¶ added in v0.7.0
GenerateEmptyTokenFile generates an empty but valid tokens.yaml file.
func GenerateEmptyUserFile ¶ added in v0.7.0
GenerateEmptyUserFile generates an empty but valid users.yaml file.
func GenerateMCPConfig ¶ added in v0.7.0
func GenerateMCPConfig(params *MCPConfigParams) ([]byte, error)
GenerateMCPConfig generates the YAML config file content for the MCP server.
func GenerateRAGConfig ¶ added in v0.8.0
func GenerateRAGConfig(params *RAGConfigParams) ([]byte, error)
GenerateRAGConfig generates the pgedge-rag-server.yaml content from the given parameters. API key paths in the generated YAML reference files under KeysDir so the RAG server reads them from the bind-mounted keys directory.
func GenerateTokenFile ¶ added in v0.7.0
GenerateTokenFile generates a tokens.yaml file from the given init token. The token is SHA256-hashed to match the MCP server's auth.HashToken() format.
func GenerateUserFile ¶ added in v0.7.0
func GenerateUserFile(users []database.MCPServiceUser) ([]byte, error)
GenerateUserFile generates a users.yaml file from the given bootstrap users. Passwords are bcrypt-hashed with cost 12 to match the MCP server's auth.HashPassword() format.
func GetPostgresContainer ¶
func GetServiceContainer ¶ added in v0.7.0
func MCPConfigResourceIdentifier ¶ added in v0.7.0
func MCPConfigResourceIdentifier(serviceInstanceID string) resource.Identifier
func NetworkResourceIdentifier ¶
func NetworkResourceIdentifier(name string) resource.Identifier
func PatroniConfigIdentifier ¶
func PatroniConfigIdentifier(instanceID string) resource.Identifier
func PgBackRestBackupCmd ¶
func PgBackRestBackupCmd(command string, args ...string) pgbackrest.Cmd
func PgBackRestRestoreCmd ¶
func PgBackRestRestoreCmd(command string, args ...string) pgbackrest.Cmd
func PgBackRestRestoreResourceIdentifier ¶
func PgBackRestRestoreResourceIdentifier(instanceID string) resource.Identifier
func PostgRESTAuthenticatorIdentifier ¶ added in v0.8.0
func PostgRESTAuthenticatorIdentifier(serviceID, nodeName string) resource.Identifier
func PostgRESTConfigResourceIdentifier ¶ added in v0.8.0
func PostgRESTConfigResourceIdentifier(serviceInstanceID string) resource.Identifier
func PostgRESTPreflightResourceIdentifier ¶ added in v0.8.0
func PostgRESTPreflightResourceIdentifier(serviceID string) resource.Identifier
func PostgresContainerExec ¶
func PostgresServiceResourceIdentifier ¶
func PostgresServiceResourceIdentifier(instanceID string) resource.Identifier
func PostgresServiceSpecResourceIdentifier ¶
func PostgresServiceSpecResourceIdentifier(instanceID string) resource.Identifier
func RAGConfigResourceIdentifier ¶ added in v0.8.0
func RAGConfigResourceIdentifier(serviceInstanceID string) resource.Identifier
func RAGPreflightResourceIdentifier ¶ added in v0.8.0
func RAGPreflightResourceIdentifier(serviceInstanceID string) resource.Identifier
func RAGServiceKeysResourceIdentifier ¶ added in v0.8.0
func RAGServiceKeysResourceIdentifier(serviceInstanceID string) resource.Identifier
func RegisterResourceTypes ¶
func ScaleServiceResourceIdentifier ¶
func ScaleServiceResourceIdentifier(instanceID string, direction ScaleDirection) resource.Identifier
func ServiceContainerSpec ¶ added in v0.7.0
func ServiceContainerSpec(opts *ServiceContainerSpecOptions) (swarm.ServiceSpec, error)
ServiceContainerSpec builds a Docker Swarm service spec for a service instance.
func ServiceInstanceName ¶ added in v0.7.0
ServiceInstanceName generates a Docker Swarm service name for a service instance. The hostID is hashed to produce a stable suffix, matching the scheme used by InstanceIDFor. serviceType is omitted because serviceID is already unique within a database.
func ServiceInstanceResourceIdentifier ¶ added in v0.7.0
func ServiceInstanceResourceIdentifier(serviceInstanceID string) resource.Identifier
func ServiceInstanceSpecResourceIdentifier ¶ added in v0.7.0
func ServiceInstanceSpecResourceIdentifier(serviceInstanceID string) resource.Identifier
func SwitchoverResourceIdentifier ¶
func SwitchoverResourceIdentifier(instanceID string) resource.Identifier
Types ¶
type CheckWillRestart ¶
type CheckWillRestart struct {
InstanceID string `json:"instance_id"`
WillRestart bool `json:"will_restart"`
}
func (*CheckWillRestart) Dependencies ¶
func (c *CheckWillRestart) Dependencies() []resource.Identifier
func (*CheckWillRestart) DiffIgnore ¶
func (c *CheckWillRestart) DiffIgnore() []string
func (*CheckWillRestart) Executor ¶
func (c *CheckWillRestart) Executor() resource.Executor
func (*CheckWillRestart) Identifier ¶
func (c *CheckWillRestart) Identifier() resource.Identifier
func (*CheckWillRestart) ResourceVersion ¶
func (c *CheckWillRestart) ResourceVersion() string
func (*CheckWillRestart) TypeDependencies ¶ added in v0.7.0
func (c *CheckWillRestart) TypeDependencies() []resource.Type
type HostOptions ¶
type Instance ¶
type Instance struct {
Spec *database.InstanceSpec `json:"spec"`
}
func (*Instance) Dependencies ¶
func (i *Instance) Dependencies() []resource.Identifier
func (*Instance) Identifier ¶
func (i *Instance) Identifier() resource.Identifier
type MCPConfigParams ¶ added in v0.7.0
type MCPConfigParams struct {
Config *database.MCPServiceConfig
DatabaseName string
DatabaseHosts []database.ServiceHostEntry
TargetSessionAttrs string
Username string
Password string
}
MCPConfigParams holds all inputs needed to generate a config.yaml for the MCP server.
type MCPConfigResource ¶ added in v0.7.0
type MCPConfigResource struct {
ServiceInstanceID string `json:"service_instance_id"`
ServiceID string `json:"service_id"`
HostID string `json:"host_id"`
DirResourceID string `json:"dir_resource_id"`
Config *database.MCPServiceConfig `json:"config"`
DatabaseName string `json:"database_name"`
DatabaseHosts []database.ServiceHostEntry `json:"database_hosts"`
TargetSessionAttrs string `json:"target_session_attrs"`
ConnectAsUsername string `json:"connect_as_username"`
ConnectAsPassword string `json:"connect_as_password"`
// KBHostPath is the full path to the KB SQLite file on the host. When non-empty,
// Create and Update verify the file exists before allowing deployment to proceed.
KBHostPath string `json:"kb_host_path,omitempty"`
}
MCPConfigResource manages the MCP server config files on the host filesystem. It follows the same pattern as PatroniConfig: generates config files and writes them to a host-side directory that is bind-mounted into the container.
Files managed:
- config.yaml: CP-owned, overwritten on every Create/Update
- tokens.yaml: Application-owned, written only on first Create if init_token is set
- users.yaml: Application-owned, written only on first Create if init_users is set
func (*MCPConfigResource) Dependencies ¶ added in v0.7.0
func (r *MCPConfigResource) Dependencies() []resource.Identifier
func (*MCPConfigResource) DiffIgnore ¶ added in v0.7.0
func (r *MCPConfigResource) DiffIgnore() []string
func (*MCPConfigResource) Executor ¶ added in v0.7.0
func (r *MCPConfigResource) Executor() resource.Executor
func (*MCPConfigResource) Identifier ¶ added in v0.7.0
func (r *MCPConfigResource) Identifier() resource.Identifier
func (*MCPConfigResource) PostDeploy ¶ added in v0.8.0
func (r *MCPConfigResource) PostDeploy(ctx context.Context, rc *resource.Context)
signalConfigReload sends SIGHUP to the running MCP container to trigger a config reload. Signal delivery failures are logged as warnings and return nil — the config file is already correct on disk and will be picked up on the next container restart. Injector failures are returned as errors since they indicate a systemic problem. PostDeploy is called by ServiceInstanceResource after the container is confirmed running. It sends SIGHUP to trigger a config reload, handling VirtioFS bind-mount propagation delays on initial provisioning.
func (*MCPConfigResource) ResourceVersion ¶ added in v0.7.0
func (r *MCPConfigResource) ResourceVersion() string
func (*MCPConfigResource) TypeDependencies ¶ added in v0.7.0
func (r *MCPConfigResource) TypeDependencies() []resource.Type
type ManifestLoader ¶
type ManifestLoader struct {
// contains filtered or unexported fields
}
ManifestLoader loads the version manifest from a remote URL (with disk caching and hourly refresh) or from a local file, and exposes the parsed *Versions and *ServiceVersions it produces.
Resolution chains:
manifest_path set (local file): local file only — no fallback, returns error if the file is missing or invalid.
Custom manifest_url (differs from DefaultManifestURL): remote URL → disk cache — no embedded fallback; returns error if all sources fail.
Default manifest_url: remote URL → disk cache → embedded manifest (always succeeds; panics only if the embedded JSON is corrupt, which indicates a broken build).
func NewManifestLoader ¶
func NewManifestLoader(ctx context.Context, cfg config.Config, loggerFactory *logging.Factory, opts ...manifestLoaderOption) (*ManifestLoader, error)
NewManifestLoader creates and starts a ManifestLoader. It loads the manifest synchronously before returning so callers always get a valid *Versions / *ServiceVersions immediately. Returns an error when using a custom manifest_path or manifest_url and the manifest cannot be loaded. Background refresh (if applicable) is started as a goroutine tied to ctx.
func (*ManifestLoader) ServiceVersions ¶
func (m *ManifestLoader) ServiceVersions() ServiceVersions
ServiceVersions returns a snapshot of the current parsed ServiceVersions.
func (*ManifestLoader) Versions ¶
func (m *ManifestLoader) Versions() Versions
Versions returns a snapshot of the current parsed Versions.
type Network ¶
type Network struct {
Scope string `json:"scope"`
Driver string `json:"driver"`
Allocator Allocator `json:"allocator"`
Name string `json:"name"`
NetworkID string `json:"network_id"`
Subnet netip.Prefix `json:"subnet"`
Gateway netip.Addr `json:"gateway"`
}
func (*Network) Dependencies ¶
func (n *Network) Dependencies() []resource.Identifier
func (*Network) DiffIgnore ¶
func (*Network) Identifier ¶
func (n *Network) Identifier() resource.Identifier
func (*Network) ResourceVersion ¶
func (*Network) TypeDependencies ¶ added in v0.7.0
type Orchestrator ¶
type Orchestrator struct {
// contains filtered or unexported fields
}
func NewOrchestrator ¶
func (*Orchestrator) AvailableUpgrades ¶
func (o *Orchestrator) AvailableUpgrades(current *ds.PgEdgeVersion) []*database.AvailableUpgrade
func (*Orchestrator) CreatePgBackRestBackup ¶
func (o *Orchestrator) CreatePgBackRestBackup(ctx context.Context, w io.Writer, spec *database.InstanceSpec, options *pgbackrest.BackupOptions) error
func (*Orchestrator) ExecuteInstanceCommand ¶ added in v0.8.0
func (*Orchestrator) FindUpgrade ¶
func (o *Orchestrator) FindUpgrade(current *ds.PgEdgeVersion, targetImage string) (*database.AvailableUpgrade, error)
func (*Orchestrator) GenerateInstanceResources ¶
func (o *Orchestrator) GenerateInstanceResources(spec *database.InstanceSpec, scripts database.Scripts) (*database.InstanceResources, error)
func (*Orchestrator) GenerateInstanceRestoreResources ¶
func (o *Orchestrator) GenerateInstanceRestoreResources(spec *database.InstanceSpec, taskID uuid.UUID) (*database.InstanceResources, error)
func (*Orchestrator) GenerateServiceInstanceResources ¶ added in v0.7.0
func (o *Orchestrator) GenerateServiceInstanceResources(spec *database.ServiceInstanceSpec) (*database.ServiceInstanceResources, error)
func (*Orchestrator) GetInstanceConnectionInfo ¶
func (o *Orchestrator) GetInstanceConnectionInfo(ctx context.Context, databaseID, instanceID string, postgresPort, patroniPort *int, pgEdgeVersion *ds.PgEdgeVersion, ) (*database.ConnectionInfo, error)
func (*Orchestrator) GetServiceInstanceStatus ¶ added in v0.7.0
func (o *Orchestrator) GetServiceInstanceStatus(ctx context.Context, serviceInstanceID string) (*database.ServiceInstanceStatus, error)
func (*Orchestrator) InstancePaths ¶ added in v0.8.0
func (o *Orchestrator) InstancePaths(_ *ds.Version, instanceID string) (database.InstancePaths, error)
func (*Orchestrator) PopulateHost ¶
func (*Orchestrator) PopulateHostStatus ¶
func (o *Orchestrator) PopulateHostStatus(ctx context.Context, status *host.HostStatus) error
func (*Orchestrator) ReconcileInstanceSpec ¶
func (o *Orchestrator) ReconcileInstanceSpec(old, new *database.InstanceSpec) error
ReconcileInstanceSpec resolves the container image for the new spec. When the version is unchanged it carries the stored ResolvedImage forward so resolveInstanceImages takes the fast path (case 2) and never consults the manifest. When the version changed it clears the stale pin so resolveInstanceImages re-derives the correct image.
func (*Orchestrator) ReconcileServiceInstanceSpec ¶
func (o *Orchestrator) ReconcileServiceInstanceSpec(old, new *database.ServiceInstanceSpec) error
ReconcileServiceInstanceSpec resolves and pins the container image for the service instance. When the service version is unchanged it carries the stored ResolvedImage forward so resolveServiceImage takes the fast path and never consults the manifest. When the version changed it clears the stale pin. old is nil when the service instance is being created for the first time.
func (*Orchestrator) StartInstance ¶
func (o *Orchestrator) StartInstance( ctx context.Context, instanceID string, ) error
func (*Orchestrator) StopInstance ¶
func (o *Orchestrator) StopInstance( ctx context.Context, instanceID string, ) error
func (*Orchestrator) ValidateInstanceSpecs ¶
func (o *Orchestrator) ValidateInstanceSpecs(ctx context.Context, changes []*database.InstanceSpecChange) ([]*database.ValidationResult, error)
func (*Orchestrator) WorkerQueues ¶
func (o *Orchestrator) WorkerQueues() ([]workflow.Queue, error)
type PatroniConfig ¶
type PatroniConfig struct {
DatabaseID string `json:"database_id"`
Base *common.PatroniConfig `json:"base"`
BridgeNetworkInfo *docker.NetworkInfo `json:"host_network_info"`
DatabaseNetworkName string `json:"database_network_name"`
}
func (*PatroniConfig) Dependencies ¶
func (c *PatroniConfig) Dependencies() []resource.Identifier
func (*PatroniConfig) DiffIgnore ¶
func (c *PatroniConfig) DiffIgnore() []string
func (*PatroniConfig) Executor ¶
func (c *PatroniConfig) Executor() resource.Executor
func (*PatroniConfig) Identifier ¶
func (c *PatroniConfig) Identifier() resource.Identifier
func (*PatroniConfig) ResourceVersion ¶
func (c *PatroniConfig) ResourceVersion() string
func (*PatroniConfig) TypeDependencies ¶ added in v0.7.0
func (r *PatroniConfig) TypeDependencies() []resource.Type
type PgBackRestRestore ¶
type PgBackRestRestore struct {
DatabaseID string `json:"database_id"`
HostID string `json:"host_id"`
InstanceID string `json:"instance_id"`
TaskID uuid.UUID `json:"task_id"`
NodeName string `json:"node_name"`
DataDirID string `json:"data_dir_id"`
RestoreOptions map[string]string `json:"restore_options"`
}
func (*PgBackRestRestore) Dependencies ¶
func (p *PgBackRestRestore) Dependencies() []resource.Identifier
func (*PgBackRestRestore) DiffIgnore ¶
func (p *PgBackRestRestore) DiffIgnore() []string
func (*PgBackRestRestore) Executor ¶
func (p *PgBackRestRestore) Executor() resource.Executor
func (*PgBackRestRestore) Identifier ¶
func (p *PgBackRestRestore) Identifier() resource.Identifier
func (*PgBackRestRestore) ResourceVersion ¶
func (p *PgBackRestRestore) ResourceVersion() string
func (*PgBackRestRestore) TypeDependencies ¶ added in v0.7.0
func (p *PgBackRestRestore) TypeDependencies() []resource.Type
type PostgRESTAuthenticatorResource ¶ added in v0.8.0
type PostgRESTAuthenticatorResource struct {
ServiceID string `json:"service_id"`
DatabaseID string `json:"database_id"`
DatabaseName string `json:"database_name"`
NodeName string `json:"node_name"`
DBAnonRole string `json:"db_anon_role"`
ConnectAsUsername string `json:"connect_as_username"` // the database_users entry PostgREST connects as
}
PostgRESTAuthenticatorResource configures a PostgreSQL role as a PostgREST authenticator. It targets the connect_as database user and adds PostgREST-specific configuration:
- ALTER ROLE ... WITH NOINHERIT (required for PostgREST's SET ROLE mechanism)
- GRANT CONNECT ON DATABASE to the authenticator user
- GRANT <anon_role> to the authenticator user
On Update, the anonymous role grant is reconciled within a single transaction to prevent transient loss of anon-role membership when the anon role changes.
func (*PostgRESTAuthenticatorResource) Dependencies ¶ added in v0.8.0
func (r *PostgRESTAuthenticatorResource) Dependencies() []resource.Identifier
func (*PostgRESTAuthenticatorResource) DiffIgnore ¶ added in v0.8.0
func (r *PostgRESTAuthenticatorResource) DiffIgnore() []string
func (*PostgRESTAuthenticatorResource) Executor ¶ added in v0.8.0
func (r *PostgRESTAuthenticatorResource) Executor() resource.Executor
func (*PostgRESTAuthenticatorResource) Identifier ¶ added in v0.8.0
func (r *PostgRESTAuthenticatorResource) Identifier() resource.Identifier
func (*PostgRESTAuthenticatorResource) Refresh ¶ added in v0.8.0
Refresh checks whether the role has NOINHERIT. If not — new deployment or manual change — returns ErrNotFound to trigger Create, which is idempotent.
func (*PostgRESTAuthenticatorResource) ResourceVersion ¶ added in v0.8.0
func (r *PostgRESTAuthenticatorResource) ResourceVersion() string
func (*PostgRESTAuthenticatorResource) TypeDependencies ¶ added in v0.8.0
func (r *PostgRESTAuthenticatorResource) TypeDependencies() []resource.Type
type PostgRESTConfigResource ¶ added in v0.8.0
type PostgRESTConfigResource struct {
ServiceInstanceID string `json:"service_instance_id"`
ServiceID string `json:"service_id"`
HostID string `json:"host_id"`
DirResourceID string `json:"dir_resource_id"`
Config *database.PostgRESTServiceConfig `json:"config"`
ConnectAsUsername string `json:"connect_as_username"`
ConnectAsPassword string `json:"connect_as_password"`
DatabaseName string `json:"database_name"`
DatabaseHosts []database.ServiceHostEntry `json:"database_hosts"`
TargetSessionAttrs string `json:"target_session_attrs,omitempty"`
}
PostgRESTConfigResource manages the postgrest.conf file on the host filesystem. The file is bind-mounted read-only into the container and includes the db-uri with embedded credentials from the connect_as database user.
func (*PostgRESTConfigResource) Dependencies ¶ added in v0.8.0
func (r *PostgRESTConfigResource) Dependencies() []resource.Identifier
func (*PostgRESTConfigResource) DiffIgnore ¶ added in v0.8.0
func (r *PostgRESTConfigResource) DiffIgnore() []string
func (*PostgRESTConfigResource) Executor ¶ added in v0.8.0
func (r *PostgRESTConfigResource) Executor() resource.Executor
func (*PostgRESTConfigResource) Identifier ¶ added in v0.8.0
func (r *PostgRESTConfigResource) Identifier() resource.Identifier
func (*PostgRESTConfigResource) ResourceVersion ¶ added in v0.8.0
func (r *PostgRESTConfigResource) ResourceVersion() string
func (*PostgRESTConfigResource) TypeDependencies ¶ added in v0.8.0
func (r *PostgRESTConfigResource) TypeDependencies() []resource.Type
type PostgRESTPreflightResource ¶ added in v0.8.0
type PostgRESTPreflightResource struct {
ServiceID string `json:"service_id"`
DatabaseID string `json:"database_id"`
DatabaseName string `json:"database_name"`
NodeName string `json:"node_name"`
DBSchemas string `json:"db_schemas"`
DBAnonRole string `json:"db_anon_role"`
}
PostgRESTPreflightResource validates that the configured schemas and anon role exist in the database before PostgREST is provisioned. It uses PrimaryExecutor so the check runs on a host with guaranteed database connectivity.
func (*PostgRESTPreflightResource) Dependencies ¶ added in v0.8.0
func (r *PostgRESTPreflightResource) Dependencies() []resource.Identifier
func (*PostgRESTPreflightResource) DiffIgnore ¶ added in v0.8.0
func (r *PostgRESTPreflightResource) DiffIgnore() []string
func (*PostgRESTPreflightResource) Executor ¶ added in v0.8.0
func (r *PostgRESTPreflightResource) Executor() resource.Executor
func (*PostgRESTPreflightResource) Identifier ¶ added in v0.8.0
func (r *PostgRESTPreflightResource) Identifier() resource.Identifier
func (*PostgRESTPreflightResource) Refresh ¶ added in v0.8.0
Refresh validates prerequisites and returns ErrNotFound only when validation fails, triggering a Create that surfaces the error. When prerequisites are satisfied the resource is considered up-to-date (no permadrift).
func (*PostgRESTPreflightResource) ResourceVersion ¶ added in v0.8.0
func (r *PostgRESTPreflightResource) ResourceVersion() string
func (*PostgRESTPreflightResource) TypeDependencies ¶ added in v0.8.0
func (r *PostgRESTPreflightResource) TypeDependencies() []resource.Type
type PostgresService ¶
type PostgresService struct {
InstanceID string `json:"instance_id"`
ServiceName string `json:"service_name"`
ServiceID string `json:"service_id"`
NeedsUpdate bool `json:"needs_update"`
}
func (*PostgresService) Dependencies ¶
func (s *PostgresService) Dependencies() []resource.Identifier
func (*PostgresService) DiffIgnore ¶
func (s *PostgresService) DiffIgnore() []string
func (*PostgresService) Executor ¶
func (s *PostgresService) Executor() resource.Executor
func (*PostgresService) Identifier ¶
func (s *PostgresService) Identifier() resource.Identifier
func (*PostgresService) ResourceVersion ¶
func (s *PostgresService) ResourceVersion() string
func (*PostgresService) TypeDependencies ¶ added in v0.7.0
func (s *PostgresService) TypeDependencies() []resource.Type
type PostgresServiceSpecResource ¶
type PostgresServiceSpecResource struct {
Instance *database.InstanceSpec `json:"instance"`
CohortMemberID string `json:"cohort_member_id"`
Images *Images `json:"images"`
ServiceName string `json:"service_name"`
InstanceHostname string `json:"instance_hostname"`
Spec swarm.ServiceSpec `json:"spec"`
DatabaseNetworkName string `json:"database_network_name"`
DataDirID string `json:"data_dir_id"`
ConfigsDirID string `json:"configs_dir_id"`
CertificatesDirID string `json:"certificates_dir_id"`
}
func (*PostgresServiceSpecResource) Dependencies ¶
func (s *PostgresServiceSpecResource) Dependencies() []resource.Identifier
func (*PostgresServiceSpecResource) DiffIgnore ¶
func (s *PostgresServiceSpecResource) DiffIgnore() []string
func (*PostgresServiceSpecResource) Executor ¶
func (s *PostgresServiceSpecResource) Executor() resource.Executor
func (*PostgresServiceSpecResource) Identifier ¶
func (s *PostgresServiceSpecResource) Identifier() resource.Identifier
func (*PostgresServiceSpecResource) ResourceVersion ¶
func (s *PostgresServiceSpecResource) ResourceVersion() string
func (*PostgresServiceSpecResource) TypeDependencies ¶ added in v0.7.0
func (s *PostgresServiceSpecResource) TypeDependencies() []resource.Type
type RAGConfigParams ¶ added in v0.8.0
type RAGConfigParams struct {
Config *database.RAGServiceConfig
DatabaseName string
DatabaseHost string
DatabasePort int
Username string
Password string
// KeysDir is the container-side directory where API key files are mounted,
// e.g. "/app/keys". Key filenames follow the {pipeline}_{embedding|rag}.key
// convention produced by extractRAGAPIKeys.
KeysDir string
}
RAGConfigParams holds all inputs needed to generate pgedge-rag-server.yaml.
type RAGConfigResource ¶ added in v0.8.0
type RAGConfigResource struct {
ServiceInstanceID string `json:"service_instance_id"`
ServiceID string `json:"service_id"`
HostID string `json:"host_id"`
DirResourceID string `json:"dir_resource_id"`
Config *database.RAGServiceConfig `json:"config"`
DatabaseName string `json:"database_name"`
DatabaseHost string `json:"database_host"`
DatabasePort int `json:"database_port"`
ConnectAsUsername string `json:"connect_as_username"`
ConnectAsPassword string `json:"connect_as_password"`
}
RAGConfigResource manages the pgedge-rag-server.yaml config file on the host filesystem. The file is written to the service data directory (managed by a DirResource) which is bind-mounted into the container at /app/data. On every Create or Update the file is regenerated from the current RAGServiceConfig and the connect_as credentials sourced from database_users.
func (*RAGConfigResource) Dependencies ¶ added in v0.8.0
func (r *RAGConfigResource) Dependencies() []resource.Identifier
func (*RAGConfigResource) DiffIgnore ¶ added in v0.8.0
func (r *RAGConfigResource) DiffIgnore() []string
func (*RAGConfigResource) Executor ¶ added in v0.8.0
func (r *RAGConfigResource) Executor() resource.Executor
func (*RAGConfigResource) Identifier ¶ added in v0.8.0
func (r *RAGConfigResource) Identifier() resource.Identifier
func (*RAGConfigResource) ResourceVersion ¶ added in v0.8.0
func (r *RAGConfigResource) ResourceVersion() string
func (*RAGConfigResource) TypeDependencies ¶ added in v0.8.0
func (r *RAGConfigResource) TypeDependencies() []resource.Type
type RAGPreflightResource ¶ added in v0.8.0
type RAGPreflightResource struct {
ServiceInstanceID string `json:"service_instance_id"`
NodeName string `json:"node_name"`
DatabaseName string `json:"database_name"`
// ConnectAsUsername is the database role the RAG service connects as.
// It must be declared in database_users.
ConnectAsUsername string `json:"connect_as_username"`
}
RAGPreflightResource verifies that the Postgres database is available and the connect_as user exists before the RAG config file is written and the Docker service is started. It uses PrimaryExecutor so it runs on a host with guaranteed database connectivity.
Refresh returns ErrNotFound until all checks pass, causing the resource engine to retry on each reconciliation cycle — effectively acting as a readiness gate that prevents the RAG container from starting while Patroni is still bootstrapping.
func (*RAGPreflightResource) Dependencies ¶ added in v0.8.0
func (r *RAGPreflightResource) Dependencies() []resource.Identifier
func (*RAGPreflightResource) DiffIgnore ¶ added in v0.8.0
func (r *RAGPreflightResource) DiffIgnore() []string
func (*RAGPreflightResource) Executor ¶ added in v0.8.0
func (r *RAGPreflightResource) Executor() resource.Executor
func (*RAGPreflightResource) Identifier ¶ added in v0.8.0
func (r *RAGPreflightResource) Identifier() resource.Identifier
func (*RAGPreflightResource) Refresh ¶ added in v0.8.0
Refresh returns ErrNotFound when the database or connect_as user is not yet ready, causing the resource engine to retry rather than treating the service as permanently failed.
func (*RAGPreflightResource) ResourceVersion ¶ added in v0.8.0
func (r *RAGPreflightResource) ResourceVersion() string
func (*RAGPreflightResource) TypeDependencies ¶ added in v0.8.0
func (r *RAGPreflightResource) TypeDependencies() []resource.Type
type RAGServiceKeysResource ¶ added in v0.8.0
type RAGServiceKeysResource struct {
ServiceInstanceID string `json:"service_instance_id"`
HostID string `json:"host_id"`
ParentID string `json:"parent_id"` // DirResource ID for the service data directory
Keys map[string]string `json:"keys"` // filename → key value
}
RAGServiceKeysResource manages provider API key files on the host filesystem. Keys are written to a "keys" subdirectory under the service data directory and bind-mounted read-only into the RAG container. The directory and all files are removed when the service is deleted.
func (*RAGServiceKeysResource) Dependencies ¶ added in v0.8.0
func (r *RAGServiceKeysResource) Dependencies() []resource.Identifier
func (*RAGServiceKeysResource) DiffIgnore ¶ added in v0.8.0
func (r *RAGServiceKeysResource) DiffIgnore() []string
func (*RAGServiceKeysResource) Executor ¶ added in v0.8.0
func (r *RAGServiceKeysResource) Executor() resource.Executor
func (*RAGServiceKeysResource) Identifier ¶ added in v0.8.0
func (r *RAGServiceKeysResource) Identifier() resource.Identifier
func (*RAGServiceKeysResource) ResourceVersion ¶ added in v0.8.0
func (r *RAGServiceKeysResource) ResourceVersion() string
func (*RAGServiceKeysResource) TypeDependencies ¶ added in v0.8.0
func (r *RAGServiceKeysResource) TypeDependencies() []resource.Type
type ScaleDirection ¶
type ScaleDirection string
const ( ScaleDirectionUP ScaleDirection = "up" ScaleDirectionDOWN ScaleDirection = "down" )
type ScaleService ¶
type ScaleService struct {
InstanceID string `json:"instance_id"`
ScaleDirection ScaleDirection `json:"scale_direction"`
Deps []resource.Identifier `json:"deps"`
}
func (*ScaleService) Dependencies ¶
func (s *ScaleService) Dependencies() []resource.Identifier
func (*ScaleService) DiffIgnore ¶
func (s *ScaleService) DiffIgnore() []string
func (*ScaleService) Executor ¶
func (s *ScaleService) Executor() resource.Executor
func (*ScaleService) Identifier ¶
func (s *ScaleService) Identifier() resource.Identifier
func (*ScaleService) ResourceVersion ¶
func (s *ScaleService) ResourceVersion() string
func (*ScaleService) TypeDependencies ¶ added in v0.7.0
func (s *ScaleService) TypeDependencies() []resource.Type
type ServiceContainerSpecOptions ¶ added in v0.7.0
type ServiceContainerSpecOptions struct {
ServiceSpec *database.ServiceSpec
ServiceInstanceID string
DatabaseID string
DatabaseName string
HostID string
ServiceName string
Hostname string
CohortMemberID string
ServiceImage *ServiceImage
DatabaseNetworkID string
DatabaseHosts []database.ServiceHostEntry // Ordered Postgres host:port entries
TargetSessionAttrs string // libpq target_session_attrs
// Service port configuration
Port *int
// DataPath is the host-side directory path for the bind mount
DataPath string
// KeysPath is the host-side directory containing API key files.
// When non-empty, it is bind-mounted read-only into the container at /app/keys.
KeysPath string
// KBDirPath is the host-side directory containing the KB SQLite file.
// When non-empty, it is bind-mounted read-only into the container at /app/kb.
KBDirPath string
}
ServiceContainerSpecOptions contains all parameters needed to build a service container spec.
type ServiceImage ¶ added in v0.7.0
type ServiceImage struct {
Tag string `json:"tag"`
PostgresConstraint *ds.VersionConstraint `json:"postgres_constraint,omitempty"`
SpockConstraint *ds.VersionConstraint `json:"spock_constraint,omitempty"`
}
ServiceImage describes a container image for a service type+version, along with optional version constraints that restrict which Postgres and Spock versions the service is compatible with.
func (*ServiceImage) ValidateCompatibility ¶ added in v0.7.0
func (s *ServiceImage) ValidateCompatibility(postgres, spock *ds.Version) error
ValidateCompatibility checks that the given Postgres and Spock versions satisfy this image's version constraints. Returns nil if compatible.
type ServiceInstanceResource ¶ added in v0.7.0
type ServiceInstanceResource struct {
ServiceInstanceID string `json:"service_instance_id"`
DatabaseID string `json:"database_id"`
ServiceName string `json:"service_name"`
ServiceID string `json:"service_id"` // Docker Swarm service ID (set by Refresh)
ServiceSpecID string `json:"service_spec_id"` // Logical service ID from the spec (e.g. "mcp-server")
ServiceType string `json:"service_type"` // Service type (e.g. "mcp", "rag", "postgrest")
ConnectAsUsername string `json:"connect_as_username"` // Non-empty when RAG uses connect_as credentials
HostID string `json:"host_id"`
NeedsUpdate bool `json:"needs_update"`
}
func (*ServiceInstanceResource) Dependencies ¶ added in v0.7.0
func (s *ServiceInstanceResource) Dependencies() []resource.Identifier
func (*ServiceInstanceResource) DiffIgnore ¶ added in v0.7.0
func (s *ServiceInstanceResource) DiffIgnore() []string
func (*ServiceInstanceResource) Executor ¶ added in v0.7.0
func (s *ServiceInstanceResource) Executor() resource.Executor
func (*ServiceInstanceResource) Identifier ¶ added in v0.7.0
func (s *ServiceInstanceResource) Identifier() resource.Identifier
func (*ServiceInstanceResource) ResourceVersion ¶ added in v0.7.0
func (s *ServiceInstanceResource) ResourceVersion() string
func (*ServiceInstanceResource) TypeDependencies ¶ added in v0.7.0
func (s *ServiceInstanceResource) TypeDependencies() []resource.Type
type ServiceInstanceSpecResource ¶ added in v0.7.0
type ServiceInstanceSpecResource struct {
ServiceInstanceID string `json:"service_instance_id"`
ServiceSpec *database.ServiceSpec `json:"service_spec"`
DatabaseID string `json:"database_id"`
DatabaseName string `json:"database_name"`
HostID string `json:"host_id"`
ServiceName string `json:"service_name"`
Hostname string `json:"hostname"`
CohortMemberID string `json:"cohort_member_id"`
ServiceImage *ServiceImage `json:"service_image"`
DatabaseNetworkID string `json:"database_network_id"`
DatabaseHosts []database.ServiceHostEntry `json:"database_hosts"` // Ordered Postgres host:port entries
TargetSessionAttrs string `json:"target_session_attrs"` // libpq target_session_attrs
Port *int `json:"port"` // Service published port (optional, 0 = random)
DataDirID string `json:"data_dir_id"` // DirResource ID for the service data directory
KBDirPath string `json:"kb_dir_path,omitempty"` // Host-side KB directory for bind mount (MCP only, KB enabled)
Spec swarm.ServiceSpec `json:"spec"`
}
func (*ServiceInstanceSpecResource) Dependencies ¶ added in v0.7.0
func (s *ServiceInstanceSpecResource) Dependencies() []resource.Identifier
func (*ServiceInstanceSpecResource) DiffIgnore ¶ added in v0.7.0
func (s *ServiceInstanceSpecResource) DiffIgnore() []string
func (*ServiceInstanceSpecResource) Executor ¶ added in v0.7.0
func (s *ServiceInstanceSpecResource) Executor() resource.Executor
func (*ServiceInstanceSpecResource) Identifier ¶ added in v0.7.0
func (s *ServiceInstanceSpecResource) Identifier() resource.Identifier
func (*ServiceInstanceSpecResource) PostDeploy ¶ added in v0.8.0
func (s *ServiceInstanceSpecResource) PostDeploy(ctx context.Context, rc *resource.Context)
PostDeploy is called by ServiceInstanceResource after the container is confirmed running. Each service type can trigger any necessary post-start actions here.
func (*ServiceInstanceSpecResource) ResourceVersion ¶ added in v0.7.0
func (s *ServiceInstanceSpecResource) ResourceVersion() string
func (*ServiceInstanceSpecResource) TypeDependencies ¶ added in v0.7.0
func (s *ServiceInstanceSpecResource) TypeDependencies() []resource.Type
type ServiceVersions ¶ added in v0.7.0
type ServiceVersions struct {
// contains filtered or unexported fields
}
func NewServiceVersions ¶ added in v0.7.0
func NewServiceVersions(cfg config.Config) *ServiceVersions
func (ServiceVersions) GetServiceImage ¶ added in v0.7.0
func (sv ServiceVersions) GetServiceImage(serviceType string, version string) (*ServiceImage, error)
GetServiceImage returns the full ServiceImage for the given service type and version.
func (ServiceVersions) SupportedServiceVersions ¶ added in v0.7.0
func (sv ServiceVersions) SupportedServiceVersions(serviceType string) ([]string, error)
type Switchover ¶
func (*Switchover) Dependencies ¶
func (s *Switchover) Dependencies() []resource.Identifier
func (*Switchover) DiffIgnore ¶
func (s *Switchover) DiffIgnore() []string
func (*Switchover) Executor ¶
func (s *Switchover) Executor() resource.Executor
func (*Switchover) Identifier ¶
func (s *Switchover) Identifier() resource.Identifier
func (*Switchover) ResourceVersion ¶
func (s *Switchover) ResourceVersion() string
func (*Switchover) TypeDependencies ¶ added in v0.7.0
func (s *Switchover) TypeDependencies() []resource.Type
type Versions ¶
type Versions struct {
// contains filtered or unexported fields
}
func NewVersions ¶
func (*Versions) AvailableUpgrades ¶
func (v *Versions) AvailableUpgrades(current *ds.PgEdgeVersion) []*database.AvailableUpgrade
AvailableUpgrades returns all newer stable manifest entries in the same (postgres_major, spock_major) bucket as current. Returns nil when current is nil or no newer entries exist.
func (Versions) Default ¶
func (v Versions) Default() *ds.PgEdgeVersion
func (*Versions) FindByImage ¶
FindByImage returns the PgEdgeVersion and Images for the manifest entry whose PgEdgeImage matches image exactly. Returns (nil, nil, false) when no entry matches.
func (Versions) Supported ¶
func (v Versions) Supported() []*ds.PgEdgeVersion
Source Files
¶
- check_will_restart.go
- images.go
- instance.go
- manifest_loader.go
- mcp_auth_files.go
- mcp_config.go
- mcp_config_resource.go
- network.go
- orchestrator.go
- patroni_config.go
- pgbackrest_restore.go
- postgres_service.go
- postgres_service_spec.go
- postgrest_authenticator_resource.go
- postgrest_config_resource.go
- postgrest_preflight_resource.go
- provide.go
- rag_config.go
- rag_config_resource.go
- rag_preflight_resource.go
- rag_service_keys_resource.go
- resources.go
- scale_service.go
- service_images.go
- service_instance.go
- service_instance_spec.go
- service_spec.go
- spec.go
- switchover.go
- utils.go