module Longleaf::EventStatusTracking

Helper methods for tracking and recording the overall outcome of a preservation event.

Public Instance Methods

record_failure(*args) click to toggle source

Record a failed operation to the output and the overall status of this event. @param args [Array] arguments to pass to logger

# File lib/longleaf/events/event_status_tracking.rb, line 26
def record_failure(*args)
  logger.failure(*args)
  track_failure
end
record_success(*args) click to toggle source

Record a successful operation to the output and the overall status of this event. @param args [Array] arguments to pass to logger

# File lib/longleaf/events/event_status_tracking.rb, line 10
def record_success(*args)
  logger.success(*args)
  track_success
end
return_status() click to toggle source

@return [Integer] the return status for this event, where 0 indicates success, 1 indicates failure, and 2 indicates partial failure

# 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() click to toggle source

Update the status of this action with a failure outcome.

# 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) click to toggle source

Update the status of this action with the provided outcome status number. @param status [Integer] outcome status

# 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() click to toggle source

Update the status of this action with a success outcome.

# 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