Class: Fluent::EventStream

Inherits:
Object
  • Object
show all
Includes:
Enumerable, MessagePackFactory::Mixin
Defined in:
lib/fluent/event.rb

Instance Method Summary collapse

Methods included from MessagePackFactory::Mixin

#msgpack_factory, #msgpack_packer, #msgpack_unpacker

Instance Method Details

#==(other) ⇒ Object

for tests



39
40
41
# File 'lib/fluent/event.rb', line 39

def ==(other)
  other.is_a?(EventStream) && self.to_msgpack_stream == other.to_msgpack_stream
end

#dupObject

dup does deep copy for event stream

Raises:



25
26
27
# File 'lib/fluent/event.rb', line 25

def dup
  raise NotImplementedError, "DO NOT USE THIS CLASS directly."
end

#each(&block) ⇒ Object

Raises:



51
52
53
# File 'lib/fluent/event.rb', line 51

def each(&block)
  raise NotImplementedError, "DO NOT USE THIS CLASS directly."
end

#empty?Boolean

Returns:



34
35
36
# File 'lib/fluent/event.rb', line 34

def empty?
  size == 0
end

#repeatable?Boolean

Returns:



43
44
45
# File 'lib/fluent/event.rb', line 43

def repeatable?
  false
end

#sizeObject Also known as: length

Raises:



29
30
31
# File 'lib/fluent/event.rb', line 29

def size
  raise NotImplementedError, "DO NOT USE THIS CLASS directly."
end

#slice(index, num) ⇒ Object

Raises:



47
48
49
# File 'lib/fluent/event.rb', line 47

def slice(index, num)
  raise NotImplementedError, "DO NOT USE THIS CLASS directly."
end

#to_msgpack_stream(time_int: false) ⇒ Object



55
56
57
58
59
60
61
62
# File 'lib/fluent/event.rb', line 55

def to_msgpack_stream(time_int: false)
  return to_msgpack_stream_forced_integer if time_int
  out = msgpack_packer
  each {|time,record|
    out.write([time,record])
  }
  out.to_s
end

#to_msgpack_stream_forced_integerObject



64
65
66
67
68
69
70
# File 'lib/fluent/event.rb', line 64

def to_msgpack_stream_forced_integer
  out = msgpack_packer
  each {|time,record|
    out.write([time.to_i,record])
  }
  out.to_s
end