1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
//! Rust interface for Google's LevelDB key-value storage library.
//!
//! ## Crate Features
//!
//! ### `snappy` (enabled by default)
//!
//! Enables Snappy compression support for data compression. When enabled,
//! LevelDB can use Snappy to compress data before writing to disk, reducing
//! storage space at the cost of additional CPU overhead during compression
//! and decompression.
//!
//! ### `zstd` (enabled by default)
//!
//! Enables Zstd compression support for data compression. When enabled,
//! LevelDB can use Zstd to compress data before writing to disk.
//!
//! The compression level can be set during compilation only, using the
//! `LEVELDB_RS_BINDING_OPTIONS_ZSTD_DEFAULT_COMPRESSION_LEVEL` environment variable.
//! See the [Compilation Environment Variables](#compilation-environment-variables)
//! section for details.
//!
//! ### `enable_lto`
//!
//! Enables Link-Time Optimization (LTO) for the underlying third-party libraries compilation.
//! It should improve performance by allowing the compiler to perform optimizations
//! across compilation units, at the cost of longer compilation times.
//!
//! ### `logger`
//!
//! Enables custom logging functionality for LevelDB operations. When enabled,
//! custom log handlers can be used to capture and process LevelDB's internal info log messages.
//! Check module [`logger`](extension::logger) for more information.
//!
//! ## Environment Variables for Compilation
//!
//! ### `LEVELDB_RS_BINDING_FORMAT_NUM_LEVELS`
//!
//! Customizes the number of LSM-tree levels in LevelDB. The default value is 7.
//! It changes the value of `kNumLevels` in both `deps/leveldb/db/dbformat.h` and `deps/leveldb/db/version_set.cc`.
//!
//! Example:
//! ```bash
//! LEVELDB_RS_BINDING_FORMAT_NUM_LEVELS=10 cargo build
//! ```
//!
//! ### `LEVELDB_RS_BINDING_FORMAT_L0_COMPACTION_TRIGGER`
//!
//! Customizes the number of Level-0 files that trigger compaction. The default value is 4.
//! It changes the value of `kL0_CompactionTrigger` in `deps/leveldb/db/dbformat.h`.
//!
//! Example:
//! ```bash
//! LEVELDB_RS_BINDING_FORMAT_L0_COMPACTION_TRIGGER=8 cargo build
//! ```
//!
//! ### `LEVELDB_RS_BINDING_FORMAT_L0_SLOWDOWN_WRITES_TRIGGER`
//!
//! Customizes the number of Level-0 files that trigger write slowdown. The default value is 8.
//! It changes the value of `kL0_SlowdownWritesTrigger` in `deps/leveldb/db/dbformat.h`.
//!
//! Example:
//! ```bash
//! LEVELDB_RS_BINDING_FORMAT_L0_SLOWDOWN_WRITES_TRIGGER=12 cargo build
//! ```
//!
//! ### `LEVELDB_RS_BINDING_FORMAT_L0_STOP_WRITES_TRIGGER`
//!
//! Customizes the number of Level-0 files that trigger write stop. The default value is 12.
//! It changes the value of `kL0_StopWritesTrigger` in `deps/leveldb/db/dbformat.h`.
//!
//! Example:
//! ```bash
//! LEVELDB_RS_BINDING_FORMAT_L0_STOP_WRITES_TRIGGER=16 cargo build
//! ```
//!
//! ### `LEVELDB_RS_BINDING_FORMAT_MAX_MEM_COMPACT_LEVEL`
//!
//! Customizes the maximum level for memory compaction. The default value is 2.
//! It changes the value of `kMaxMemCompactLevel` in `deps/leveldb/db/dbformat.h`.
//!
//! Example:
//! ```bash
//! LEVELDB_RS_BINDING_FORMAT_MAX_MEM_COMPACT_LEVEL=3 cargo build
//! ```
//!
//! ### `LEVELDB_RS_BINDING_FORMAT_READ_BYTES_PERIOD`
//!
//! Customizes the read bytes period for rate limiting. The default value is 1048576.
//! It changes the value of `kReadBytesPeriod` in `deps/leveldb/db/dbformat.h`.
//!
//! Example:
//! ```bash
//! LEVELDB_RS_BINDING_FORMAT_READ_BYTES_PERIOD=2097152 cargo build
//! ```
//!
//! ### `LEVELDB_RS_BINDING_OPTIONS_ZSTD_DEFAULT_COMPRESSION_LEVEL`
//!
//! Customizes the default Zstd compression level. The default value is 1.
//! It changes the value of `zstd_compression_level` in `deps/leveldb/include/leveldb/options.h`.
//!
//! Example:
//! ```bash
//! LEVELDB_RS_BINDING_OPTIONS_ZSTD_DEFAULT_COMPRESSION_LEVEL=3 cargo build
//! ```
//!
//! ### `LEVELDB_RS_BINDING_CLEAR_CODE_CHANGES`
//!
//! When set, it automatically resets the LevelDB source code to the original state after build completion.
//! This is useful to keep the source code clean after building with custom configurations.
//!
//! Example:
//! ```bash
//! LEVELDB_RS_BINDING_FORMAT_NUM_LEVELS=8 LEVELDB_RS_BINDING_CLEAR_CODE_CHANGES=y cargo build
//! ```
//!
//! ## Examples
//! Check [here](https://github.com/rim99/leveldb-rs-binding/tree/trunk/example).
extern crate libc;
extern crate ffi_opaque;
use crate;
pub use cratebatch;
pub use cratecompaction;
pub use cratecomparator;
pub use crateerror;
pub use crateiterator;
pub use cratekv;
pub use cratemanagement;
pub use crateoptions;
pub use crateproperty;
pub use cratesnapshots;
pub use cratestatistics;
pub use crateLogger;
/// Library version information
///
/// Need a recent version of LevelDB to be used.