Class: OnStomp::Failover::Buffers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/onstomp/failover/buffers/base.rb

Overview

The base class for all buffers. This class exists mostly as a factoring out of the code shared between the Written and Receipts buffers.

Direct Known Subclasses

Receipts, Written

Instance Method Summary collapse

Constructor Details

#initialize(failover) ⇒ Base

Returns a new instance of Base.



7
8
9
10
11
12
# File 'lib/onstomp/failover/buffers/base.rb', line 7

def initialize failover
  @failover = failover
  @buffer_mutex = Mutex.new
  @buffer = []
  @txs = {}
end

Instance Method Details

#bufferedFixnum

Returns the number of frames currently sitting in the buffer.

Returns:

  • (Fixnum)


16
17
18
# File 'lib/onstomp/failover/buffers/base.rb', line 16

def buffered
  @buffer.length
end