couchbase 3.0.0.alpha.1-universal-darwin-19 → 3.0.0.alpha.2-universal-darwin-19

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 (176) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/tests-6.0.3.yml +49 -0
  3. data/.github/workflows/tests.yml +47 -0
  4. data/.gitmodules +3 -0
  5. data/.idea/dictionaries/gem_terms.xml +5 -0
  6. data/.idea/inspectionProfiles/Project_Default.xml +1 -0
  7. data/.idea/vcs.xml +1 -0
  8. data/Gemfile +1 -0
  9. data/README.md +55 -2
  10. data/Rakefile +18 -0
  11. data/bin/init-cluster +62 -0
  12. data/bin/setup +1 -0
  13. data/couchbase.gemspec +3 -2
  14. data/examples/crud.rb +1 -2
  15. data/examples/managing_buckets.rb +47 -0
  16. data/examples/managing_collections.rb +58 -0
  17. data/examples/managing_query_indexes.rb +63 -0
  18. data/examples/query.rb +3 -2
  19. data/examples/query_with_consistency.rb +76 -0
  20. data/examples/subdocument.rb +23 -1
  21. data/ext/.clang-format +1 -1
  22. data/ext/.idea/dictionaries/couchbase_terms.xml +2 -0
  23. data/ext/.idea/vcs.xml +1 -0
  24. data/ext/CMakeLists.txt +30 -12
  25. data/ext/build_version.hxx.in +26 -0
  26. data/ext/couchbase/bucket.hxx +69 -8
  27. data/ext/couchbase/cluster.hxx +70 -54
  28. data/ext/couchbase/collections_manifest.hxx +3 -3
  29. data/ext/couchbase/configuration.hxx +14 -0
  30. data/ext/couchbase/couchbase.cxx +2044 -383
  31. data/ext/couchbase/{operations/document_id.hxx → document_id.hxx} +5 -4
  32. data/ext/couchbase/io/http_message.hxx +5 -1
  33. data/ext/couchbase/io/http_parser.hxx +2 -1
  34. data/ext/couchbase/io/http_session.hxx +6 -3
  35. data/ext/couchbase/io/{binary_message.hxx → mcbp_message.hxx} +15 -12
  36. data/ext/couchbase/io/mcbp_parser.hxx +99 -0
  37. data/ext/couchbase/io/{key_value_session.hxx → mcbp_session.hxx} +200 -95
  38. data/ext/couchbase/io/session_manager.hxx +37 -22
  39. data/ext/couchbase/mutation_token.hxx +2 -1
  40. data/ext/couchbase/operations.hxx +38 -8
  41. data/ext/couchbase/operations/bucket_create.hxx +138 -0
  42. data/ext/couchbase/operations/bucket_drop.hxx +65 -0
  43. data/ext/couchbase/operations/bucket_flush.hxx +65 -0
  44. data/ext/couchbase/operations/bucket_get.hxx +69 -0
  45. data/ext/couchbase/operations/bucket_get_all.hxx +62 -0
  46. data/ext/couchbase/operations/bucket_settings.hxx +111 -0
  47. data/ext/couchbase/operations/bucket_update.hxx +115 -0
  48. data/ext/couchbase/operations/cluster_developer_preview_enable.hxx +60 -0
  49. data/ext/couchbase/operations/collection_create.hxx +86 -0
  50. data/ext/couchbase/operations/collection_drop.hxx +82 -0
  51. data/ext/couchbase/operations/command.hxx +10 -10
  52. data/ext/couchbase/operations/document_decrement.hxx +80 -0
  53. data/ext/couchbase/operations/document_exists.hxx +80 -0
  54. data/ext/couchbase/operations/{get.hxx → document_get.hxx} +4 -2
  55. data/ext/couchbase/operations/document_get_and_lock.hxx +64 -0
  56. data/ext/couchbase/operations/document_get_and_touch.hxx +64 -0
  57. data/ext/couchbase/operations/document_increment.hxx +80 -0
  58. data/ext/couchbase/operations/document_insert.hxx +74 -0
  59. data/ext/couchbase/operations/{lookup_in.hxx → document_lookup_in.hxx} +2 -2
  60. data/ext/couchbase/operations/{mutate_in.hxx → document_mutate_in.hxx} +11 -2
  61. data/ext/couchbase/operations/{query.hxx → document_query.hxx} +101 -6
  62. data/ext/couchbase/operations/document_remove.hxx +67 -0
  63. data/ext/couchbase/operations/document_replace.hxx +76 -0
  64. data/ext/couchbase/operations/{upsert.hxx → document_touch.hxx} +14 -14
  65. data/ext/couchbase/operations/{remove.hxx → document_unlock.hxx} +12 -10
  66. data/ext/couchbase/operations/document_upsert.hxx +74 -0
  67. data/ext/couchbase/operations/query_index_build_deferred.hxx +85 -0
  68. data/ext/couchbase/operations/query_index_create.hxx +134 -0
  69. data/ext/couchbase/operations/query_index_drop.hxx +108 -0
  70. data/ext/couchbase/operations/query_index_get_all.hxx +106 -0
  71. data/ext/couchbase/operations/scope_create.hxx +81 -0
  72. data/ext/couchbase/operations/scope_drop.hxx +79 -0
  73. data/ext/couchbase/operations/scope_get_all.hxx +72 -0
  74. data/ext/couchbase/protocol/client_opcode.hxx +35 -0
  75. data/ext/couchbase/protocol/client_request.hxx +56 -9
  76. data/ext/couchbase/protocol/client_response.hxx +52 -15
  77. data/ext/couchbase/protocol/cmd_cluster_map_change_notification.hxx +81 -0
  78. data/ext/couchbase/protocol/cmd_decrement.hxx +187 -0
  79. data/ext/couchbase/protocol/cmd_exists.hxx +171 -0
  80. data/ext/couchbase/protocol/cmd_get.hxx +31 -8
  81. data/ext/couchbase/protocol/cmd_get_and_lock.hxx +142 -0
  82. data/ext/couchbase/protocol/cmd_get_and_touch.hxx +142 -0
  83. data/ext/couchbase/protocol/cmd_get_cluster_config.hxx +16 -3
  84. data/ext/couchbase/protocol/cmd_get_collections_manifest.hxx +16 -3
  85. data/ext/couchbase/protocol/cmd_get_error_map.hxx +16 -3
  86. data/ext/couchbase/protocol/cmd_hello.hxx +24 -8
  87. data/ext/couchbase/protocol/cmd_increment.hxx +187 -0
  88. data/ext/couchbase/protocol/cmd_info.hxx +1 -0
  89. data/ext/couchbase/protocol/cmd_insert.hxx +172 -0
  90. data/ext/couchbase/protocol/cmd_lookup_in.hxx +28 -13
  91. data/ext/couchbase/protocol/cmd_mutate_in.hxx +65 -13
  92. data/ext/couchbase/protocol/cmd_remove.hxx +59 -4
  93. data/ext/couchbase/protocol/cmd_replace.hxx +172 -0
  94. data/ext/couchbase/protocol/cmd_sasl_auth.hxx +15 -3
  95. data/ext/couchbase/protocol/cmd_sasl_list_mechs.hxx +15 -3
  96. data/ext/couchbase/protocol/cmd_sasl_step.hxx +15 -3
  97. data/ext/couchbase/protocol/cmd_select_bucket.hxx +14 -2
  98. data/ext/couchbase/protocol/cmd_touch.hxx +102 -0
  99. data/ext/couchbase/protocol/cmd_unlock.hxx +95 -0
  100. data/ext/couchbase/protocol/cmd_upsert.hxx +50 -14
  101. data/ext/couchbase/protocol/durability_level.hxx +67 -0
  102. data/ext/couchbase/protocol/frame_info_id.hxx +187 -0
  103. data/ext/couchbase/protocol/hello_feature.hxx +137 -0
  104. data/ext/couchbase/protocol/server_opcode.hxx +57 -0
  105. data/ext/couchbase/protocol/server_request.hxx +122 -0
  106. data/ext/couchbase/protocol/unsigned_leb128.h +15 -15
  107. data/ext/couchbase/utils/byteswap.hxx +1 -2
  108. data/ext/couchbase/utils/url_codec.hxx +225 -0
  109. data/ext/couchbase/version.hxx +3 -1
  110. data/ext/extconf.rb +4 -1
  111. data/ext/test/main.cxx +37 -113
  112. data/ext/third_party/snappy/.appveyor.yml +36 -0
  113. data/ext/third_party/snappy/.gitignore +8 -0
  114. data/ext/third_party/snappy/.travis.yml +98 -0
  115. data/ext/third_party/snappy/AUTHORS +1 -0
  116. data/ext/third_party/snappy/CMakeLists.txt +345 -0
  117. data/ext/third_party/snappy/CONTRIBUTING.md +26 -0
  118. data/ext/third_party/snappy/COPYING +54 -0
  119. data/ext/third_party/snappy/NEWS +188 -0
  120. data/ext/third_party/snappy/README.md +148 -0
  121. data/ext/third_party/snappy/cmake/SnappyConfig.cmake.in +33 -0
  122. data/ext/third_party/snappy/cmake/config.h.in +59 -0
  123. data/ext/third_party/snappy/docs/README.md +72 -0
  124. data/ext/third_party/snappy/format_description.txt +110 -0
  125. data/ext/third_party/snappy/framing_format.txt +135 -0
  126. data/ext/third_party/snappy/snappy-c.cc +90 -0
  127. data/ext/third_party/snappy/snappy-c.h +138 -0
  128. data/ext/third_party/snappy/snappy-internal.h +315 -0
  129. data/ext/third_party/snappy/snappy-sinksource.cc +121 -0
  130. data/ext/third_party/snappy/snappy-sinksource.h +182 -0
  131. data/ext/third_party/snappy/snappy-stubs-internal.cc +42 -0
  132. data/ext/third_party/snappy/snappy-stubs-internal.h +493 -0
  133. data/ext/third_party/snappy/snappy-stubs-public.h.in +63 -0
  134. data/ext/third_party/snappy/snappy-test.cc +613 -0
  135. data/ext/third_party/snappy/snappy-test.h +526 -0
  136. data/ext/third_party/snappy/snappy.cc +1770 -0
  137. data/ext/third_party/snappy/snappy.h +209 -0
  138. data/ext/third_party/snappy/snappy_compress_fuzzer.cc +60 -0
  139. data/ext/third_party/snappy/snappy_uncompress_fuzzer.cc +58 -0
  140. data/ext/third_party/snappy/snappy_unittest.cc +1512 -0
  141. data/ext/third_party/snappy/testdata/alice29.txt +3609 -0
  142. data/ext/third_party/snappy/testdata/asyoulik.txt +4122 -0
  143. data/ext/third_party/snappy/testdata/baddata1.snappy +0 -0
  144. data/ext/third_party/snappy/testdata/baddata2.snappy +0 -0
  145. data/ext/third_party/snappy/testdata/baddata3.snappy +0 -0
  146. data/ext/third_party/snappy/testdata/fireworks.jpeg +0 -0
  147. data/ext/third_party/snappy/testdata/geo.protodata +0 -0
  148. data/ext/third_party/snappy/testdata/html +1 -0
  149. data/ext/third_party/snappy/testdata/html_x_4 +1 -0
  150. data/ext/third_party/snappy/testdata/kppkn.gtb +0 -0
  151. data/ext/third_party/snappy/testdata/lcet10.txt +7519 -0
  152. data/ext/third_party/snappy/testdata/paper-100k.pdf +600 -2
  153. data/ext/third_party/snappy/testdata/plrabn12.txt +10699 -0
  154. data/ext/third_party/snappy/testdata/urls.10K +10000 -0
  155. data/lib/couchbase/binary_collection.rb +33 -76
  156. data/lib/couchbase/binary_collection_options.rb +94 -0
  157. data/lib/couchbase/bucket.rb +9 -3
  158. data/lib/couchbase/cluster.rb +161 -23
  159. data/lib/couchbase/collection.rb +108 -191
  160. data/lib/couchbase/collection_options.rb +430 -0
  161. data/lib/couchbase/errors.rb +136 -134
  162. data/lib/couchbase/json_transcoder.rb +32 -0
  163. data/lib/couchbase/management/analytics_index_manager.rb +185 -9
  164. data/lib/couchbase/management/bucket_manager.rb +84 -33
  165. data/lib/couchbase/management/collection_manager.rb +166 -1
  166. data/lib/couchbase/management/query_index_manager.rb +261 -0
  167. data/lib/couchbase/management/search_index_manager.rb +291 -0
  168. data/lib/couchbase/management/user_manager.rb +12 -10
  169. data/lib/couchbase/management/view_index_manager.rb +151 -1
  170. data/lib/couchbase/mutation_state.rb +11 -1
  171. data/lib/couchbase/scope.rb +4 -4
  172. data/lib/couchbase/version.rb +1 -1
  173. metadata +113 -18
  174. data/.travis.yml +0 -7
  175. data/ext/couchbase/io/binary_parser.hxx +0 -64
  176. data/lib/couchbase/results.rb +0 -307
@@ -0,0 +1,26 @@
1
+ # How to Contribute
2
+
3
+ We'd love to accept your patches and contributions to this project. There are
4
+ just a few small guidelines you need to follow.
5
+
6
+ ## Contributor License Agreement
7
+
8
+ Contributions to this project must be accompanied by a Contributor License
9
+ Agreement. You (or your employer) retain the copyright to your contribution,
10
+ this simply gives us permission to use and redistribute your contributions as
11
+ part of the project. Head over to <https://cla.developers.google.com/> to see
12
+ your current agreements on file or to sign a new one.
13
+
14
+ You generally only need to submit a CLA once, so if you've already submitted one
15
+ (even if it was for a different project), you probably don't need to do it
16
+ again.
17
+
18
+ ## Code reviews
19
+
20
+ All submissions, including submissions by project members, require review. We
21
+ use GitHub pull requests for this purpose. Consult
22
+ [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
23
+ information on using pull requests.
24
+
25
+ Please make sure that all the automated checks (CLA, AppVeyor, Travis) pass for
26
+ your pull requests. Pull requests whose checks fail may be ignored.
@@ -0,0 +1,54 @@
1
+ Copyright 2011, Google Inc.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are
6
+ met:
7
+
8
+ * Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above
11
+ copyright notice, this list of conditions and the following disclaimer
12
+ in the documentation and/or other materials provided with the
13
+ distribution.
14
+ * Neither the name of Google Inc. nor the names of its
15
+ contributors may be used to endorse or promote products derived from
16
+ this software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ ===
31
+
32
+ Some of the benchmark data in testdata/ is licensed differently:
33
+
34
+ - fireworks.jpeg is Copyright 2013 Steinar H. Gunderson, and
35
+ is licensed under the Creative Commons Attribution 3.0 license
36
+ (CC-BY-3.0). See https://creativecommons.org/licenses/by/3.0/
37
+ for more information.
38
+
39
+ - kppkn.gtb is taken from the Gaviota chess tablebase set, and
40
+ is licensed under the MIT License. See
41
+ https://sites.google.com/site/gaviotachessengine/Home/endgame-tablebases-1
42
+ for more information.
43
+
44
+ - paper-100k.pdf is an excerpt (bytes 92160 to 194560) from the paper
45
+ “Combinatorial Modeling of Chromatin Features Quantitatively Predicts DNA
46
+ Replication Timing in _Drosophila_” by Federico Comoglio and Renato Paro,
47
+ which is licensed under the CC-BY license. See
48
+ http://www.ploscompbiol.org/static/license for more ifnormation.
49
+
50
+ - alice29.txt, asyoulik.txt, plrabn12.txt and lcet10.txt are from Project
51
+ Gutenberg. The first three have expired copyrights and are in the public
52
+ domain; the latter does not have expired copyright, but is still in the
53
+ public domain according to the license information
54
+ (http://www.gutenberg.org/ebooks/53).
@@ -0,0 +1,188 @@
1
+ Snappy v1.1.8, January 15th 2020:
2
+
3
+ * Small performance improvements.
4
+
5
+ * Removed snappy::string alias for std::string.
6
+
7
+ * Improved CMake configuration.
8
+
9
+ Snappy v1.1.7, August 24th 2017:
10
+
11
+ * Improved CMake build support for 64-bit Linux distributions.
12
+
13
+ * MSVC builds now use MSVC-specific intrinsics that map to clzll.
14
+
15
+ * ARM64 (AArch64) builds use the code paths optimized for 64-bit processors.
16
+
17
+ Snappy v1.1.6, July 12th 2017:
18
+
19
+ This is a re-release of v1.1.5 with proper SONAME / SOVERSION values.
20
+
21
+ Snappy v1.1.5, June 28th 2017:
22
+
23
+ This release has broken SONAME / SOVERSION values. Users of snappy as a shared
24
+ library should avoid 1.1.5 and use 1.1.6 instead. SONAME / SOVERSION errors will
25
+ manifest as the dynamic library loader complaining that it cannot find snappy's
26
+ shared library file (libsnappy.so / libsnappy.dylib), or that the library it
27
+ found does not have the required version. 1.1.6 has the same code as 1.1.5, but
28
+ carries build configuration fixes for the issues above.
29
+
30
+ * Add CMake build support. The autoconf build support is now deprecated, and
31
+ will be removed in the next release.
32
+
33
+ * Add AppVeyor configuration, for Windows CI coverage.
34
+
35
+ * Small performance improvement on little-endian PowerPC.
36
+
37
+ * Small performance improvement on LLVM with position-independent executables.
38
+
39
+ * Fix a few issues with various build environments.
40
+
41
+ Snappy v1.1.4, January 25th 2017:
42
+
43
+ * Fix a 1% performance regression when snappy is used in PIE executables.
44
+
45
+ * Improve compression performance by 5%.
46
+
47
+ * Improve decompression performance by 20%.
48
+
49
+ Snappy v1.1.3, July 6th 2015:
50
+
51
+ This is the first release to be done from GitHub, which means that
52
+ some minor things like the ChangeLog format has changed (git log
53
+ format instead of svn log).
54
+
55
+ * Add support for Uncompress() from a Source to a Sink.
56
+
57
+ * Various minor changes to improve MSVC support; in particular,
58
+ the unit tests now compile and run under MSVC.
59
+
60
+
61
+ Snappy v1.1.2, February 28th 2014:
62
+
63
+ This is a maintenance release with no changes to the actual library
64
+ source code.
65
+
66
+ * Stop distributing benchmark data files that have unclear
67
+ or unsuitable licensing.
68
+
69
+ * Add support for padding chunks in the framing format.
70
+
71
+
72
+ Snappy v1.1.1, October 15th 2013:
73
+
74
+ * Add support for uncompressing to iovecs (scatter I/O).
75
+ The bulk of this patch was contributed by Mohit Aron.
76
+
77
+ * Speed up decompression by ~2%; much more so (~13-20%) on
78
+ a few benchmarks on given compilers and CPUs.
79
+
80
+ * Fix a few issues with MSVC compilation.
81
+
82
+ * Support truncated test data in the benchmark.
83
+
84
+
85
+ Snappy v1.1.0, January 18th 2013:
86
+
87
+ * Snappy now uses 64 kB block size instead of 32 kB. On average,
88
+ this means it compresses about 3% denser (more so for some
89
+ inputs), at the same or better speeds.
90
+
91
+ * libsnappy no longer depends on iostream.
92
+
93
+ * Some small performance improvements in compression on x86
94
+ (0.5–1%).
95
+
96
+ * Various portability fixes for ARM-based platforms, for MSVC,
97
+ and for GNU/Hurd.
98
+
99
+
100
+ Snappy v1.0.5, February 24th 2012:
101
+
102
+ * More speed improvements. Exactly how big will depend on
103
+ the architecture:
104
+
105
+ - 3–10% faster decompression for the base case (x86-64).
106
+
107
+ - ARMv7 and higher can now use unaligned accesses,
108
+ and will see about 30% faster decompression and
109
+ 20–40% faster compression.
110
+
111
+ - 32-bit platforms (ARM and 32-bit x86) will see 2–5%
112
+ faster compression.
113
+
114
+ These are all cumulative (e.g., ARM gets all three speedups).
115
+
116
+ * Fixed an issue where the unit test would crash on system
117
+ with less than 256 MB address space available,
118
+ e.g. some embedded platforms.
119
+
120
+ * Added a framing format description, for use over e.g. HTTP,
121
+ or for a command-line compressor. We do not have any
122
+ implementations of this at the current point, but there seems
123
+ to be enough of a general interest in the topic.
124
+ Also make the format description slightly clearer.
125
+
126
+ * Remove some compile-time warnings in -Wall
127
+ (mostly signed/unsigned comparisons), for easier embedding
128
+ into projects that use -Wall -Werror.
129
+
130
+
131
+ Snappy v1.0.4, September 15th 2011:
132
+
133
+ * Speeded up the decompressor somewhat; typically about 2–8%
134
+ for Core i7, in 64-bit mode (comparable for Opteron).
135
+ Somewhat more for some tests, almost no gain for others.
136
+
137
+ * Make Snappy compile on certain platforms it didn't before
138
+ (Solaris with SunPro C++, HP-UX, AIX).
139
+
140
+ * Correct some minor errors in the format description.
141
+
142
+
143
+ Snappy v1.0.3, June 2nd 2011:
144
+
145
+ * Speeded up the decompressor somewhat; about 3-6% for Core 2,
146
+ 6-13% for Core i7, and 5-12% for Opteron (all in 64-bit mode).
147
+
148
+ * Added compressed format documentation. This text is new,
149
+ but an earlier version from Zeev Tarantov was used as reference.
150
+
151
+ * Only link snappy_unittest against -lz and other autodetected
152
+ libraries, not libsnappy.so (which doesn't need any such dependency).
153
+
154
+ * Fixed some display issues in the microbenchmarks, one of which would
155
+ frequently make the test crash on GNU/Hurd.
156
+
157
+
158
+ Snappy v1.0.2, April 29th 2011:
159
+
160
+ * Relicense to a BSD-type license.
161
+
162
+ * Added C bindings, contributed by Martin Gieseking.
163
+
164
+ * More Win32 fixes, in particular for MSVC.
165
+
166
+ * Replace geo.protodata with a newer version.
167
+
168
+ * Fix timing inaccuracies in the unit test when comparing Snappy
169
+ to other algorithms.
170
+
171
+
172
+ Snappy v1.0.1, March 25th 2011:
173
+
174
+ This is a maintenance release, mostly containing minor fixes.
175
+ There is no new functionality. The most important fixes include:
176
+
177
+ * The COPYING file and all licensing headers now correctly state that
178
+ Snappy is licensed under the Apache 2.0 license.
179
+
180
+ * snappy_unittest should now compile natively under Windows,
181
+ as well as on embedded systems with no mmap().
182
+
183
+ * Various autotools nits have been fixed.
184
+
185
+
186
+ Snappy v1.0, March 17th 2011:
187
+
188
+ * Initial version.
@@ -0,0 +1,148 @@
1
+ Snappy, a fast compressor/decompressor.
2
+
3
+
4
+ Introduction
5
+ ============
6
+
7
+ Snappy is a compression/decompression library. It does not aim for maximum
8
+ compression, or compatibility with any other compression library; instead,
9
+ it aims for very high speeds and reasonable compression. For instance,
10
+ compared to the fastest mode of zlib, Snappy is an order of magnitude faster
11
+ for most inputs, but the resulting compressed files are anywhere from 20% to
12
+ 100% bigger. (For more information, see "Performance", below.)
13
+
14
+ Snappy has the following properties:
15
+
16
+ * Fast: Compression speeds at 250 MB/sec and beyond, with no assembler code.
17
+ See "Performance" below.
18
+ * Stable: Over the last few years, Snappy has compressed and decompressed
19
+ petabytes of data in Google's production environment. The Snappy bitstream
20
+ format is stable and will not change between versions.
21
+ * Robust: The Snappy decompressor is designed not to crash in the face of
22
+ corrupted or malicious input.
23
+ * Free and open source software: Snappy is licensed under a BSD-type license.
24
+ For more information, see the included COPYING file.
25
+
26
+ Snappy has previously been called "Zippy" in some Google presentations
27
+ and the like.
28
+
29
+
30
+ Performance
31
+ ===========
32
+
33
+ Snappy is intended to be fast. On a single core of a Core i7 processor
34
+ in 64-bit mode, it compresses at about 250 MB/sec or more and decompresses at
35
+ about 500 MB/sec or more. (These numbers are for the slowest inputs in our
36
+ benchmark suite; others are much faster.) In our tests, Snappy usually
37
+ is faster than algorithms in the same class (e.g. LZO, LZF, QuickLZ,
38
+ etc.) while achieving comparable compression ratios.
39
+
40
+ Typical compression ratios (based on the benchmark suite) are about 1.5-1.7x
41
+ for plain text, about 2-4x for HTML, and of course 1.0x for JPEGs, PNGs and
42
+ other already-compressed data. Similar numbers for zlib in its fastest mode
43
+ are 2.6-2.8x, 3-7x and 1.0x, respectively. More sophisticated algorithms are
44
+ capable of achieving yet higher compression rates, although usually at the
45
+ expense of speed. Of course, compression ratio will vary significantly with
46
+ the input.
47
+
48
+ Although Snappy should be fairly portable, it is primarily optimized
49
+ for 64-bit x86-compatible processors, and may run slower in other environments.
50
+ In particular:
51
+
52
+ - Snappy uses 64-bit operations in several places to process more data at
53
+ once than would otherwise be possible.
54
+ - Snappy assumes unaligned 32 and 64-bit loads and stores are cheap.
55
+ On some platforms, these must be emulated with single-byte loads
56
+ and stores, which is much slower.
57
+ - Snappy assumes little-endian throughout, and needs to byte-swap data in
58
+ several places if running on a big-endian platform.
59
+
60
+ Experience has shown that even heavily tuned code can be improved.
61
+ Performance optimizations, whether for 64-bit x86 or other platforms,
62
+ are of course most welcome; see "Contact", below.
63
+
64
+
65
+ Building
66
+ ========
67
+
68
+ You need the CMake version specified in [CMakeLists.txt](./CMakeLists.txt)
69
+ or later to build:
70
+
71
+ ```bash
72
+ mkdir build
73
+ cd build && cmake ../ && make
74
+ ```
75
+
76
+ Usage
77
+ =====
78
+
79
+ Note that Snappy, both the implementation and the main interface,
80
+ is written in C++. However, several third-party bindings to other languages
81
+ are available; see the [home page](docs/README.md) for more information.
82
+ Also, if you want to use Snappy from C code, you can use the included C
83
+ bindings in snappy-c.h.
84
+
85
+ To use Snappy from your own C++ program, include the file "snappy.h" from
86
+ your calling file, and link against the compiled library.
87
+
88
+ There are many ways to call Snappy, but the simplest possible is
89
+
90
+ ```c++
91
+ snappy::Compress(input.data(), input.size(), &output);
92
+ ```
93
+
94
+ and similarly
95
+
96
+ ```c++
97
+ snappy::Uncompress(input.data(), input.size(), &output);
98
+ ```
99
+
100
+ where "input" and "output" are both instances of std::string.
101
+
102
+ There are other interfaces that are more flexible in various ways, including
103
+ support for custom (non-array) input sources. See the header file for more
104
+ information.
105
+
106
+
107
+ Tests and benchmarks
108
+ ====================
109
+
110
+ When you compile Snappy, snappy_unittest is compiled in addition to the
111
+ library itself. You do not need it to use the compressor from your own library,
112
+ but it contains several useful components for Snappy development.
113
+
114
+ First of all, it contains unit tests, verifying correctness on your machine in
115
+ various scenarios. If you want to change or optimize Snappy, please run the
116
+ tests to verify you have not broken anything. Note that if you have the
117
+ Google Test library installed, unit test behavior (especially failures) will be
118
+ significantly more user-friendly. You can find Google Test at
119
+
120
+ https://github.com/google/googletest
121
+
122
+ You probably also want the gflags library for handling of command-line flags;
123
+ you can find it at
124
+
125
+ https://gflags.github.io/gflags/
126
+
127
+ In addition to the unit tests, snappy contains microbenchmarks used to
128
+ tune compression and decompression performance. These are automatically run
129
+ before the unit tests, but you can disable them using the flag
130
+ --run_microbenchmarks=false if you have gflags installed (otherwise you will
131
+ need to edit the source).
132
+
133
+ Finally, snappy can benchmark Snappy against a few other compression libraries
134
+ (zlib, LZO, LZF, and QuickLZ), if they were detected at configure time.
135
+ To benchmark using a given file, give the compression algorithm you want to test
136
+ Snappy against (e.g. --zlib) and then a list of one or more file names on the
137
+ command line. The testdata/ directory contains the files used by the
138
+ microbenchmark, which should provide a reasonably balanced starting point for
139
+ benchmarking. (Note that baddata[1-3].snappy are not intended as benchmarks; they
140
+ are used to verify correctness in the presence of corrupted data in the unit
141
+ test.)
142
+
143
+
144
+ Contact
145
+ =======
146
+
147
+ Snappy is distributed through GitHub. For the latest version, a bug tracker,
148
+ and other information, see https://github.com/google/snappy.
@@ -0,0 +1,33 @@
1
+ # Copyright 2019 Google Inc. All Rights Reserved.
2
+ #
3
+ # Redistribution and use in source and binary forms, with or without
4
+ # modification, are permitted provided that the following conditions are
5
+ # met:
6
+ #
7
+ # * Redistributions of source code must retain the above copyright
8
+ # notice, this list of conditions and the following disclaimer.
9
+ # * Redistributions in binary form must reproduce the above
10
+ # copyright notice, this list of conditions and the following disclaimer
11
+ # in the documentation and/or other materials provided with the
12
+ # distribution.
13
+ # * Neither the name of Google Inc. nor the names of its
14
+ # contributors may be used to endorse or promote products derived from
15
+ # this software without specific prior written permission.
16
+ #
17
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+
29
+ @PACKAGE_INIT@
30
+
31
+ include("${CMAKE_CURRENT_LIST_DIR}/SnappyTargets.cmake")
32
+
33
+ check_required_components(Snappy)