Documentation
¶
Index ¶
- type AWSCredentialsBody
- type BackupRequest
- type BackupResponse
- type CreateRDBMSRequest
- type CronPlanRequest
- type CronTaskTracker
- type ErrorResponse
- type HealthHistory
- type HealthRecord
- type HealthScheduler
- type HealthStatus
- type KVPair
- type KVSetRequest
- type PullImageRequest
- type ReconfigureRequest
- type RestoreRequest
- type RestoreResponse
- type Server
- type SnapshotArchiveSource
- type SnapshotCronRequest
- type SnapshotRestoreDatabaseRequest
- type SnapshotRestoreInstanceRequest
- type SwitchRequest
- type UpdateRequest
- type UpdateStateRequest
- type UpgradeRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AWSCredentialsBody ¶ added in v0.1.65
type AWSCredentialsBody struct {
AccessKeyID string `json:"accessKeyId"`
SecretAccessKey string `json:"secretAccessKey"`
// SessionToken is required for STS/SSO-derived credentials (an instance
// role resolved on the client, an assumed role, an SSO session) — they do
// not authenticate without it.
SessionToken string `json:"sessionToken,omitempty"`
// Source is the chain rung that produced the triple (e.g.
// "EnvConfigCredentials"), for the daemon's log line only.
Source string `json:"source,omitempty"`
}
AWSCredentialsBody carries CLIENT-resolved static AWS credentials for a one-shot S3 fetch. Precedent for secrets in a request body: PUT /api/offsite/config has always carried secretAccessKey the same way, over the same loopback-by-default channel.
NEVER log this struct, its enclosing request, or a resolved aws.Credentials value. The daemon uses the triple only to build an in-memory S3 client; nothing persists it.
type BackupRequest ¶
type BackupRequest struct {
Comment string `json:"comment,omitempty"`
}
type BackupResponse ¶
type CreateRDBMSRequest ¶
type CreateRDBMSRequest struct {
Name string `json:"name"`
Version string `json:"version"`
Image string `json:"image"`
Port int `json:"port"`
CPUCores int `json:"cpuCores"`
RAMMB int `json:"ramMb"`
ParameterGroup string `json:"parameterGroup"`
}
Request/Response types for RDBMS operations
type CronPlanRequest ¶
type CronTaskTracker ¶
type CronTaskTracker struct {
// contains filtered or unexported fields
}
CronTaskTracker manages sequential execution of cron tasks
func NewCronTaskTracker ¶
func NewCronTaskTracker(opDeps *operations.Dependencies, executor *operations.Executor, backupDir string) *CronTaskTracker
NewCronTaskTracker creates a new cron task tracker
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
ErrorResponse represents an API error response
type HealthHistory ¶
type HealthHistory struct {
Records []*HealthRecord `json:"records"`
Timestamp string `json:"timestamp"`
}
HealthHistory represents the health history response
type HealthRecord ¶
type HealthRecord struct {
ID int64 `json:"id"`
Timestamp string `json:"timestamp"`
TimestampUnix int64 `json:"timestampUnix"`
InProgress bool `json:"inProgress"`
HealthyAll bool `json:"healthyAll"`
HealthyHost bool `json:"healthyHost"`
HealthyInstances []string `json:"healthyInstances"`
BrokenInstances []string `json:"brokenInstances"`
FailDetails string `json:"failDetails"`
}
HealthRecord represents a single health check record for API response
type HealthScheduler ¶
type HealthScheduler struct {
// contains filtered or unexported fields
}
HealthScheduler manages the health check scheduling with process mutex
func NewHealthScheduler ¶
func NewHealthScheduler(healthChecker *services.HealthChecker, intervalSec int) *HealthScheduler
func (*HealthScheduler) IsRunning ¶
func (hs *HealthScheduler) IsRunning() bool
IsRunning returns whether a health check is currently running
func (*HealthScheduler) Pause ¶
func (hs *HealthScheduler) Pause()
Pause pauses health checks (new ones won't start)
func (*HealthScheduler) Start ¶
func (hs *HealthScheduler) Start(ctx context.Context)
func (*HealthScheduler) Unpause ¶
func (hs *HealthScheduler) Unpause()
Unpause resumes health checks
func (*HealthScheduler) WaitForCompletion ¶
func (hs *HealthScheduler) WaitForCompletion(timeout time.Duration) bool
WaitForCompletion waits for any running health check to complete
type HealthStatus ¶
type HealthStatus struct {
Overall string `json:"overall"` // "healthy", "degraded", "unhealthy"
LastCheck *HealthRecord `json:"lastCheck"`
CheckRunning bool `json:"checkRunning"`
Timestamp string `json:"timestamp"`
}
HealthStatus represents the detailed health status response
type KVPair ¶
type KVPair struct {
Key string `json:"key"`
Value string `json:"value"`
UpdatedAt string `json:"updatedAt"`
}
KVPair represents a key-value pair for API responses
type KVSetRequest ¶
KVSetRequest represents the request body for setting a key-value pair
type PullImageRequest ¶
type PullImageRequest struct {
Version string `json:"version"`
Image string `json:"image"`
// IfMissing pulls only when the image is not already present locally.
IfMissing bool `json:"ifMissing"`
}
Request types for image operations
type ReconfigureRequest ¶
type ReconfigureRequest struct {
ParameterGroup string `json:"parameterGroup,omitempty"`
CPUCores *int `json:"cpuCores,omitempty"`
RAMMB *int `json:"ramMb,omitempty"`
Port *int `json:"port,omitempty"`
}
ReconfigureRequest is the body of PUT /api/rdbms/{name}/config. Every field is optional and an absent one keeps the instance's current value; at least one must be present.
type RestoreRequest ¶
type RestoreRequest struct {
BackupID int `json:"backupId,omitempty"`
FilePath string `json:"filePath,omitempty"`
DatabaseName string `json:"databaseName"`
RestoreAs string `json:"restoreAs,omitempty"`
}
RestoreRequest represents the request body for restore
type RestoreResponse ¶
type RestoreResponse struct {
TargetDatabase string `json:"targetDatabase"`
SourceBackup string `json:"sourceBackup"`
Message string `json:"message"`
}
RestoreResponse represents the response from restore
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) MintToken ¶
MintToken creates a new CLI auth token and returns its plaintext. The daemon does not mint tokens on its own (see NewServer); this is the programmatic equivalent of `oddk auth mint`, used by tests to obtain a usable token.
func (*Server) Shutdown ¶
Shutdown gracefully shuts down the server.
ORDER MATTERS, and it is not the obvious one. Scheduled operations inherit the background context cancelled by s.cancel, so cancelling first would abort the very operation this is supposed to protect — a half-aborted pg_restore or container-create is precisely the debris the uninterruptible-operations design exists to prevent. So: stop accepting work, wait for what is running, and only then cancel.
If ctx expires first, the in-flight operation is abandoned and the caller gets ctx.Err(); the next daemon start reconciles whatever it left behind.
type SnapshotArchiveSource ¶ added in v0.1.93
type SnapshotArchiveSource struct {
// FilePath is a path on the DAEMON's filesystem (the original form).
FilePath string `json:"filePath,omitempty"`
// SnapshotID names a row in this host's snapshot catalogue; the daemon
// downloads it from S3 first (via offsite settings) if the local copy is
// gone.
SnapshotID int `json:"snapshotId,omitempty"`
// S3URI names an s3://bucket/key archive, possibly from another
// deployment. Region, Endpoint and Credentials apply only to this mode.
S3URI string `json:"s3Uri,omitempty"`
Region string `json:"region,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
Credentials *AWSCredentialsBody `json:"credentials,omitempty"`
// MasterKeyPath is the SOURCE host's master.key, needed only when the
// snapshot came from a different deployment. Empty means this host's key.
MasterKeyPath string `json:"masterKeyPath,omitempty"`
}
SnapshotArchiveSource selects the archive a snapshot restore reads, shared by restore-instance and restore-database. Exactly one of FilePath, SnapshotID or S3URI must be set.
type SnapshotCronRequest ¶ added in v0.1.59
type SnapshotCronRequest struct {
UTCHour int `json:"utcHour"`
IntervalHours int `json:"intervalHours"`
CleanupLocalDays int `json:"cleanupLocalDays"`
CleanupRemoteDays int `json:"cleanupRemoteDays"`
// Format is "physical" or "logical". Empty follows the merge rule below:
// an existing plan keeps its format, a new plan defaults to physical.
Format string `json:"format,omitempty"`
}
SnapshotCronRequest is the body of POST /api/cron/snapshot.
type SnapshotRestoreDatabaseRequest ¶ added in v0.1.93
type SnapshotRestoreDatabaseRequest struct {
Instance string `json:"instance"`
// FromInstance is the snapshot entry to read; empty means Instance.
FromInstance string `json:"fromInstance,omitempty"`
Database string `json:"database"`
RestoreAs string `json:"restoreAs,omitempty"`
SnapshotArchiveSource
}
SnapshotRestoreDatabaseRequest is the body of POST /api/snapshot/restore-database.
type SnapshotRestoreInstanceRequest ¶ added in v0.1.59
type SnapshotRestoreInstanceRequest struct {
Instance string `json:"instance"`
SnapshotArchiveSource
}
SnapshotRestoreInstanceRequest is the body of POST /api/snapshot/restore-instance.
type SwitchRequest ¶
type UpdateRequest ¶
type UpdateRequest struct {
Image string `json:"image"`
}
UpdateRequest is the body for POST /api/rdbms/{name}/update. Image is optional (defaults to the instance's current image).
type UpdateStateRequest ¶
type UpdateStateRequest struct {
State string `json:"state"`
}
type UpgradeRequest ¶
Source Files
¶
- backup_deprecation_stub.go
- cron_scheduler.go
- cron_tasks.go
- handlers_backup.go
- handlers_checklist.go
- handlers_cron.go
- handlers_customkv.go
- handlers_database.go
- handlers_health.go
- handlers_image.go
- handlers_notification.go
- handlers_offsite.go
- handlers_parameters.go
- handlers_password.go
- handlers_rdbms.go
- handlers_restore.go
- handlers_snapshot.go
- health_scheduler.go
- log_retention.go
- paused_schedule_reminder.go
- reconcile.go
- reencrypt.go
- router.go
- router_debug_stub.go
- server.go
- utils.go