Skip to content

Commit b3c5ee6

Browse files
committed
update readme
1 parent 83f00f6 commit b3c5ee6

File tree

142 files changed

+28426
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+28426
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
build_config.mk
2+
*.a
3+
*.o
4+
*.dylib*
5+
*.so
6+
*.so.*
7+
*_test
8+
db_bench
9+
leveldbutil

AUTHORS

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Names should be added to this file like so:
2+
# Name or Organization <email address>
3+
4+
Google Inc.
5+
6+
# Initial version authors:
7+
Jeffrey Dean <[email protected]>
8+
Sanjay Ghemawat <[email protected]>
9+
10+
# Partial list of contributors:
11+
Kevin Regan <[email protected]>
12+
Johan Bilien <[email protected]>

CONTRIBUTING.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Contributing
2+
3+
We'd love to accept your code patches! However, before we can take them, we
4+
have to jump a couple of legal hurdles.
5+
6+
## Contributor License Agreements
7+
8+
Please fill out either the individual or corporate Contributor License
9+
Agreement as appropriate.
10+
11+
* If you are an individual writing original source code and you're sure you
12+
own the intellectual property, then sign an [individual CLA](https://developers.google.com/open-source/cla/individual).
13+
* If you work for a company that wants to allow you to contribute your work,
14+
then sign a [corporate CLA](https://developers.google.com/open-source/cla/corporate).
15+
16+
Follow either of the two links above to access the appropriate CLA and
17+
instructions for how to sign and return it.
18+
19+
## Submitting a Patch
20+
21+
1. Sign the contributors license agreement above.
22+
2. Decide which code you want to submit. A submission should be a set of changes
23+
that addresses one issue in the [issue tracker](https://github.com/google/leveldb/issues).
24+
Please don't mix more than one logical change per submission, because it makes
25+
the history hard to follow. If you want to make a change
26+
(e.g. add a sample or feature) that doesn't have a corresponding issue in the
27+
issue tracker, please create one.
28+
3. **Submitting**: When you are ready to submit, send us a Pull Request. Be
29+
sure to include the issue number you fixed and the name you used to sign
30+
the CLA.
31+
32+
## Writing Code ##
33+
34+
If your contribution contains code, please make sure that it follows
35+
[the style guide](http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml).
36+
Otherwise we will have to ask you to make changes, and that's no fun for anyone.

LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2011 The LevelDB Authors. 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.

Makefile

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
# Copyright (c) 2011 The LevelDB Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file. See the AUTHORS file for names of contributors.
4+
5+
#-----------------------------------------------
6+
# Uncomment exactly one of the lines labelled (A), (B), and (C) below
7+
# to switch between compilation modes.
8+
9+
# (A) Production use (optimized mode)
10+
OPT ?= -O2 -DNDEBUG
11+
# (B) Debug mode, w/ full line-level debugging symbols
12+
# OPT ?= -g2
13+
# (C) Profiling mode: opt, but w/debugging symbols
14+
# OPT ?= -O2 -g2 -DNDEBUG
15+
#-----------------------------------------------
16+
17+
# detect what platform we're building on
18+
$(shell CC="$(CC)" CXX="$(CXX)" TARGET_OS="$(TARGET_OS)" \
19+
./build_detect_platform build_config.mk ./)
20+
# this file is generated by the previous line to set build flags and sources
21+
include build_config.mk
22+
23+
CFLAGS += -I. -I./include $(PLATFORM_CCFLAGS) $(OPT)
24+
CXXFLAGS += -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT)
25+
26+
LDFLAGS += $(PLATFORM_LDFLAGS)
27+
LIBS += $(PLATFORM_LIBS)
28+
29+
LIBOBJECTS = $(SOURCES:.cc=.o)
30+
MEMENVOBJECTS = $(MEMENV_SOURCES:.cc=.o)
31+
32+
TESTUTIL = ./util/testutil.o
33+
TESTHARNESS = ./util/testharness.o $(TESTUTIL)
34+
35+
# Note: iOS should probably be using libtool, not ar.
36+
ifeq ($(PLATFORM), IOS)
37+
AR=xcrun ar
38+
endif
39+
40+
TESTS = \
41+
arena_test \
42+
autocompact_test \
43+
bloom_test \
44+
c_test \
45+
cache_test \
46+
coding_test \
47+
corruption_test \
48+
crc32c_test \
49+
db_test \
50+
dbformat_test \
51+
env_test \
52+
fault_injection_test \
53+
filename_test \
54+
filter_block_test \
55+
hash_test \
56+
issue178_test \
57+
issue200_test \
58+
log_test \
59+
memenv_test \
60+
recovery_test \
61+
skiplist_test \
62+
table_test \
63+
version_edit_test \
64+
version_set_test \
65+
write_batch_test
66+
67+
PROGRAMS = db_bench leveldbutil $(TESTS)
68+
BENCHMARKS = db_bench_sqlite3 db_bench_tree_db
69+
70+
LIBRARY = libleveldb.a
71+
MEMENVLIBRARY = libmemenv.a
72+
73+
default: all
74+
75+
# Should we build shared libraries?
76+
ifneq ($(PLATFORM_SHARED_EXT),)
77+
78+
ifneq ($(PLATFORM_SHARED_VERSIONED),true)
79+
SHARED1 = libleveldb.$(PLATFORM_SHARED_EXT)
80+
SHARED2 = $(SHARED1)
81+
SHARED3 = $(SHARED1)
82+
SHARED = $(SHARED1)
83+
else
84+
# Update db.h if you change these.
85+
SHARED_MAJOR = 1
86+
SHARED_MINOR = 18
87+
SHARED1 = libleveldb.$(PLATFORM_SHARED_EXT)
88+
SHARED2 = $(SHARED1).$(SHARED_MAJOR)
89+
SHARED3 = $(SHARED1).$(SHARED_MAJOR).$(SHARED_MINOR)
90+
SHARED = $(SHARED1) $(SHARED2) $(SHARED3)
91+
$(SHARED1): $(SHARED3)
92+
ln -fs $(SHARED3) $(SHARED1)
93+
$(SHARED2): $(SHARED3)
94+
ln -fs $(SHARED3) $(SHARED2)
95+
endif
96+
97+
$(SHARED3):
98+
$(CXX) $(LDFLAGS) $(PLATFORM_SHARED_LDFLAGS)$(SHARED2) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) $(SOURCES) -o $(SHARED3) $(LIBS)
99+
100+
endif # PLATFORM_SHARED_EXT
101+
102+
all: $(SHARED) $(LIBRARY)
103+
104+
check: all $(PROGRAMS) $(TESTS)
105+
for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done
106+
107+
clean:
108+
-rm -f $(PROGRAMS) $(BENCHMARKS) $(LIBRARY) $(SHARED) $(MEMENVLIBRARY) */*.o */*/*.o ios-x86/*/*.o ios-arm/*/*.o build_config.mk
109+
-rm -rf ios-x86/* ios-arm/*
110+
111+
$(LIBRARY): $(LIBOBJECTS)
112+
rm -f $@
113+
$(AR) -rs $@ $(LIBOBJECTS)
114+
115+
db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL)
116+
$(CXX) $(LDFLAGS) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) -o $@ $(LIBS)
117+
118+
db_bench_sqlite3: doc/bench/db_bench_sqlite3.o $(LIBOBJECTS) $(TESTUTIL)
119+
$(CXX) $(LDFLAGS) doc/bench/db_bench_sqlite3.o $(LIBOBJECTS) $(TESTUTIL) -o $@ -lsqlite3 $(LIBS)
120+
121+
db_bench_tree_db: doc/bench/db_bench_tree_db.o $(LIBOBJECTS) $(TESTUTIL)
122+
$(CXX) $(LDFLAGS) doc/bench/db_bench_tree_db.o $(LIBOBJECTS) $(TESTUTIL) -o $@ -lkyotocabinet $(LIBS)
123+
124+
leveldbutil: db/leveldb_main.o $(LIBOBJECTS)
125+
$(CXX) $(LDFLAGS) db/leveldb_main.o $(LIBOBJECTS) -o $@ $(LIBS)
126+
127+
arena_test: util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS)
128+
$(CXX) $(LDFLAGS) util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
129+
130+
autocompact_test: db/autocompact_test.o $(LIBOBJECTS) $(TESTHARNESS)
131+
$(CXX) $(LDFLAGS) db/autocompact_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
132+
133+
bloom_test: util/bloom_test.o $(LIBOBJECTS) $(TESTHARNESS)
134+
$(CXX) $(LDFLAGS) util/bloom_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
135+
136+
c_test: db/c_test.o $(LIBOBJECTS) $(TESTHARNESS)
137+
$(CXX) $(LDFLAGS) db/c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
138+
139+
cache_test: util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS)
140+
$(CXX) $(LDFLAGS) util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
141+
142+
coding_test: util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS)
143+
$(CXX) $(LDFLAGS) util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
144+
145+
corruption_test: db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS)
146+
$(CXX) $(LDFLAGS) db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
147+
148+
crc32c_test: util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS)
149+
$(CXX) $(LDFLAGS) util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
150+
151+
db_test: db/db_test.o $(LIBOBJECTS) $(TESTHARNESS)
152+
$(CXX) $(LDFLAGS) db/db_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
153+
154+
dbformat_test: db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS)
155+
$(CXX) $(LDFLAGS) db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
156+
157+
env_test: util/env_test.o $(LIBOBJECTS) $(TESTHARNESS)
158+
$(CXX) $(LDFLAGS) util/env_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
159+
160+
fault_injection_test: db/fault_injection_test.o $(LIBOBJECTS) $(TESTHARNESS)
161+
$(CXX) $(LDFLAGS) db/fault_injection_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
162+
163+
filename_test: db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS)
164+
$(CXX) $(LDFLAGS) db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
165+
166+
filter_block_test: table/filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS)
167+
$(CXX) $(LDFLAGS) table/filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
168+
169+
hash_test: util/hash_test.o $(LIBOBJECTS) $(TESTHARNESS)
170+
$(CXX) $(LDFLAGS) util/hash_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
171+
172+
issue178_test: issues/issue178_test.o $(LIBOBJECTS) $(TESTHARNESS)
173+
$(CXX) $(LDFLAGS) issues/issue178_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
174+
175+
issue200_test: issues/issue200_test.o $(LIBOBJECTS) $(TESTHARNESS)
176+
$(CXX) $(LDFLAGS) issues/issue200_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
177+
178+
log_test: db/log_test.o $(LIBOBJECTS) $(TESTHARNESS)
179+
$(CXX) $(LDFLAGS) db/log_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
180+
181+
recovery_test: db/recovery_test.o $(LIBOBJECTS) $(TESTHARNESS)
182+
$(CXX) $(LDFLAGS) db/recovery_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
183+
184+
table_test: table/table_test.o $(LIBOBJECTS) $(TESTHARNESS)
185+
$(CXX) $(LDFLAGS) table/table_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
186+
187+
skiplist_test: db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS)
188+
$(CXX) $(LDFLAGS) db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
189+
190+
version_edit_test: db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS)
191+
$(CXX) $(LDFLAGS) db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
192+
193+
version_set_test: db/version_set_test.o $(LIBOBJECTS) $(TESTHARNESS)
194+
$(CXX) $(LDFLAGS) db/version_set_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
195+
196+
write_batch_test: db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS)
197+
$(CXX) $(LDFLAGS) db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
198+
199+
$(MEMENVLIBRARY) : $(MEMENVOBJECTS)
200+
rm -f $@
201+
$(AR) -rs $@ $(MEMENVOBJECTS)
202+
203+
memenv_test : helpers/memenv/memenv_test.o $(MEMENVLIBRARY) $(LIBRARY) $(TESTHARNESS)
204+
$(CXX) $(LDFLAGS) helpers/memenv/memenv_test.o $(MEMENVLIBRARY) $(LIBRARY) $(TESTHARNESS) -o $@ $(LIBS)
205+
206+
ifeq ($(PLATFORM), IOS)
207+
# For iOS, create universal object files to be used on both the simulator and
208+
# a device.
209+
SIMULATORSDK=$(shell xcrun -sdk iphonesimulator --show-sdk-path)
210+
DEVICESDK=$(shell xcrun -sdk iphoneos --show-sdk-path)
211+
IOSARCH=-arch armv6 -arch armv7 -arch armv7s -arch arm64
212+
213+
.cc.o:
214+
mkdir -p ios-x86/$(dir $@)
215+
xcrun -sdk iphonesimulator $(CXX) $(CXXFLAGS) -isysroot "$(SIMULATORSDK)" -arch i686 -arch x86_64 -c $< -o ios-x86/$@
216+
mkdir -p ios-arm/$(dir $@)
217+
xcrun -sdk iphoneos $(CXX) $(CXXFLAGS) -isysroot "$(DEVICESDK)" $(IOSARCH) -c $< -o ios-arm/$@
218+
xcrun lipo ios-x86/$@ ios-arm/$@ -create -output $@
219+
220+
.c.o:
221+
mkdir -p ios-x86/$(dir $@)
222+
xcrun -sdk iphonesimulator $(CC) $(CFLAGS) -isysroot "$(SIMULATORSDK)" -arch i686 -arch x86_64 -c $< -o ios-x86/$@
223+
mkdir -p ios-arm/$(dir $@)
224+
xcrun -sdk iphoneos $(CC) $(CFLAGS) -isysroot "$(DEVICESDK)" $(IOSARCH) -c $< -o ios-arm/$@
225+
xcrun lipo ios-x86/$@ ios-arm/$@ -create -output $@
226+
227+
else
228+
.cc.o:
229+
$(CXX) $(CXXFLAGS) -c $< -o $@
230+
231+
.c.o:
232+
$(CC) $(CFLAGS) -c $< -o $@
233+
endif

NEWS

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Release 1.2 2011-05-16
2+
----------------------
3+
4+
Fixes for larger databases (tested up to one billion 100-byte entries,
5+
i.e., ~100GB).
6+
7+
(1) Place hard limit on number of level-0 files. This fixes errors
8+
of the form "too many open files".
9+
10+
(2) Fixed memtable management. Before the fix, a heavy write burst
11+
could cause unbounded memory usage.
12+
13+
A fix for a logging bug where the reader would incorrectly complain
14+
about corruption.
15+
16+
Allow public access to WriteBatch contents so that users can easily
17+
wrap a DB.

0 commit comments

Comments
 (0)