snappy 0.1.0-java → 0.2.0-java

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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +34 -0
  3. data/.github/workflows/publish.yml +34 -0
  4. data/Gemfile +3 -4
  5. data/Rakefile +32 -30
  6. data/ext/api.c +6 -1
  7. data/lib/snappy.rb +5 -5
  8. data/lib/snappy/hadoop/reader.rb +6 -2
  9. data/lib/snappy/reader.rb +11 -7
  10. data/lib/snappy/shim.rb +1 -1
  11. data/lib/snappy/version.rb +1 -1
  12. data/snappy.gemspec +13 -9
  13. data/test/hadoop/snappy_hadoop_reader_test.rb +115 -0
  14. data/test/hadoop/snappy_hadoop_writer_test.rb +48 -0
  15. data/test/snappy_hadoop_test.rb +26 -0
  16. data/test/snappy_reader_test.rb +148 -0
  17. data/test/snappy_test.rb +95 -0
  18. data/test/snappy_writer_test.rb +55 -0
  19. data/test/test_helper.rb +7 -0
  20. data/vendor/snappy/CMakeLists.txt +177 -54
  21. data/vendor/snappy/NEWS +8 -0
  22. data/vendor/snappy/README.md +19 -20
  23. data/vendor/snappy/cmake/SnappyConfig.cmake.in +33 -0
  24. data/vendor/snappy/cmake/config.h.in +6 -6
  25. data/vendor/snappy/docs/README.md +72 -0
  26. data/vendor/snappy/snappy-internal.h +12 -5
  27. data/vendor/snappy/snappy-stubs-internal.cc +1 -1
  28. data/vendor/snappy/snappy-stubs-internal.h +60 -15
  29. data/vendor/snappy/snappy-stubs-public.h.in +16 -36
  30. data/vendor/snappy/snappy-test.cc +16 -15
  31. data/vendor/snappy/snappy-test.h +12 -60
  32. data/vendor/snappy/snappy.cc +333 -187
  33. data/vendor/snappy/snappy.h +14 -10
  34. data/vendor/snappy/snappy_compress_fuzzer.cc +59 -0
  35. data/vendor/snappy/snappy_uncompress_fuzzer.cc +57 -0
  36. data/vendor/snappy/snappy_unittest.cc +220 -124
  37. metadata +25 -18
  38. data/.travis.yml +0 -31
  39. data/smoke.sh +0 -8
  40. data/test/hadoop/test-snappy-hadoop-reader.rb +0 -103
  41. data/test/hadoop/test-snappy-hadoop-writer.rb +0 -48
  42. data/test/test-snappy-hadoop.rb +0 -22
  43. data/test/test-snappy-reader.rb +0 -129
  44. data/test/test-snappy-writer.rb +0 -55
  45. data/test/test-snappy.rb +0 -58
  46. data/vendor/snappy/cmake/SnappyConfig.cmake +0 -1
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.1.0
4
+ version: 0.2.0
5
5
  platform: java
6
6
  authors:
7
7
  - miyucy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-04 00:00:00.000000000 Z
11
+ date: 2020-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -31,9 +31,10 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
+ - ".github/workflows/main.yml"
35
+ - ".github/workflows/publish.yml"
34
36
  - ".gitignore"
35
37
  - ".gitmodules"
36
- - ".travis.yml"
37
38
  - Gemfile
38
39
  - LICENSE.txt
39
40
  - README.md
@@ -51,22 +52,23 @@ files:
51
52
  - lib/snappy/version.rb
52
53
  - lib/snappy/writer.rb
53
54
  - lib/snappy_ext.jar
54
- - smoke.sh
55
55
  - snappy.gemspec
56
- - test/hadoop/test-snappy-hadoop-reader.rb
57
- - test/hadoop/test-snappy-hadoop-writer.rb
58
- - test/test-snappy-hadoop.rb
59
- - test/test-snappy-reader.rb
60
- - test/test-snappy-writer.rb
61
- - test/test-snappy.rb
56
+ - test/hadoop/snappy_hadoop_reader_test.rb
57
+ - test/hadoop/snappy_hadoop_writer_test.rb
58
+ - test/snappy_hadoop_test.rb
59
+ - test/snappy_reader_test.rb
60
+ - test/snappy_test.rb
61
+ - test/snappy_writer_test.rb
62
+ - test/test_helper.rb
62
63
  - vendor/snappy/AUTHORS
63
64
  - vendor/snappy/CMakeLists.txt
64
65
  - vendor/snappy/CONTRIBUTING.md
65
66
  - vendor/snappy/COPYING
66
67
  - vendor/snappy/NEWS
67
68
  - vendor/snappy/README.md
68
- - vendor/snappy/cmake/SnappyConfig.cmake
69
+ - vendor/snappy/cmake/SnappyConfig.cmake.in
69
70
  - vendor/snappy/cmake/config.h.in
71
+ - vendor/snappy/docs/README.md
70
72
  - vendor/snappy/format_description.txt
71
73
  - vendor/snappy/framing_format.txt
72
74
  - vendor/snappy/snappy-c.cc
@@ -81,11 +83,15 @@ files:
81
83
  - vendor/snappy/snappy-test.h
82
84
  - vendor/snappy/snappy.cc
83
85
  - vendor/snappy/snappy.h
86
+ - vendor/snappy/snappy_compress_fuzzer.cc
87
+ - vendor/snappy/snappy_uncompress_fuzzer.cc
84
88
  - vendor/snappy/snappy_unittest.cc
85
89
  homepage: http://github.com/miyucy/snappy
86
90
  licenses:
87
91
  - MIT
88
- metadata: {}
92
+ metadata:
93
+ homepage_uri: http://github.com/miyucy/snappy
94
+ source_code_uri: http://github.com/miyucy/snappy
89
95
  post_install_message:
90
96
  rdoc_options: []
91
97
  require_paths:
@@ -106,9 +112,10 @@ signing_key:
106
112
  specification_version: 4
107
113
  summary: libsnappy binding for Ruby
108
114
  test_files:
109
- - test/hadoop/test-snappy-hadoop-reader.rb
110
- - test/hadoop/test-snappy-hadoop-writer.rb
111
- - test/test-snappy-hadoop.rb
112
- - test/test-snappy-reader.rb
113
- - test/test-snappy-writer.rb
114
- - test/test-snappy.rb
115
+ - test/hadoop/snappy_hadoop_reader_test.rb
116
+ - test/hadoop/snappy_hadoop_writer_test.rb
117
+ - test/snappy_hadoop_test.rb
118
+ - test/snappy_reader_test.rb
119
+ - test/snappy_test.rb
120
+ - test/snappy_writer_test.rb
121
+ - test/test_helper.rb
@@ -1,31 +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
- - 2.5
13
- - jruby-19mode
14
- env:
15
- global:
16
- - PATH="/usr/lib/ccache:$PATH"
17
- before_install:
18
- - travis_retry gem install bundler --no-document -v 1.16.1
19
- addons:
20
- apt:
21
- packages:
22
- - cmake
23
- deploy:
24
- provider: rubygems
25
- api_key:
26
- 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=
27
- gem: snappy
28
- on:
29
- tags: true
30
- repo: miyucy/snappy
31
- 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-document "$(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,103 +0,0 @@
1
- require "minitest/autorun"
2
- require "minitest/spec"
3
- require "snappy"
4
- require "stringio"
5
-
6
- describe Snappy::Hadoop::Reader do
7
- before do
8
- @buffer = StringIO.new
9
- Snappy::Hadoop::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::Hadoop::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::Hadoop::Reader.new @buffer do |r|
26
- yielded = r
27
- end
28
- returned.must_equal yielded
29
- end
30
- end
31
-
32
- describe :io do
33
- it "should be a constructor argument" do
34
- subject.io.must_equal @buffer
35
- end
36
-
37
- it "should not receive `length' in initializing" do
38
- length = MiniTest::Mock.new.expect(:call, 0)
39
- @buffer.stub(:length, length) do
40
- Snappy::Hadoop::Reader.new @buffer
41
- end
42
- -> { length.verify }.must_raise MockExpectationError
43
- end
44
- end
45
-
46
- describe :each do
47
- before do
48
- Snappy::Hadoop::Writer.new @buffer do |w|
49
- w << "foo"
50
- w << "bar"
51
- w.dump!
52
- w << "baz"
53
- w << "quux"
54
- end
55
- @buffer.rewind
56
- end
57
-
58
- it "should yield each chunk" do
59
- chunks = []
60
- Snappy::Hadoop::Reader.new(@buffer).each do |chunk|
61
- chunks << chunk
62
- end
63
- chunks.must_equal ["foobar", "bazquux"]
64
- end
65
- end
66
-
67
- describe :read do
68
- before do
69
- Snappy::Hadoop::Writer.new @buffer do |w|
70
- w << "foo"
71
- w << "bar"
72
- w << "baz"
73
- w << "quux"
74
- end
75
- @buffer.rewind
76
- end
77
-
78
- it "should return the bytes" do
79
- Snappy::Hadoop::Reader.new(@buffer).read.must_equal "foobarbazquux"
80
- end
81
- end
82
-
83
- describe :each_line do
84
- before do
85
- Snappy::Hadoop::Writer.new @buffer do |w|
86
- w << "foo\n"
87
- w << "bar"
88
- w.dump!
89
- w << "baz\n"
90
- w << "quux\n"
91
- end
92
- @buffer.rewind
93
- end
94
-
95
- it "should yield each line" do
96
- lines = []
97
- Snappy::Hadoop::Reader.new(@buffer).each_line do |line|
98
- lines << line
99
- end
100
- lines.must_equal ["foo", "barbaz", "quux"]
101
- end
102
- end
103
- end
@@ -1,48 +0,0 @@
1
- require "minitest/autorun"
2
- require "minitest/spec"
3
- require "snappy"
4
- require "stringio"
5
-
6
- describe Snappy::Hadoop::Writer do
7
- before do
8
- @buffer = StringIO.new
9
- end
10
-
11
- subject do
12
- Snappy::Hadoop::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::Hadoop::Writer.new @buffer do |w|
19
- yielded = w
20
- end
21
- returned.must_equal yielded
22
- end
23
-
24
- it "should dump on the end of yield" do
25
- Snappy::Hadoop::Writer.new @buffer do |w|
26
- w << "foo"
27
- end
28
- @buffer.string.must_equal "\u0000\u0000\u0000\u0003\u0000\u0000\u0000\u0005\u0003\bfoo"
29
- end
30
- end
31
-
32
- describe :io do
33
- it "should be a constructor argument" do
34
- io = StringIO.new
35
- Snappy::Hadoop::Writer.new(io).io.must_equal io
36
- end
37
- end
38
-
39
- describe :block_size do
40
- it "should default to DEFAULT_BLOCK_SIZE" do
41
- Snappy::Hadoop::Writer.new(StringIO.new).block_size.must_equal Snappy::Hadoop::Writer::DEFAULT_BLOCK_SIZE
42
- end
43
-
44
- it "should be settable via the constructor" do
45
- Snappy::Hadoop::Writer.new(StringIO.new, 42).block_size.must_equal 42
46
- end
47
- end
48
- end
@@ -1,22 +0,0 @@
1
- require 'minitest/autorun'
2
- require 'minitest/spec'
3
- require 'snappy'
4
-
5
- describe Snappy::Hadoop 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::Hadoop.inflate(Snappy::Hadoop.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
- ].each do |(i, o)|
18
- Snappy::Hadoop.__send__(o, (Snappy::Hadoop.__send__ i, s)).must_equal(s)
19
- eval %{Snappy::Hadoop.#{o}(Snappy::Hadoop.#{i} s).must_equal(s)}
20
- end
21
- end
22
- end
@@ -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