Class: CDC::Concurrent::Configuration

Inherits:
Data
  • Object
show all
Defined in:
lib/cdc/concurrent/configuration.rb

Overview

Immutable configuration for concurrent runtimes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(concurrency: 100, timeout: nil, preserve_order: true) ⇒ Configuration

Returns a new instance of Configuration.

Parameters:

  • concurrency (Integer) (defaults to: 100)

    maximum concurrent tasks.

  • timeout (Float, nil) (defaults to: nil)

    optional timeout.

  • preserve_order (Boolean) (defaults to: true)

    whether batch results preserve input order.

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
# File 'lib/cdc/concurrent/configuration.rb', line 10

def initialize(concurrency: 100, timeout: nil, preserve_order: true)
  raise ArgumentError, "concurrency must be an Integer" unless concurrency.is_a?(Integer)
  raise ArgumentError, "concurrency must be greater than zero" unless concurrency.positive?

  super
  freeze
end

Instance Attribute Details

#concurrencyObject (readonly)

Returns the value of attribute concurrency

Returns:

  • (Object)

    the current value of concurrency



6
7
8
# File 'lib/cdc/concurrent/configuration.rb', line 6

def concurrency
  @concurrency
end

#preserve_orderObject (readonly)

Returns the value of attribute preserve_order

Returns:

  • (Object)

    the current value of preserve_order



6
7
8
# File 'lib/cdc/concurrent/configuration.rb', line 6

def preserve_order
  @preserve_order
end

#timeoutObject (readonly)

Returns the value of attribute timeout

Returns:

  • (Object)

    the current value of timeout



6
7
8
# File 'lib/cdc/concurrent/configuration.rb', line 6

def timeout
  @timeout
end