Module: Longleaf::EventStatusTracking
- Includes:
- Logging
- Included in:
- DeregisterCommand, DeregisterEvent, PreserveCommand, PreserveEvent, RegisterCommand, RegisterEvent, ReindexCommand, ValidateConfigCommand, ValidateMetadataCommand
- Defined in:
- lib/longleaf/events/event_status_tracking.rb
Overview
Helper methods for tracking and recording the overall outcome of a preservation event.
Instance Method Summary collapse
-
#record_failure(*args) ⇒ Object
Record a failed operation to the output and the overall status of this event.
-
#record_success(*args) ⇒ Object
Record a successful operation to the output and the overall status of this event.
-
#return_status ⇒ Integer
1 indicates failure, and 2 indicates partial failure.
-
#track_failure ⇒ Object
Update the status of this action with a failure outcome.
-
#track_status(status) ⇒ Object
Update the status of this action with the provided outcome status number.
-
#track_success ⇒ Object
Update the status of this action with a success outcome.
Methods included from Logging
#initialize_logger, initialize_logger, #logger, logger
Instance Method Details
#record_failure(*args) ⇒ Object
Record a failed operation to the output and the overall status of this event.
26 27 28 29 |
# File 'lib/longleaf/events/event_status_tracking.rb', line 26 def record_failure(*args) logger.failure(*args) track_failure end |
#record_success(*args) ⇒ Object
Record a successful operation to the output and the overall status of this event.
10 11 12 13 |
# File 'lib/longleaf/events/event_status_tracking.rb', line 10 def record_success(*args) logger.success(*args) track_success end |
#return_status ⇒ Integer
1 indicates failure, and 2 indicates partial failure
54 55 56 57 |
# File 'lib/longleaf/events/event_status_tracking.rb', line 54 def return_status @return_status = 0 if @return_status.nil? @return_status end |
#track_failure ⇒ Object
Update the status of this action with a failure outcome.
32 33 34 35 36 37 38 |
# File 'lib/longleaf/events/event_status_tracking.rb', line 32 def track_failure if @return_status.nil? || @return_status == 1 @return_status = 1 else @return_status = 2 end end |
#track_status(status) ⇒ Object
Update the status of this action with the provided outcome status number.
42 43 44 45 46 47 48 49 50 |
# File 'lib/longleaf/events/event_status_tracking.rb', line 42 def track_status(status) if status == 2 @return_status = 2 elsif status == 0 track_success elsif status == 1 track_failure end end |
#track_success ⇒ Object
Update the status of this action with a success outcome.
16 17 18 19 20 21 22 |
# File 'lib/longleaf/events/event_status_tracking.rb', line 16 def track_success if @return_status.nil? || @return_status == 0 @return_status = 0 else @return_status = 2 end end |