Class: Fluent::EventStream

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

Instance Method Summary collapse

Methods included from Plugin::Compressable

#compress, #decompress

Methods included from MessagePackFactory::Mixin

#msgpack_factory, #msgpack_packer, #msgpack_unpacker

Instance Method Details

#==(other) ⇒ Object

for tests



41
42
43
# File 'lib/fluent/event.rb', line 41

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

#dupObject

dup does deep copy for event stream

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/fluent/event.rb', line 27

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

#each(&block) ⇒ Object

Raises:

  • (NotImplementedError)


53
54
55
# File 'lib/fluent/event.rb', line 53

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

#empty?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/fluent/event.rb', line 36

def empty?
  size == 0
end

#repeatable?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/fluent/event.rb', line 45

def repeatable?
  false
end

#sizeObject Also known as: length

Raises:

  • (NotImplementedError)


31
32
33
# File 'lib/fluent/event.rb', line 31

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

#slice(index, num) ⇒ Object

Raises:

  • (NotImplementedError)


49
50
51
# File 'lib/fluent/event.rb', line 49

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

#to_compressed_msgpack_stream(time_int: false) ⇒ Object



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

def to_compressed_msgpack_stream(time_int: false)
  packed = to_msgpack_stream(time_int: time_int)
  compress(packed)
end

#to_msgpack_stream(time_int: false) ⇒ Object



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

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



71
72
73
74
75
76
77
# File 'lib/fluent/event.rb', line 71

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