class Sawmill::EntryProcessor::SimpleQueue

This processor simply queues up log entries for later use.

Public Class Methods

new(opts_={}) click to toggle source

Create a queue.

Recognized options include:

:limit

Size limit for the queue. If not specified, the queue can grow arbitrarily large.

:drop_oldest

If set to true, then when an item is added to a full queue, the oldest item is dropped. If set to false or not specified, then the new item is not added.

# File lib/sawmill/entry_processor/simple_queue.rb, line 60
def initialize(opts_={})
  @queue = Util::Queue.new(opts_)
  @closed = false
end

Public Instance Methods

attribute(entry_) click to toggle source
# File lib/sawmill/entry_processor/simple_queue.rb, line 102
def attribute(entry_)
  @queue.enqueue(entry_) unless @closed
  !@closed
end
begin_record(entry_) click to toggle source
# File lib/sawmill/entry_processor/simple_queue.rb, line 87
def begin_record(entry_)
  @queue.enqueue(entry_) unless @closed
  !@closed
end
dequeue() click to toggle source

Return the oldest entry in the queue, or nil if the queue is empty.

# File lib/sawmill/entry_processor/simple_queue.rb, line 68
def dequeue
  @queue.dequeue
end
dequeue_all() click to toggle source

Return an array of the contents of the queue, in order.

# File lib/sawmill/entry_processor/simple_queue.rb, line 75
def dequeue_all
  @queue.dequeue_all
end
end_record(entry_) click to toggle source
# File lib/sawmill/entry_processor/simple_queue.rb, line 92
def end_record(entry_)
  @queue.enqueue(entry_) unless @closed
  !@closed
end
finish() click to toggle source
# File lib/sawmill/entry_processor/simple_queue.rb, line 112
def finish
  @closed = true
  nil
end
message(entry_) click to toggle source
# File lib/sawmill/entry_processor/simple_queue.rb, line 97
def message(entry_)
  @queue.enqueue(entry_) unless @closed
  !@closed
end
size() click to toggle source

Return the size of the queue, which is 0 if the queue is empty.

# File lib/sawmill/entry_processor/simple_queue.rb, line 82
def size
  @queue.size
end
unknown_data(entry_) click to toggle source
# File lib/sawmill/entry_processor/simple_queue.rb, line 107
def unknown_data(entry_)
  @queue.enqueue(entry_) unless @closed
  !@closed
end