Class/Module Index [+]

Quicksearch

Fluent::MemoryBufferChunk

Attributes

unique_id[R]

Public Class Methods

new(key, data='') click to toggle source
# File lib/fluent/plugin/buf_memory.rb, line 22
def initialize(key, data='')
  @data = data
  @data.force_encoding('ASCII-8BIT')
  now = Time.now.utc
  u1 = ((now.to_i*1000*1000+now.usec) << 12 | rand(0xfff))
  @unique_id = [u1 >> 32, u1 & u1 & 0xffffffff, rand(0xffffffff), rand(0xffffffff)].pack('NNNN')
  super(key)
end

Public Instance Methods

<<(data) click to toggle source
# File lib/fluent/plugin/buf_memory.rb, line 33
def <<(data)
  data.force_encoding('ASCII-8BIT')
  @data << data
end
close() click to toggle source
# File lib/fluent/plugin/buf_memory.rb, line 42
def close
end
msgpack_each(&block) click to toggle source

optimize

# File lib/fluent/plugin/buf_memory.rb, line 62
def msgpack_each(&block)
  u = MessagePack::Unpacker.new
  u.feed_each(@data, &block)
end
open(&block) click to toggle source
# File lib/fluent/plugin/buf_memory.rb, line 52
def open(&block)
  StringIO.open(@data, &block)
end
purge() click to toggle source
# File lib/fluent/plugin/buf_memory.rb, line 45
def purge
end
read() click to toggle source
# File lib/fluent/plugin/buf_memory.rb, line 48
def read
  @data
end
size() click to toggle source
# File lib/fluent/plugin/buf_memory.rb, line 38
def size
  @data.bytesize
end
write_to(io) click to toggle source

optimize

# File lib/fluent/plugin/buf_memory.rb, line 57
def write_to(io)
  io.write @data
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.