Sha256: cc88b0a302e5b8cd3ca3b5e5b37b52208b5be25aa3deadfd1112d684de67ecf5

Contents?: true

Size: 1.33 KB

Versions: 3

Compression:

Stored size: 1.33 KB

Contents

module RocketJob
  module Sliced
    autoload :BZip2OutputSlice, "rocket_job/sliced/bzip2_output_slice"
    autoload :CompressedSlice, "rocket_job/sliced/compressed_slice"
    autoload :EncryptedSlice, "rocket_job/sliced/encrypted_slice"
    autoload :Input, "rocket_job/sliced/input"
    autoload :Output, "rocket_job/sliced/output"
    autoload :Slice, "rocket_job/sliced/slice"
    autoload :Slices, "rocket_job/sliced/slices"
    autoload :Store, "rocket_job/sliced/store"

    module Writer
      autoload :Input, "rocket_job/sliced/writer/input"
      autoload :Output, "rocket_job/sliced/writer/output"
    end

    # Returns [RocketJob::Sliced::Slices] for the relevant direction and category.
    def self.factory(direction, category, job)
      collection_name = "rocket_job.#{direction}s.#{job.id}"
      collection_name << ".#{category.name}" unless category.name == :main

      case direction
      when :input
        RocketJob::Sliced::Input.new(
          collection_name: collection_name,
          slice_class:     category.serializer_class,
          slice_size:      category.slice_size
        )
      when :output
        RocketJob::Sliced::Output.new(collection_name: collection_name, slice_class: category.serializer_class)
      else
        raise(ArgumentError, "Unknown direction: #{direction.inspect}")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rocketjob-6.0.0.rc3 lib/rocket_job/sliced.rb
rocketjob-6.0.0.rc2 lib/rocket_job/sliced.rb
rocketjob-6.0.0.rc1 lib/rocket_job/sliced.rb