blob: be741a9d91b76382a42f1d5172290808284f8926 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# frozen_string_literal: true
module Gitlab
module Database
module BackgroundMigration
module HealthStatus
module Signals
# Base class for a signal
class Base
attr_reader :indicator_class, :reason
def initialize(indicator_class, reason:)
@indicator_class = indicator_class
@reason = reason
end
def to_s
"#{short_name} (indicator: #{indicator_class}; reason: #{reason})"
end
# :nocov:
def log_info?
false
end
def stop?
false
end
# :nocov:
private
def short_name
self.class.name.demodulize
end
end
# A Signals::Stop is an indication to put a migration on hold or stop it entirely:
# In general, we want to slow down or pause the migration.
class Stop < Base
# :nocov:
def log_info?
true
end
def stop?
true
end
# :nocov:
end
# A Signals::Normal indicates normal system state: We carry on with the migration
# and may even attempt to optimize its throughput etc.
class Normal < Base; end
# When given an Signals::Unknown, something unexpected happened while
# we evaluated system indicators.
class Unknown < Base
# :nocov:
def log_info?
true
end
# :nocov:
end
# No signal could be determined, e.g. because the indicator
# was disabled.
class NotAvailable < Base; end
end
end
end
end
end
|