Class: LaunchDarkly::EventBuffer Private
- Inherits:
-
Object
- Object
- LaunchDarkly::EventBuffer
- Defined in:
- lib/ldclient-rb/events.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.
Instance Method Summary collapse
- #add_event(event) ⇒ Object private
- #add_to_summary(event) ⇒ Object private
- #clear ⇒ Object private
- #get_and_clear_dropped_count ⇒ Object private
- #get_payload ⇒ Object private
-
#initialize(capacity, logger) ⇒ EventBuffer
constructor
private
A new instance of EventBuffer.
Constructor Details
#initialize(capacity, logger) ⇒ EventBuffer
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 a new instance of EventBuffer.
448 449 450 451 452 453 454 455 |
# File 'lib/ldclient-rb/events.rb', line 448 def initialize(capacity, logger) @capacity = capacity @logger = logger @capacity_exceeded = false @dropped_events = 0 @events = [] @summarizer = LaunchDarkly::Impl::EventSummarizer.new end |
Instance Method Details
#add_event(event) ⇒ 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.
457 458 459 460 461 462 463 464 465 466 467 468 |
# File 'lib/ldclient-rb/events.rb', line 457 def add_event(event) if @events.length < @capacity @events.push(event) @capacity_exceeded = false else @dropped_events += 1 unless @capacity_exceeded @capacity_exceeded = true @logger.warn { "[LDClient] Exceeded event queue capacity. Increase capacity to avoid dropping events." } end end end |
#add_to_summary(event) ⇒ 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.
470 471 472 |
# File 'lib/ldclient-rb/events.rb', line 470 def add_to_summary(event) @summarizer.summarize_event(event) end |
#clear ⇒ 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.
484 485 486 487 |
# File 'lib/ldclient-rb/events.rb', line 484 def clear @events = [] @summarizer.clear end |
#get_and_clear_dropped_count ⇒ 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.
478 479 480 481 482 |
# File 'lib/ldclient-rb/events.rb', line 478 def get_and_clear_dropped_count ret = @dropped_events @dropped_events = 0 ret end |
#get_payload ⇒ 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.
474 475 476 |
# File 'lib/ldclient-rb/events.rb', line 474 def get_payload FlushPayload.new(@events, @summarizer.snapshot) end |