Module: Karafka::Pro::Routing::Features::OffsetMetadata::Topic
- Defined in:
- lib/karafka/pro/routing/features/offset_metadata/topic.rb
Overview
Commit Metadata API extensions
Instance Method Summary collapse
-
#initialize ⇒ Object
This method calls the parent class initializer and then sets up the extra instance variable to nil.
-
#offset_metadata(cache: true, deserializer: STRING_DESERIALIZER) ⇒ Config
This feature config.
-
#offset_metadata? ⇒ true
Is offset metadata active (it always is).
-
#to_h ⇒ Hash
Topic with all its native configuration options plus offset metadata settings.
Instance Method Details
#initialize ⇒ Object
This method calls the parent class initializer and then sets up the extra instance variable to nil. The explicit initialization to nil is included as an optimization for Ruby’s object shapes system, which improves memory layout and access performance.
32 33 34 35 |
# File 'lib/karafka/pro/routing/features/offset_metadata/topic.rb', line 32 def initialize(...) super @offset_metadata = nil end |
#offset_metadata(cache: true, deserializer: STRING_DESERIALIZER) ⇒ Config
41 42 43 44 45 46 47 |
# File 'lib/karafka/pro/routing/features/offset_metadata/topic.rb', line 41 def (cache: true, deserializer: STRING_DESERIALIZER) @offset_metadata ||= Config.new( active: true, cache: cache, deserializer: deserializer ) end |
#offset_metadata? ⇒ true
50 51 52 |
# File 'lib/karafka/pro/routing/features/offset_metadata/topic.rb', line 50 def .active? end |
#to_h ⇒ Hash
56 57 58 59 60 |
# File 'lib/karafka/pro/routing/features/offset_metadata/topic.rb', line 56 def to_h super.merge( offset_metadata: .to_h ).freeze end |