paquito 0.9.0 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +18 -12
- data/README.md +12 -0
- data/benchmark/flat-entry-coder.rb +1 -1
- data/lib/paquito/single_byte_prefix_version_with_string_bypass.rb +14 -6
- data/lib/paquito/translate_errors.rb +1 -1
- data/lib/paquito/types/active_record_packer.rb +1 -1
- data/lib/paquito/types.rb +2 -2
- data/lib/paquito/version.rb +1 -1
- data/lib/paquito.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beedd98334166781382fbe4d773b19f27e58ea8cfe8c83fa211c745c7c752deb
|
4
|
+
data.tar.gz: 2912c724ee66b3b9547477e56aeb2bc1a0622128c41bf06b0be221c54eb0e8b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba2c02fa73d7b1a27577e36c8f8e2a2ea73a57446939e0519ea3d1fbd1ababf6af4c0bdda47bfba074ce0af60ae0269c8ea838abcb5ad0cba75a5d2f81848297
|
7
|
+
data.tar.gz: fb527d860bfd14dd71c42c75320fd694ad1335ca4e21b7edacf798612b55125bd19d1a5bf7126f8e4770ad0b68c448d003fe8fad450b7686d7e8a97ad4921dbb
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
+
|
4
|
+
# 0.9.2
|
5
|
+
|
6
|
+
* Support cast of coder in translate errors. (#24)
|
7
|
+
|
8
|
+
# 0.9.1
|
9
|
+
|
10
|
+
* Fix a bug when handle `compress / decompress` coders. (#23)
|
11
|
+
* `SingleBytePrefixVersionWithStringBypass` accepts another coder for strings.
|
12
|
+
|
3
13
|
# 0.9.0
|
4
14
|
|
5
15
|
* Handle `compress / decompress` coders (#22)
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
paquito (0.9.
|
4
|
+
paquito (0.9.2)
|
5
5
|
msgpack (>= 1.5.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -23,34 +23,40 @@ GEM
|
|
23
23
|
concurrent-ruby (1.1.10)
|
24
24
|
i18n (1.12.0)
|
25
25
|
concurrent-ruby (~> 1.0)
|
26
|
+
json (2.6.3)
|
27
|
+
mini_portile2 (2.8.0)
|
26
28
|
minitest (5.16.3)
|
27
29
|
msgpack (1.6.0)
|
28
30
|
parallel (1.22.1)
|
29
|
-
parser (3.1.
|
31
|
+
parser (3.1.3.0)
|
30
32
|
ast (~> 2.4.1)
|
31
33
|
rainbow (3.1.1)
|
32
34
|
rake (13.0.6)
|
33
|
-
regexp_parser (2.
|
35
|
+
regexp_parser (2.6.1)
|
34
36
|
rexml (3.2.5)
|
35
|
-
rubocop (1.
|
37
|
+
rubocop (1.40.0)
|
38
|
+
json (~> 2.3)
|
36
39
|
parallel (~> 1.10)
|
37
|
-
parser (>= 3.1.
|
40
|
+
parser (>= 3.1.2.1)
|
38
41
|
rainbow (>= 2.2.2, < 4.0)
|
39
42
|
regexp_parser (>= 1.8, < 3.0)
|
40
43
|
rexml (>= 3.2.5, < 4.0)
|
41
|
-
rubocop-ast (>= 1.
|
44
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
42
45
|
ruby-progressbar (~> 1.7)
|
43
46
|
unicode-display_width (>= 1.4.0, < 3.0)
|
44
|
-
rubocop-ast (1.
|
47
|
+
rubocop-ast (1.24.0)
|
45
48
|
parser (>= 3.1.1.0)
|
46
|
-
rubocop-shopify (2.
|
47
|
-
rubocop (~> 1.
|
49
|
+
rubocop-shopify (2.10.1)
|
50
|
+
rubocop (~> 1.35)
|
48
51
|
ruby-progressbar (1.11.0)
|
49
|
-
sorbet-runtime (0.5.
|
50
|
-
sqlite3 (1.
|
52
|
+
sorbet-runtime (0.5.10577)
|
53
|
+
sqlite3 (1.5.4)
|
54
|
+
mini_portile2 (~> 2.8.0)
|
55
|
+
sqlite3 (1.5.4-x86_64-darwin)
|
56
|
+
sqlite3 (1.5.4-x86_64-linux)
|
51
57
|
tzinfo (2.0.5)
|
52
58
|
concurrent-ruby (~> 1.0)
|
53
|
-
unicode-display_width (2.
|
59
|
+
unicode-display_width (2.3.0)
|
54
60
|
|
55
61
|
PLATFORMS
|
56
62
|
ruby
|
data/README.md
CHANGED
@@ -70,6 +70,18 @@ in an optimized way.
|
|
70
70
|
When the object to serialize is an `UTF-8`, `ASCII` or `BINARY` string, rather than invoking the underlying serializer, it simply
|
71
71
|
prepends a single byte to the string which indicates the encoding.
|
72
72
|
|
73
|
+
Additionally, you can pass a distinct serializer for strings only:
|
74
|
+
|
75
|
+
Example:
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
coder = Paquito::SingleBytePrefixVersion.new(
|
79
|
+
1,
|
80
|
+
{ 0 => YAML, 1 => JSON },
|
81
|
+
Paquito::ConditionalCompressor.new(Zlib, 1024), # Large strings will be compressed but not serialized in JSON.
|
82
|
+
)
|
83
|
+
```
|
84
|
+
|
73
85
|
The larger the string the larger the speed gain is, e.g. for a 1MB string, it's over 500x faster than going through `MessagePack` or `Marshal`.
|
74
86
|
|
75
87
|
### `CommentPrefixVersion`
|
@@ -6,15 +6,20 @@ module Paquito
|
|
6
6
|
BINARY_VERSION = 254
|
7
7
|
ASCII_VERSION = 253
|
8
8
|
|
9
|
+
def initialize(current_version, coders, string_coder = nil)
|
10
|
+
super(current_version, coders)
|
11
|
+
@string_coder = string_coder
|
12
|
+
end
|
13
|
+
|
9
14
|
def dump(object)
|
10
15
|
if object.class == String # We don't want to match subclasses
|
11
16
|
case object.encoding
|
12
17
|
when Encoding::UTF_8
|
13
|
-
UTF8_VERSION.chr(Encoding::BINARY) << object
|
18
|
+
UTF8_VERSION.chr(Encoding::BINARY) << (@string_coder ? @string_coder.dump(object) : object)
|
14
19
|
when Encoding::BINARY
|
15
|
-
BINARY_VERSION.chr(Encoding::BINARY) << object
|
20
|
+
BINARY_VERSION.chr(Encoding::BINARY) << (@string_coder ? @string_coder.dump(object) : object)
|
16
21
|
when Encoding::US_ASCII
|
17
|
-
ASCII_VERSION.chr(Encoding::BINARY) << object
|
22
|
+
ASCII_VERSION.chr(Encoding::BINARY) << (@string_coder ? @string_coder.dump(object) : object)
|
18
23
|
else
|
19
24
|
super
|
20
25
|
end
|
@@ -31,11 +36,14 @@ module Paquito
|
|
31
36
|
|
32
37
|
case payload_version
|
33
38
|
when UTF8_VERSION
|
34
|
-
payload.byteslice(1..-1).force_encoding(Encoding::UTF_8)
|
39
|
+
string = payload.byteslice(1..-1).force_encoding(Encoding::UTF_8)
|
40
|
+
@string_coder ? @string_coder.load(string) : string
|
35
41
|
when BINARY_VERSION
|
36
|
-
payload.byteslice(1..-1).force_encoding(Encoding::BINARY)
|
42
|
+
string = payload.byteslice(1..-1).force_encoding(Encoding::BINARY)
|
43
|
+
@string_coder ? @string_coder.load(string) : string
|
37
44
|
when ASCII_VERSION
|
38
|
-
payload.byteslice(1..-1).force_encoding(Encoding::US_ASCII)
|
45
|
+
string = payload.byteslice(1..-1).force_encoding(Encoding::US_ASCII)
|
46
|
+
@string_coder ? @string_coder.load(string) : string
|
39
47
|
else
|
40
48
|
coder = @coders.fetch(payload_version) do
|
41
49
|
raise UnsupportedCodec, "Unsupported packer version #{payload_version}"
|
data/lib/paquito/types.rb
CHANGED
@@ -217,7 +217,7 @@ module Paquito
|
|
217
217
|
factory.register_type(
|
218
218
|
type_attributes.fetch(:code),
|
219
219
|
type,
|
220
|
-
type_attributes
|
220
|
+
type_attributes,
|
221
221
|
)
|
222
222
|
end
|
223
223
|
end
|
@@ -242,7 +242,7 @@ module Paquito
|
|
242
242
|
|
243
243
|
unpacker = CustomTypesRegistry.unpacker(klass)
|
244
244
|
unpacker.call(payload)
|
245
|
-
end
|
245
|
+
end,
|
246
246
|
)
|
247
247
|
end
|
248
248
|
|
data/lib/paquito/version.rb
CHANGED
data/lib/paquito.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paquito
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-12-
|
11
|
+
date: 2022-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|