thrift-base64 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/Makefile +18 -0
- data/README.md +128 -0
- data/Rakefile +8 -0
- data/benchmark/plaintext.rb +61 -0
- data/benchmark/serialization.rb +55 -0
- data/lib/thrift/base64/version.rb +5 -0
- data/lib/thrift/base64.rb +52 -0
- data/lib/thrift-base64.rb +1 -0
- data/test/acceptance_test.rb +64 -0
- data/test/test_helper.rb +14 -0
- data/test.thrift +3 -0
- data/thrift-base64.gemspec +26 -0
- data/vendor/gen-rb/test_constants.rb +9 -0
- data/vendor/gen-rb/test_types.rb +25 -0
- metadata +119 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 90c0d60e32a5487e5b62c5b8a3b4444250d1e8a4
|
4
|
+
data.tar.gz: 5636b4ccb3c931c8ac51f8d230d668df1ab9f92a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 22d6158b32d9a19cdc56fa5399c969fcd6df0fac94478ab3214a2d00af82070834f14beadb380ce3edff8eca4ca6be3b459b32c8dcf781368342979aecb9b51a
|
7
|
+
data.tar.gz: 871a51715bb4c86d4b2706948c1e01d9b3832de89370cece4b37f1c3dc98eb266d0a5a847fb32e95030fac49b43118f968cb32f4101295abf09e68c9bf41e3ef
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 ahawkins
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Makefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
THRIFT:=vendor/gen-rb/test_types.rb
|
2
|
+
|
3
|
+
$(THRIFT): test.thrift
|
4
|
+
mkdir -p $(@D)
|
5
|
+
thrift -o vendor --gen rb test.thrift
|
6
|
+
|
7
|
+
.PHONY: test
|
8
|
+
test: $(THRIFT)
|
9
|
+
bundle exec rake test
|
10
|
+
|
11
|
+
.PHONY:
|
12
|
+
release:
|
13
|
+
bundle exec rake release
|
14
|
+
|
15
|
+
.PHONY: benchmark
|
16
|
+
benchmark: $(THRIFT)
|
17
|
+
ruby benchmark/serialization.rb
|
18
|
+
ruby benchmark/plaintext.rb
|
data/README.md
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
# thrift-base64
|
2
|
+
|
3
|
+
This gem contains helper classes for working with Base64 encoded
|
4
|
+
Thrift objects. Eventually code will need to persist a serialized
|
5
|
+
Thrift object. The binary protocols are the fastest ones.
|
6
|
+
Unfortunately binary doesn't work well with plaintext protocols.
|
7
|
+
Base64 solves this problem. It's also much faster than working with
|
8
|
+
the provided `Thrift::JSON` protocol for interlop with plaintext
|
9
|
+
protocols. Just check out the benchmarks below.
|
10
|
+
|
11
|
+
## Benchmarks
|
12
|
+
|
13
|
+
ruby benchmark/serialization.rb
|
14
|
+
Calculating -------------------------------------
|
15
|
+
JSON 739.000 i/100ms
|
16
|
+
Binary 4.532k i/100ms
|
17
|
+
Compact 7.174k i/100ms
|
18
|
+
Binary Base64 3.951k i/100ms
|
19
|
+
Compact Base64 6.660k i/100ms
|
20
|
+
-------------------------------------------------
|
21
|
+
JSON 7.369k (±16.3%) i/s - 106.416k
|
22
|
+
Binary 50.965k (± 9.8%) i/s - 756.844k
|
23
|
+
Compact 87.953k (± 8.5%) i/s - 1.313M
|
24
|
+
Binary Base64 43.881k (±10.2%) i/s - 651.915k
|
25
|
+
Compact Base64 87.340k (± 9.3%) i/s - 1.299M
|
26
|
+
|
27
|
+
Comparison:
|
28
|
+
Compact: 87953.3 i/s
|
29
|
+
Compact Base64: 87340.1 i/s - 1.01x slower
|
30
|
+
Binary: 50964.6 i/s - 1.73x slower
|
31
|
+
Binary Base64: 43880.7 i/s - 2.00x slower
|
32
|
+
JSON: 7369.0 i/s - 11.94x slower
|
33
|
+
|
34
|
+
ruby benchmark/plaintext.rb
|
35
|
+
Calculating -------------------------------------
|
36
|
+
JSON/JSON String 690.000 i/100ms
|
37
|
+
JSON/JSON Object 651.000 i/100ms
|
38
|
+
JSON/Binary 2.554k i/100ms
|
39
|
+
JSON/Compact 3.329k i/100ms
|
40
|
+
YAML/YAML String 355.000 i/100ms
|
41
|
+
YAML/Binary 575.000 i/100ms
|
42
|
+
YAML/Compact 607.000 i/100ms
|
43
|
+
-------------------------------------------------
|
44
|
+
JSON/JSON String 7.093k (± 8.6%) i/s - 105.570k
|
45
|
+
JSON/JSON Object 6.834k (±10.0%) i/s - 101.556k
|
46
|
+
JSON/Binary 28.120k (± 8.4%) i/s - 418.856k
|
47
|
+
JSON/Compact 36.468k (± 8.3%) i/s - 542.627k
|
48
|
+
YAML/YAML String 3.636k (±13.8%) i/s - 52.895k
|
49
|
+
YAML/Binary 6.118k (± 9.5%) i/s - 90.850k
|
50
|
+
YAML/Compact 6.541k (±10.3%) i/s - 97.120k
|
51
|
+
|
52
|
+
Comparison:
|
53
|
+
JSON/Compact: 36468.5 i/s
|
54
|
+
JSON/Binary: 28120.3 i/s - 1.30x slower
|
55
|
+
JSON/JSON String: 7093.4 i/s - 5.14x slower
|
56
|
+
JSON/JSON Object: 6834.5 i/s - 5.34x slower
|
57
|
+
YAML/Compact: 6540.9 i/s - 5.58x slower
|
58
|
+
YAML/Binary: 6118.3 i/s - 5.96x slower
|
59
|
+
YAML/YAML String: 3636.5 i/s - 10.03x slower
|
60
|
+
|
61
|
+
These benchmarks are included in [benchmark/][benchmark/].
|
62
|
+
|
63
|
+
## Installation
|
64
|
+
|
65
|
+
Add this line to your application's Gemfile:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
gem 'thrift-base64'
|
69
|
+
```
|
70
|
+
|
71
|
+
And then execute:
|
72
|
+
|
73
|
+
$ bundle
|
74
|
+
|
75
|
+
Or install it yourself as:
|
76
|
+
|
77
|
+
$ gem install thrift-base64
|
78
|
+
|
79
|
+
## Usage
|
80
|
+
|
81
|
+
`thrift-base64` adds two classes to the `Thrift` module:
|
82
|
+
`Thrift::Base64Derserializer` & `Thrift::Base64Serializer`. They mimic the
|
83
|
+
interface of `Thirft::Deserializer` & `Thrift::Serializer` except they
|
84
|
+
require no arguments to `initialize`. Here's an example:
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
require 'thrift-base64'
|
88
|
+
|
89
|
+
struct = SomeThriftStruct.new
|
90
|
+
|
91
|
+
json = Thrift::Base64Serializer.new.serialize(struct)
|
92
|
+
deserialized = Thrift::Base64Deserializer.new.deserialize(SomeThriftStruct.new, json)
|
93
|
+
```
|
94
|
+
|
95
|
+
Here's another example if you don't like the verbosity. Defaults to
|
96
|
+
using `Thrift::BinaryProtocol`.
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
require 'thrift-base64'
|
100
|
+
|
101
|
+
struct = SomeThriftStruct.new
|
102
|
+
SomeThriftStruct.from_base64(struct.to_base64)
|
103
|
+
```
|
104
|
+
|
105
|
+
Compact methods are available as well. They use
|
106
|
+
`Thrift::CompactProtocol`.
|
107
|
+
|
108
|
+
```
|
109
|
+
require 'thrift-base64'
|
110
|
+
|
111
|
+
struct = SomeThriftStruct.new
|
112
|
+
SomeThriftStruct.from_compact_base64(struct.to_compact_base64)
|
113
|
+
```
|
114
|
+
|
115
|
+
## Testing
|
116
|
+
|
117
|
+
$ make test
|
118
|
+
$ make benchmark
|
119
|
+
|
120
|
+
## Contributing
|
121
|
+
|
122
|
+
1. Fork it ( https://github.com/saltside/thrift-base64-ruby/fork )
|
123
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
124
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
125
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
126
|
+
5. Create a new Pull Request
|
127
|
+
|
128
|
+
[thrift]: https://thrift.apache.org
|
data/Rakefile
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'thrift-base64'
|
3
|
+
|
4
|
+
root = File.expand_path '../..', __FILE__
|
5
|
+
|
6
|
+
$LOAD_PATH << "#{root}/vendor/gen-rb"
|
7
|
+
|
8
|
+
Thrift.type_checking = true
|
9
|
+
|
10
|
+
require 'test_types'
|
11
|
+
require 'benchmark/ips'
|
12
|
+
|
13
|
+
require 'json'
|
14
|
+
require 'yaml'
|
15
|
+
|
16
|
+
struct = SimpleStruct.new message: 'Benchmarking!!'
|
17
|
+
|
18
|
+
json_serializer = Thrift::Serializer.new Thrift::JsonProtocolFactory.new
|
19
|
+
json_deserializer = Thrift::Deserializer.new Thrift::JsonProtocolFactory.new
|
20
|
+
|
21
|
+
binary_base64_serializer = Thrift::Base64Serializer.new Thrift::BinaryProtocolFactory.new
|
22
|
+
binary_base64_deserializer = Thrift::Base64Deserializer.new Thrift::BinaryProtocolFactory.new
|
23
|
+
|
24
|
+
compact_base64_serializer = Thrift::Base64Serializer.new Thrift::CompactProtocolFactory.new
|
25
|
+
compact_base64_deserializer = Thrift::Base64Deserializer.new Thrift::CompactProtocolFactory.new
|
26
|
+
|
27
|
+
# Cover the various blobs when used inside other plaintext protocols
|
28
|
+
Benchmark.ips do |x|
|
29
|
+
x.warmup = 5
|
30
|
+
x.time = 15
|
31
|
+
|
32
|
+
x.report "JSON/JSON String" do
|
33
|
+
json_deserializer.deserialize(SimpleStruct.new, JSON.load(JSON.dump([ json_serializer.serialize(struct) ])).first)
|
34
|
+
end
|
35
|
+
|
36
|
+
x.report "JSON/JSON Object" do
|
37
|
+
json_deserializer.deserialize(SimpleStruct.new, JSON.load(JSON.dump({ blob: json_serializer.serialize(struct) })).fetch('blob'))
|
38
|
+
end
|
39
|
+
|
40
|
+
x.report "JSON/Binary" do
|
41
|
+
binary_base64_deserializer.deserialize(SimpleStruct.new, JSON.load(JSON.dump([ binary_base64_serializer.serialize(struct) ])).first)
|
42
|
+
end
|
43
|
+
|
44
|
+
x.report "JSON/Compact" do
|
45
|
+
compact_base64_deserializer.deserialize(SimpleStruct.new, JSON.load(JSON.dump([ compact_base64_serializer.serialize(struct) ])).first)
|
46
|
+
end
|
47
|
+
|
48
|
+
x.report "YAML/YAML String" do
|
49
|
+
json_deserializer.deserialize(SimpleStruct.new, YAML.load(YAML.dump([ json_serializer.serialize(struct) ])).first)
|
50
|
+
end
|
51
|
+
|
52
|
+
x.report "YAML/Binary" do
|
53
|
+
binary_base64_deserializer.deserialize(SimpleStruct.new, YAML.load(YAML.dump([ binary_base64_serializer.serialize(struct) ])).first)
|
54
|
+
end
|
55
|
+
|
56
|
+
x.report "YAML/Compact" do
|
57
|
+
compact_base64_deserializer.deserialize(SimpleStruct.new, YAML.load(YAML.dump([ compact_base64_serializer.serialize(struct) ])).first)
|
58
|
+
end
|
59
|
+
|
60
|
+
x.compare!
|
61
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'thrift-base64'
|
3
|
+
|
4
|
+
root = File.expand_path '../..', __FILE__
|
5
|
+
|
6
|
+
$LOAD_PATH << "#{root}/vendor/gen-rb"
|
7
|
+
|
8
|
+
Thrift.type_checking = true
|
9
|
+
|
10
|
+
require 'test_types'
|
11
|
+
require 'benchmark/ips'
|
12
|
+
|
13
|
+
struct = SimpleStruct.new message: 'Benchmarking!!'
|
14
|
+
|
15
|
+
json_serializer = Thrift::Serializer.new Thrift::JsonProtocolFactory.new
|
16
|
+
json_deserializer = Thrift::Deserializer.new Thrift::JsonProtocolFactory.new
|
17
|
+
|
18
|
+
binary_serializer = Thrift::Serializer.new Thrift::BinaryProtocolFactory.new
|
19
|
+
binary_deserializer = Thrift::Deserializer.new Thrift::BinaryProtocolFactory.new
|
20
|
+
|
21
|
+
compact_serializer = Thrift::Serializer.new Thrift::CompactProtocolFactory.new
|
22
|
+
compact_deserializer = Thrift::Deserializer.new Thrift::CompactProtocolFactory.new
|
23
|
+
|
24
|
+
binary_base64_serializer = Thrift::Base64Serializer.new Thrift::BinaryProtocolFactory.new
|
25
|
+
binary_base64_deserializer = Thrift::Base64Deserializer.new Thrift::BinaryProtocolFactory.new
|
26
|
+
|
27
|
+
compact_base64_serializer = Thrift::Base64Serializer.new Thrift::CompactProtocolFactory.new
|
28
|
+
compact_base64_deserializer = Thrift::Base64Deserializer.new Thrift::CompactProtocolFactory.new
|
29
|
+
|
30
|
+
Benchmark.ips do |x|
|
31
|
+
x.warmup = 5
|
32
|
+
x.time = 15
|
33
|
+
|
34
|
+
x.report "JSON" do
|
35
|
+
json_deserializer.deserialize(SimpleStruct.new, json_serializer.serialize(struct))
|
36
|
+
end
|
37
|
+
|
38
|
+
x.report "Binary" do
|
39
|
+
binary_deserializer.deserialize(SimpleStruct.new, binary_serializer.serialize(struct))
|
40
|
+
end
|
41
|
+
|
42
|
+
x.report "Compact" do
|
43
|
+
compact_deserializer.deserialize(SimpleStruct.new, compact_serializer.serialize(struct))
|
44
|
+
end
|
45
|
+
|
46
|
+
x.report "Binary Base64" do
|
47
|
+
binary_base64_deserializer.deserialize(SimpleStruct.new, binary_base64_serializer.serialize(struct))
|
48
|
+
end
|
49
|
+
|
50
|
+
x.report "Compact Base64" do
|
51
|
+
compact_deserializer.deserialize(SimpleStruct.new, compact_serializer.serialize(struct))
|
52
|
+
end
|
53
|
+
|
54
|
+
x.compare!
|
55
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'thrift/base64/version'
|
2
|
+
require 'thrift'
|
3
|
+
require 'base64'
|
4
|
+
|
5
|
+
module Thrift
|
6
|
+
class Base64Serializer < Serializer
|
7
|
+
def serialize(base)
|
8
|
+
::Base64.encode64 super
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class Base64Deserializer < Deserializer
|
13
|
+
def deserialize(object, blob)
|
14
|
+
super object, ::Base64.decode64(blob)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# NOTE: this module is a little workaround in off the chance
|
19
|
+
# another library has redefined Struct.included. So instead
|
20
|
+
# we prepend a module which then extends the original including
|
21
|
+
# class with the module containing from_base64.
|
22
|
+
module Base64Extension
|
23
|
+
module FromBase64
|
24
|
+
def from_base64(blob, protocol = BinaryProtocolFactory.new)
|
25
|
+
Base64Deserializer.new(protocol).deserialize(new, blob)
|
26
|
+
end
|
27
|
+
|
28
|
+
def from_compact_base64(blob)
|
29
|
+
from_base64 blob, CompactProtocolFactory.new
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def included(base)
|
34
|
+
base.extend FromBase64
|
35
|
+
super
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
module Struct
|
40
|
+
class << self
|
41
|
+
prepend Base64Extension
|
42
|
+
end
|
43
|
+
|
44
|
+
def to_base64(protocol = BinaryProtocolFactory.new)
|
45
|
+
Base64Serializer.new(protocol).serialize self
|
46
|
+
end
|
47
|
+
|
48
|
+
def to_compact_base64
|
49
|
+
to_base64 CompactProtocolFactory.new
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'thrift/base64'
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
class AcceptanceTest < MiniTest::Unit::TestCase
|
4
|
+
attr_reader :struct
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@struct = SimpleStruct.new message: utf8_string
|
8
|
+
assert_utf8 struct.message
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_round_trips_itself_with_proper_encodings
|
12
|
+
base64 = Thrift::Base64Serializer.new.serialize(struct)
|
13
|
+
|
14
|
+
deserialized = Thrift::Base64Deserializer.new.deserialize(SimpleStruct.new, base64)
|
15
|
+
assert_equal struct.message, deserialized.message
|
16
|
+
assert_utf8 deserialized.message
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_generated_strings_can_be_used_in_encoding_aware_code
|
20
|
+
base64 = Thrift::Base64Serializer.new.serialize(struct)
|
21
|
+
roundtripped = JSON.load(JSON.dump(blob: base64)).fetch('blob')
|
22
|
+
|
23
|
+
assert_equal base64, roundtripped
|
24
|
+
|
25
|
+
deserialized = Thrift::Base64Deserializer.new.deserialize(SimpleStruct.new, roundtripped)
|
26
|
+
assert_equal struct.message, deserialized.message
|
27
|
+
assert_utf8 deserialized.message
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_roundtrips_via_to_from_base64
|
31
|
+
roundtripped = SimpleStruct.from_base64(struct.to_base64)
|
32
|
+
assert_equal struct.message, roundtripped.message
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_to_from_methods_take_protocol_argument
|
36
|
+
compact_base64 = struct.to_base64 Thrift::CompactProtocolFactory.new
|
37
|
+
expected = Base64.encode64(Thrift::Serializer.new(Thrift::CompactProtocolFactory.new).serialize(struct))
|
38
|
+
|
39
|
+
assert expected == compact_base64, 'Protocol incorrect'
|
40
|
+
|
41
|
+
deserialized = SimpleStruct.from_base64(compact_base64, Thrift::CompactProtocolFactory.new)
|
42
|
+
assert_equal struct.message, deserialized.message
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_to_from_compact_binary_with_base64_encoding
|
46
|
+
compact_base64 = struct.to_compact_base64
|
47
|
+
expected = Base64.encode64(Thrift::Serializer.new(Thrift::CompactProtocolFactory.new).serialize(struct))
|
48
|
+
|
49
|
+
assert expected == compact_base64, 'Protocol incorrect'
|
50
|
+
|
51
|
+
deserialized = SimpleStruct.from_compact_base64(compact_base64)
|
52
|
+
assert_equal struct.message, deserialized.message
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def assert_utf8(string)
|
58
|
+
assert_equal Encoding::UTF_8, string.encoding, 'Non UTF-8 string'
|
59
|
+
end
|
60
|
+
|
61
|
+
def utf8_string
|
62
|
+
"Hi, I'am a ☃ !!"
|
63
|
+
end
|
64
|
+
end
|
data/test/test_helper.rb
ADDED
data/test.thrift
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'thrift/base64/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "thrift-base64"
|
8
|
+
spec.version = Thrift::Base64::VERSION
|
9
|
+
spec.authors = ["ahawkins"]
|
10
|
+
spec.email = ["adam@hawkins.io"]
|
11
|
+
spec.summary = %q{Thrift object serialization/deserialization with Base64}
|
12
|
+
spec.description = %q{}
|
13
|
+
spec.homepage = "https://github.com/saltside/thrift-base64-ruby"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "thrift"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "benchmark-ips"
|
26
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift Compiler (0.9.2)
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'thrift'
|
8
|
+
|
9
|
+
class SimpleStruct
|
10
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
11
|
+
MESSAGE = 1
|
12
|
+
|
13
|
+
FIELDS = {
|
14
|
+
MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
|
15
|
+
}
|
16
|
+
|
17
|
+
def struct_fields; FIELDS; end
|
18
|
+
|
19
|
+
def validate
|
20
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field message is unset!') unless @message
|
21
|
+
end
|
22
|
+
|
23
|
+
::Thrift::Struct.generate_accessors self
|
24
|
+
end
|
25
|
+
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: thrift-base64
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ahawkins
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thrift
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: benchmark-ips
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: ''
|
70
|
+
email:
|
71
|
+
- adam@hawkins.io
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- Makefile
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- benchmark/plaintext.rb
|
83
|
+
- benchmark/serialization.rb
|
84
|
+
- lib/thrift-base64.rb
|
85
|
+
- lib/thrift/base64.rb
|
86
|
+
- lib/thrift/base64/version.rb
|
87
|
+
- test.thrift
|
88
|
+
- test/acceptance_test.rb
|
89
|
+
- test/test_helper.rb
|
90
|
+
- thrift-base64.gemspec
|
91
|
+
- vendor/gen-rb/test_constants.rb
|
92
|
+
- vendor/gen-rb/test_types.rb
|
93
|
+
homepage: https://github.com/saltside/thrift-base64-ruby
|
94
|
+
licenses:
|
95
|
+
- MIT
|
96
|
+
metadata: {}
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 2.2.2
|
114
|
+
signing_key:
|
115
|
+
specification_version: 4
|
116
|
+
summary: Thrift object serialization/deserialization with Base64
|
117
|
+
test_files:
|
118
|
+
- test/acceptance_test.rb
|
119
|
+
- test/test_helper.rb
|