ruby-zstds 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +57 -149
- data/ext/extconf.rb +7 -0
- data/lib/zstds/option.rb +2 -3
- data/lib/zstds/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f277f0e51b0f8328d440a5f42f4834026c188f665eae60949645222cb73a23a
|
4
|
+
data.tar.gz: 0d7dffc0a3a026ecc4f3d97d060b43e3e701d5f1cabc53c9694a276eccad2199
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 652c9cc07c28459b47d16efa85aabb46bce2c5e35e440243aba73092ee3058e48cbcb0349179796cb041343f4c80cf2918101f6881b08b17c9922cf4dc64ce01
|
7
|
+
data.tar.gz: e1b3e5fd27512a02561ad61aff70983a42ef37e86293cb75365aa39174139f37a163ac51030ef9ebec721746f6bf39114e4a8db1c851a7207bed90c2ecf092ce
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Ruby bindings for zstd library
|
2
2
|
|
3
|
-
| Travis | AppVeyor |
|
4
|
-
| :---: | :---: | :---: | :---:
|
5
|
-
| [![Travis test status](https://travis-ci.com/andrew-aladev/ruby-zstds.svg?branch=master)](https://travis-ci.com/andrew-aladev/ruby-zstds) | [![AppVeyor test status](https://ci.appveyor.com/api/projects/status/github/andrew-aladev/ruby-zstds?branch=master&svg=true)](https://ci.appveyor.com/project/andrew-aladev/ruby-zstds/branch/master) | [![
|
3
|
+
| Travis | AppVeyor | Circle | Codecov |
|
4
|
+
| :---: | :---: | :---: | :---: |
|
5
|
+
| [![Travis test status](https://travis-ci.com/andrew-aladev/ruby-zstds.svg?branch=master)](https://travis-ci.com/andrew-aladev/ruby-zstds) | [![AppVeyor test status](https://ci.appveyor.com/api/projects/status/github/andrew-aladev/ruby-zstds?branch=master&svg=true)](https://ci.appveyor.com/project/andrew-aladev/ruby-zstds/branch/master) | [![Circle test status](https://circleci.com/gh/andrew-aladev/ruby-zstds/tree/master.svg?style=shield)](https://circleci.com/gh/andrew-aladev/ruby-zstds/tree/master) | [![Codecov](https://codecov.io/gh/andrew-aladev/ruby-zstds/branch/master/graph/badge.svg)](https://codecov.io/gh/andrew-aladev/ruby-zstds) |
|
6
6
|
|
7
7
|
See [zstd library](https://github.com/facebook/zstd).
|
8
8
|
|
@@ -21,6 +21,8 @@ rake gem
|
|
21
21
|
gem install pkg/ruby-zstds-*.gem
|
22
22
|
```
|
23
23
|
|
24
|
+
You can also use [overlay](https://github.com/andrew-aladev/overlay) for gentoo.
|
25
|
+
|
24
26
|
## Usage
|
25
27
|
|
26
28
|
There are simple APIs: `String` and `File`. Also you can use generic streaming API: `Stream::Writer` and `Stream::Reader`.
|
@@ -101,158 +103,64 @@ end
|
|
101
103
|
|
102
104
|
## Options
|
103
105
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
106
|
+
| Option | Values | Default | Description |
|
107
|
+
|---------------------------------|------------------|--------------|-------------|
|
108
|
+
| `source_buffer_length` | `0 - inf` | `0 (auto)` | internal buffer length for source data |
|
109
|
+
| `destination_buffer_length` | `0 - inf` | `0 (auto)` | internal buffer length for description data |
|
110
|
+
| `compression_level` | `-131072 - 22` | `0 (auto)` | compression level |
|
111
|
+
| `window_log` | `10 - 31` | `0 (auto)` | maximum back-reference distance (power of 2) |
|
112
|
+
| `hash_log` | `6 - 30` | `0 (auto)` | size of the initial probe table (power of 2) |
|
113
|
+
| `chain_log` | `6 - 30` | `0 (auto)` | size of the multi-probe search table (power of 2) |
|
114
|
+
| `search_log` | `1 - 30` | `0 (auto)` | number of search attempts (power of 2) |
|
115
|
+
| `min_match` | `3 - 7` | `0 (auto)` | minimum size of searched matches |
|
116
|
+
| `target_length` | `0 - 131072` | `0 (auto)` | distance between match sampling (for `:fast` strategy), length of match considered "good enough" for (for other strategies) |
|
117
|
+
| `strategy` | `STRATEGIES` | `nil (auto)` | choses strategy |
|
118
|
+
| `enable_long_distance_matching` | `true/false` | `nil (auto)` | enables long distance matching |
|
119
|
+
| `ldm_hash_log` | `6 - 30` | `0 (auto)` | size of the table for long distance matching (power of 2) |
|
120
|
+
| `ldm_min_match` | `4 - 4096` | `0 (auto)` | minimum match size for long distance matcher |
|
121
|
+
| `ldm_bucket_size_log` | `1 - 8` | `0 (auto)` | log size of each bucket in the LDM hash table for collision resolution |
|
122
|
+
| `ldm_hash_rate_log` | `0 - 25` | `0 (auto)` | frequency of inserting/looking up entries into the LDM hash table |
|
123
|
+
| `content_size_flag` | `true/false` | `true` | enables writing of content size into frame header (if known) |
|
124
|
+
| `checksum_flag` | `true/false` | `false` | enables writing of 32-bits checksum of content at end of frame |
|
125
|
+
| `dict_id_flag` | `true/false` | `true` | enables writing of dictionary id into frame header |
|
126
|
+
| `nb_workers` | `0 - 200` | `0 (auto)` | number of threads spawned in parallel |
|
127
|
+
| `job_size` | `0 - 1073741824` | `0 (auto)` | size of job (nb_workers >= 1) |
|
128
|
+
| `overlap_log` | `0 - 9` | `0 (auto)` | overlap size, as a fraction of window size |
|
129
|
+
| `window_log_max` | `10 - 31` | `0 (auto)` | size limit (power of 2) |
|
130
|
+
| `dictionary` | `Dictionary` | `nil` | chose dictionary |
|
131
|
+
| `pledged_size` | `0 - inf` | `0 (auto)` | size of input (if known) |
|
110
132
|
|
111
133
|
There are internal buffers for compressed and decompressed data.
|
112
|
-
For example you want to use 1 KB as
|
113
|
-
You want to use 256 B as
|
114
|
-
|
115
|
-
Values: 0 - infinity, default value: 0.
|
116
|
-
0 means automatic buffer length selection.
|
117
|
-
|
118
|
-
```
|
119
|
-
:compression_level
|
120
|
-
```
|
121
|
-
|
122
|
-
Values: `ZSTDS::Option::MIN_COMPRESSION_LEVEL` - `ZSTDS::Option::MAX_COMPRESSION_LEVEL`, default value: `0`.
|
123
|
-
|
124
|
-
```
|
125
|
-
:window_log
|
126
|
-
```
|
127
|
-
|
128
|
-
Values: `ZSTDS::Option::MIN_WINDOW_LOG` - `ZSTDS::Option::MAX_WINDOW_LOG`, default value: `0`.
|
129
|
-
|
130
|
-
```
|
131
|
-
:hash_log
|
132
|
-
```
|
133
|
-
|
134
|
-
Values: `ZSTDS::Option::MIN_HASH_LOG` - `ZSTDS::Option::MAX_HASH_LOG`, default value: `0`.
|
135
|
-
|
136
|
-
```
|
137
|
-
:chain_log
|
138
|
-
```
|
139
|
-
|
140
|
-
Values: `ZSTDS::Option::MIN_CHAIN_LOG` - `ZSTDS::Option::MAX_CHAIN_LOG`, default value: `0`.
|
141
|
-
|
142
|
-
```
|
143
|
-
:search_log
|
144
|
-
```
|
145
|
-
|
146
|
-
Values: `ZSTDS::Option::MIN_SEARCH_LOG` - `ZSTDS::Option::MAX_SEARCH_LOG`, default value: `0`.
|
147
|
-
|
148
|
-
```
|
149
|
-
:min_match
|
150
|
-
```
|
151
|
-
|
152
|
-
Values: `ZSTDS::Option::MIN_MIN_MATCH` - `ZSTDS::Option::MAX_MIN_MATCH`, default value: `0`.
|
153
|
-
|
154
|
-
```
|
155
|
-
:target_length
|
156
|
-
```
|
157
|
-
|
158
|
-
Values: `ZSTDS::Option::MIN_TARGET_LENGTH` - `ZSTDS::Option::MAX_TARGET_LENGTH`, default value: `0`.
|
159
|
-
|
160
|
-
```
|
161
|
-
:strategy
|
162
|
-
```
|
163
|
-
|
164
|
-
Values: `ZSTDS::Option::STRATEGIES`, default value: none.
|
165
|
-
|
166
|
-
```
|
167
|
-
:enable_long_distance_matching
|
168
|
-
```
|
169
|
-
|
170
|
-
Values: true/false, default value: none.
|
171
|
-
|
172
|
-
```
|
173
|
-
:ldm_hash_log
|
174
|
-
```
|
175
|
-
|
176
|
-
Values: `ZSTDS::Option::MIN_LDM_HASH_LOG` - `ZSTDS::Option::MAX_LDM_HASH_LOG`, default value: `0`.
|
177
|
-
|
178
|
-
```
|
179
|
-
:ldm_min_match
|
180
|
-
```
|
134
|
+
For example you want to use 1 KB as `source_buffer_length` for compressor - please use 256 B as `destination_buffer_length`.
|
135
|
+
You want to use 256 B as `source_buffer_length` for decompressor - please use 1 KB as `destination_buffer_length`.
|
181
136
|
|
182
|
-
Values: `ZSTDS::Option::MIN_LDM_MIN_MATCH` - `ZSTDS::Option::MAX_LDM_MIN_MATCH`, default value: `0`.
|
183
|
-
|
184
|
-
```
|
185
|
-
:ldm_bucket_size_log
|
186
|
-
```
|
187
|
-
|
188
|
-
Values: `ZSTDS::Option::MIN_LDM_BUCKET_SIZE_LOG` - `ZSTDS::Option::MAX_LDM_BUCKET_SIZE_LOG`, default value: `0`.
|
189
|
-
|
190
|
-
```
|
191
|
-
:ldm_hash_rate_log
|
192
|
-
```
|
193
|
-
|
194
|
-
Values: `ZSTDS::Option::MIN_LDM_HASH_RATE_LOG` - `ZSTDS::Option::MAX_LDM_HASH_RATE_LOG`, default value: `0`.
|
195
|
-
|
196
|
-
```
|
197
|
-
:content_size_flag
|
198
|
-
```
|
199
|
-
|
200
|
-
Values: true/false, default value: true.
|
201
|
-
|
202
|
-
```
|
203
|
-
:checksum_flag
|
204
|
-
```
|
205
|
-
|
206
|
-
Values: true/false, default value: false.
|
207
|
-
|
208
|
-
```
|
209
|
-
:dict_id_flag
|
210
|
-
```
|
211
|
-
|
212
|
-
Values: true/false, default value: true.
|
213
|
-
|
214
|
-
```
|
215
|
-
:nb_workers
|
216
|
-
```
|
217
|
-
|
218
|
-
Values: `ZSTDS::Option::MIN_NB_WORKERS` - `ZSTDS::Option::MAX_NB_WORKERS`, default value: `0`.
|
219
|
-
|
220
|
-
```
|
221
|
-
:job_size
|
222
|
-
```
|
223
|
-
|
224
|
-
Values: `ZSTDS::Option::MIN_JOB_SIZE` - `ZSTDS::Option::MAX_JOB_SIZE`, default value: `0`.
|
225
|
-
|
226
|
-
```
|
227
|
-
:overlap_log
|
228
|
-
```
|
229
|
-
|
230
|
-
Values: `ZSTDS::Option::MIN_OVERLAP_LOG` - `ZSTDS::Option::MAX_OVERLAP_LOG`, default value: `0`.
|
231
|
-
|
232
|
-
```
|
233
|
-
:window_log_max
|
234
|
-
```
|
235
|
-
|
236
|
-
Values: `ZSTDS::Option::MIN_WINDOW_LOG_MAX` - `ZSTDS::Option::MAX_WINDOW_LOG_MAX`, default value: `0`.
|
237
|
-
|
238
|
-
```
|
239
|
-
:dictionary
|
240
|
-
```
|
241
|
-
|
242
|
-
Special option for dictionary, default value: none.
|
243
|
-
|
244
|
-
```
|
245
|
-
:pledged_size
|
246
|
-
```
|
247
|
-
|
248
|
-
Values: 0 - infinity, default value: 0.
|
249
|
-
It is reasonable to provide size of input (if known) for streaming api.
|
250
137
|
`String` and `File` will set `:pledged_size` automaticaly.
|
251
138
|
|
252
|
-
|
139
|
+
You can also read zstd docs for more info about options.
|
140
|
+
|
141
|
+
| Option | Related constants |
|
142
|
+
|-----------------------|-------------------|
|
143
|
+
| `compression_level` | `ZSTDS::Option::MIN_COMPRESSION_LEVEL = -131072`, `ZSTDS::Option::MAX_COMPRESSION_LEVEL = 22` |
|
144
|
+
| `window_log` | `ZSTDS::Option::MIN_WINDOW_LOG = 10`, `ZSTDS::Option::MAX_WINDOW_LOG = 31` |
|
145
|
+
| `hash_log` | `ZSTDS::Option::MIN_HASH_LOG = 6`, `ZSTDS::Option::MAX_HASH_LOG = 30` |
|
146
|
+
| `chain_log` | `ZSTDS::Option::MIN_CHAIN_LOG = 6`, `ZSTDS::Option::MAX_CHAIN_LOG = 30` |
|
147
|
+
| `search_log` | `ZSTDS::Option::MIN_SEARCH_LOG = 1`, `ZSTDS::Option::MAX_SEARCH_LOG = 30` |
|
148
|
+
| `min_match` | `ZSTDS::Option::MIN_MIN_MATCH = 3`, `ZSTDS::Option::MAX_MIN_MATCH = 7` |
|
149
|
+
| `target_length` | `ZSTDS::Option::MIN_TARGET_LENGTH = 0`, `ZSTDS::Option::MAX_TARGET_LENGTH = 131072` |
|
150
|
+
| `strategy` | `ZSTDS::Option::STRATEGIES = %i[fast dfast greedy lazy lazy2 btlazy2 btopt btultra btultra2]` |
|
151
|
+
| `ldm_hash_log` | `ZSTDS::Option::MIN_LDM_HASH_LOG = 6`, `ZSTDS::Option::MAX_LDM_HASH_LOG = 30` |
|
152
|
+
| `ldm_min_match` | `ZSTDS::Option::MIN_LDM_MIN_MATCH = 4`, `ZSTDS::Option::MAX_LDM_MIN_MATCH = 4096` |
|
153
|
+
| `ldm_bucket_size_log` | `ZSTDS::Option::MIN_LDM_BUCKET_SIZE_LOG = 1`, `ZSTDS::Option::MAX_LDM_BUCKET_SIZE_LOG = 8` |
|
154
|
+
| `ldm_hash_rate_log` | `ZSTDS::Option::MIN_LDM_HASH_RATE_LOG = 0`, `ZSTDS::Option::MAX_LDM_HASH_RATE_LOG = 25` |
|
155
|
+
| `nb_workers` | `ZSTDS::Option::MIN_NB_WORKERS = 0`, `ZSTDS::Option::MAX_NB_WORKERS = 200` |
|
156
|
+
| `job_size` | `ZSTDS::Option::MIN_JOB_SIZE = 0`, `ZSTDS::Option::MAX_JOB_SIZE = 1073741824` |
|
157
|
+
| `overlap_log` | `ZSTDS::Option::MIN_OVERLAP_LOG = 0`, `ZSTDS::Option::MAX_OVERLAP_LOG = 9` |
|
158
|
+
| `window_log_max` | `ZSTDS::Option::MIN_WINDOW_LOG_MAX = 10`, `ZSTDS::Option::MAX_WINDOW_LOG_MAX = 31` |
|
253
159
|
|
254
160
|
Possible compressor options:
|
255
161
|
```
|
162
|
+
:source_buffer_length
|
163
|
+
:destination_buffer_length
|
256
164
|
:compression_level
|
257
165
|
:window_log
|
258
166
|
:hash_log
|
@@ -278,6 +186,8 @@ Possible compressor options:
|
|
278
186
|
|
279
187
|
Possible decompressor options:
|
280
188
|
```
|
189
|
+
:source_buffer_length
|
190
|
+
:destination_buffer_length
|
281
191
|
:window_log_max
|
282
192
|
:dictionary
|
283
193
|
```
|
@@ -514,8 +424,6 @@ See universal test script [scripts/ci_test.sh](scripts/ci_test.sh) for CI.
|
|
514
424
|
Please visit [scripts/test-images](scripts/test-images).
|
515
425
|
You can run this test script using many native and cross images.
|
516
426
|
|
517
|
-
Cirrus CI uses `x86_64-pc-linux-gnu` image, Circle CI - `x86_64-gentoo-linux-musl` image.
|
518
|
-
|
519
427
|
## License
|
520
428
|
|
521
429
|
MIT license, see LICENSE and AUTHORS.
|
data/ext/extconf.rb
CHANGED
@@ -75,6 +75,13 @@ $srcs = %w[
|
|
75
75
|
.map { |name| "src/#{extension_name}/#{name}.c" }
|
76
76
|
.freeze
|
77
77
|
|
78
|
+
# Removing library duplicates.
|
79
|
+
$libs = $libs.split(%r{\s})
|
80
|
+
.reject(&:empty?)
|
81
|
+
.sort
|
82
|
+
.uniq
|
83
|
+
.join " "
|
84
|
+
|
78
85
|
if ENV["CI"] || ENV["COVERAGE"]
|
79
86
|
$CFLAGS << " --coverage"
|
80
87
|
$LDFLAGS << " --coverage"
|
data/lib/zstds/option.rb
CHANGED
@@ -166,9 +166,8 @@ module ZSTDS
|
|
166
166
|
end
|
167
167
|
|
168
168
|
dictionary = options[:dictionary]
|
169
|
-
|
170
|
-
|
171
|
-
end
|
169
|
+
raise ValidateError, "invalid dictionary" unless
|
170
|
+
dictionary.nil? || dictionary.is_a?(Dictionary)
|
172
171
|
|
173
172
|
options
|
174
173
|
end
|
data/lib/zstds/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-zstds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Aladjev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: codecov
|
@@ -194,9 +194,9 @@ require_paths:
|
|
194
194
|
- lib
|
195
195
|
required_ruby_version: !ruby/object:Gem::Requirement
|
196
196
|
requirements:
|
197
|
-
- - "
|
197
|
+
- - "~>"
|
198
198
|
- !ruby/object:Gem::Version
|
199
|
-
version: '
|
199
|
+
version: '2.7'
|
200
200
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
201
201
|
requirements:
|
202
202
|
- - ">="
|