@nxtedition/rocksdb 5.2.1

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 (42) hide show
  1. package/CHANGELOG.md +294 -0
  2. package/LICENSE +21 -0
  3. package/README.md +102 -0
  4. package/UPGRADING.md +91 -0
  5. package/binding.cc +2120 -0
  6. package/binding.gyp +73 -0
  7. package/binding.js +1 -0
  8. package/chained-batch.js +30 -0
  9. package/deps/rocksdb/build_version.cc +4 -0
  10. package/deps/rocksdb/rocksdb.gyp +475 -0
  11. package/deps/snappy/freebsd/config.h +135 -0
  12. package/deps/snappy/freebsd/snappy-stubs-public.h +100 -0
  13. package/deps/snappy/linux/config.h +135 -0
  14. package/deps/snappy/linux/snappy-stubs-public.h +100 -0
  15. package/deps/snappy/mac/config.h +137 -0
  16. package/deps/snappy/mac/snappy-stubs-public.h +100 -0
  17. package/deps/snappy/openbsd/config.h +135 -0
  18. package/deps/snappy/openbsd/snappy-stubs-public.h +100 -0
  19. package/deps/snappy/snappy-1.1.7/COPYING +54 -0
  20. package/deps/snappy/snappy-1.1.7/cmake/SnappyConfig.cmake +1 -0
  21. package/deps/snappy/snappy-1.1.7/cmake/config.h.in +62 -0
  22. package/deps/snappy/snappy-1.1.7/snappy-c.cc +90 -0
  23. package/deps/snappy/snappy-1.1.7/snappy-c.h +138 -0
  24. package/deps/snappy/snappy-1.1.7/snappy-internal.h +224 -0
  25. package/deps/snappy/snappy-1.1.7/snappy-sinksource.cc +104 -0
  26. package/deps/snappy/snappy-1.1.7/snappy-sinksource.h +182 -0
  27. package/deps/snappy/snappy-1.1.7/snappy-stubs-internal.cc +42 -0
  28. package/deps/snappy/snappy-1.1.7/snappy-stubs-internal.h +561 -0
  29. package/deps/snappy/snappy-1.1.7/snappy-stubs-public.h.in +94 -0
  30. package/deps/snappy/snappy-1.1.7/snappy-test.cc +612 -0
  31. package/deps/snappy/snappy-1.1.7/snappy-test.h +573 -0
  32. package/deps/snappy/snappy-1.1.7/snappy.cc +1515 -0
  33. package/deps/snappy/snappy-1.1.7/snappy.h +203 -0
  34. package/deps/snappy/snappy-1.1.7/snappy_unittest.cc +1410 -0
  35. package/deps/snappy/snappy.gyp +90 -0
  36. package/deps/snappy/solaris/config.h +135 -0
  37. package/deps/snappy/solaris/snappy-stubs-public.h +100 -0
  38. package/deps/snappy/win32/config.h +29 -0
  39. package/deps/snappy/win32/snappy-stubs-public.h +100 -0
  40. package/iterator.js +50 -0
  41. package/leveldown.js +164 -0
  42. package/package.json +70 -0
@@ -0,0 +1,100 @@
1
+ // Copyright 2011 Google Inc. All Rights Reserved.
2
+ // Author: sesse@google.com (Steinar H. Gunderson)
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
+ // Various type stubs for the open-source version of Snappy.
31
+ //
32
+ // This file cannot include config.h, as it is included from snappy.h,
33
+ // which is a public header. Instead, snappy-stubs-public.h is generated by
34
+ // from snappy-stubs-public.h.in at configure time.
35
+
36
+ #ifndef THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_
37
+ #define THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_
38
+
39
+ #if 1
40
+ #include <stdint.h>
41
+ #endif
42
+
43
+ #if 1
44
+ #include <stddef.h>
45
+ #endif
46
+
47
+ #if 1
48
+ #include <sys/uio.h>
49
+ #endif
50
+
51
+ #define SNAPPY_MAJOR 1
52
+ #define SNAPPY_MINOR 1
53
+ #define SNAPPY_PATCHLEVEL 4
54
+ #define SNAPPY_VERSION \
55
+ ((SNAPPY_MAJOR << 16) | (SNAPPY_MINOR << 8) | SNAPPY_PATCHLEVEL)
56
+
57
+ #include <string>
58
+
59
+ namespace snappy {
60
+
61
+ #if 1
62
+ typedef int8_t int8;
63
+ typedef uint8_t uint8;
64
+ typedef int16_t int16;
65
+ typedef uint16_t uint16;
66
+ typedef int32_t int32;
67
+ typedef uint32_t uint32;
68
+ typedef int64_t int64;
69
+ typedef uint64_t uint64;
70
+ #else
71
+ typedef signed char int8;
72
+ typedef unsigned char uint8;
73
+ typedef short int16;
74
+ typedef unsigned short uint16;
75
+ typedef int int32;
76
+ typedef unsigned int uint32;
77
+ typedef long long int64;
78
+ typedef unsigned long long uint64;
79
+ #endif
80
+
81
+ typedef std::string string;
82
+
83
+ #ifndef DISALLOW_COPY_AND_ASSIGN
84
+ #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
85
+ TypeName(const TypeName&); \
86
+ void operator=(const TypeName&)
87
+ #endif
88
+
89
+ #if !1
90
+ // Windows does not have an iovec type, yet the concept is universally useful.
91
+ // It is simple to define it ourselves, so we put it inside our own namespace.
92
+ struct iovec {
93
+ void* iov_base;
94
+ size_t iov_len;
95
+ };
96
+ #endif
97
+
98
+ } // namespace snappy
99
+
100
+ #endif // THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_
@@ -0,0 +1,135 @@
1
+ /* config.h. Generated from config.h.in by configure. */
2
+ /* config.h.in. Generated from configure.ac by autoheader. */
3
+
4
+ /* Define if building universal (internal helper macro) */
5
+ /* #undef AC_APPLE_UNIVERSAL_BUILD */
6
+
7
+ /* Define to 1 if the compiler supports __builtin_ctz and friends. */
8
+ #define HAVE_BUILTIN_CTZ 1
9
+
10
+ /* Define to 1 if the compiler supports __builtin_expect. */
11
+ #define HAVE_BUILTIN_EXPECT 1
12
+
13
+ /* Define to 1 if you have the <byteswap.h> header file. */
14
+ /* #undef HAVE_BYTESWAP_H */
15
+
16
+ /* Define to 1 if you have the <dlfcn.h> header file. */
17
+ #define HAVE_DLFCN_H 1
18
+
19
+ /* Use the gflags package for command-line parsing. */
20
+ /* #undef HAVE_GFLAGS */
21
+
22
+ /* Defined when Google Test is available. */
23
+ /* #undef HAVE_GTEST */
24
+
25
+ /* Define to 1 if you have the <inttypes.h> header file. */
26
+ #define HAVE_INTTYPES_H 1
27
+
28
+ /* Define to 1 if you have the `fastlz' library (-lfastlz). */
29
+ /* #undef HAVE_LIBFASTLZ */
30
+
31
+ /* Define to 1 if you have the `lzf' library (-llzf). */
32
+ /* #undef HAVE_LIBLZF */
33
+
34
+ /* Define to 1 if you have the `lzo2' library (-llzo2). */
35
+ /* #undef HAVE_LIBLZO2 */
36
+
37
+ /* Define to 1 if you have the `quicklz' library (-lquicklz). */
38
+ /* #undef HAVE_LIBQUICKLZ */
39
+
40
+ /* Define to 1 if you have the `z' library (-lz). */
41
+ #define HAVE_LIBZ 1
42
+
43
+ /* Define to 1 if you have the <memory.h> header file. */
44
+ #define HAVE_MEMORY_H 1
45
+
46
+ /* Define to 1 if you have the <stddef.h> header file. */
47
+ #define HAVE_STDDEF_H 1
48
+
49
+ /* Define to 1 if you have the <stdint.h> header file. */
50
+ #define HAVE_STDINT_H 1
51
+
52
+ /* Define to 1 if you have the <stdlib.h> header file. */
53
+ #define HAVE_STDLIB_H 1
54
+
55
+ /* Define to 1 if you have the <strings.h> header file. */
56
+ #define HAVE_STRINGS_H 1
57
+
58
+ /* Define to 1 if you have the <string.h> header file. */
59
+ #define HAVE_STRING_H 1
60
+
61
+ /* Define to 1 if you have the <sys/byteswap.h> header file. */
62
+ /* #undef HAVE_SYS_BYTESWAP_H */
63
+
64
+ /* Define to 1 if you have the <sys/endian.h> header file. */
65
+ #define HAVE_SYS_ENDIAN_H 1
66
+
67
+ /* Define to 1 if you have the <sys/mman.h> header file. */
68
+ #define HAVE_SYS_MMAN_H 1
69
+
70
+ /* Define to 1 if you have the <sys/resource.h> header file. */
71
+ #define HAVE_SYS_RESOURCE_H 1
72
+
73
+ /* Define to 1 if you have the <sys/stat.h> header file. */
74
+ #define HAVE_SYS_STAT_H 1
75
+
76
+ /* Define to 1 if you have the <sys/time.h> header file. */
77
+ #define HAVE_SYS_TIME_H 1
78
+
79
+ /* Define to 1 if you have the <sys/types.h> header file. */
80
+ #define HAVE_SYS_TYPES_H 1
81
+
82
+ /* Define to 1 if you have the <sys/uio.h> header file. */
83
+ #define HAVE_SYS_UIO_H 1
84
+
85
+ /* Define to 1 if you have the <unistd.h> header file. */
86
+ #define HAVE_UNISTD_H 1
87
+
88
+ /* Define to 1 if you have the <windows.h> header file. */
89
+ /* #undef HAVE_WINDOWS_H */
90
+
91
+ /* Define to the sub-directory in which libtool stores uninstalled libraries.
92
+ */
93
+ #define LT_OBJDIR ".libs/"
94
+
95
+ /* Name of package */
96
+ #define PACKAGE "snappy"
97
+
98
+ /* Define to the address where bug reports for this package should be sent. */
99
+ #define PACKAGE_BUGREPORT ""
100
+
101
+ /* Define to the full name of this package. */
102
+ #define PACKAGE_NAME "snappy"
103
+
104
+ /* Define to the full name and version of this package. */
105
+ #define PACKAGE_STRING "snappy 1.1.4"
106
+
107
+ /* Define to the one symbol short name of this package. */
108
+ #define PACKAGE_TARNAME "snappy"
109
+
110
+ /* Define to the version of this package. */
111
+ #define PACKAGE_VERSION "1.1.4"
112
+
113
+ /* Define to 1 if you have the ANSI C header files. */
114
+ #define STDC_HEADERS 1
115
+
116
+ /* Version number of package */
117
+ #define VERSION "1.1.4"
118
+
119
+ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
120
+ significant byte first (like Motorola and SPARC, unlike Intel). */
121
+ #if defined AC_APPLE_UNIVERSAL_BUILD
122
+ # if defined __BIG_ENDIAN__
123
+ # define WORDS_BIGENDIAN 1
124
+ # endif
125
+ #else
126
+ # ifndef WORDS_BIGENDIAN
127
+ /* # undef WORDS_BIGENDIAN */
128
+ # endif
129
+ #endif
130
+
131
+ /* Define to `unsigned int' if <sys/types.h> does not define. */
132
+ /* #undef size_t */
133
+
134
+ /* Define to `int' if <sys/types.h> does not define. */
135
+ /* #undef ssize_t */
@@ -0,0 +1,100 @@
1
+ // Copyright 2011 Google Inc. All Rights Reserved.
2
+ // Author: sesse@google.com (Steinar H. Gunderson)
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
+ // Various type stubs for the open-source version of Snappy.
31
+ //
32
+ // This file cannot include config.h, as it is included from snappy.h,
33
+ // which is a public header. Instead, snappy-stubs-public.h is generated by
34
+ // from snappy-stubs-public.h.in at configure time.
35
+
36
+ #ifndef THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_
37
+ #define THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_
38
+
39
+ #if 1
40
+ #include <stdint.h>
41
+ #endif
42
+
43
+ #if 1
44
+ #include <stddef.h>
45
+ #endif
46
+
47
+ #if 1
48
+ #include <sys/uio.h>
49
+ #endif
50
+
51
+ #define SNAPPY_MAJOR 1
52
+ #define SNAPPY_MINOR 1
53
+ #define SNAPPY_PATCHLEVEL 4
54
+ #define SNAPPY_VERSION \
55
+ ((SNAPPY_MAJOR << 16) | (SNAPPY_MINOR << 8) | SNAPPY_PATCHLEVEL)
56
+
57
+ #include <string>
58
+
59
+ namespace snappy {
60
+
61
+ #if 1
62
+ typedef int8_t int8;
63
+ typedef uint8_t uint8;
64
+ typedef int16_t int16;
65
+ typedef uint16_t uint16;
66
+ typedef int32_t int32;
67
+ typedef uint32_t uint32;
68
+ typedef int64_t int64;
69
+ typedef uint64_t uint64;
70
+ #else
71
+ typedef signed char int8;
72
+ typedef unsigned char uint8;
73
+ typedef short int16;
74
+ typedef unsigned short uint16;
75
+ typedef int int32;
76
+ typedef unsigned int uint32;
77
+ typedef long long int64;
78
+ typedef unsigned long long uint64;
79
+ #endif
80
+
81
+ typedef std::string string;
82
+
83
+ #ifndef DISALLOW_COPY_AND_ASSIGN
84
+ #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
85
+ TypeName(const TypeName&); \
86
+ void operator=(const TypeName&)
87
+ #endif
88
+
89
+ #if !1
90
+ // Windows does not have an iovec type, yet the concept is universally useful.
91
+ // It is simple to define it ourselves, so we put it inside our own namespace.
92
+ struct iovec {
93
+ void* iov_base;
94
+ size_t iov_len;
95
+ };
96
+ #endif
97
+
98
+ } // namespace snappy
99
+
100
+ #endif // THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_
@@ -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 @@
1
+ include("${CMAKE_CURRENT_LIST_DIR}/SnappyTargets.cmake")
@@ -0,0 +1,62 @@
1
+ #ifndef THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_
2
+ #define THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_
3
+
4
+ /* Define to 1 if the compiler supports __builtin_ctz and friends. */
5
+ #cmakedefine HAVE_BUILTIN_CTZ 1
6
+
7
+ /* Define to 1 if the compiler supports __builtin_expect. */
8
+ #cmakedefine HAVE_BUILTIN_EXPECT 1
9
+
10
+ /* Define to 1 if you have the <byteswap.h> header file. */
11
+ #cmakedefine HAVE_BYTESWAP_H 1
12
+
13
+ /* Define to 1 if you have a definition for mmap() in <sys/mman.h>. */
14
+ #cmakedefine HAVE_FUNC_MMAP 1
15
+
16
+ /* Define to 1 if you have a definition for sysconf() in <unistd.h>. */
17
+ #cmakedefine HAVE_FUNC_SYSCONF 1
18
+
19
+ /* Define to 1 to use the gflags package for command-line parsing. */
20
+ #cmakedefine HAVE_GFLAGS 1
21
+
22
+ /* Define to 1 if you have Google Test. */
23
+ #cmakedefine HAVE_GTEST 1
24
+
25
+ /* Define to 1 if you have the `lzo2' library (-llzo2). */
26
+ #cmakedefine HAVE_LIBLZO2 1
27
+
28
+ /* Define to 1 if you have the `z' library (-lz). */
29
+ #cmakedefine HAVE_LIBZ 1
30
+
31
+ /* Define to 1 if you have the <stddef.h> header file. */
32
+ #cmakedefine HAVE_STDDEF_H 1
33
+
34
+ /* Define to 1 if you have the <stdint.h> header file. */
35
+ #cmakedefine HAVE_STDINT_H 1
36
+
37
+ /* Define to 1 if you have the <sys/endian.h> header file. */
38
+ #cmakedefine HAVE_SYS_ENDIAN_H 1
39
+
40
+ /* Define to 1 if you have the <sys/mman.h> header file. */
41
+ #cmakedefine HAVE_SYS_MMAN_H 1
42
+
43
+ /* Define to 1 if you have the <sys/resource.h> header file. */
44
+ #cmakedefine HAVE_SYS_RESOURCE_H 1
45
+
46
+ /* Define to 1 if you have the <sys/time.h> header file. */
47
+ #cmakedefine HAVE_SYS_TIME_H 1
48
+
49
+ /* Define to 1 if you have the <sys/uio.h> header file. */
50
+ #cmakedefine HAVE_SYS_UIO_H 1
51
+
52
+ /* Define to 1 if you have the <unistd.h> header file. */
53
+ #cmakedefine HAVE_UNISTD_H 1
54
+
55
+ /* Define to 1 if you have the <windows.h> header file. */
56
+ #cmakedefine HAVE_WINDOWS_H 1
57
+
58
+ /* Define to 1 if your processor stores words with the most significant byte
59
+ first (like Motorola and SPARC, unlike Intel and VAX). */
60
+ #cmakedefine SNAPPY_IS_BIG_ENDIAN 1
61
+
62
+ #endif // THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_
@@ -0,0 +1,90 @@
1
+ // Copyright 2011 Martin Gieseking <martin.gieseking@uos.de>.
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
+ #include "snappy.h"
30
+ #include "snappy-c.h"
31
+
32
+ extern "C" {
33
+
34
+ snappy_status snappy_compress(const char* input,
35
+ size_t input_length,
36
+ char* compressed,
37
+ size_t *compressed_length) {
38
+ if (*compressed_length < snappy_max_compressed_length(input_length)) {
39
+ return SNAPPY_BUFFER_TOO_SMALL;
40
+ }
41
+ snappy::RawCompress(input, input_length, compressed, compressed_length);
42
+ return SNAPPY_OK;
43
+ }
44
+
45
+ snappy_status snappy_uncompress(const char* compressed,
46
+ size_t compressed_length,
47
+ char* uncompressed,
48
+ size_t* uncompressed_length) {
49
+ size_t real_uncompressed_length;
50
+ if (!snappy::GetUncompressedLength(compressed,
51
+ compressed_length,
52
+ &real_uncompressed_length)) {
53
+ return SNAPPY_INVALID_INPUT;
54
+ }
55
+ if (*uncompressed_length < real_uncompressed_length) {
56
+ return SNAPPY_BUFFER_TOO_SMALL;
57
+ }
58
+ if (!snappy::RawUncompress(compressed, compressed_length, uncompressed)) {
59
+ return SNAPPY_INVALID_INPUT;
60
+ }
61
+ *uncompressed_length = real_uncompressed_length;
62
+ return SNAPPY_OK;
63
+ }
64
+
65
+ size_t snappy_max_compressed_length(size_t source_length) {
66
+ return snappy::MaxCompressedLength(source_length);
67
+ }
68
+
69
+ snappy_status snappy_uncompressed_length(const char *compressed,
70
+ size_t compressed_length,
71
+ size_t *result) {
72
+ if (snappy::GetUncompressedLength(compressed,
73
+ compressed_length,
74
+ result)) {
75
+ return SNAPPY_OK;
76
+ } else {
77
+ return SNAPPY_INVALID_INPUT;
78
+ }
79
+ }
80
+
81
+ snappy_status snappy_validate_compressed_buffer(const char *compressed,
82
+ size_t compressed_length) {
83
+ if (snappy::IsValidCompressedBuffer(compressed, compressed_length)) {
84
+ return SNAPPY_OK;
85
+ } else {
86
+ return SNAPPY_INVALID_INPUT;
87
+ }
88
+ }
89
+
90
+ } // extern "C"
@@ -0,0 +1,138 @@
1
+ /*
2
+ * Copyright 2011 Martin Gieseking <martin.gieseking@uos.de>.
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
+ * Plain C interface (a wrapper around the C++ implementation).
31
+ */
32
+
33
+ #ifndef THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_C_H_
34
+ #define THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_C_H_
35
+
36
+ #ifdef __cplusplus
37
+ extern "C" {
38
+ #endif
39
+
40
+ #include <stddef.h>
41
+
42
+ /*
43
+ * Return values; see the documentation for each function to know
44
+ * what each can return.
45
+ */
46
+ typedef enum {
47
+ SNAPPY_OK = 0,
48
+ SNAPPY_INVALID_INPUT = 1,
49
+ SNAPPY_BUFFER_TOO_SMALL = 2
50
+ } snappy_status;
51
+
52
+ /*
53
+ * Takes the data stored in "input[0..input_length-1]" and stores
54
+ * it in the array pointed to by "compressed".
55
+ *
56
+ * <compressed_length> signals the space available in "compressed".
57
+ * If it is not at least equal to "snappy_max_compressed_length(input_length)",
58
+ * SNAPPY_BUFFER_TOO_SMALL is returned. After successful compression,
59
+ * <compressed_length> contains the true length of the compressed output,
60
+ * and SNAPPY_OK is returned.
61
+ *
62
+ * Example:
63
+ * size_t output_length = snappy_max_compressed_length(input_length);
64
+ * char* output = (char*)malloc(output_length);
65
+ * if (snappy_compress(input, input_length, output, &output_length)
66
+ * == SNAPPY_OK) {
67
+ * ... Process(output, output_length) ...
68
+ * }
69
+ * free(output);
70
+ */
71
+ snappy_status snappy_compress(const char* input,
72
+ size_t input_length,
73
+ char* compressed,
74
+ size_t* compressed_length);
75
+
76
+ /*
77
+ * Given data in "compressed[0..compressed_length-1]" generated by
78
+ * calling the snappy_compress routine, this routine stores
79
+ * the uncompressed data to
80
+ * uncompressed[0..uncompressed_length-1].
81
+ * Returns failure (a value not equal to SNAPPY_OK) if the message
82
+ * is corrupted and could not be decrypted.
83
+ *
84
+ * <uncompressed_length> signals the space available in "uncompressed".
85
+ * If it is not at least equal to the value returned by
86
+ * snappy_uncompressed_length for this stream, SNAPPY_BUFFER_TOO_SMALL
87
+ * is returned. After successful decompression, <uncompressed_length>
88
+ * contains the true length of the decompressed output.
89
+ *
90
+ * Example:
91
+ * size_t output_length;
92
+ * if (snappy_uncompressed_length(input, input_length, &output_length)
93
+ * != SNAPPY_OK) {
94
+ * ... fail ...
95
+ * }
96
+ * char* output = (char*)malloc(output_length);
97
+ * if (snappy_uncompress(input, input_length, output, &output_length)
98
+ * == SNAPPY_OK) {
99
+ * ... Process(output, output_length) ...
100
+ * }
101
+ * free(output);
102
+ */
103
+ snappy_status snappy_uncompress(const char* compressed,
104
+ size_t compressed_length,
105
+ char* uncompressed,
106
+ size_t* uncompressed_length);
107
+
108
+ /*
109
+ * Returns the maximal size of the compressed representation of
110
+ * input data that is "source_length" bytes in length.
111
+ */
112
+ size_t snappy_max_compressed_length(size_t source_length);
113
+
114
+ /*
115
+ * REQUIRES: "compressed[]" was produced by snappy_compress()
116
+ * Returns SNAPPY_OK and stores the length of the uncompressed data in
117
+ * *result normally. Returns SNAPPY_INVALID_INPUT on parsing error.
118
+ * This operation takes O(1) time.
119
+ */
120
+ snappy_status snappy_uncompressed_length(const char* compressed,
121
+ size_t compressed_length,
122
+ size_t* result);
123
+
124
+ /*
125
+ * Check if the contents of "compressed[]" can be uncompressed successfully.
126
+ * Does not return the uncompressed data; if so, returns SNAPPY_OK,
127
+ * or if not, returns SNAPPY_INVALID_INPUT.
128
+ * Takes time proportional to compressed_length, but is usually at least a
129
+ * factor of four faster than actual decompression.
130
+ */
131
+ snappy_status snappy_validate_compressed_buffer(const char* compressed,
132
+ size_t compressed_length);
133
+
134
+ #ifdef __cplusplus
135
+ } // extern "C"
136
+ #endif
137
+
138
+ #endif /* THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_C_H_ */