omnizip 0.3.52 → 0.3.53
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -0
- data/lib/omnizip/archive_handlers/zip_handler.rb +1 -1
- data/lib/omnizip/buffer/memory_extractor.rb +3 -16
- data/lib/omnizip/buffer/seven_zip_bridge.rb +13 -0
- data/lib/omnizip/buffer.rb +23 -21
- data/lib/omnizip/checksums/verifier.rb +2 -2
- data/lib/omnizip/chunked.rb +14 -21
- data/lib/omnizip/formats/cpio/reader.rb +1 -1
- data/lib/omnizip/formats/iso/reader.rb +3 -3
- data/lib/omnizip/formats/iso/volume_descriptor.rb +2 -2
- data/lib/omnizip/formats/rar/compression/ppmd/decoder.rb +0 -20
- data/lib/omnizip/formats/rar/decompressor.rb +7 -7
- data/lib/omnizip/formats/rar/reader.rb +2 -2
- data/lib/omnizip/formats/rpm.rb +4 -4
- data/lib/omnizip/formats/seven_zip/reader.rb +1 -1
- data/lib/omnizip/formats/seven_zip/split_archive_reader.rb +1 -1
- data/lib/omnizip/formats/xar/reader.rb +2 -2
- data/lib/omnizip/formats/zip/reader.rb +96 -8
- data/lib/omnizip/models/conversion_result.rb +75 -63
- data/lib/omnizip/models/filter_config.rb +34 -44
- data/lib/omnizip/models/match_result.rb +35 -18
- data/lib/omnizip/models/optimization_suggestion.rb +45 -41
- data/lib/omnizip/models/performance_result.rb +53 -47
- data/lib/omnizip/models/profile_report.rb +70 -36
- data/lib/omnizip/parallel/parallel_extractor.rb +2 -2
- data/lib/omnizip/parallel/worker_pool.rb +3 -3
- data/lib/omnizip/profiler/report_generator.rb +1 -1
- data/lib/omnizip/version.rb +1 -1
- data/lib/omnizip/zip/file.rb +1 -1
- metadata +1 -1
|
@@ -1,26 +1,65 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
3
5
|
module Omnizip
|
|
4
6
|
module Models
|
|
5
|
-
#
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
# Aggregated profiling report with hot path analysis.
|
|
8
|
+
#
|
|
9
|
+
# Serialized via lutaml-model — no hand-rolled +to_h+ / +to_json+.
|
|
10
|
+
# The +summary+ key serializes a nested Summary model built from
|
|
11
|
+
# the report's aggregates; hot paths and bottlenecks are the
|
|
12
|
+
# analyzer-supplied hashes.
|
|
13
|
+
class ProfileReport < Lutaml::Model::Serializable
|
|
14
|
+
# Aggregate block of {ProfileReport#to_hash}.
|
|
15
|
+
class Summary < Lutaml::Model::Serializable
|
|
16
|
+
attribute :total_execution_time, :double, default: 0.0
|
|
17
|
+
attribute :total_memory_allocated, :integer, default: 0
|
|
18
|
+
attribute :total_gc_runs, :integer, default: 0
|
|
19
|
+
attribute :operation_count, :integer, default: 0
|
|
20
|
+
|
|
21
|
+
key_value do
|
|
22
|
+
map "total_execution_time", to: :total_execution_time,
|
|
23
|
+
render_default: true, render_nil: true
|
|
24
|
+
map "total_memory_allocated", to: :total_memory_allocated,
|
|
25
|
+
render_default: true, render_nil: true
|
|
26
|
+
map "total_gc_runs", to: :total_gc_runs,
|
|
27
|
+
render_default: true, render_nil: true
|
|
28
|
+
map "operation_count", to: :operation_count,
|
|
29
|
+
render_default: true, render_nil: true
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
attribute :profile_name, :string
|
|
34
|
+
attribute :results, PerformanceResult, collection: true, default: []
|
|
35
|
+
attribute :hot_paths, :hash, collection: true, default: []
|
|
36
|
+
attribute :bottlenecks, :hash, collection: true, default: []
|
|
37
|
+
attribute :timestamp, :date_time, default: -> { Time.now }
|
|
38
|
+
attribute :metadata, :hash, default: {}
|
|
39
|
+
attribute :summary, Summary, method: :build_summary
|
|
40
|
+
|
|
41
|
+
key_value do
|
|
42
|
+
map "profile_name", to: :profile_name,
|
|
43
|
+
render_default: true, render_nil: true
|
|
44
|
+
map "timestamp", to: :timestamp,
|
|
45
|
+
render_default: true, render_nil: true
|
|
46
|
+
map "summary", to: :summary,
|
|
47
|
+
render_default: true, render_nil: true
|
|
48
|
+
map "results", to: :results,
|
|
49
|
+
render_default: true, render_nil: true
|
|
50
|
+
map "hot_paths", to: :hot_paths,
|
|
51
|
+
render_default: true, render_nil: true
|
|
52
|
+
map "bottlenecks", to: :bottlenecks,
|
|
53
|
+
render_default: true, render_nil: true
|
|
54
|
+
map "metadata", to: :metadata,
|
|
55
|
+
render_default: true, render_nil: true
|
|
56
|
+
end
|
|
9
57
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
hot_paths: [],
|
|
14
|
-
|
|
15
|
-
timestamp: Time.now,
|
|
16
|
-
metadata: {}
|
|
17
|
-
)
|
|
18
|
-
@profile_name = profile_name
|
|
19
|
-
@results = results
|
|
20
|
-
@hot_paths = hot_paths
|
|
21
|
-
@bottlenecks = bottlenecks
|
|
22
|
-
@timestamp = timestamp
|
|
23
|
-
@metadata = metadata
|
|
58
|
+
# lutaml-model 0.8.x does not render empty-collection defaults,
|
|
59
|
+
# so they are assigned explicitly to keep every key present.
|
|
60
|
+
def initialize(attrs = {})
|
|
61
|
+
super({ results: [], hot_paths: [], bottlenecks: [],
|
|
62
|
+
metadata: {} }.merge(attrs))
|
|
24
63
|
end
|
|
25
64
|
|
|
26
65
|
def total_execution_time
|
|
@@ -50,32 +89,27 @@ module Omnizip
|
|
|
50
89
|
end
|
|
51
90
|
|
|
52
91
|
def add_result(result)
|
|
53
|
-
|
|
92
|
+
results << result
|
|
54
93
|
end
|
|
55
94
|
|
|
56
95
|
def add_hot_path(hot_path)
|
|
57
|
-
|
|
96
|
+
hot_paths << hot_path
|
|
58
97
|
end
|
|
59
98
|
|
|
60
99
|
def add_bottleneck(bottleneck)
|
|
61
|
-
|
|
100
|
+
bottlenecks << bottleneck
|
|
62
101
|
end
|
|
63
102
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
results: results.map(&:to_h),
|
|
75
|
-
hot_paths: hot_paths,
|
|
76
|
-
bottlenecks: bottlenecks,
|
|
77
|
-
metadata: metadata,
|
|
78
|
-
}
|
|
103
|
+
# Serialized aggregate block.
|
|
104
|
+
#
|
|
105
|
+
# @return [Summary]
|
|
106
|
+
def build_summary
|
|
107
|
+
Summary.new(
|
|
108
|
+
total_execution_time: total_execution_time,
|
|
109
|
+
total_memory_allocated: total_memory_allocated,
|
|
110
|
+
total_gc_runs: total_gc_runs,
|
|
111
|
+
operation_count: results.size,
|
|
112
|
+
)
|
|
79
113
|
end
|
|
80
114
|
end
|
|
81
115
|
end
|
|
@@ -87,7 +87,7 @@ module Omnizip
|
|
|
87
87
|
::File.open(archive_path, "rb") do |io|
|
|
88
88
|
# Find the entry in reader
|
|
89
89
|
reader_entry = reader.entries.find { |e| e.filename == entry.name }
|
|
90
|
-
raise "Entry not found in archive: #{entry.name}" unless reader_entry
|
|
90
|
+
raise Errno::ENOENT, "Entry not found in archive: #{entry.name}" unless reader_entry
|
|
91
91
|
|
|
92
92
|
# Seek to entry data
|
|
93
93
|
io.seek(reader_entry.local_header_offset, ::IO::SEEK_SET)
|
|
@@ -288,7 +288,7 @@ module Omnizip
|
|
|
288
288
|
@write_mutex.synchronize do
|
|
289
289
|
# Check if file exists
|
|
290
290
|
if ::File.exist?(dest_path) && !overwrite
|
|
291
|
-
raise "File exists: #{dest_path}"
|
|
291
|
+
raise Errno::EEXIST, "File exists: #{dest_path}"
|
|
292
292
|
end
|
|
293
293
|
|
|
294
294
|
# Write file or create directory
|
|
@@ -93,7 +93,7 @@ module Omnizip
|
|
|
93
93
|
# @param work [Fractor::Work] work item to process
|
|
94
94
|
# @return [void]
|
|
95
95
|
def submit(work)
|
|
96
|
-
raise "Worker pool not started" unless @running
|
|
96
|
+
raise Omnizip::IOError, "Worker pool not started" unless @running
|
|
97
97
|
|
|
98
98
|
if @continuous
|
|
99
99
|
# In continuous mode, add to work queue
|
|
@@ -116,8 +116,8 @@ module Omnizip
|
|
|
116
116
|
#
|
|
117
117
|
# @return [void]
|
|
118
118
|
def run
|
|
119
|
-
raise "Can only run in batch mode" if @continuous
|
|
120
|
-
raise "Worker pool not started" unless @running
|
|
119
|
+
raise Omnizip::IOError, "Can only run in batch mode" if @continuous
|
|
120
|
+
raise Omnizip::IOError, "Worker pool not started" unless @running
|
|
121
121
|
|
|
122
122
|
@supervisor.run
|
|
123
123
|
|
data/lib/omnizip/version.rb
CHANGED
data/lib/omnizip/zip/file.rb
CHANGED
|
@@ -402,7 +402,7 @@ module Omnizip
|
|
|
402
402
|
::File.open(@name, "rb") do |io|
|
|
403
403
|
# Find the entry in reader
|
|
404
404
|
reader_entry = @reader.entries.find { |e| e.filename == entry.name }
|
|
405
|
-
raise "Entry not found in archive: #{entry.name}" unless reader_entry
|
|
405
|
+
raise Errno::ENOENT, "Entry not found in archive: #{entry.name}" unless reader_entry
|
|
406
406
|
|
|
407
407
|
# Extract just the data
|
|
408
408
|
io.seek(reader_entry.local_header_offset, ::IO::SEEK_SET)
|