Class: Contrast::Agent::Reporting::ResponseHandlerMode

Inherits:
Object
  • Object
show all
Defined in:
lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb

Overview

This class will hold the mode state in which the reporter will send event ot TS.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResponseHandlerMode

Returns a new instance of ResponseHandlerMode.



34
35
36
37
38
39
# File 'lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb', line 34

def initialize
  @running = :running
  @disabled = :disabled
  @resending = :resending
  @modes = [@running, @disabled, @resending].cs__freeze
end

Instance Attribute Details

#disabledSymbol (readonly)

Reader for the disabled mode type.

due to received Error. The Reporting is disabled for this application.

Returns:

  • (Symbol)

    Reporter’s client and Response Handler are disabled



21
22
23
# File 'lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb', line 21

def disabled
  @disabled
end

#modesArray<Symbol> (readonly)

Reader for all supported modes.

available modes of operation.

Returns:

  • (Array<Symbol>)

    Reporter’s client and Response Handler all



32
33
34
# File 'lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb', line 32

def modes
  @modes
end

#resendingSymbol (readonly)

Reader for the resending/retry mode type.

for a TS received amount of time and will try to resend the previous request after that.

Returns:

  • (Symbol)

    Reporter’s client and Response Handler are suspended



27
28
29
# File 'lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb', line 27

def resending
  @resending
end

#runningSymbol (readonly)

Reader for the running mode type.

and responses are being processed.

Returns:

  • (Symbol)

    Reporter’s client and Response Handler are running



16
17
18
# File 'lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb', line 16

def running
  @running
end

Instance Method Details

#enter_resend_modeObject



56
57
58
# File 'lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb', line 56

def enter_resend_mode
  @_status = resending
end

#enter_run_modeObject

Reset mode



70
71
72
# File 'lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb', line 70

def enter_run_mode
  @_status = running
end

#resendContrast::Agent::Reporting::Resend::Status

Resend Status tracker



52
53
54
# File 'lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb', line 52

def resend
  @_resend ||= Contrast::Agent::Reporting::Resend::Status.new
end

#statusSymbol

Current mode.

current mode of operation.

Returns:

  • (Symbol)

    Reporter’s client and Response Handler



45
46
47
# File 'lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb', line 45

def status
  @_status ||= running
end

#status=(mode) ⇒ Symbol

Set current mode.

current mode of operation.

Returns:

  • (Symbol)

    Reporter’s client and Response Handler



64
65
66
# File 'lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb', line 64

def status= mode
  @_status = mode if mode.cs__is_a?(Symbol) && modes.include?(mode)
end