diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 23:02:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 23:02:30 +0300 |
commit | 41fe97390ceddf945f3d967b8fdb3de4c66b7dea (patch) | |
tree | 9c8d89a8624828992f06d892cd2f43818ff5dcc8 /lib/backup/task.rb | |
parent | 0804d2dc31052fb45a1efecedc8e06ce9bc32862 (diff) |
Add latest changes from gitlab-org/gitlab@14-9-stable-eev14.9.0-rc42
Diffstat (limited to 'lib/backup/task.rb')
-rw-r--r-- | lib/backup/task.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/backup/task.rb b/lib/backup/task.rb new file mode 100644 index 00000000000..15cd2aa64d3 --- /dev/null +++ b/lib/backup/task.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +module Backup + class Task + def initialize(progress) + @progress = progress + end + + # human readable task name used for logging + def human_name + raise NotImplementedError + end + + # dump task backup to `path` + def dump(path) + raise NotImplementedError + end + + # restore task backup from `path` + def restore(path) + raise NotImplementedError + end + + # a string returned here will be displayed to the user before calling #restore + def pre_restore_warning + end + + # a string returned here will be displayed to the user after calling #restore + def post_restore_warning + end + + # returns `true` when the task should be used + def enabled + true + end + + private + + attr_reader :progress + + def puts_time(msg) + progress.puts "#{Time.zone.now} -- #{msg}" + Gitlab::BackupLogger.info(message: "#{Rainbow.uncolor(msg)}") + end + end +end |