Class: Omnizip::Models::ParallelOptions

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Includes:
AttributeApply
Defined in:
lib/omnizip/models/parallel_options.rb

Overview

Model for parallel processing configuration

Stores settings for parallel compression and extraction operations including thread count, queue size, and load balancing strategy.

Serialized via lutaml-model — no hand-rolled to_h / to_json.

Examples:

Create parallel options

options = Omnizip::Models::ParallelOptions.new
options.threads = 8
options.queue_size = 100
options.strategy = :dynamic

Use with parallel compression

Omnizip::Parallel.compress_directory('files/', 'backup.zip', options)

Instance Method Summary collapse

Methods included from AttributeApply

#apply

Instance Method Details

#batch_sizeInteger

Returns Batch size for work queue polling.

Returns:

  • (Integer)

    Batch size for work queue polling



41
# File 'lib/omnizip/models/parallel_options.rb', line 41

attribute :batch_size, :integer, default: 10

#chunk_sizeInteger

Returns Chunk size for chunked operations in bytes.

Returns:

  • (Integer)

    Chunk size for chunked operations in bytes



32
# File 'lib/omnizip/models/parallel_options.rb', line 32

attribute :chunk_size, :integer, default: 64 * 1024 * 1024

#queue_sizeInteger

Returns Maximum size of job queue (default: 1000).

Returns:

  • (Integer)

    Maximum size of job queue (default: 1000)



29
# File 'lib/omnizip/models/parallel_options.rb', line 29

attribute :queue_size, :integer, default: 1000

#strategySymbol

Returns Load balancing strategy (:dynamic or :static).

Returns:

  • (Symbol)

    Load balancing strategy (:dynamic or :static)



35
# File 'lib/omnizip/models/parallel_options.rb', line 35

attribute :strategy, :symbol, default: :dynamic

#threadsInteger

Returns Number of worker threads (default: auto-detect).

Returns:

  • (Integer)

    Number of worker threads (default: auto-detect)



26
# File 'lib/omnizip/models/parallel_options.rb', line 26

attribute :threads, :integer, default: -> { detect_cpu_count }

#validate_options!Boolean

Validate options

Named validate_options! rather than validate! so it does not shadow Lutaml::Model::Validation#validate!(register:).

Returns:

  • (Boolean)

    true if valid

Raises:

  • (ArgumentError)

    if options are invalid



62
63
64
65
66
67
68
69
70
# File 'lib/omnizip/models/parallel_options.rb', line 62

def validate_options!
  validate_positive(:threads)
  validate_positive(:queue_size)
  validate_positive(:chunk_size)
  validate_strategy
  validate_positive(:batch_size)

  true
end

#verboseBoolean

Returns Enable verbose progress output.

Returns:

  • (Boolean)

    Enable verbose progress output



38
# File 'lib/omnizip/models/parallel_options.rb', line 38

attribute :verbose, :boolean, default: false