activities

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const ErrTypeBackupFailed = "backup_failed"

ErrTypeBackupFailed marks a failed (but retryable) backup activity; the error carries temporal.BackupFailureDetails for the workflow.

View Source
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)
	// LogTail returns the agent's recent log output, attached to failures
	LogTail func() string
}

AgentActivities provides activities executed on the client backup agent host

func NewAgentActivities

func NewAgentActivities() *AgentActivities

NewAgentActivities creates a new AgentActivities instance

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.

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)
	// 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
}

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
	// 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
	VolumeTicket func(ctx context.Context, sessionTicket, volumeBackupID string) (string, error)
	// WorkerToken mints a short-lived agent bearer for worker pods
	WorkerToken func(ctx context.Context, sessionTicket string) (string, time.Time, error)
	// 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

	// 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

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

func (*ServerActivities) PruneJob

func (s *ServerActivities) PruneJob(ctx context.Context, session *temporal.BackupSessionInfo) error

PruneJob executes the retention policy prune on the target Proxmox Backup Server

func (*ServerActivities) PruneKubernetesJob added in v0.7.2

func (s *ServerActivities) PruneKubernetesJob(ctx context.Context, session *temporal.BackupSessionInfo, activeGroups []string) error

PruneKubernetesJob applies the job's retention policy to every PBS group a kubernetes cluster writes: the resources group and each k8s-<cluster>-pvc-* group — including groups of PVCs deleted since earlier runs, which would otherwise never be pruned. activeGroups are the groups touched by this run; orphaned volume groups can additionally be forgotten entirely after volumes.forget_orphans_after_days.

Jump to

Keyboard shortcuts

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