Sha256: 6094a09278fdfcfe80a09fa0cc35a5197140700c05f5ee3eee53787a152b7c22

Contents?: true

Size: 474 Bytes

Versions: 2

Compression:

Stored size: 474 Bytes

Contents

module Turbine
  # Batches of messages to be processed
  class Batch
    attr_reader :messages, :partition

    def initialize(messages, partition)
      @messages  = messages.freeze
      @partition = partition
      @completed = Concurrent::AtomicBoolean.new
    end

    def complete
      @completed.value = true
    end

    def completed?
      @completed.value
    end

    def [](n)
      @messages.at(n)
    end

    def size
      @messages.size
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
turbine-1.0.0.pre2 lib/turbine/batch.rb
turbine-1.0.0.pre lib/turbine/batch.rb