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.
441 442 443 444 445 446 447 448 |
# File 'lib/ldclient-rb/events.rb', line 441 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.
450 451 452 453 454 455 456 457 458 459 460 461 |
# File 'lib/ldclient-rb/events.rb', line 450 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.
463 464 465 |
# File 'lib/ldclient-rb/events.rb', line 463 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.
477 478 479 480 |
# File 'lib/ldclient-rb/events.rb', line 477 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.
471 472 473 474 475 |
# File 'lib/ldclient-rb/events.rb', line 471 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.
467 468 469 |
# File 'lib/ldclient-rb/events.rb', line 467 def get_payload FlushPayload.new(@events, @summarizer.snapshot) end |