swarm

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: PostgreSQL Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OverlayDriver = "overlay"
)
View Source
const ResourceTypeCheckWillRestart resource.Type = "swarm.check_will_restart"
View Source
const ResourceTypeEtcdCreds resource.Type = "swarm.etcd_creds"
View Source
const ResourceTypeMCPConfig resource.Type = "swarm.mcp_config"
View Source
const ResourceTypeNetwork resource.Type = "swarm.network"
View Source
const ResourceTypePatroniCluster resource.Type = "swarm.patroni_cluster"
View Source
const ResourceTypePatroniConfig resource.Type = "swarm.patroni_config"
View Source
const ResourceTypePatroniMember resource.Type = "swarm.patroni_member"
View Source
const ResourceTypePgBackRestConfig resource.Type = "swarm.pgbackrest_config"
View Source
const ResourceTypePgBackRestRestore resource.Type = "swarm.pgbackrest_restore"
View Source
const ResourceTypePgBackRestStanza resource.Type = "swarm.pgbackrest_stanza"
View Source
const ResourceTypePostgRESTAuthenticator resource.Type = "swarm.postgrest_authenticator"
View Source
const ResourceTypePostgRESTConfig resource.Type = "swarm.postgrest_config"
View Source
const ResourceTypePostgRESTPreflightResource resource.Type = "swarm.postgrest_preflight"
View Source
const ResourceTypePostgresCerts resource.Type = "swarm.postgres_certs"
View Source
const ResourceTypePostgresService resource.Type = "swarm.postgres_service"
View Source
const ResourceTypePostgresServiceSpec resource.Type = "swarm.postgres_service_spec"
View Source
const ResourceTypeRAGConfig resource.Type = "swarm.rag_config"
View Source
const ResourceTypeRAGPreflightResource resource.Type = "swarm.rag_preflight"
View Source
const ResourceTypeRAGServiceKeys resource.Type = "swarm.rag_service_keys"
View Source
const ResourceTypeScaleService resource.Type = "swarm.scale_service"
View Source
const ResourceTypeServiceInstance resource.Type = database.ResourceTypeServiceInstance
View Source
const ResourceTypeServiceInstanceSpec resource.Type = "swarm.service_instance_spec"
View Source
const ResourceTypeSwitchover resource.Type = "swarm.switchover"

Variables

View Source
var (
	ErrNoPostgresContainer = errors.New("no postgres container found")
	ErrNoPostgresService   = errors.New("no postgres service found")
	ErrNoServiceContainer  = errors.New("no service container found")
)

Functions

func CheckWillRestartIdentifier

func CheckWillRestartIdentifier(instanceID string) resource.Identifier

func DatabaseServiceSpec

func DatabaseServiceSpec(
	instance *database.InstanceSpec,
	options *HostOptions,
) (swarm.ServiceSpec, error)

func EtcdCredsIdentifier

func EtcdCredsIdentifier(instanceID string) resource.Identifier

func GenerateEmptyTokenFile added in v0.7.0

func GenerateEmptyTokenFile() ([]byte, error)

GenerateEmptyTokenFile generates an empty but valid tokens.yaml file.

func GenerateEmptyUserFile added in v0.7.0

func GenerateEmptyUserFile() ([]byte, error)

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

func GenerateTokenFile(initToken string) ([]byte, error)

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 GetPostgresContainer(ctx context.Context, dockerClient *docker.Docker, instanceID string) (types.Container, error)

func GetServiceContainer added in v0.7.0

func GetServiceContainer(ctx context.Context, dockerClient *docker.Docker, serviceInstanceID string) (types.Container, error)

func MCPConfigResourceIdentifier added in v0.7.0

func MCPConfigResourceIdentifier(serviceInstanceID string) resource.Identifier

func NetworkResourceIdentifier

func NetworkResourceIdentifier(name string) resource.Identifier

func PatroniClusterResourceIdentifier

func PatroniClusterResourceIdentifier(nodeName string) resource.Identifier

func PatroniConfigIdentifier

func PatroniConfigIdentifier(instanceID string) resource.Identifier

func PatroniMemberResourceIdentifier

func PatroniMemberResourceIdentifier(instanceID string) resource.Identifier

func PgBackRestBackupCmd

func PgBackRestBackupCmd(command string, args ...string) pgbackrest.Cmd

func PgBackRestConfigIdentifier

func PgBackRestConfigIdentifier(instanceID string, configType PgBackRestConfigType) resource.Identifier

func PgBackRestRestoreCmd

func PgBackRestRestoreCmd(command string, args ...string) pgbackrest.Cmd

func PgBackRestRestoreResourceIdentifier

func PgBackRestRestoreResourceIdentifier(instanceID string) resource.Identifier

func PgBackRestStanzaIdentifier

func PgBackRestStanzaIdentifier(nodeName 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 PostgresCertsIdentifier

func PostgresCertsIdentifier(instanceID string) resource.Identifier

func PostgresContainerExec

func PostgresContainerExec(ctx context.Context, w io.Writer, dockerClient *docker.Docker, instanceID string, cmd []string) error

func PostgresServiceResourceIdentifier

func PostgresServiceResourceIdentifier(instanceID string) resource.Identifier

func PostgresServiceSpecResourceIdentifier

func PostgresServiceSpecResourceIdentifier(instanceID string) resource.Identifier

func Provide

func Provide(i *do.Injector)

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 RegisterResourceTypes(registry *resource.Registry)

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

func ServiceInstanceName(databaseID, serviceID, hostID string) string

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 Allocator

type Allocator struct {
	Prefix netip.Prefix `json:"prefix"`
	Bits   int          `json:"bits"`
}

type CheckWillRestart

type CheckWillRestart struct {
	InstanceID  string `json:"instance_id"`
	WillRestart bool   `json:"will_restart"`
}

func (*CheckWillRestart) Create

func (c *CheckWillRestart) Create(ctx context.Context, rc *resource.Context) error

func (*CheckWillRestart) Delete

func (c *CheckWillRestart) Delete(ctx context.Context, rc *resource.Context) error

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) Refresh

func (c *CheckWillRestart) Refresh(ctx context.Context, rc *resource.Context) error

func (*CheckWillRestart) ResourceVersion

func (c *CheckWillRestart) ResourceVersion() string

func (*CheckWillRestart) TypeDependencies added in v0.7.0

func (c *CheckWillRestart) TypeDependencies() []resource.Type

func (*CheckWillRestart) Update

func (c *CheckWillRestart) Update(ctx context.Context, rc *resource.Context) error

type EtcdCreds

type EtcdCreds struct {
	InstanceID string `json:"instance_id"`
	DatabaseID string `json:"database_id"`
	HostID     string `json:"host_id"`
	NodeName   string `json:"node_name"`
	ParentID   string `json:"parent_id"`
	OwnerUID   int    `json:"owner_uid"`
	OwnerGID   int    `json:"owner_gid"`
	Username   string `json:"username"`
	Password   string `json:"password"`
	CaCert     []byte `json:"ca_cert"`
	ClientCert []byte `json:"server_cert"`
	ClientKey  []byte `json:"server_key"`
}

func (*EtcdCreds) Create

func (c *EtcdCreds) Create(ctx context.Context, rc *resource.Context) error

func (*EtcdCreds) Delete

func (c *EtcdCreds) Delete(ctx context.Context, rc *resource.Context) error

func (*EtcdCreds) Dependencies

func (c *EtcdCreds) Dependencies() []resource.Identifier

func (*EtcdCreds) DiffIgnore

func (c *EtcdCreds) DiffIgnore() []string

func (*EtcdCreds) Executor

func (c *EtcdCreds) Executor() resource.Executor

func (*EtcdCreds) Identifier

func (c *EtcdCreds) Identifier() resource.Identifier

func (*EtcdCreds) Refresh

func (c *EtcdCreds) Refresh(ctx context.Context, rc *resource.Context) error

func (*EtcdCreds) ResourceVersion

func (c *EtcdCreds) ResourceVersion() string

func (*EtcdCreds) TypeDependencies added in v0.7.0

func (c *EtcdCreds) TypeDependencies() []resource.Type

func (*EtcdCreds) Update

func (c *EtcdCreds) Update(ctx context.Context, rc *resource.Context) error

type HostOptions

type HostOptions struct {
	ServiceName       string
	InstanceHostname  string
	DatabaseNetworkID string
	Paths             Paths
	Images            *Images
	CohortMemberID    string
}

type Images

type Images struct {
	PgEdgeImage string
}

type Instance

type Instance struct {
	Spec *database.InstanceSpec `json:"spec"`
}

func (*Instance) Create

func (i *Instance) Create(
	ctx context.Context,
	state *resource.State,
	inj *do.Injector,
) error

func (*Instance) Dependencies

func (i *Instance) Dependencies() []resource.Identifier

func (*Instance) Identifier

func (i *Instance) Identifier() resource.Identifier

func (*Instance) Validate

func (i *Instance) Validate() error

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"`
}

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) Create added in v0.7.0

func (r *MCPConfigResource) Create(ctx context.Context, rc *resource.Context) error

func (*MCPConfigResource) Delete added in v0.7.0

func (r *MCPConfigResource) Delete(ctx context.Context, rc *resource.Context) error

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) Refresh added in v0.7.0

func (r *MCPConfigResource) Refresh(ctx context.Context, rc *resource.Context) error

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

func (*MCPConfigResource) Update added in v0.7.0

func (r *MCPConfigResource) Update(ctx context.Context, rc *resource.Context) error

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) Create

func (n *Network) Create(ctx context.Context, rc *resource.Context) error

func (*Network) Delete

func (n *Network) Delete(ctx context.Context, rc *resource.Context) error

func (*Network) Dependencies

func (n *Network) Dependencies() []resource.Identifier

func (*Network) DiffIgnore

func (n *Network) DiffIgnore() []string

func (*Network) Executor

func (n *Network) Executor() resource.Executor

func (*Network) Identifier

func (n *Network) Identifier() resource.Identifier

func (*Network) Refresh

func (n *Network) Refresh(ctx context.Context, rc *resource.Context) error

func (*Network) ResourceVersion

func (n *Network) ResourceVersion() string

func (*Network) TypeDependencies added in v0.7.0

func (n *Network) TypeDependencies() []resource.Type

func (*Network) Update

func (n *Network) Update(ctx context.Context, rc *resource.Context) error

func (*Network) Validate

func (n *Network) Validate() error

type Orchestrator

type Orchestrator struct {
	// contains filtered or unexported fields
}

func NewOrchestrator

func NewOrchestrator(
	ctx context.Context,
	cfg config.Config,
	d *docker.Docker,
	logger zerolog.Logger,
) (*Orchestrator, error)

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 (o *Orchestrator) ExecuteInstanceCommand(ctx context.Context, w io.Writer, databaseID, instanceID string, args ...string) 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) NodeDSN added in v0.8.0

func (o *Orchestrator) NodeDSN(ctx context.Context, rc *resource.Context, nodeName string, fromInstanceID string, dbName string) (*postgres.DSN, error)

func (*Orchestrator) PopulateHost

func (o *Orchestrator) PopulateHost(ctx context.Context, h *host.Host) error

func (*Orchestrator) PopulateHostStatus

func (o *Orchestrator) PopulateHostStatus(ctx context.Context, status *host.HostStatus) error

func (*Orchestrator) Start added in v0.8.0

func (o *Orchestrator) Start(_ context.Context) error

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 Paths

type Paths struct {
	Configs      string
	Certificates string
	Data         string
}

type PatroniCluster

type PatroniCluster struct {
	DatabaseID           string `json:"database_id"`
	NodeName             string `json:"node_name"`
	PatroniClusterPrefix string `json:"patroni_namespace"`
}

func (*PatroniCluster) Create

func (p *PatroniCluster) Create(ctx context.Context, rc *resource.Context) error

func (*PatroniCluster) Delete

func (p *PatroniCluster) Delete(ctx context.Context, rc *resource.Context) error

func (*PatroniCluster) Dependencies

func (p *PatroniCluster) Dependencies() []resource.Identifier

func (*PatroniCluster) DiffIgnore

func (p *PatroniCluster) DiffIgnore() []string

func (*PatroniCluster) Executor

func (p *PatroniCluster) Executor() resource.Executor

func (*PatroniCluster) Identifier

func (p *PatroniCluster) Identifier() resource.Identifier

func (*PatroniCluster) Refresh

func (p *PatroniCluster) Refresh(ctx context.Context, rc *resource.Context) error

func (*PatroniCluster) ResourceVersion

func (p *PatroniCluster) ResourceVersion() string

func (*PatroniCluster) TypeDependencies added in v0.7.0

func (p *PatroniCluster) TypeDependencies() []resource.Type

func (*PatroniCluster) Update

func (p *PatroniCluster) Update(ctx context.Context, rc *resource.Context) error

type PatroniConfig

type PatroniConfig struct {
	Spec                *database.InstanceSpec `json:"spec"`
	ParentID            string                 `json:"parent_id"`
	HostCPUs            float64                `json:"host_cpus"`
	HostMemoryBytes     uint64                 `json:"host_memory_bytes"`
	BridgeNetworkInfo   *docker.NetworkInfo    `json:"host_network_info"`
	DatabaseNetworkName string                 `json:"database_network_name"`
	OwnerUID            int                    `json:"owner_uid"`
	OwnerGID            int                    `json:"owner_gid"`
	InstanceHostname    string                 `json:"instance_hostname"`
}

func (*PatroniConfig) Create

func (c *PatroniConfig) Create(ctx context.Context, rc *resource.Context) error

func (*PatroniConfig) Delete

func (c *PatroniConfig) Delete(ctx context.Context, rc *resource.Context) error

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) Refresh

func (c *PatroniConfig) Refresh(ctx context.Context, rc *resource.Context) error

func (*PatroniConfig) ResourceVersion

func (c *PatroniConfig) ResourceVersion() string

func (*PatroniConfig) TypeDependencies added in v0.7.0

func (r *PatroniConfig) TypeDependencies() []resource.Type

func (*PatroniConfig) Update

func (c *PatroniConfig) Update(ctx context.Context, rc *resource.Context) error

type PatroniMember

type PatroniMember struct {
	DatabaseID string `json:"database_id"`
	NodeName   string `json:"node_name"`
	InstanceID string `json:"instance_id"`
}

func (*PatroniMember) Create

func (p *PatroniMember) Create(ctx context.Context, rc *resource.Context) error

func (*PatroniMember) Delete

func (p *PatroniMember) Delete(ctx context.Context, rc *resource.Context) error

func (*PatroniMember) Dependencies

func (p *PatroniMember) Dependencies() []resource.Identifier

func (*PatroniMember) DiffIgnore

func (p *PatroniMember) DiffIgnore() []string

func (*PatroniMember) Executor

func (p *PatroniMember) Executor() resource.Executor

func (*PatroniMember) Identifier

func (p *PatroniMember) Identifier() resource.Identifier

func (*PatroniMember) Refresh

func (p *PatroniMember) Refresh(ctx context.Context, rc *resource.Context) error

func (*PatroniMember) ResourceVersion

func (p *PatroniMember) ResourceVersion() string

func (*PatroniMember) TypeDependencies added in v0.7.0

func (p *PatroniMember) TypeDependencies() []resource.Type

func (*PatroniMember) Update

func (p *PatroniMember) Update(ctx context.Context, rc *resource.Context) error

type PgBackRestConfig

type PgBackRestConfig struct {
	InstanceID   string                   `json:"instance_id"`
	HostID       string                   `json:"host_id"`
	DatabaseID   string                   `json:"database_id"`
	NodeName     string                   `json:"node_name"`
	Repositories []*pgbackrest.Repository `json:"repositories"`
	ParentID     string                   `json:"parent_id"`
	Type         PgBackRestConfigType     `json:"type"`
	OwnerUID     int                      `json:"owner_uid"`
	OwnerGID     int                      `json:"owner_gid"`
}

func (*PgBackRestConfig) BaseName

func (c *PgBackRestConfig) BaseName() string

func (*PgBackRestConfig) ContainerPath

func (c *PgBackRestConfig) ContainerPath() string

func (*PgBackRestConfig) Create

func (c *PgBackRestConfig) Create(ctx context.Context, rc *resource.Context) error

func (*PgBackRestConfig) Delete

func (c *PgBackRestConfig) Delete(ctx context.Context, rc *resource.Context) error

func (*PgBackRestConfig) Dependencies

func (c *PgBackRestConfig) Dependencies() []resource.Identifier

func (*PgBackRestConfig) DiffIgnore

func (c *PgBackRestConfig) DiffIgnore() []string

func (*PgBackRestConfig) Executor

func (c *PgBackRestConfig) Executor() resource.Executor

func (*PgBackRestConfig) HostPath

func (c *PgBackRestConfig) HostPath(rc *resource.Context) (string, error)

func (*PgBackRestConfig) Identifier

func (c *PgBackRestConfig) Identifier() resource.Identifier

func (*PgBackRestConfig) Refresh

func (c *PgBackRestConfig) Refresh(ctx context.Context, rc *resource.Context) error

func (*PgBackRestConfig) ResourceVersion

func (c *PgBackRestConfig) ResourceVersion() string

func (*PgBackRestConfig) TypeDependencies added in v0.7.0

func (c *PgBackRestConfig) TypeDependencies() []resource.Type

func (*PgBackRestConfig) Update

func (c *PgBackRestConfig) Update(ctx context.Context, rc *resource.Context) error

type PgBackRestConfigType

type PgBackRestConfigType string
const (
	PgBackRestConfigTypeBackup  PgBackRestConfigType = "backup"
	PgBackRestConfigTypeRestore PgBackRestConfigType = "restore"
)

func (PgBackRestConfigType) String

func (t PgBackRestConfigType) String() string

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) Create

func (p *PgBackRestRestore) Create(ctx context.Context, rc *resource.Context) error

func (*PgBackRestRestore) Delete

func (p *PgBackRestRestore) Delete(ctx context.Context, rc *resource.Context) error

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) Refresh

func (p *PgBackRestRestore) Refresh(ctx context.Context, rc *resource.Context) error

func (*PgBackRestRestore) ResourceVersion

func (p *PgBackRestRestore) ResourceVersion() string

func (*PgBackRestRestore) TypeDependencies added in v0.7.0

func (p *PgBackRestRestore) TypeDependencies() []resource.Type

func (*PgBackRestRestore) Update

func (p *PgBackRestRestore) Update(ctx context.Context, rc *resource.Context) error

type PgBackRestStanza

type PgBackRestStanza struct {
	NodeName string `json:"node_name"`
}

func (*PgBackRestStanza) Create

func (p *PgBackRestStanza) Create(ctx context.Context, rc *resource.Context) error

func (*PgBackRestStanza) Delete

func (p *PgBackRestStanza) Delete(ctx context.Context, rc *resource.Context) error

func (*PgBackRestStanza) Dependencies

func (p *PgBackRestStanza) Dependencies() []resource.Identifier

func (*PgBackRestStanza) DiffIgnore

func (p *PgBackRestStanza) DiffIgnore() []string

func (*PgBackRestStanza) Executor

func (p *PgBackRestStanza) Executor() resource.Executor

func (*PgBackRestStanza) Identifier

func (p *PgBackRestStanza) Identifier() resource.Identifier

func (*PgBackRestStanza) Refresh

func (p *PgBackRestStanza) Refresh(ctx context.Context, rc *resource.Context) error

func (*PgBackRestStanza) ResourceVersion

func (p *PgBackRestStanza) ResourceVersion() string

func (*PgBackRestStanza) TypeDependencies added in v0.7.0

func (p *PgBackRestStanza) TypeDependencies() []resource.Type

func (*PgBackRestStanza) Update

func (p *PgBackRestStanza) Update(ctx context.Context, rc *resource.Context) error

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) Create added in v0.8.0

func (*PostgRESTAuthenticatorResource) Delete added in v0.8.0

func (*PostgRESTAuthenticatorResource) Dependencies added in v0.8.0

func (*PostgRESTAuthenticatorResource) DiffIgnore added in v0.8.0

func (r *PostgRESTAuthenticatorResource) DiffIgnore() []string

func (*PostgRESTAuthenticatorResource) Executor added in v0.8.0

func (*PostgRESTAuthenticatorResource) Identifier added in v0.8.0

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

func (*PostgRESTAuthenticatorResource) Update added in v0.8.0

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) Create added in v0.8.0

func (*PostgRESTConfigResource) Delete added in v0.8.0

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 (*PostgRESTConfigResource) Identifier added in v0.8.0

func (*PostgRESTConfigResource) Refresh added in v0.8.0

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

func (*PostgRESTConfigResource) Update added in v0.8.0

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) Create added in v0.8.0

func (*PostgRESTPreflightResource) Delete added in v0.8.0

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 (*PostgRESTPreflightResource) Identifier added in v0.8.0

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

func (*PostgRESTPreflightResource) Update added in v0.8.0

type PostgresCerts

type PostgresCerts struct {
	InstanceID        string   `json:"instance_id"`
	HostID            string   `json:"host_id"`
	InstanceAddresses []string `json:"instance_addresses"`
	ParentID          string   `json:"parent_id"`
	OwnerUID          int      `json:"owner_uid"`
	OwnerGID          int      `json:"owner_gid"`
	CaCert            []byte   `json:"ca_cert"`
	ServerCert        []byte   `json:"server_cert"`
	ServerKey         []byte   `json:"server_key"`
	SuperuserCert     []byte   `json:"superuser_cert"`
	SuperuserKey      []byte   `json:"superuser_key"`
	ReplicationCert   []byte   `json:"replication_cert"`
	ReplicationKey    []byte   `json:"replication_key"`
}

func (*PostgresCerts) Create

func (c *PostgresCerts) Create(ctx context.Context, rc *resource.Context) error

func (*PostgresCerts) Delete

func (c *PostgresCerts) Delete(ctx context.Context, rc *resource.Context) error

func (*PostgresCerts) Dependencies

func (c *PostgresCerts) Dependencies() []resource.Identifier

func (*PostgresCerts) DiffIgnore

func (c *PostgresCerts) DiffIgnore() []string

func (*PostgresCerts) Executor

func (c *PostgresCerts) Executor() resource.Executor

func (*PostgresCerts) Identifier

func (c *PostgresCerts) Identifier() resource.Identifier

func (*PostgresCerts) Refresh

func (c *PostgresCerts) Refresh(ctx context.Context, rc *resource.Context) error

func (*PostgresCerts) ResourceVersion

func (c *PostgresCerts) ResourceVersion() string

func (*PostgresCerts) TypeDependencies added in v0.7.0

func (c *PostgresCerts) TypeDependencies() []resource.Type

func (*PostgresCerts) Update

func (c *PostgresCerts) Update(ctx context.Context, rc *resource.Context) error

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) Create

func (s *PostgresService) Create(ctx context.Context, rc *resource.Context) error

func (*PostgresService) Delete

func (s *PostgresService) Delete(ctx context.Context, rc *resource.Context) error

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) Refresh

func (s *PostgresService) Refresh(ctx context.Context, rc *resource.Context) error

func (*PostgresService) ResourceVersion

func (s *PostgresService) ResourceVersion() string

func (*PostgresService) TypeDependencies added in v0.7.0

func (s *PostgresService) TypeDependencies() []resource.Type

func (*PostgresService) Update

func (s *PostgresService) Update(ctx context.Context, rc *resource.Context) error

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) Create

func (*PostgresServiceSpecResource) Delete

func (*PostgresServiceSpecResource) Dependencies

func (s *PostgresServiceSpecResource) Dependencies() []resource.Identifier

func (*PostgresServiceSpecResource) DiffIgnore

func (s *PostgresServiceSpecResource) DiffIgnore() []string

func (*PostgresServiceSpecResource) Executor

func (*PostgresServiceSpecResource) Identifier

func (*PostgresServiceSpecResource) Refresh

func (*PostgresServiceSpecResource) ResourceVersion

func (s *PostgresServiceSpecResource) ResourceVersion() string

func (*PostgresServiceSpecResource) TypeDependencies added in v0.7.0

func (s *PostgresServiceSpecResource) TypeDependencies() []resource.Type

func (*PostgresServiceSpecResource) Update

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) Create added in v0.8.0

func (r *RAGConfigResource) Create(ctx context.Context, rc *resource.Context) error

func (*RAGConfigResource) Delete added in v0.8.0

func (r *RAGConfigResource) Delete(ctx context.Context, rc *resource.Context) error

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) Refresh added in v0.8.0

func (r *RAGConfigResource) Refresh(ctx context.Context, rc *resource.Context) error

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

func (*RAGConfigResource) Update added in v0.8.0

func (r *RAGConfigResource) Update(ctx context.Context, rc *resource.Context) error

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) Create added in v0.8.0

func (*RAGPreflightResource) Delete added in v0.8.0

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

func (*RAGPreflightResource) Update added in v0.8.0

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) Create added in v0.8.0

func (*RAGServiceKeysResource) Delete added in v0.8.0

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 (*RAGServiceKeysResource) Identifier added in v0.8.0

func (r *RAGServiceKeysResource) Identifier() resource.Identifier

func (*RAGServiceKeysResource) Refresh added in v0.8.0

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

func (*RAGServiceKeysResource) Update added in v0.8.0

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) Create

func (s *ScaleService) Create(ctx context.Context, rc *resource.Context) error

func (*ScaleService) Delete

func (s *ScaleService) Delete(ctx context.Context, rc *resource.Context) error

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) Refresh

func (s *ScaleService) Refresh(ctx context.Context, rc *resource.Context) error

func (*ScaleService) ResourceVersion

func (s *ScaleService) ResourceVersion() string

func (*ScaleService) TypeDependencies added in v0.7.0

func (s *ScaleService) TypeDependencies() []resource.Type

func (*ScaleService) Update

func (s *ScaleService) Update(ctx context.Context, rc *resource.Context) error

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
}

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) Create added in v0.7.0

func (*ServiceInstanceResource) Delete added in v0.7.0

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 (*ServiceInstanceResource) Identifier added in v0.7.0

func (*ServiceInstanceResource) Refresh added in v0.7.0

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

func (*ServiceInstanceResource) Update added in v0.7.0

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
	Spec               swarm.ServiceSpec           `json:"spec"`
}

func (*ServiceInstanceSpecResource) Create added in v0.7.0

func (*ServiceInstanceSpecResource) Delete added in v0.7.0

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 (*ServiceInstanceSpecResource) Identifier added in v0.7.0

func (*ServiceInstanceSpecResource) PostDeploy added in v0.8.0

PostDeploy is called by ServiceInstanceResource after the container is confirmed running. Each service type can trigger any necessary post-start actions here.

func (*ServiceInstanceSpecResource) Refresh added in v0.7.0

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

func (*ServiceInstanceSpecResource) Update added in v0.7.0

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

type Switchover struct {
	HostID     string `json:"host_id"`
	InstanceID string `json:"instance_id"`
}

func (*Switchover) Create

func (s *Switchover) Create(ctx context.Context, rc *resource.Context) error

func (*Switchover) Delete

func (s *Switchover) Delete(ctx context.Context, rc *resource.Context) error

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) Refresh

func (s *Switchover) Refresh(ctx context.Context, rc *resource.Context) error

func (*Switchover) ResourceVersion

func (s *Switchover) ResourceVersion() string

func (*Switchover) TypeDependencies added in v0.7.0

func (s *Switchover) TypeDependencies() []resource.Type

func (*Switchover) Update

func (s *Switchover) Update(ctx context.Context, rc *resource.Context) error

type Versions

type Versions struct {
	// contains filtered or unexported fields
}

func NewVersions

func NewVersions(cfg config.Config) *Versions

func (*Versions) Default

func (v *Versions) Default() *ds.PgEdgeVersion

func (*Versions) GetImages

func (v *Versions) GetImages(version *ds.PgEdgeVersion) (*Images, error)

func (*Versions) Supported

func (v *Versions) Supported() []*ds.PgEdgeVersion

Jump to

Keyboard shortcuts

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