Class: Fluent::Plugin::Buffer::ArrowFileChunk

Inherits:
FileChunk
  • Object
show all
Includes:
ArrowBufferStringBuilder
Defined in:
lib/fluent/plugin/buffer/arrow_file_chunk.rb

Instance Method Summary collapse

Constructor Details

#initialize(metadata, path, mode, schema, perm: system_config.file_permission || FILE_PERMISSION, chunk_size: 1024, format: :arrow) ⇒ ArrowFileChunk

Returns a new instance of ArrowFileChunk.



29
30
31
32
33
34
# File 'lib/fluent/plugin/buffer/arrow_file_chunk.rb', line 29

def initialize(, path, mode, schema, perm: system_config.file_permission || FILE_PERMISSION, chunk_size: 1024, format: :arrow)
  super(, path, mode, perm: perm, compress: :text)
  @schema = schema
  @chunk_size = chunk_size
  @format = format
end

Instance Method Details

#open(**kwargs, &block) ⇒ Object



41
42
43
44
45
46
# File 'lib/fluent/plugin/buffer/arrow_file_chunk.rb', line 41

def open(**kwargs, &block)
  @chunk.seek(0, IO::SEEK_SET)
  val = StringIO.open(build_arrow_buffer_string, &block)
  @chunk.seek(0, IO::SEEK_END) if self.staged?
  val
end

#read(**kwargs) ⇒ Object



36
37
38
39
# File 'lib/fluent/plugin/buffer/arrow_file_chunk.rb', line 36

def read(**kwargs)
  @chunk.seek(0, IO::SEEK_SET)
  build_arrow_buffer_string
end

#write_to(io, **kwargs) ⇒ Object



48
49
50
51
# File 'lib/fluent/plugin/buffer/arrow_file_chunk.rb', line 48

def write_to(io, **kwargs)
  @chunk.seek(0, IO::SEEK_SET)
  io.write build_arrow_buffer_string
end