Documentation
¶
Index ¶
- Constants
- Variables
- func InstallWantedByOption(value ...string) *unit.UnitOption
- func InstalledPostgresCmp(a, b *InstalledPostgres) int
- func PackageCmp(a, b *InstalledPackage) int
- func PatroniConfigIdentifier(instanceID string) resource.Identifier
- func PatroniUnitOptions(paths database.InstancePaths, pgBinPath string, cpus float64, ...) []*unit.UnitOption
- func PgBackRestRestoreResourceIdentifier(instanceID string) resource.Identifier
- func Provide(i *do.Injector)
- func RegisterResourceTypes(registry *resource.Registry)
- func ServiceCPUQuotaOption(cpus float64) *unit.UnitOption
- func ServiceEnvironmentOption(name, value string) *unit.UnitOption
- func ServiceExecReloadOption(value string) *unit.UnitOption
- func ServiceExecStartOption(value string) *unit.UnitOption
- func ServiceKillModeOption(value ServiceKillMode) *unit.UnitOption
- func ServiceMemoryMaxOption(memoryBytes uint64) *unit.UnitOption
- func ServiceRestartOption(value ServiceRestart) *unit.UnitOption
- func ServiceTimeoutSecOption(value int) *unit.UnitOption
- func ServiceTypeOption(value ServiceType) *unit.UnitOption
- func ServiceUserOption(value string) *unit.UnitOption
- func UnitAfterOption(values ...string) *unit.UnitOption
- func UnitResourceIdentifier(name, databaseID, hostID string) resource.Identifier
- type Client
- func (c *Client) DisableUnit(ctx context.Context, path string) error
- func (c *Client) EnableUnit(ctx context.Context, name string) error
- func (c *Client) GetMainPID(ctx context.Context, name string) (int, error)
- func (c *Client) Reload(ctx context.Context) error
- func (c *Client) ReloadOrRestartUnit(ctx context.Context, name string) error
- func (c *Client) ReloadUnit(ctx context.Context, name string) error
- func (c *Client) Shutdown() error
- func (c *Client) Start(ctx context.Context) error
- func (c *Client) StartUnit(ctx context.Context, name string) error
- func (c *Client) StopUnit(ctx context.Context, name string, wait bool) error
- func (c *Client) UnitExists(ctx context.Context, name string) error
- type Dnf
- type InstallSection
- type InstalledPackage
- type InstalledPostgres
- type Orchestrator
- 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) 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(pgVersion *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, h *host.HostStatus) error
- func (o *Orchestrator) Start(ctx 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(_ context.Context, changes []*database.InstanceSpecChange) ([]*database.ValidationResult, error)
- func (o *Orchestrator) WorkerQueues() ([]workflow.Queue, error)
- type PackageManager
- 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 (c *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 ServiceKillMode
- type ServiceRestart
- type ServiceSection
- type ServiceType
- type UnitFile
- type UnitResource
- func (r *UnitResource) Create(ctx context.Context, rc *resource.Context) error
- func (r *UnitResource) Delete(ctx context.Context, rc *resource.Context) error
- func (r *UnitResource) Dependencies() []resource.Identifier
- func (r *UnitResource) DiffIgnore() []string
- func (r *UnitResource) Executor() resource.Executor
- func (r *UnitResource) Identifier() resource.Identifier
- func (r *UnitResource) Refresh(ctx context.Context, rc *resource.Context) error
- func (r *UnitResource) ResourceVersion() string
- func (r *UnitResource) TypeDependencies() []resource.Type
- func (r *UnitResource) Update(ctx context.Context, rc *resource.Context) error
- type UnitSection
Constants ¶
View Source
const ResourceTypePatroniConfig resource.Type = "systemd.patroni_config"
View Source
const ResourceTypePgBackRestRestore resource.Type = "systemd.pgbackrest_restore"
View Source
const ResourceTypeUnit resource.Type = "systemd.unit"
Variables ¶
View Source
var ErrUnitNotFound = errors.New("unit does not exist")
Functions ¶
func InstallWantedByOption ¶
func InstallWantedByOption(value ...string) *unit.UnitOption
func InstalledPostgresCmp ¶
func InstalledPostgresCmp(a, b *InstalledPostgres) int
func PackageCmp ¶
func PackageCmp(a, b *InstalledPackage) int
func PatroniConfigIdentifier ¶
func PatroniConfigIdentifier(instanceID string) resource.Identifier
func PatroniUnitOptions ¶
func PatroniUnitOptions( paths database.InstancePaths, pgBinPath string, cpus float64, memoryBytes uint64, ) []*unit.UnitOption
func PgBackRestRestoreResourceIdentifier ¶
func PgBackRestRestoreResourceIdentifier(instanceID string) resource.Identifier
func RegisterResourceTypes ¶
func ServiceCPUQuotaOption ¶
func ServiceCPUQuotaOption(cpus float64) *unit.UnitOption
func ServiceEnvironmentOption ¶
func ServiceEnvironmentOption(name, value string) *unit.UnitOption
func ServiceExecReloadOption ¶
func ServiceExecReloadOption(value string) *unit.UnitOption
func ServiceExecStartOption ¶
func ServiceExecStartOption(value string) *unit.UnitOption
func ServiceKillModeOption ¶
func ServiceKillModeOption(value ServiceKillMode) *unit.UnitOption
func ServiceMemoryMaxOption ¶
func ServiceMemoryMaxOption(memoryBytes uint64) *unit.UnitOption
func ServiceRestartOption ¶
func ServiceRestartOption(value ServiceRestart) *unit.UnitOption
func ServiceTimeoutSecOption ¶
func ServiceTimeoutSecOption(value int) *unit.UnitOption
func ServiceTypeOption ¶
func ServiceTypeOption(value ServiceType) *unit.UnitOption
func ServiceUserOption ¶
func ServiceUserOption(value string) *unit.UnitOption
func UnitAfterOption ¶
func UnitAfterOption(values ...string) *unit.UnitOption
func UnitResourceIdentifier ¶
func UnitResourceIdentifier(name, databaseID, hostID string) resource.Identifier
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetMainPID ¶
func (*Client) ReloadOrRestartUnit ¶
type Dnf ¶
type Dnf struct{}
func (*Dnf) InstalledPostgresVersions ¶
func (d *Dnf) InstalledPostgresVersions(ctx context.Context) ([]*InstalledPostgres, error)
func (*Dnf) InstanceDataBaseDir ¶
type InstallSection ¶
type InstallSection struct {
WantedBy []string
}
func (InstallSection) Options ¶
func (s InstallSection) Options() []*unit.UnitOption
type InstalledPackage ¶
func InstalledPostgresPackage ¶
func InstalledPostgresPackage(pkg, ver string) (*InstalledPackage, error)
func InstalledSpockPackage ¶
func InstalledSpockPackage(pkg, ver string) (*InstalledPackage, error)
type InstalledPostgres ¶
type InstalledPostgres struct {
Postgres *InstalledPackage
Spock []*InstalledPackage
}
type Orchestrator ¶
type Orchestrator struct {
// contains filtered or unexported fields
}
func NewOrchestrator ¶
func NewOrchestrator( cfg config.Config, loggerFactory *logging.Factory, client *Client, packageManager PackageManager, ) (*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 ¶
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 ¶
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 ¶
func (o *Orchestrator) GetServiceInstanceStatus(ctx context.Context, serviceInstanceID string) (*database.ServiceInstanceStatus, error)
func (*Orchestrator) InstancePaths ¶
func (o *Orchestrator) InstancePaths(pgVersion *ds.Version, instanceID string) (database.InstancePaths, error)
func (*Orchestrator) PopulateHost ¶
func (*Orchestrator) PopulateHostStatus ¶
func (o *Orchestrator) PopulateHostStatus(ctx context.Context, h *host.HostStatus) 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(_ context.Context, changes []*database.InstanceSpecChange) ([]*database.ValidationResult, error)
func (*Orchestrator) WorkerQueues ¶
func (o *Orchestrator) WorkerQueues() ([]workflow.Queue, error)
type PackageManager ¶
type PatroniConfig ¶
type PatroniConfig struct {
DatabaseID string `json:"database_id"`
Base *common.PatroniConfig `json:"base"`
AllHostIDs []string `json:"all_host_ids"`
}
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 ¶
func (c *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"`
Paths database.InstancePaths `json:"paths"`
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 ¶
func (p *PgBackRestRestore) TypeDependencies() []resource.Type
type ServiceKillMode ¶
type ServiceKillMode string
const ( ServiceKillModeControlGroup ServiceKillMode = "control-group" ServiceKillModeMixed ServiceKillMode = "mixed" ServiceKillModeProcess ServiceKillMode = "process" ServiceKillModeNone ServiceKillMode = "none" )
func (ServiceKillMode) String ¶
func (s ServiceKillMode) String() string
type ServiceRestart ¶
type ServiceRestart string
const ( ServiceRestartNo ServiceRestart = "no" ServiceRestartAlways ServiceRestart = "always" ServiceRestartOnSuccess ServiceRestart = "on-success" ServiceRestartOnFailure ServiceRestart = "on-failure" ServiceRestartOnAbnormal ServiceRestart = "on-abnormal" ServiceRestartOnAbort ServiceRestart = "on-abort" ServiceRestartOnWatchdog ServiceRestart = "on-watchdog" )
func (ServiceRestart) String ¶
func (s ServiceRestart) String() string
type ServiceSection ¶
type ServiceSection struct {
Type ServiceType
User string
ExecStart string
ExecReload string
KillMode ServiceKillMode
TimeoutSec int
CPUs float64
MemoryBytes uint64
Restart ServiceRestart
Environment map[string]string
}
func (ServiceSection) Options ¶
func (s ServiceSection) Options() []*unit.UnitOption
type ServiceType ¶
type ServiceType string
const ( ServiceTypeSimple ServiceType = "simple" ServiceTypeExec ServiceType = "exec" ServiceTypeForking ServiceType = "forking" ServiceTypeOneShot ServiceType = "oneshot" ServiceTypeNotify ServiceType = "notify" ServiceTypeDBus ServiceType = "dbus" ServiceTypeIdle ServiceType = "idle" ServiceTypeNotifyReload ServiceType = "notify-reload" )
func (ServiceType) String ¶
func (s ServiceType) String() string
type UnitFile ¶
type UnitFile struct {
Unit UnitSection
Service ServiceSection
Install InstallSection
}
func (UnitFile) Options ¶
func (f UnitFile) Options() []*unit.UnitOption
type UnitResource ¶
type UnitResource struct {
DatabaseID string `json:"database_id"`
HostID string `json:"host_id"`
Name string `json:"name"`
Options []*unit.UnitOption `json:"options"`
ExtraDependencies []resource.Identifier `json:"extra_dependencies"`
}
func (*UnitResource) Dependencies ¶
func (r *UnitResource) Dependencies() []resource.Identifier
func (*UnitResource) DiffIgnore ¶
func (r *UnitResource) DiffIgnore() []string
func (*UnitResource) Executor ¶
func (r *UnitResource) Executor() resource.Executor
func (*UnitResource) Identifier ¶
func (r *UnitResource) Identifier() resource.Identifier
func (*UnitResource) ResourceVersion ¶
func (r *UnitResource) ResourceVersion() string
func (*UnitResource) TypeDependencies ¶
func (r *UnitResource) TypeDependencies() []resource.Type
type UnitSection ¶
type UnitSection struct {
After []string
}
func (UnitSection) Options ¶
func (u UnitSection) Options() []*unit.UnitOption
Click to show internal directories.
Click to hide internal directories.