Documentation ¶
Index ¶
- type Hook
- type HookErrorFatal
- type HookErrorRequestCancel
- type HookExecutor
- type HookVars
- func (v HookVars) EventName(cond v1.Hook_Condition) string
- func (v HookVars) FormatDuration(d time.Duration) 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 HookErrorFatal ¶ added in v0.17.0
type HookErrorFatal struct {
Err error
}
HookErrorFatal stops evaluation of subsequent hooks and will propagate to the hook flow's caller
func (HookErrorFatal) Error ¶ added in v0.17.0
func (e HookErrorFatal) Error() string
func (HookErrorFatal) Unwrap ¶ added in v0.17.0
func (e HookErrorFatal) Unwrap() error
type HookErrorRequestCancel ¶ added in v0.17.0
type HookErrorRequestCancel struct {
Err error
}
HookErrorCancel requests that the calling operation cancel itself. It must be handled explicitly caller. Subsequent hooks will be skipped.
func (HookErrorRequestCancel) Error ¶ added in v0.17.0
func (e HookErrorRequestCancel) Error() string
func (HookErrorRequestCancel) Unwrap ¶ added in v0.17.0
func (e HookErrorRequestCancel) Unwrap() error
type HookExecutor ¶
type HookExecutor struct {
// contains filtered or unexported fields
}
func NewHookExecutor ¶
func NewHookExecutor(config *v1.Config, oplog *oplog.OpLog, bigOutputStore *rotatinglog.RotatingLog) *HookExecutor
func (*HookExecutor) ExecuteHooks ¶
func (e *HookExecutor) ExecuteHooks(flowID int64, repo *v1.Repo, plan *v1.Plan, events []v1.Hook_Condition, vars HookVars) error
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 Duration time.Duration // the duration of the operation that triggered the hook. 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.