Documentation
¶
Index ¶
- type Hook
- type HookExecutor
- type HookVars
- func (v HookVars) EventName(cond v1.Hook_Condition) string
- func (v HookVars) FormatSizeBytes(val any) string
- func (v HookVars) FormatTime(t time.Time) string
- func (v HookVars) IsError(cond v1.Hook_Condition) bool
- func (v HookVars) JsonMarshal(s any) string
- func (v HookVars) ShellEscape(s string) string
- func (v HookVars) Summary() (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HookExecutor ¶
type HookExecutor struct {
// contains filtered or unexported fields
}
func NewHookExecutor ¶
func NewHookExecutor(oplog *oplog.OpLog, bigOutputStore *rotatinglog.RotatingLog) *HookExecutor
func (*HookExecutor) ExecuteHooks ¶
func (e *HookExecutor) ExecuteHooks(repo *v1.Repo, plan *v1.Plan, snapshotId string, events []v1.Hook_Condition, vars HookVars)
ExecuteHooks schedules tasks for the hooks subscribed to the given event. The vars map is used to substitute variables Hooks are pulled both from the provided plan and from the repo config.
type HookVars ¶
type HookVars struct {
Task string // the name of the task that triggered the hook.
Event v1.Hook_Condition // the event that triggered the hook.
Repo *v1.Repo // the v1.Repo that triggered the hook.
Plan *v1.Plan // the v1.Plan that triggered the hook.
SnapshotId string // the snapshot ID that triggered the hook.
SnapshotStats *restic.BackupProgressEntry // the summary of the backup operation.
CurTime time.Time // the current time as time.Time
Error string // the error that caused the hook to run as a string.
}
HookVars is the set of variables that are available to a hook. Some of these are optional. NOTE: names of HookVars may change between versions of backrest. This is not a guaranteed stable API. when names change hooks will require updating.
func (HookVars) FormatSizeBytes ¶
func (HookVars) JsonMarshal ¶
func (HookVars) ShellEscape ¶
Click to show internal directories.
Click to hide internal directories.