omnizip 0.3.13 → 0.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/lib/omnizip/algorithm.rb +36 -1
  3. data/lib/omnizip/algorithms/bzip2.rb +1 -3
  4. data/lib/omnizip/algorithms/deflate.rb +1 -3
  5. data/lib/omnizip/algorithms/deflate64.rb +2 -2
  6. data/lib/omnizip/algorithms/lzma.rb +1 -1
  7. data/lib/omnizip/algorithms/lzma2.rb +4 -12
  8. data/lib/omnizip/algorithms/zstandard.rb +1 -3
  9. data/lib/omnizip/algorithms.rb +14 -1
  10. data/lib/omnizip/commands/archive_list_command.rb +9 -7
  11. data/lib/omnizip/entry.rb +44 -0
  12. data/lib/omnizip/extraction/selective_extractor.rb +2 -10
  13. data/lib/omnizip/filter_pipeline.rb +1 -1
  14. data/lib/omnizip/filter_registry.rb +18 -16
  15. data/lib/omnizip/filters/bcj2.rb +1 -1
  16. data/lib/omnizip/filters/bcj_arm.rb +1 -1
  17. data/lib/omnizip/filters/bcj_arm64.rb +1 -1
  18. data/lib/omnizip/filters/bcj_ia64.rb +1 -1
  19. data/lib/omnizip/filters/bcj_ppc.rb +1 -1
  20. data/lib/omnizip/filters/bcj_sparc.rb +1 -1
  21. data/lib/omnizip/filters/bcj_x86.rb +1 -1
  22. data/lib/omnizip/filters.rb +0 -2
  23. data/lib/omnizip/formats/bzip2_file.rb +0 -7
  24. data/lib/omnizip/formats/cpio/entry.rb +6 -0
  25. data/lib/omnizip/formats/cpio.rb +0 -6
  26. data/lib/omnizip/formats/gzip.rb +0 -7
  27. data/lib/omnizip/formats/iso/directory_record.rb +7 -0
  28. data/lib/omnizip/formats/iso.rb +0 -5
  29. data/lib/omnizip/formats/lzip.rb +0 -7
  30. data/lib/omnizip/formats/lzma_alone.rb +0 -6
  31. data/lib/omnizip/formats/msi/entry.rb +6 -0
  32. data/lib/omnizip/formats/msi.rb +0 -9
  33. data/lib/omnizip/formats/ole/dirent.rb +6 -0
  34. data/lib/omnizip/formats/ole.rb +0 -9
  35. data/lib/omnizip/formats/rar.rb +0 -6
  36. data/lib/omnizip/formats/rar3/reader.rb +7 -0
  37. data/lib/omnizip/formats/rar5/reader.rb +7 -0
  38. data/lib/omnizip/formats/rpm/entry.rb +6 -0
  39. data/lib/omnizip/formats/seven_zip/models/file_entry.rb +7 -0
  40. data/lib/omnizip/formats/seven_zip.rb +0 -6
  41. data/lib/omnizip/formats/tar/entry.rb +6 -0
  42. data/lib/omnizip/formats/tar.rb +0 -6
  43. data/lib/omnizip/formats/xar/entry.rb +6 -0
  44. data/lib/omnizip/formats/xar.rb +0 -6
  45. data/lib/omnizip/formats/zip.rb +0 -6
  46. data/lib/omnizip/implementations.rb +18 -4
  47. data/lib/omnizip/metadata/entry_metadata.rb +7 -0
  48. data/lib/omnizip/parallel/engine.rb +48 -0
  49. data/lib/omnizip/parallel/parallel_compressor.rb +5 -16
  50. data/lib/omnizip/parallel/parallel_extractor.rb +5 -16
  51. data/lib/omnizip/parallel.rb +1 -0
  52. data/lib/omnizip/registry.rb +0 -1
  53. data/lib/omnizip/rubyzip_compat.rb +0 -1
  54. data/lib/omnizip/version.rb +1 -1
  55. data/lib/omnizip/zip/entry.rb +7 -0
  56. data/lib/omnizip.rb +1 -1
  57. metadata +4 -6
  58. data/lib/omnizip/filters/filter_base.rb +0 -6
  59. data/lib/omnizip/filters/registration.rb +0 -22
  60. data/lib/omnizip/filters/registry.rb +0 -111
  61. data/lib/omnizip/format_registry.rb +0 -100
@@ -161,13 +161,7 @@ module Omnizip
161
161
  def repair(archive_path, output_path)
162
162
  ArchiveRepairer.new.repair(archive_path, output_path)
163
163
  end
164
-
165
- # Auto-register .rar format
166
- def register!
167
- FormatRegistry.register(".rar", "Omnizip::Formats::Rar::Reader")
168
- end
169
164
  end
170
165
  end
171
166
  end
172
167
  end
173
-
@@ -361,10 +361,17 @@ module Omnizip
361
361
 
362
362
  # RAR archive entry model
363
363
  class Entry
364
+ include Omnizip::Entry
365
+
364
366
  attr_accessor :name, :compressed_size, :uncompressed_size, :crc32,
365
367
  :compression_method, :modified_time, :attributes,
366
368
  :encrypted, :data_offset, :host_os, :salt
367
369
 
370
+ def entry_name = name
371
+ def entry_directory? = false
372
+ def entry_size = uncompressed_size
373
+ def entry_mtime = modified_time
374
+
368
375
  def initialize(name: nil, compressed_size: nil, uncompressed_size: nil,
369
376
  crc32: nil, compression_method: nil, modified_time: nil,
370
377
  attributes: nil, encrypted: nil, data_offset: nil,
@@ -316,10 +316,17 @@ module Omnizip
316
316
 
317
317
  # RAR v5 archive entry model
318
318
  class Entry
319
+ include Omnizip::Entry
320
+
319
321
  attr_accessor :name, :compressed_size, :uncompressed_size, :crc32,
320
322
  :compression_method, :modified_time, :attributes,
321
323
  :encrypted, :data_offset, :host_os, :is_directory
322
324
 
325
+ def entry_name = name
326
+ def entry_directory? = is_directory
327
+ def entry_size = uncompressed_size
328
+ def entry_mtime = modified_time
329
+
323
330
  def initialize(name: nil, compressed_size: nil, uncompressed_size: nil,
324
331
  crc32: nil, compression_method: nil, modified_time: nil,
325
332
  attributes: nil, encrypted: nil, data_offset: nil,
@@ -8,8 +8,14 @@ module Omnizip
8
8
  # Represents a single file within an RPM package.
9
9
  # File information is assembled from multiple header tags.
10
10
  class Entry
11
+ include Omnizip::Entry
11
12
  include Omnizip::Formats::Rpm::Constants
12
13
 
14
+ def entry_name = path
15
+ def entry_directory? = mode && ::File.directory?(mode)
16
+ def entry_size = size
17
+ def entry_mtime = mtime
18
+
13
19
  # @return [String] File path
14
20
  attr_accessor :path
15
21
 
@@ -7,11 +7,18 @@ module Omnizip
7
7
  # Represents a file entry in .7z archive
8
8
  # Contains file metadata, attributes, and extraction information
9
9
  class FileEntry
10
+ include Omnizip::Entry
11
+
10
12
  attr_accessor :name, :size, :compressed_size, :crc, :is_dir,
11
13
  :is_empty, :is_anti, :has_stream, :mtime, :atime,
12
14
  :ctime, :attributes, :folder_index, :file_index,
13
15
  :source_path, :inline_data, :compression_options
14
16
 
17
+ def entry_name = name
18
+ def entry_directory? = is_dir
19
+ def entry_size = size
20
+ def entry_mtime = mtime
21
+
15
22
  # Initialize file entry
16
23
  def initialize
17
24
  @name = nil
@@ -174,12 +174,6 @@ module Omnizip
174
174
  rescue StandardError
175
175
  false
176
176
  end
177
-
178
- # Auto-register .7z format when loaded
179
- def self.register!
180
- FormatRegistry.register(".7z", "Omnizip::Formats::SevenZip::Reader")
181
- end
182
177
  end
183
178
  end
184
179
  end
185
-
@@ -7,12 +7,18 @@ module Omnizip
7
7
  #
8
8
  # Represents a single entry (file, directory, link) in a TAR archive
9
9
  class Entry
10
+ include Omnizip::Entry
10
11
  include Omnizip::Formats::Tar::Constants
11
12
 
12
13
  attr_accessor :name, :mode, :uid, :gid, :size, :mtime, :typeflag,
13
14
  :linkname, :uname, :gname, :devmajor, :devminor, :prefix
14
15
  attr_reader :data
15
16
 
17
+ def entry_name = name
18
+ def entry_directory? = directory?
19
+ def entry_size = size
20
+ def entry_mtime = mtime
21
+
16
22
  # Initialize a new TAR entry
17
23
  #
18
24
  # @param name [String] Entry name/path
@@ -70,13 +70,7 @@ module Omnizip
70
70
  reader = read(file_path)
71
71
  reader.list_entries
72
72
  end
73
-
74
- # Register TAR format when loaded
75
- def register!
76
- FormatRegistry.register(".tar", Omnizip::Formats::Tar)
77
- end
78
73
  end
79
74
  end
80
75
  end
81
76
  end
82
-
@@ -8,8 +8,14 @@ module Omnizip
8
8
  # Represents a single file/directory/link in a XAR archive.
9
9
  # Each entry has metadata and optional data.
10
10
  class Entry
11
+ include Omnizip::Entry
11
12
  include Omnizip::Formats::Xar::Constants
12
13
 
14
+ def entry_name = name
15
+ def entry_directory? = type == :directory
16
+ def entry_size = size
17
+ def entry_mtime = mtime
18
+
13
19
  attr_accessor :id, :name, :type, :mode, :uid, :gid, :user, :group,
14
20
  :size, :ctime, :mtime, :atime,
15
21
  :data_offset, :data_length, :data_size, :data_encoding,
@@ -139,13 +139,7 @@ module Omnizip
139
139
  def info(path)
140
140
  open(path, &:info) # rubocop:disable Security/Open
141
141
  end
142
-
143
- # Auto-register XAR format when loaded
144
- def register!
145
- FormatRegistry.register(".xar", Reader)
146
- end
147
142
  end
148
143
  end
149
144
  end
150
145
  end
151
-
@@ -44,13 +44,7 @@ module Omnizip
44
44
  reader = read(file_path)
45
45
  reader.list_entries
46
46
  end
47
-
48
- # Auto-register .zip format when loaded
49
- def register!
50
- FormatRegistry.register(".zip", Omnizip::Formats::Zip)
51
- end
52
47
  end
53
48
  end
54
49
  end
55
50
  end
56
-
@@ -1,11 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Omnizip
4
+ # Bit-level SDK ports: state machines, range coders, match finders,
5
+ # raw LZMA/LZMA2 encoders and decoders.
6
+ #
7
+ # This namespace owns the *primitives*; +Omnizip::Algorithms+ owns
8
+ # the *streaming contract*. The boundary is: +Algorithms+ calls
9
+ # +Implementations+, never the reverse. Files under this tree
10
+ # should never reach across into format-specific concerns (no
11
+ # .7z header parsing, no ZIP central directory, no tar entry
12
+ # metadata).
13
+ #
14
+ # The two top-level sub-namespaces mirror the upstream SDK split:
15
+ # - +SevenZip+ : ports of 7-Zip's LZMA/LZMA2 encoder + decoder
16
+ # - +XZUtils+ : ports of XZ Utils' LZMA/LZMA2 encoder + decoder
17
+ #
18
+ # Despite the LZMA name, the two SDKs diverge in subtle ways (no
19
+ # EOS marker, different chunk padding, different property-byte
20
+ # handling); keeping them in separate trees makes those
21
+ # divergences visible rather than hidden in flag parameters.
4
22
  module Implementations
5
- # Implementation namespace for various algorithm ports
6
- # This module contains reference implementations ported from external projects
7
-
8
- # Base classes for implementation inheritance
9
23
  autoload :Base, "omnizip/implementations/base"
10
24
  end
11
25
  end
@@ -5,8 +5,15 @@ module Omnizip
5
5
  # Model for file entry metadata
6
6
  # Wraps CentralDirectoryHeader with a cleaner metadata API
7
7
  class EntryMetadata
8
+ include Omnizip::Entry
9
+
8
10
  attr_reader :entry
9
11
 
12
+ def entry_name = entry.name
13
+ def entry_directory? = entry.directory?
14
+ def entry_size = entry.size
15
+ def entry_mtime = entry.time
16
+
10
17
  # Initialize metadata for an entry
11
18
  # @param entry [Omnizip::Zip::Entry] The entry to manage metadata for
12
19
  def initialize(entry)
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fractor"
4
+
5
+ module Omnizip
6
+ module Parallel
7
+ # Engine owns the Fractor worker-pool dance: build the pool, submit
8
+ # a batch of work, run it to completion, return successful and
9
+ # failed results. Callers (ParallelCompressor, ParallelExtractor,
10
+ # future operations) supply the worker class and the work items;
11
+ # Engine handles the threading.
12
+ #
13
+ # This is the deep module behind the parallel API: the threading
14
+ # shape is identical across every consumer, so it lives here once.
15
+ # Domain-specific concerns (which file to read, which archive to
16
+ # open, what stats to track) stay with the caller.
17
+ class Engine
18
+ # @param worker_class [Class] a +Fractor::Worker+ subclass whose
19
+ # +#process(work)+ turns one work item into a result.
20
+ # @param threads [Integer] worker count.
21
+ def initialize(worker_class:, threads:)
22
+ @worker_class = worker_class
23
+ @threads = threads
24
+ end
25
+
26
+ # Run +work_items+ through the pool and yield each successful
27
+ # +Fractor::WorkResult+ to the caller-supplied block.
28
+ #
29
+ # @param work_items [Array<Fractor::Work>] batch to submit.
30
+ # @yieldparam result [Fractor::WorkResult] a successful result.
31
+ # @return [Array<Fractor::WorkResult>] the failed results, for
32
+ # the caller to decide how to surface.
33
+ def run(work_items)
34
+ pool = Fractor::WorkerPool.new(
35
+ worker_class: @worker_class,
36
+ num_workers: @threads,
37
+ continuous: false,
38
+ )
39
+ pool.start
40
+ pool.submit_batch(work_items)
41
+ pool.run
42
+
43
+ pool.successful_results.each { |r| yield r if block_given? }
44
+ pool.failed_results
45
+ end
46
+ end
47
+ end
48
+ end
@@ -212,20 +212,11 @@ level: 6)
212
212
  )
213
213
  end
214
214
 
215
- # Create worker pool
216
- pool = WorkerPool.new(
217
- worker_class: CompressionWorker,
218
- num_workers: @options.threads,
219
- continuous: false,
220
- )
221
-
222
- pool.start
223
- pool.submit_batch(work_items)
224
- pool.run
225
-
226
- # Collect results
227
- results = pool.successful_results
228
- errors = pool.failed_results
215
+ # Run the worker pool through the shared engine.
216
+ engine = Engine.new(worker_class: CompressionWorker,
217
+ threads: @options.threads)
218
+ results = []
219
+ errors = engine.run(work_items) { |r| results << r }
229
220
 
230
221
  # Handle errors
231
222
  unless errors.empty?
@@ -238,8 +229,6 @@ level: 6)
238
229
  # Write archive sequentially (thread-safe)
239
230
  write_archive(output, results, compression: compression)
240
231
 
241
- pool.shutdown
242
-
243
232
  @stats[:end_time] = Time.now
244
233
  @stats[:files_processed] = results.size
245
234
 
@@ -201,20 +201,11 @@ module Omnizip
201
201
  )
202
202
  end
203
203
 
204
- # Create worker pool
205
- pool = WorkerPool.new(
206
- worker_class: ExtractionWorker,
207
- num_workers: @options.threads,
208
- continuous: false,
209
- )
210
-
211
- pool.start
212
- pool.submit_batch(work_items)
213
- pool.run
214
-
215
- # Collect results
216
- results = pool.successful_results
217
- errors = pool.failed_results
204
+ # Run the worker pool through the shared engine.
205
+ engine = Engine.new(worker_class: ExtractionWorker,
206
+ threads: @options.threads)
207
+ results = []
208
+ errors = engine.run(work_items) { |r| results << r }
218
209
 
219
210
  # Handle errors
220
211
  unless errors.empty?
@@ -227,8 +218,6 @@ module Omnizip
227
218
  # Write files to disk (thread-safe)
228
219
  extracted_paths = write_extracted_files(results, overwrite: overwrite)
229
220
 
230
- pool.shutdown
231
-
232
221
  @stats[:end_time] = Time.now
233
222
  @stats[:files_extracted] = results.size
234
223
 
@@ -26,6 +26,7 @@ module Omnizip
26
26
  autoload :JobQueue, "omnizip/parallel/job_queue"
27
27
  autoload :JobScheduler, "omnizip/parallel/job_scheduler"
28
28
  autoload :WorkerPool, "omnizip/parallel/worker_pool"
29
+ autoload :Engine, "omnizip/parallel/engine"
29
30
  autoload :ParallelCompressor, "omnizip/parallel/parallel_compressor"
30
31
  autoload :ParallelExtractor, "omnizip/parallel/parallel_extractor"
31
32
 
@@ -48,7 +48,6 @@ module Omnizip
48
48
 
49
49
  trigger = lazy_triggers[normalized]
50
50
  if trigger
51
- synchronize { lazy_triggers.delete(normalized) }
52
51
  trigger.call
53
52
  value = storage[normalized]
54
53
  return value if value
@@ -15,7 +15,6 @@
15
15
  # end
16
16
  #
17
17
 
18
-
19
18
  # Create Zip namespace as alias for Omnizip::Zip
20
19
  module Zip
21
20
  # Rubyzip-compatible File class
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Omnizip
4
- VERSION = "0.3.13"
4
+ VERSION = "0.3.14"
5
5
  end
@@ -5,8 +5,15 @@ module Omnizip
5
5
  # Rubyzip-compatible Entry class
6
6
  # Wraps CentralDirectoryHeader with rubyzip API
7
7
  class Entry
8
+ include Omnizip::Entry
9
+
8
10
  attr_reader :header, :ftype, :filepath
9
11
 
12
+ def entry_name = name
13
+ def entry_directory? = directory?
14
+ def entry_size = size
15
+ def entry_mtime = time
16
+
10
17
  # Create entry from CentralDirectoryHeader
11
18
  def initialize(header, filepath: nil)
12
19
  @header = header
data/lib/omnizip.rb CHANGED
@@ -43,7 +43,6 @@ module Omnizip
43
43
  autoload :Registry, "omnizip/registry"
44
44
  autoload :Algorithm, "omnizip/algorithm"
45
45
  autoload :AlgorithmRegistry, "omnizip/algorithm_registry"
46
- autoload :FormatRegistry, "omnizip/format_registry"
47
46
  autoload :OptimizationRegistry, "omnizip/optimization_registry"
48
47
  autoload :ChecksumRegistry, "omnizip/checksum_registry"
49
48
  autoload :FilterRegistry, "omnizip/filter_registry"
@@ -60,6 +59,7 @@ module Omnizip
60
59
  autoload :ETA, "omnizip/eta"
61
60
  autoload :Progress, "omnizip/progress"
62
61
  autoload :Metadata, "omnizip/metadata"
62
+ autoload :Entry, "omnizip/entry"
63
63
  autoload :Converter, "omnizip/converter"
64
64
  autoload :LinkHandler, "omnizip/link_handler"
65
65
  autoload :Parity, "omnizip/parity"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omnizip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-07-24 00:00:00.000000000 Z
11
+ date: 2026-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -364,6 +364,7 @@ files:
364
364
  - lib/omnizip/crypto/aes256/cipher.rb
365
365
  - lib/omnizip/crypto/aes256/constants.rb
366
366
  - lib/omnizip/crypto/aes256/key_derivation.rb
367
+ - lib/omnizip/entry.rb
367
368
  - lib/omnizip/error.rb
368
369
  - lib/omnizip/eta.rb
369
370
  - lib/omnizip/eta/exponential_smoothing_estimator.rb
@@ -397,12 +398,8 @@ files:
397
398
  - lib/omnizip/filters/bcj_sparc.rb
398
399
  - lib/omnizip/filters/bcj_x86.rb
399
400
  - lib/omnizip/filters/delta.rb
400
- - lib/omnizip/filters/filter_base.rb
401
- - lib/omnizip/filters/registration.rb
402
- - lib/omnizip/filters/registry.rb
403
401
  - lib/omnizip/filters/xz_delta.rb
404
402
  - lib/omnizip/format_detector.rb
405
- - lib/omnizip/format_registry.rb
406
403
  - lib/omnizip/formats.rb
407
404
  - lib/omnizip/formats/.keep
408
405
  - lib/omnizip/formats/bzip2_file.rb
@@ -630,6 +627,7 @@ files:
630
627
  - lib/omnizip/models/split_options.rb
631
628
  - lib/omnizip/optimization_registry.rb
632
629
  - lib/omnizip/parallel.rb
630
+ - lib/omnizip/parallel/engine.rb
633
631
  - lib/omnizip/parallel/job_queue.rb
634
632
  - lib/omnizip/parallel/job_scheduler.rb
635
633
  - lib/omnizip/parallel/parallel_compressor.rb
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # FilterBase is a historical alias for Omnizip::Filter. New code should
4
- # inherit from Omnizip::Filter directly; FilterBase is kept for
5
- # backward compatibility with existing subclasses (BcjX86, BcjArm, …).
6
- Omnizip::Filters::FilterBase = Omnizip::Filter
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Filter registration - triggers autoload and registers all filters
4
- # This file should be required after filters.rb which sets up autoloads
5
-
6
- module Omnizip
7
- module Filters
8
- # Touch constants to trigger autoload
9
- BCJ
10
- BcjX86
11
- Bcj2
12
- BcjArm
13
- BcjArm64
14
- BcjPpc
15
- BcjSparc
16
- BcjIa64
17
- Delta
18
- end
19
- end
20
-
21
- # Filter registration is handled by each filter class in their initialize methods
22
- # via FilterRegistry.register calls
@@ -1,111 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #
4
- # Copyright (C) 2024 Ribose Inc.
5
- #
6
- # This file is part of Omnizip.
7
- #
8
- # Omnizip is a pure Ruby port of 7-Zip compression algorithms.
9
- # Based on the 7-Zip LZMA SDK by Igor Pavlov.
10
- #
11
- # This library is free software; you can redistribute it and/or
12
- # modify it under the terms of the GNU Lesser General Public
13
- # License as published by the Free Software Foundation; either
14
- # version 2.1 of the License, or (at your option) any later version.
15
- #
16
- # See the COPYING file for the complete text of the license.
17
- #
18
-
19
- module Omnizip
20
- module Filters
21
- # Registry for auto-registering all preprocessing filters.
22
- #
23
- # This module centralizes filter registration, ensuring all filters
24
- # are properly registered with their supported formats.
25
- module Registry
26
- # Register all BCJ filters with appropriate format support.
27
- #
28
- # BCJ filters are architecture-specific filters for executable code.
29
- # XZ format supports a subset of architectures (no ARM64),
30
- # while 7z supports all.
31
- #
32
- # @return [void]
33
- def self.register_bcj_filters
34
- # Individual BCJ architecture filters (use hyphens to match existing convention)
35
- register_bcj_filter(:"bcj-x86", BcjX86, architecture: :x86)
36
- register_bcj_filter(:"bcj-arm", BcjArm, architecture: :arm)
37
- register_bcj_filter(:"bcj-arm64", BcjArm64, architecture: :arm64,
38
- xz_supported: false)
39
- register_bcj_filter(:"bcj-ia64", BcjIa64, architecture: :ia64)
40
- register_bcj_filter(:"bcj-ppc", BcjPpc, architecture: :powerpc)
41
- register_bcj_filter(:"bcj-sparc", BcjSparc, architecture: :sparc)
42
-
43
- # Unified BCJ filter (Task 2) - supports all architectures
44
- # Note: We register it as 'bcj' without architecture suffix
45
- Omnizip::FilterRegistry.register_with_formats(
46
- :bcj,
47
- Omnizip::Filters::BCJ,
48
- formats: [:seven_zip], # Only 7z for now (uses architecture parameter)
49
- )
50
- end
51
-
52
- # Register a BCJ filter with format support.
53
- #
54
- # @param name [Symbol] Filter name identifier
55
- # @param filter_class [Class] Filter class to register
56
- # @param architecture [Symbol] Target architecture
57
- # @param xz_supported [Boolean] Whether XZ format supports this architecture
58
- # @return [void]
59
- def self.register_bcj_filter(name, filter_class, architecture:,
60
- xz_supported: true)
61
- formats = [:seven_zip]
62
- formats << :xz if xz_supported
63
- Omnizip::FilterRegistry.register_with_formats(name, filter_class,
64
- formats: formats)
65
- end
66
-
67
- # Register Delta filter.
68
- #
69
- # Delta filter is supported by both XZ and 7z formats.
70
- #
71
- # @return [void]
72
- def self.register_delta_filter
73
- Omnizip::FilterRegistry.register_with_formats(
74
- :delta,
75
- Delta,
76
- formats: %i[seven_zip xz],
77
- )
78
- end
79
-
80
- # Register BCJ2 filter.
81
- #
82
- # BCJ2 is a 4-stream variant of BCJ, primarily used by 7z.
83
- # XZ does not support BCJ2.
84
- #
85
- # @return [void]
86
- def self.register_bcj2_filter
87
- Omnizip::FilterRegistry.register_with_formats(
88
- :bcj2,
89
- Bcj2,
90
- formats: [:seven_zip], # Only 7z supports BCJ2
91
- )
92
- end
93
-
94
- # Register all filters.
95
- #
96
- # This method registers all available filters with their
97
- # appropriate format support. Call this during application
98
- # initialization to ensure all filters are available.
99
- #
100
- # @return [void]
101
- def self.register_all
102
- register_bcj_filters
103
- register_delta_filter
104
- register_bcj2_filter
105
- end
106
- end
107
- end
108
- end
109
-
110
- # Auto-register all filters on load
111
- Omnizip::Filters::Registry.register_all