snappy 0.0.17-java → 0.3.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +5 -5
  2. data/.dockerignore +2 -0
  3. data/.github/workflows/main.yml +34 -0
  4. data/.github/workflows/publish.yml +34 -0
  5. data/.gitignore +2 -1
  6. data/.gitmodules +1 -1
  7. data/Dockerfile +13 -0
  8. data/Gemfile +4 -0
  9. data/README.md +29 -5
  10. data/Rakefile +32 -29
  11. data/ext/api.c +6 -1
  12. data/ext/extconf.rb +23 -16
  13. data/lib/snappy/hadoop/reader.rb +62 -0
  14. data/lib/snappy/hadoop/writer.rb +51 -0
  15. data/lib/snappy/hadoop.rb +22 -0
  16. data/lib/snappy/reader.rb +14 -10
  17. data/lib/snappy/shim.rb +1 -1
  18. data/lib/snappy/version.rb +1 -1
  19. data/lib/snappy.rb +5 -4
  20. data/lib/snappy_ext.jar +0 -0
  21. data/snappy.gemspec +13 -13
  22. data/test/hadoop/snappy_hadoop_reader_test.rb +115 -0
  23. data/test/hadoop/snappy_hadoop_writer_test.rb +48 -0
  24. data/test/snappy_hadoop_test.rb +26 -0
  25. data/test/snappy_reader_test.rb +148 -0
  26. data/test/snappy_test.rb +95 -0
  27. data/test/snappy_writer_test.rb +55 -0
  28. data/test/test_helper.rb +7 -0
  29. data/test.sh +3 -0
  30. data/vendor/snappy/CMakeLists.txt +297 -0
  31. data/vendor/snappy/CONTRIBUTING.md +26 -0
  32. data/vendor/snappy/NEWS +40 -0
  33. data/vendor/snappy/{README → README.md} +27 -18
  34. data/vendor/snappy/cmake/SnappyConfig.cmake.in +33 -0
  35. data/vendor/snappy/cmake/config.h.in +62 -0
  36. data/vendor/snappy/docs/README.md +72 -0
  37. data/vendor/snappy/snappy-internal.h +22 -18
  38. data/vendor/snappy/snappy-stubs-internal.cc +1 -1
  39. data/vendor/snappy/snappy-stubs-internal.h +116 -38
  40. data/vendor/snappy/snappy-stubs-public.h.in +20 -46
  41. data/vendor/snappy/snappy-test.cc +26 -22
  42. data/vendor/snappy/snappy-test.h +24 -98
  43. data/vendor/snappy/snappy.cc +380 -183
  44. data/vendor/snappy/snappy.h +14 -10
  45. data/vendor/snappy/snappy_compress_fuzzer.cc +59 -0
  46. data/vendor/snappy/snappy_uncompress_fuzzer.cc +57 -0
  47. data/vendor/snappy/snappy_unittest.cc +236 -261
  48. metadata +36 -62
  49. data/.travis.yml +0 -26
  50. data/smoke.sh +0 -8
  51. data/test/test-snappy-reader.rb +0 -129
  52. data/test/test-snappy-writer.rb +0 -55
  53. data/test/test-snappy.rb +0 -58
  54. data/vendor/snappy/ChangeLog +0 -2468
  55. data/vendor/snappy/Makefile.am +0 -26
  56. data/vendor/snappy/autogen.sh +0 -12
  57. data/vendor/snappy/configure.ac +0 -134
  58. data/vendor/snappy/m4/gtest.m4 +0 -74
  59. data/vendor/snappy/snappy.pc.in +0 -10
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snappy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.3.0
5
5
  platform: java
6
6
  authors:
7
7
  - miyucy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-08 00:00:00.000000000 Z
11
+ date: 2022-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -24,48 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.1.0
27
- - !ruby/object:Gem::Dependency
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - "~>"
31
- - !ruby/object:Gem::Version
32
- version: '1.3'
33
- name: bundler
34
- prerelease: false
35
- type: :development
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.3'
41
- - !ruby/object:Gem::Dependency
42
- requirement: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: '0'
47
- name: rake
48
- prerelease: false
49
- type: :development
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- requirement: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: '0'
61
- name: minitest
62
- prerelease: false
63
- type: :development
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
27
  description: libsnappy binding for Ruby
70
28
  email:
71
29
  - fistfvck@gmail.com
@@ -73,9 +31,12 @@ executables: []
73
31
  extensions: []
74
32
  extra_rdoc_files: []
75
33
  files:
34
+ - ".dockerignore"
35
+ - ".github/workflows/main.yml"
36
+ - ".github/workflows/publish.yml"
76
37
  - ".gitignore"
77
38
  - ".gitmodules"
78
- - ".travis.yml"
39
+ - Dockerfile
79
40
  - Gemfile
80
41
  - LICENSE.txt
81
42
  - README.md
@@ -85,27 +46,34 @@ files:
85
46
  - ext/java/src/SnappyExtService.java
86
47
  - ext/java/src/snappy/SnappyModule.java
87
48
  - lib/snappy.rb
49
+ - lib/snappy/hadoop.rb
50
+ - lib/snappy/hadoop/reader.rb
51
+ - lib/snappy/hadoop/writer.rb
88
52
  - lib/snappy/reader.rb
89
53
  - lib/snappy/shim.rb
90
54
  - lib/snappy/version.rb
91
55
  - lib/snappy/writer.rb
92
56
  - lib/snappy_ext.jar
93
- - smoke.sh
94
57
  - snappy.gemspec
95
- - test/test-snappy-reader.rb
96
- - test/test-snappy-writer.rb
97
- - test/test-snappy.rb
58
+ - test.sh
59
+ - test/hadoop/snappy_hadoop_reader_test.rb
60
+ - test/hadoop/snappy_hadoop_writer_test.rb
61
+ - test/snappy_hadoop_test.rb
62
+ - test/snappy_reader_test.rb
63
+ - test/snappy_test.rb
64
+ - test/snappy_writer_test.rb
65
+ - test/test_helper.rb
98
66
  - vendor/snappy/AUTHORS
67
+ - vendor/snappy/CMakeLists.txt
68
+ - vendor/snappy/CONTRIBUTING.md
99
69
  - vendor/snappy/COPYING
100
- - vendor/snappy/ChangeLog
101
- - vendor/snappy/Makefile.am
102
70
  - vendor/snappy/NEWS
103
- - vendor/snappy/README
104
- - vendor/snappy/autogen.sh
105
- - vendor/snappy/configure.ac
71
+ - vendor/snappy/README.md
72
+ - vendor/snappy/cmake/SnappyConfig.cmake.in
73
+ - vendor/snappy/cmake/config.h.in
74
+ - vendor/snappy/docs/README.md
106
75
  - vendor/snappy/format_description.txt
107
76
  - vendor/snappy/framing_format.txt
108
- - vendor/snappy/m4/gtest.m4
109
77
  - vendor/snappy/snappy-c.cc
110
78
  - vendor/snappy/snappy-c.h
111
79
  - vendor/snappy/snappy-internal.h
@@ -118,12 +86,15 @@ files:
118
86
  - vendor/snappy/snappy-test.h
119
87
  - vendor/snappy/snappy.cc
120
88
  - vendor/snappy/snappy.h
121
- - vendor/snappy/snappy.pc.in
89
+ - vendor/snappy/snappy_compress_fuzzer.cc
90
+ - vendor/snappy/snappy_uncompress_fuzzer.cc
122
91
  - vendor/snappy/snappy_unittest.cc
123
92
  homepage: http://github.com/miyucy/snappy
124
93
  licenses:
125
94
  - MIT
126
- metadata: {}
95
+ metadata:
96
+ homepage_uri: http://github.com/miyucy/snappy
97
+ source_code_uri: http://github.com/miyucy/snappy
127
98
  post_install_message:
128
99
  rdoc_options: []
129
100
  require_paths:
@@ -139,12 +110,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
110
  - !ruby/object:Gem::Version
140
111
  version: '0'
141
112
  requirements: []
142
- rubyforge_project:
143
- rubygems_version: 2.6.12
113
+ rubygems_version: 3.2.29
144
114
  signing_key:
145
115
  specification_version: 4
146
116
  summary: libsnappy binding for Ruby
147
117
  test_files:
148
- - test/test-snappy-reader.rb
149
- - test/test-snappy-writer.rb
150
- - test/test-snappy.rb
118
+ - test/hadoop/snappy_hadoop_reader_test.rb
119
+ - test/hadoop/snappy_hadoop_writer_test.rb
120
+ - test/snappy_hadoop_test.rb
121
+ - test/snappy_reader_test.rb
122
+ - test/snappy_test.rb
123
+ - test/snappy_writer_test.rb
124
+ - test/test_helper.rb
data/.travis.yml DELETED
@@ -1,26 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- cache:
4
- bundler: true
5
- directories:
6
- - "$HOME/.ccache"
7
- rvm:
8
- - 1.9.3
9
- - 2.2
10
- - 2.3
11
- - 2.4
12
- - jruby-19mode
13
- env:
14
- global:
15
- - PATH="/usr/lib/ccache:$PATH"
16
- before_install:
17
- - gem install bundler
18
- deploy:
19
- provider: rubygems
20
- api_key:
21
- secure: Jwk5pSUD9dUb34fO4dLamqhQw9U/t/5pHX7l5LKE4e1MDlD9fq/KB/DFpRTSfA0s8XUu+NZYtRO+6GZBEBY5UjZyPcUk5izaQzMWANP6QEMI4mYheSFUXTGkimV8MFxo2Fp7itZBM9SsLccDp/59nmbhBUMdr4OECZtd1Igjz63AtRdD7JgZwhC2XqBVbcxyx78VcZH8r4JEZzpcnZjjGN9YwQFubhiPs0V2uTMp/kGSWeP4U3T71MrvRmDlu8QJTsTRsvhv+zDatFySzs2SGsn25+cUCOqWnb5vcwtCbfj7trY+DLO3FqZOvQlvDfvyOy9LlLRpovhu6w+L42Z2ZN5U1Ovz0bMjk5WGLlXRxCLTRqXihvJrtFuL/7B2YSXcWPBNt5HWFwtapEJDm+CJoKpqa/WB7gEgO+uAocHbRqbg64rnPLODOEH0xGeRNSXBA3P5JeVNYhvpFdX8LclRFaVpfYDDenzRV9zpIppMXSq3Suzw/nZPBL9cuuIsBYG6hnijhZertWIRjZqw8D/1wEBd6VT7cDQ+PsNBGKhvPBVd5Nb7Zh9YjwCv4BQHB6XekiKi7mGFN4X/6eTzudRYxG7KyrYqk9AQ6KmEv5U/Xv+Wcar86O49LtNqYykYKLknC9CiUwTDp4lkVD8D3LoIzkL2/AeZyI6NQso8tymB0CM=
22
- gem: snappy
23
- on:
24
- tags: true
25
- repo: miyucy/snappy
26
- script: bundle exec rake && ./smoke.sh
data/smoke.sh DELETED
@@ -1,8 +0,0 @@
1
- #!/bin/bash
2
- gem list | grep snappy && gem uninstall --force snappy
3
- bundle exec rake clean build
4
- gem install --no-ri --no-rdoc "$(ls pkg/snappy-*.gem)"
5
- cat <<EOF | ruby
6
- require 'snappy'
7
- abort if Snappy.inflate(Snappy.deflate(File.read('smoke.sh'))) != File.read('smoke.sh')
8
- EOF
@@ -1,129 +0,0 @@
1
- require "minitest/autorun"
2
- require "minitest/spec"
3
- require "snappy"
4
- require "stringio"
5
-
6
- describe Snappy::Reader do
7
- before do
8
- @buffer = StringIO.new
9
- Snappy::Writer.new @buffer do |w|
10
- w << "foo"
11
- w << "bar"
12
- w << "baz"
13
- w << "quux"
14
- end
15
- @buffer.rewind
16
- end
17
-
18
- subject do
19
- Snappy::Reader.new @buffer
20
- end
21
-
22
- describe :initialize do
23
- it "should yield itself to the block" do
24
- yielded = nil
25
- returned = Snappy::Reader.new @buffer do |r|
26
- yielded = r
27
- end
28
- returned.must_equal yielded
29
- end
30
-
31
- it "should read the header" do
32
- subject.magic.must_equal Snappy::Writer::MAGIC
33
- subject.default_version.must_equal Snappy::Writer::DEFAULT_VERSION
34
- subject.minimum_compatible_version.must_equal Snappy::Writer::MINIMUM_COMPATIBLE_VERSION
35
- end
36
- end
37
-
38
- describe :initialize_without_headers do
39
- before do
40
- @buffer = StringIO.new
41
- @buffer << Snappy.deflate("HelloWorld" * 10)
42
- @buffer.rewind
43
- end
44
-
45
- it "should inflate with a magic header" do
46
- subject.read.must_equal "HelloWorld" * 10
47
- end
48
-
49
- it "should not receive `length' in eaching" do
50
- length = MiniTest::Mock.new.expect(:call, 0)
51
- @buffer.stub(:length, length) do
52
- subject.read
53
- end
54
- -> { length.verify }.must_raise MockExpectationError
55
- end
56
- end
57
-
58
- describe :io do
59
- it "should be a constructor argument" do
60
- subject.io.must_equal @buffer
61
- end
62
-
63
- it "should not receive `length' in initializing" do
64
- length = MiniTest::Mock.new.expect(:call, 0)
65
- @buffer.stub(:length, length) do
66
- Snappy::Reader.new @buffer
67
- end
68
- -> { length.verify }.must_raise MockExpectationError
69
- end
70
- end
71
-
72
- describe :each do
73
- before do
74
- Snappy::Writer.new @buffer do |w|
75
- w << "foo"
76
- w << "bar"
77
- w.dump!
78
- w << "baz"
79
- w << "quux"
80
- end
81
- @buffer.rewind
82
- end
83
-
84
- it "should yield each chunk" do
85
- chunks = []
86
- Snappy::Reader.new(@buffer).each do |chunk|
87
- chunks << chunk
88
- end
89
- chunks.must_equal ["foobar", "bazquux"]
90
- end
91
- end
92
-
93
- describe :read do
94
- before do
95
- Snappy::Writer.new @buffer do |w|
96
- w << "foo"
97
- w << "bar"
98
- w << "baz"
99
- w << "quux"
100
- end
101
- @buffer.rewind
102
- end
103
-
104
- it "should return the bytes" do
105
- Snappy::Reader.new(@buffer).read.must_equal "foobarbazquux"
106
- end
107
- end
108
-
109
- describe :each_line do
110
- before do
111
- Snappy::Writer.new @buffer do |w|
112
- w << "foo\n"
113
- w << "bar"
114
- w.dump!
115
- w << "baz\n"
116
- w << "quux\n"
117
- end
118
- @buffer.rewind
119
- end
120
-
121
- it "should yield each line" do
122
- lines = []
123
- Snappy::Reader.new(@buffer).each_line do |line|
124
- lines << line
125
- end
126
- lines.must_equal ["foo", "barbaz", "quux"]
127
- end
128
- end
129
- end
@@ -1,55 +0,0 @@
1
- require "minitest/autorun"
2
- require "minitest/spec"
3
- require "snappy"
4
- require "stringio"
5
-
6
- describe Snappy::Writer do
7
- before do
8
- @buffer = StringIO.new
9
- end
10
-
11
- subject do
12
- Snappy::Writer.new @buffer
13
- end
14
-
15
- describe :initialize do
16
- it "should yield itself to the block" do
17
- yielded = nil
18
- returned = Snappy::Writer.new @buffer do |w|
19
- yielded = w
20
- end
21
- returned.must_equal yielded
22
- end
23
-
24
- it "should write the header" do
25
- subject.io.string.must_equal [Snappy::Writer::MAGIC,
26
- Snappy::Writer::DEFAULT_VERSION,
27
- Snappy::Writer::MINIMUM_COMPATIBLE_VERSION].pack("a8NN")
28
- end
29
-
30
- it "should dump on the end of yield" do
31
- Snappy::Writer.new @buffer do |w|
32
- w << "foo"
33
- end
34
- foo = Snappy.deflate "foo"
35
- @buffer.string[16, @buffer.size - 16].must_equal [foo.size, foo].pack("Na#{foo.size}")
36
- end
37
- end
38
-
39
- describe :io do
40
- it "should be a constructor argument" do
41
- io = StringIO.new
42
- Snappy::Writer.new(io).io.must_equal io
43
- end
44
- end
45
-
46
- describe :block_size do
47
- it "should default to DEFAULT_BLOCK_SIZE" do
48
- Snappy::Writer.new(StringIO.new).block_size.must_equal Snappy::Writer::DEFAULT_BLOCK_SIZE
49
- end
50
-
51
- it "should be settable via the constructor" do
52
- Snappy::Writer.new(StringIO.new, 42).block_size.must_equal 42
53
- end
54
- end
55
- end
data/test/test-snappy.rb DELETED
@@ -1,58 +0,0 @@
1
- require 'minitest/autorun'
2
- require 'minitest/spec'
3
- require 'snappy'
4
-
5
- describe Snappy do
6
- T = [*'a'..'z', *'A'..'Z', *'0'..'9']
7
-
8
- it 'well done' do
9
- s = Array.new(1024){T.sample}.join
10
- Snappy.inflate(Snappy.deflate s).must_equal(s)
11
- end
12
-
13
- it 'well done (pair)' do
14
- s = Array.new(1024){T.sample}.join
15
- [
16
- [:deflate, :inflate],
17
- [:compress, :uncompress],
18
- [:dump, :load],
19
- ].each do |(i, o)|
20
- Snappy.__send__(o, (Snappy.__send__ i, s)).must_equal(s)
21
- eval %{Snappy.#{o}(Snappy.#{i} s).must_equal(s)}
22
- end
23
- end
24
-
25
- describe '#deflate' do
26
- it 'can pass buffer' do
27
- skip 'cannot pass buffer in jruby' if defined? JRUBY_VERSION
28
- s = 'a' * 1024
29
- d = ' ' * 1024
30
- r = Snappy.deflate(s, d)
31
- d.must_be_same_as r
32
- end
33
- end
34
-
35
- describe '#inflate' do
36
- it 'can pass buffer' do
37
- skip 'cannot pass buffer in jruby' if defined? JRUBY_VERSION
38
- s = Snappy.deflate('a' * 1024)
39
- d = ' ' * 1024
40
- r = Snappy.inflate(s, d)
41
- d.must_be_same_as r
42
- end
43
- end
44
-
45
- describe '#valid?' do
46
- it 'return true when passed deflated data' do
47
- skip 'snappy-jars does not have valid?' if defined? JRUBY_VERSION
48
- d = Snappy.deflate(Array.new(1024){T.sample}.join)
49
- Snappy.valid?(d).must_equal true
50
- end
51
-
52
- it 'return false when passed invalid data' do
53
- skip 'snappy-jars does not have valid?' if defined? JRUBY_VERSION
54
- d = Snappy.deflate(Array.new(1024){T.sample}.join).reverse
55
- Snappy.valid?(d).must_equal false
56
- end
57
- end
58
- end