Class: Hoss::Event Private

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
ChildDurations::Methods
Defined in:
lib/hoss/event.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: Error, Request, Response

Constant Summary collapse

DEFAULT_TYPE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'custom'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ChildDurations::Methods

#child_durations, #child_started, #child_stopped

Constructor Details

#initializeEvent

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

rubocop:disable Metrics/ParameterLists



72
73
74
75
76
77
78
# File 'lib/hoss/event.rb', line 72

def initialize
  @id = SecureRandom.uuid
  @request = Request.new
  # @response = Response.new
  @filtered = false
  @retries = 0
end

Instance Attribute Details

#errorObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

rubocop:enable Metrics/ParameterLists



81
82
83
# File 'lib/hoss/event.rb', line 81

def error
  @error
end

#filteredObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

rubocop:enable Metrics/ParameterLists



81
82
83
# File 'lib/hoss/event.rb', line 81

def filtered
  @filtered
end

#idObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



89
90
91
# File 'lib/hoss/event.rb', line 89

def id
  @id
end

#requestObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

rubocop:enable Metrics/ParameterLists



81
82
83
# File 'lib/hoss/event.rb', line 81

def request
  @request
end

#responseObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

rubocop:enable Metrics/ParameterLists



81
82
83
# File 'lib/hoss/event.rb', line 81

def response
  @response
end

Instance Method Details

#done(clock_end: Util.monotonic_micros) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



107
108
109
110
# File 'lib/hoss/event.rb', line 107

def done(clock_end: Util.monotonic_micros)
  stop clock_end
  self
end

#inspectObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

relations



126
127
128
129
# File 'lib/hoss/event.rb', line 126

def inspect
  "<Hoss::Event id:#{id.inspect}" \
    '>'
end

#running?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


120
121
122
# File 'lib/hoss/event.rb', line 120

def running?
  started? && !stopped?
end

#start(clock_start = Util.monotonic_micros) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

life cycle



95
96
97
98
99
# File 'lib/hoss/event.rb', line 95

def start(clock_start = Util.monotonic_micros)
  @timestamp = Util.micros
  @clock_start = clock_start
  self
end

#started?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


116
117
118
# File 'lib/hoss/event.rb', line 116

def started?
  !!timestamp
end

#stop(clock_end = Util.monotonic_micros) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



101
102
103
104
105
# File 'lib/hoss/event.rb', line 101

def stop(clock_end = Util.monotonic_micros)
  @duration ||= (clock_end - @clock_start)
  @self_time = @duration - child_durations.duration
  self
end

#stopped?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


112
113
114
# File 'lib/hoss/event.rb', line 112

def stopped?
  !!duration
end