Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 418bbe2
Showing
146 changed files
with
26,347 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules/ | ||
build/ | ||
libleveldb.so | ||
libleveldb.a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"Xtargets": [ | ||
{ | ||
"target_name": "hello" | ||
, "sources": [ "src/examples/hello.cc" ] | ||
} | ||
, { | ||
"target_name": "argex" | ||
, "sources": [ "src/examples/argex.cc" ] | ||
} | ||
, { | ||
"target_name": "cb" | ||
, "sources": [ "src/examples/cb.cc" ] | ||
} | ||
, { | ||
"target_name": "obj" | ||
, "sources": [ "src/examples/obj.cc" ] | ||
} | ||
, { | ||
"target_name": "fn" | ||
, "sources": [ "src/examples/fn.cc" ] | ||
} | ||
, { | ||
"target_name": "wrap" | ||
, "sources": [ "src/examples/wrap.cc", "src/examples/myobject.cc" ] | ||
} | ||
, { | ||
"target_name": "wrapcreate" | ||
, "sources": [ "src/examples/wrapcreate.cc", "src/examples/myobjectcreate.cc" ] | ||
} | ||
, { | ||
"target_name": "unwrap" | ||
, "sources": [ "src/examples/unwrap.cc", "src/examples/myobjectunwrap.cc" ] | ||
} | ||
] | ||
|
||
, "good resource": "https://github.com/rbranson/node-ffi/blob/master/binding.gyp" | ||
|
||
, "targets": [ | ||
{ | ||
"target_name": "levelup" | ||
, "sources": [ | ||
"src/levelup.cc" | ||
, "src/database.cc" | ||
, "src/database_async.cc" | ||
] | ||
, "include_dirs": [ | ||
"<(module_root_dir)/deps/leveldb-1.5.0/include/" | ||
] | ||
, "conditions": [ | ||
["OS=='linux'", { | ||
"libraries": [ | ||
"<(module_root_dir)/deps/leveldb-1.5.0/libleveldb.a" | ||
] | ||
}] | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
var config = module.exports | ||
|
||
config['unit'] = { | ||
environment: 'node' | ||
, tests: [ 'test/*-test.js' ] | ||
, libs: [ 'test/common.js' ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
build_config.mk | ||
*.a | ||
*.o | ||
*.dylib* | ||
*.so | ||
*.so.* | ||
*_test | ||
db_bench |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Names should be added to this file like so: | ||
# Name or Organization <email address> | ||
|
||
Google Inc. | ||
|
||
# Initial version authors: | ||
Jeffrey Dean <jeff@google.com> | ||
Sanjay Ghemawat <sanjay@google.com> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright (c) 2011 The LevelDB Authors. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are | ||
met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above | ||
copyright notice, this list of conditions and the following disclaimer | ||
in the documentation and/or other materials provided with the | ||
distribution. | ||
* Neither the name of Google Inc. nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
# Copyright (c) 2011 The LevelDB Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. See the AUTHORS file for names of contributors. | ||
|
||
# Inherit some settings from environment variables, if available | ||
INSTALL_PATH ?= $(CURDIR) | ||
|
||
#----------------------------------------------- | ||
# Uncomment exactly one of the lines labelled (A), (B), and (C) below | ||
# to switch between compilation modes. | ||
|
||
OPT ?= -O2 -DNDEBUG # (A) Production use (optimized mode) | ||
# OPT ?= -g2 # (B) Debug mode, w/ full line-level debugging symbols | ||
# OPT ?= -O2 -g2 -DNDEBUG # (C) Profiling mode: opt, but w/debugging symbols | ||
#----------------------------------------------- | ||
|
||
# detect what platform we're building on | ||
$(shell ./build_detect_platform build_config.mk) | ||
# this file is generated by the previous line to set build flags and sources | ||
include build_config.mk | ||
|
||
CFLAGS += -I. -I./include $(PLATFORM_CCFLAGS) $(OPT) | ||
CXXFLAGS += -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT) | ||
|
||
LDFLAGS += $(PLATFORM_LDFLAGS) | ||
|
||
LIBOBJECTS = $(SOURCES:.cc=.o) | ||
MEMENVOBJECTS = $(MEMENV_SOURCES:.cc=.o) | ||
|
||
TESTUTIL = ./util/testutil.o | ||
TESTHARNESS = ./util/testharness.o $(TESTUTIL) | ||
|
||
TESTS = \ | ||
arena_test \ | ||
bloom_test \ | ||
c_test \ | ||
cache_test \ | ||
coding_test \ | ||
corruption_test \ | ||
crc32c_test \ | ||
db_test \ | ||
dbformat_test \ | ||
env_test \ | ||
filename_test \ | ||
filter_block_test \ | ||
log_test \ | ||
memenv_test \ | ||
skiplist_test \ | ||
table_test \ | ||
version_edit_test \ | ||
version_set_test \ | ||
write_batch_test | ||
|
||
PROGRAMS = db_bench $(TESTS) | ||
BENCHMARKS = db_bench_sqlite3 db_bench_tree_db | ||
|
||
LIBRARY = libleveldb.a | ||
MEMENVLIBRARY = libmemenv.a | ||
|
||
default: all | ||
|
||
# Should we build shared libraries? | ||
ifneq ($(PLATFORM_SHARED_EXT),) | ||
|
||
ifneq ($(PLATFORM_SHARED_VERSIONED),true) | ||
SHARED1 = libleveldb.$(PLATFORM_SHARED_EXT) | ||
SHARED2 = $(SHARED1) | ||
SHARED3 = $(SHARED1) | ||
SHARED = $(SHARED1) | ||
else | ||
# Update db.h if you change these. | ||
SHARED_MAJOR = 1 | ||
SHARED_MINOR = 5 | ||
SHARED1 = libleveldb.$(PLATFORM_SHARED_EXT) | ||
SHARED2 = $(SHARED1).$(SHARED_MAJOR) | ||
SHARED3 = $(SHARED1).$(SHARED_MAJOR).$(SHARED_MINOR) | ||
SHARED = $(SHARED1) $(SHARED2) $(SHARED3) | ||
$(SHARED1): $(SHARED3) | ||
ln -fs $(SHARED3) $(SHARED1) | ||
$(SHARED2): $(SHARED3) | ||
ln -fs $(SHARED3) $(SHARED2) | ||
endif | ||
|
||
$(SHARED3): | ||
$(CXX) $(LDFLAGS) $(PLATFORM_SHARED_LDFLAGS)$(SHARED2) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) $(SOURCES) -o $(SHARED3) | ||
|
||
endif # PLATFORM_SHARED_EXT | ||
|
||
all: $(SHARED) $(LIBRARY) | ||
|
||
check: all $(PROGRAMS) $(TESTS) | ||
for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done | ||
|
||
clean: | ||
-rm -f $(PROGRAMS) $(BENCHMARKS) $(LIBRARY) $(SHARED) $(MEMENVLIBRARY) */*.o */*/*.o ios-x86/*/*.o ios-arm/*/*.o build_config.mk | ||
-rm -rf ios-x86/* ios-arm/* | ||
|
||
$(LIBRARY): $(LIBOBJECTS) | ||
rm -f $@ | ||
$(AR) -rs $@ $(LIBOBJECTS) | ||
|
||
db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) | ||
$(CXX) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) -o $@ $(LDFLAGS) | ||
|
||
db_bench_sqlite3: doc/bench/db_bench_sqlite3.o $(LIBOBJECTS) $(TESTUTIL) | ||
$(CXX) doc/bench/db_bench_sqlite3.o $(LIBOBJECTS) $(TESTUTIL) -o $@ $(LDFLAGS) -lsqlite3 | ||
|
||
db_bench_tree_db: doc/bench/db_bench_tree_db.o $(LIBOBJECTS) $(TESTUTIL) | ||
$(CXX) doc/bench/db_bench_tree_db.o $(LIBOBJECTS) $(TESTUTIL) -o $@ $(LDFLAGS) -lkyotocabinet | ||
|
||
arena_test: util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CXX) util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
bloom_test: util/bloom_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CXX) util/bloom_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
c_test: db/c_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CXX) db/c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
cache_test: util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CXX) util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
coding_test: util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CXX) util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
corruption_test: db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CXX) db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
crc32c_test: util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CXX) util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
db_test: db/db_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CXX) db/db_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
dbformat_test: db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CXX) db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
env_test: util/env_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CXX) util/env_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
filename_test: db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CXX) db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
filter_block_test: table/filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CXX) table/filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
log_test: db/log_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CXX) db/log_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
table_test: table/table_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CXX) table/table_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
skiplist_test: db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CXX) db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
version_edit_test: db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CXX) db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
version_set_test: db/version_set_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CXX) db/version_set_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
write_batch_test: db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CXX) db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
$(MEMENVLIBRARY) : $(MEMENVOBJECTS) | ||
rm -f $@ | ||
$(AR) -rs $@ $(MEMENVOBJECTS) | ||
|
||
memenv_test : helpers/memenv/memenv_test.o $(MEMENVLIBRARY) $(LIBRARY) $(TESTHARNESS) | ||
$(CXX) helpers/memenv/memenv_test.o $(MEMENVLIBRARY) $(LIBRARY) $(TESTHARNESS) -o $@ $(LDFLAGS) | ||
|
||
ifeq ($(PLATFORM), IOS) | ||
# For iOS, create universal object files to be used on both the simulator and | ||
# a device. | ||
PLATFORMSROOT=/Applications/Xcode.app/Contents/Developer/Platforms | ||
SIMULATORROOT=$(PLATFORMSROOT)/iPhoneSimulator.platform/Developer | ||
DEVICEROOT=$(PLATFORMSROOT)/iPhoneOS.platform/Developer | ||
IOSVERSION=$(shell defaults read $(PLATFORMSROOT)/iPhoneOS.platform/version CFBundleShortVersionString) | ||
|
||
.cc.o: | ||
mkdir -p ios-x86/$(dir $@) | ||
$(SIMULATORROOT)/usr/bin/$(CXX) $(CXXFLAGS) -isysroot $(SIMULATORROOT)/SDKs/iPhoneSimulator$(IOSVERSION).sdk -arch i686 -c $< -o ios-x86/$@ | ||
mkdir -p ios-arm/$(dir $@) | ||
$(DEVICEROOT)/usr/bin/$(CXX) $(CXXFLAGS) -isysroot $(DEVICEROOT)/SDKs/iPhoneOS$(IOSVERSION).sdk -arch armv6 -arch armv7 -c $< -o ios-arm/$@ | ||
lipo ios-x86/$@ ios-arm/$@ -create -output $@ | ||
|
||
.c.o: | ||
mkdir -p ios-x86/$(dir $@) | ||
$(SIMULATORROOT)/usr/bin/$(CC) $(CFLAGS) -isysroot $(SIMULATORROOT)/SDKs/iPhoneSimulator$(IOSVERSION).sdk -arch i686 -c $< -o ios-x86/$@ | ||
mkdir -p ios-arm/$(dir $@) | ||
$(DEVICEROOT)/usr/bin/$(CC) $(CFLAGS) -isysroot $(DEVICEROOT)/SDKs/iPhoneOS$(IOSVERSION).sdk -arch armv6 -arch armv7 -c $< -o ios-arm/$@ | ||
lipo ios-x86/$@ ios-arm/$@ -create -output $@ | ||
|
||
else | ||
.cc.o: | ||
$(CXX) $(CXXFLAGS) -c $< -o $@ | ||
|
||
.c.o: | ||
$(CC) $(CFLAGS) -c $< -o $@ | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Release 1.2 2011-05-16 | ||
---------------------- | ||
|
||
Fixes for larger databases (tested up to one billion 100-byte entries, | ||
i.e., ~100GB). | ||
|
||
(1) Place hard limit on number of level-0 files. This fixes errors | ||
of the form "too many open files". | ||
|
||
(2) Fixed memtable management. Before the fix, a heavy write burst | ||
could cause unbounded memory usage. | ||
|
||
A fix for a logging bug where the reader would incorrectly complain | ||
about corruption. | ||
|
||
Allow public access to WriteBatch contents so that users can easily | ||
wrap a DB. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
leveldb: A key-value store | ||
Authors: Sanjay Ghemawat (sanjay@google.com) and Jeff Dean (jeff@google.com) | ||
|
||
The code under this directory implements a system for maintaining a | ||
persistent key/value store. | ||
|
||
See doc/index.html for more explanation. | ||
See doc/impl.html for a brief overview of the implementation. | ||
|
||
The public interface is in include/*.h. Callers should not include or | ||
rely on the details of any other header files in this package. Those | ||
internal APIs may be changed without warning. | ||
|
||
Guide to header files: | ||
|
||
include/db.h | ||
Main interface to the DB: Start here | ||
|
||
include/options.h | ||
Control over the behavior of an entire database, and also | ||
control over the behavior of individual reads and writes. | ||
|
||
include/comparator.h | ||
Abstraction for user-specified comparison function. If you want | ||
just bytewise comparison of keys, you can use the default comparator, | ||
but clients can write their own comparator implementations if they | ||
want custom ordering (e.g. to handle different character | ||
encodings, etc.) | ||
|
||
include/iterator.h | ||
Interface for iterating over data. You can get an iterator | ||
from a DB object. | ||
|
||
include/write_batch.h | ||
Interface for atomically applying multiple updates to a database. | ||
|
||
include/slice.h | ||
A simple module for maintaining a pointer and a length into some | ||
other byte array. | ||
|
||
include/status.h | ||
Status is returned from many of the public interfaces and is used | ||
to report success and various kinds of errors. | ||
|
||
include/env.h | ||
Abstraction of the OS environment. A posix implementation of | ||
this interface is in util/env_posix.cc | ||
|
||
include/table.h | ||
include/table_builder.h | ||
Lower-level modules that most clients probably won't use directly |
Oops, something went wrong.