Class: Karafka::Web::Processing::Consumers::Aggregators::State::Context
- Inherits:
-
Object
- Object
- Karafka::Web::Processing::Consumers::Aggregators::State::Context
- Defined in:
- lib/karafka/web/processing/consumers/aggregators/state/context.rb
Overview
Shared, per-call value object passed through the State pipeline steps.
Each step reads and mutates the contents of state/active_reports in place to
enrich the materialized state for the next step, instead of each step reaching
into State's own ivars directly. This keeps steps isolated and independently
testable with a hand-built Context.
Instance Attribute Summary collapse
-
#active_reports ⇒ Object
readonly
Returns the value of attribute active_reports.
-
#aggregated_from ⇒ Object
readonly
Returns the value of attribute aggregated_from.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#report ⇒ Object
readonly
Returns the value of attribute report.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
-
#initialize(state:, active_reports:, aggregated_from:, report:, offset:) ⇒ Context
constructor
Initialize all instance variables upfront so every instance has the same object shape, avoiding Ruby's
:performance"shape variations" warning.
Constructor Details
#initialize(state:, active_reports:, aggregated_from:, report:, offset:) ⇒ Context
Initialize all instance variables upfront so every instance has the same
object shape, avoiding Ruby's :performance "shape variations" warning.
24 25 26 27 28 29 30 |
# File 'lib/karafka/web/processing/consumers/aggregators/state/context.rb', line 24 def initialize(state:, active_reports:, aggregated_from:, report:, offset:) @state = state @active_reports = active_reports @aggregated_from = aggregated_from @report = report @offset = offset end |
Instance Attribute Details
#active_reports ⇒ Object (readonly)
Returns the value of attribute active_reports.
32 33 34 |
# File 'lib/karafka/web/processing/consumers/aggregators/state/context.rb', line 32 def active_reports @active_reports end |
#aggregated_from ⇒ Object (readonly)
Returns the value of attribute aggregated_from.
32 33 34 |
# File 'lib/karafka/web/processing/consumers/aggregators/state/context.rb', line 32 def aggregated_from @aggregated_from end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
32 33 34 |
# File 'lib/karafka/web/processing/consumers/aggregators/state/context.rb', line 32 def offset @offset end |
#report ⇒ Object (readonly)
Returns the value of attribute report.
32 33 34 |
# File 'lib/karafka/web/processing/consumers/aggregators/state/context.rb', line 32 def report @report end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
32 33 34 |
# File 'lib/karafka/web/processing/consumers/aggregators/state/context.rb', line 32 def state @state end |