Documentation
¶
Index ¶
- Constants
- type AgentActivities
- func (a *AgentActivities) ExecuteDockerBackup(ctx context.Context, session *temporal.BackupSessionInfo) (*temporal.BackupExecutionResult, error)
- func (a *AgentActivities) ExecuteFilesystemBackup(ctx context.Context, session *temporal.BackupSessionInfo) (*temporal.BackupExecutionResult, error)
- func (a *AgentActivities) ExecutePVEBackup(ctx context.Context, session *temporal.BackupSessionInfo) (*temporal.BackupExecutionResult, error)
- type DBAgentActivities
- type K8sAgentActivities
- func (a *K8sAgentActivities) BackupKubernetesResources(ctx context.Context, session *temporal.BackupSessionInfo, plan *spec.Plan, ...) (*temporal.BackupExecutionResult, error)
- func (a *K8sAgentActivities) BackupKubernetesVolume(ctx context.Context, session *temporal.BackupSessionInfo, plan spec.VolumePlan) (*spec.VolumeResult, error)
- func (a *K8sAgentActivities) DiscoverKubernetesBackup(ctx context.Context, session *temporal.BackupSessionInfo) (*spec.Plan, error)
- func (a *K8sAgentActivities) ExecuteKubernetesDatabaseBackup(ctx context.Context, session *temporal.BackupSessionInfo) (*temporal.BackupExecutionResult, error)
- type ProgressFunc
- type RunTracker
- type ServerActivities
- type TicketRefreshFunc
Constants ¶
const ErrTypeBackupFailed = "backup_failed"
ErrTypeBackupFailed marks a failed (but retryable) backup activity; the error carries temporal.BackupFailureDetails for the workflow.
const ErrTypeDBPrecheckFailed = "db_precheck_failed"
ErrTypeDBPrecheckFailed marks configuration/precheck failures of database backups; the workflow does not retry them.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentActivities ¶
type AgentActivities struct {
// Tunnel is the agent's gRPC connection to the FallBCK server (carrying its bearer
// token); PBS backup sessions are opened through it.
Tunnel grpc.ClientConnInterface
// Workers bounds concurrent chunk uploads (0 = default)
Workers int
// Credentials fetches PBS connection details for jobs in direct mode
// (GET /api/v1/agents/pbs-credentials with the run's ticket)
Credentials func(ctx context.Context, ticket string) (*backup.DirectOptions, error)
// RefreshTicket re-issues the run's ticket with a fresh snapshot timestamp for
// retries (POST /api/v1/agents/ticket/refresh); nil keeps the session's timestamp
RefreshTicket TicketRefreshFunc
// LogTail returns the agent's recent log output, attached to failures
LogTail func() string
// ReportProgress posts live phase updates to the server (best-effort)
ReportProgress ProgressFunc
// SpoolDir stages collected data for Proxmox VE and Docker host backups (<data dir>/spool)
SpoolDir string
// Docker is the agent's docker_backup settings block (socket, volume access, helper image)
Docker dockerspec.Config
// CacheDir holds the per-group metadata caches for change detection
// (<data dir>/pxar-cache); empty disables change detection
CacheDir string
// VSSDir enables Volume Shadow Copies on Windows: paths are read through
// shadow copies linked under this directory; empty reads the live filesystem
VSSDir string
Hostname string
Version string
}
AgentActivities provides activities executed on the client backup agent host
func NewAgentActivities ¶
func NewAgentActivities() *AgentActivities
NewAgentActivities creates a new AgentActivities instance
func (*AgentActivities) ExecuteDockerBackup ¶ added in v0.9.11
func (a *AgentActivities) ExecuteDockerBackup(ctx context.Context, session *temporal.BackupSessionInfo) (*temporal.BackupExecutionResult, error)
ExecuteDockerBackup backs up the Docker host this agent runs on: container, network, volume and image definitions, compose files and the daemon configuration (collect/) plus every named volume (vol-<name>) go into one docker.pxar archive.
func (*AgentActivities) ExecuteFilesystemBackup ¶
func (a *AgentActivities) ExecuteFilesystemBackup(ctx context.Context, session *temporal.BackupSessionInfo) (*temporal.BackupExecutionResult, error)
ExecuteFilesystemBackup performs the filesystem backup on the agent host, streaming into PBS through the server-side tunnel.
func (*AgentActivities) ExecutePVEBackup ¶ added in v0.9.5
func (a *AgentActivities) ExecutePVEBackup(ctx context.Context, session *temporal.BackupSessionInfo) (*temporal.BackupExecutionResult, error)
ExecutePVEBackup backs up the Proxmox VE host this agent runs on: the collected inventory (/etc/pve copy, package lists, storage/network/disk definitions, restore runbook), /etc, /root and the job's data paths go into one pve.pxar archive.
type DBAgentActivities ¶ added in v0.6.0
type DBAgentActivities struct {
// Tunnel is the agent's gRPC connection to the FallBCK server (PBS sessions)
Tunnel grpc.ClientConnInterface
// Workers bounds concurrent chunk uploads (0 = default)
Workers int
// Credentials fetches PBS connection details for jobs in direct mode
Credentials func(ctx context.Context, ticket string) (*backup.DirectOptions, error)
// DBPassword fetches the server-stored database password for a run
DBPassword func(ctx context.Context, ticket string) (string, error)
// RefreshTicket re-issues the run's ticket with a fresh snapshot timestamp for
// retries; nil keeps the session's timestamp
RefreshTicket TicketRefreshFunc
// Config is the agent's db_backup configuration (defaults applied)
Config dbbackup.Config
Hostname string
Version string
// LogTail returns the agent's recent log output, attached to failures
LogTail func() string
// ReportProgress posts live phase updates to the server (best-effort)
ReportProgress ProgressFunc
}
DBAgentActivities are the activities of fallbck-db-agent
func NewDBAgentActivities ¶ added in v0.6.0
func NewDBAgentActivities() *DBAgentActivities
NewDBAgentActivities creates a new DBAgentActivities instance
func (*DBAgentActivities) ExecuteDatabaseBackup ¶ added in v0.6.0
func (a *DBAgentActivities) ExecuteDatabaseBackup(ctx context.Context, session *temporal.BackupSessionInfo) (*temporal.BackupExecutionResult, error)
ExecuteDatabaseBackup dumps the job's databases into the spool directory and uploads the result to PBS (through the server tunnel or directly).
type K8sAgentActivities ¶ added in v0.7.2
type K8sAgentActivities struct {
// Tunnel is the agent's gRPC connection to the FallBCK server (resources upload)
Tunnel grpc.ClientConnInterface
// Clients are the in-cluster API clients
Clients *k8sagent.Clients
// Config supplies the server URL / TLS settings handed to worker pods
Config *config.AgentConfig
ClusterName string
// AgentNamespace is the namespace the agent pod runs in
AgentNamespace string
Version string
// Worker pod parameters (from the Helm chart)
WorkerImage string
WorkerImagePullPolicy string
WorkerResourcesJSON string
WorkerSecurityContextJSON string
// WorkerMaxProcs bounds gopbs concurrency (GOMAXPROCS) inside worker pods; 0 = 2
WorkerMaxProcs int
// Credentials fetches PBS connection details for jobs in direct mode
Credentials func(ctx context.Context, ticket string) (*backup.DirectOptions, error)
// VolumeTicket mints a per-volume backup ticket from the session ticket; the
// returned snapshot timestamp is the one embedded in the ticket (fresh per attempt)
VolumeTicket func(ctx context.Context, sessionTicket, volumeBackupID string) (ticket string, backupTime int64, err error)
// WorkerToken mints a short-lived agent bearer for worker pods
WorkerToken func(ctx context.Context, sessionTicket string) (string, time.Time, error)
// RefreshTicket re-issues the session ticket with a fresh snapshot timestamp when
// the resources upload is retried; nil keeps the session's timestamp
RefreshTicket TicketRefreshFunc
// Database jobs assigned to this agent (dump pods): DBPassword fetches the job's
// server-stored password; the per-engine image templates, pod resources/security
// context and spool size come from the Helm chart; StateSecretName holds the
// per-job chain state in the agent namespace
DBPassword func(ctx context.Context, ticket string) (string, error)
DBWorkerImages map[string]string
DBWorkerResourcesJSON string
DBWorkerSecurityContextJSON string
DBWorkerSpoolSize string
StateSecretName string
// SpoolDir stages the resource dump (default <data dir>/spool)
SpoolDir string
// LogTail returns the agent's recent log output, attached to failures
LogTail func() string
// ReportProgress posts live phase / per-PVC updates to the server (best-effort)
ReportProgress ProgressFunc
// Runs tracks in-flight run ids for the orphan sweep. It lives in a named field:
// worker.RegisterActivity(struct) validates every exported *method* of the struct,
// so helpers must not be methods on K8sAgentActivities.
Runs *RunTracker
// contains filtered or unexported fields
}
K8sAgentActivities are the activities of fallbck-k8s-agent
func NewK8sAgentActivities ¶ added in v0.7.2
func NewK8sAgentActivities() *K8sAgentActivities
NewK8sAgentActivities creates a new K8sAgentActivities instance
func (*K8sAgentActivities) BackupKubernetesResources ¶ added in v0.7.2
func (a *K8sAgentActivities) BackupKubernetesResources(ctx context.Context, session *temporal.BackupSessionInfo, plan *spec.Plan, volumes []spec.VolumeResult) (*temporal.BackupExecutionResult, error)
BackupKubernetesResources dumps every selected API resource and uploads it together with the run manifest (which embeds the per-volume outcomes; it runs last).
func (*K8sAgentActivities) BackupKubernetesVolume ¶ added in v0.7.2
func (a *K8sAgentActivities) BackupKubernetesVolume(ctx context.Context, session *temporal.BackupSessionInfo, plan spec.VolumePlan) (*spec.VolumeResult, error)
BackupKubernetesVolume snapshots/mounts one PVC and uploads it from a worker pod
func (*K8sAgentActivities) DiscoverKubernetesBackup ¶ added in v0.7.2
func (a *K8sAgentActivities) DiscoverKubernetesBackup(ctx context.Context, session *temporal.BackupSessionInfo) (*spec.Plan, error)
DiscoverKubernetesBackup plans the run: which volumes, snapshot or live per volume
func (*K8sAgentActivities) ExecuteKubernetesDatabaseBackup ¶ added in v0.9.5
func (a *K8sAgentActivities) ExecuteKubernetesDatabaseBackup(ctx context.Context, session *temporal.BackupSessionInfo) (*temporal.BackupExecutionResult, error)
ExecuteKubernetesDatabaseBackup runs a database job assigned to this kubernetes agent: the database is dumped from a short-lived pod in its namespace (engine image with the client tools, this agent's binary injected) and uploaded to PBS from there.
type ProgressFunc ¶ added in v0.9.0
type ProgressFunc func(ctx context.Context, ticket string, runID uuid.UUID, phase string, items map[string]rundetail.ProgressItem) error
ProgressFunc posts live run progress (phase and/or per-item statuses) to the server.
type RunTracker ¶ added in v0.7.2
type RunTracker struct {
// contains filtered or unexported fields
}
RunTracker counts in-flight backup runs (consulted by the orphan sweep)
func (*RunTracker) Active ¶ added in v0.7.2
func (t *RunTracker) Active(runID string) bool
Active reports whether a run currently executes on this agent
type ServerActivities ¶
type ServerActivities struct {
DB *db.DB
Config *config.ServerConfig
TokenManager *auth.TokenManager
}
ServerActivities provides activities executed on the central FallBCK server
func NewServerActivities ¶
func NewServerActivities(database *db.DB, cfg *config.ServerConfig, tm *auth.TokenManager) *ServerActivities
NewServerActivities creates a new ServerActivities instance
func (*ServerActivities) FinalizeBackupRun ¶
func (s *ServerActivities) FinalizeBackupRun(ctx context.Context, session *temporal.BackupSessionInfo, result *temporal.BackupExecutionResult) error
FinalizeBackupRun updates the backup run record in the database with results and deduplication metrics
func (*ServerActivities) PrepareBackupSession ¶
func (s *ServerActivities) PrepareBackupSession(ctx context.Context, jobID uuid.UUID) (*temporal.BackupSessionInfo, error)
PrepareBackupSession validates job parameters and generates a short-lived backup ticket