Sha256: b53ade85f85325d815a54804e076fdc1ae4c9a402a7fd9242bc0c67b5fcf0b35

Contents?: true

Size: 731 Bytes

Versions: 1

Compression:

Stored size: 731 Bytes

Contents

# frozen_string_literal: true

module Chronicle
  module ETL
    class BufferTransformer < Chronicle::ETL::Transformer
      register_connector do |r|
        r.identifier = :buffer
        r.description = 'by buffering'
      end

      setting :size, default: 10, description: 'The size of the buffer'

      def transform(record)
        stash_record(record)

        # FIXME: this doesn't seem to be working with the runner
        return if @stashed_records.size < @config.size

        # FIXME: this will result in the wrong extraction being associated with
        # the batch of flushed records
        flush_stashed_records.map(&:data)
      end

      def finish
        flush_stashed_records
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chronicle-etl-0.6.1 lib/chronicle/etl/transformers/buffer_transformer.rb