Class: CDC::Concurrent::Configuration

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

Overview

Immutable configuration for cdc-concurrent runtime pools.

A Configuration instance captures the execution limits shared by ProcessorPool, TransactionPool, and Runtime. Instances are frozen so pool behavior cannot change while work is being processed.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Builds a frozen runtime configuration.

Parameters:

  • concurrency (Integer) (defaults to: 100)

    Maximum number of Async tasks allowed to run at once.

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

    Optional per-event processing timeout in seconds.

  • preserve_order (Boolean) (defaults to: true)

    Whether batch results should preserve input order.

Raises:

  • (ArgumentError)

    If concurrency is not a positive Integer.



23
24
25
26
27
28
29
30
31
# File 'lib/cdc/concurrent/configuration.rb', line 23

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?

  @concurrency = concurrency
  @timeout = timeout
  @preserve_order = preserve_order
  freeze
end

Instance Attribute Details

#concurrencyInteger, ... (readonly)

Returns:

  • (Integer)

    Maximum number of Async tasks allowed to run concurrently.

  • (Float, nil)

    Optional per-event processing timeout in seconds.

  • (Boolean)

    Whether batch results should be returned in input order.



14
15
16
# File 'lib/cdc/concurrent/configuration.rb', line 14

def concurrency
  @concurrency
end

#preserve_orderInteger, ... (readonly)

Returns:

  • (Integer)

    Maximum number of Async tasks allowed to run concurrently.

  • (Float, nil)

    Optional per-event processing timeout in seconds.

  • (Boolean)

    Whether batch results should be returned in input order.



14
15
16
# File 'lib/cdc/concurrent/configuration.rb', line 14

def preserve_order
  @preserve_order
end

#timeoutInteger, ... (readonly)

Returns:

  • (Integer)

    Maximum number of Async tasks allowed to run concurrently.

  • (Float, nil)

    Optional per-event processing timeout in seconds.

  • (Boolean)

    Whether batch results should be returned in input order.



14
15
16
# File 'lib/cdc/concurrent/configuration.rb', line 14

def timeout
  @timeout
end