[Pkg-javascript-commits] [node-leveldown] 104/492: leveldb 1.7
Andrew Kelley
andrewrk-guest at moszumanska.debian.org
Sun Jul 6 17:13:49 UTC 2014
This is an automated email from the git hooks/post-receive script.
andrewrk-guest pushed a commit to annotated tag rocksdb-0.10.1
in repository node-leveldown.
commit 700ff085f746fb9eb6f31f1e7af745a2702f99ce
Author: Rod Vagg <rod at vagg.org>
Date: Sat Dec 15 11:55:57 2012 +1100
leveldb 1.7
---
.gitignore | 1 -
deps/leveldb/leveldb-1.5.0/.gitignore | 8 -
.../{leveldb-1.5.0 => leveldb-1.7.0}/AUTHORS | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/LICENSE | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/Makefile | 59 ++--
deps/leveldb/{leveldb-1.5.0 => leveldb-1.7.0}/NEWS | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/README | 0
deps/leveldb/{leveldb-1.5.0 => leveldb-1.7.0}/TODO | 1 +
.../build_detect_platform | 69 +++--
.../{leveldb-1.5.0 => leveldb-1.7.0}/db/builder.cc | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/db/builder.h | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/db/c.cc | 14 +
.../{leveldb-1.5.0 => leveldb-1.7.0}/db/c_test.c | 9 +
.../db/corruption_test.cc | 0
.../db/db_bench.cc | 1 +
.../{leveldb-1.5.0 => leveldb-1.7.0}/db/db_impl.cc | 6 +-
.../{leveldb-1.5.0 => leveldb-1.7.0}/db/db_impl.h | 28 +-
.../{leveldb-1.5.0 => leveldb-1.7.0}/db/db_iter.cc | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/db/db_iter.h | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/db/db_test.cc | 6 +
.../db/dbformat.cc | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/db/dbformat.h | 0
.../db/dbformat_test.cc | 0
.../db/filename.cc | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/db/filename.h | 0
.../db/filename_test.cc | 0
.../db/log_format.h | 0
.../db/log_reader.cc | 0
.../db/log_reader.h | 0
.../db/log_test.cc | 0
.../db/log_writer.cc | 0
.../db/log_writer.h | 0
.../db/memtable.cc | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/db/memtable.h | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/db/repair.cc | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/db/skiplist.h | 0
.../db/skiplist_test.cc | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/db/snapshot.h | 0
.../db/table_cache.cc | 0
.../db/table_cache.h | 0
.../db/version_edit.cc | 0
.../db/version_edit.h | 0
.../db/version_edit_test.cc | 0
.../db/version_set.cc | 2 +-
.../db/version_set.h | 4 +-
.../db/version_set_test.cc | 0
.../db/write_batch.cc | 0
.../db/write_batch_internal.h | 0
.../db/write_batch_test.cc | 0
.../doc/bench/db_bench_sqlite3.cc | 2 +-
.../doc/bench/db_bench_tree_db.cc | 0
.../doc/benchmark.html | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/doc/doc.css | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/doc/impl.html | 0
.../doc/index.html | 8 +-
.../doc/log_format.txt | 4 +-
.../doc/table_format.txt | 12 +-
.../helpers/memenv/memenv.cc | 10 +
.../helpers/memenv/memenv.h | 0
.../helpers/memenv/memenv_test.cc | 0
.../include/leveldb/c.h | 16 ++
.../include/leveldb/cache.h | 0
.../include/leveldb/comparator.h | 0
.../include/leveldb/db.h | 2 +-
.../include/leveldb/env.h | 10 +
.../include/leveldb/filter_policy.h | 0
.../include/leveldb/iterator.h | 0
.../include/leveldb/options.h | 0
.../include/leveldb/slice.h | 0
.../include/leveldb/status.h | 0
.../include/leveldb/table.h | 0
.../include/leveldb/table_builder.h | 0
.../include/leveldb/write_batch.h | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/port/README | 0
.../port/atomic_pointer.h | 72 +++++
.../{leveldb-1.5.0 => leveldb-1.7.0}/port/port.h | 0
.../port/port_example.h | 0
.../port/port_posix.cc | 0
.../port/port_posix.h | 11 +-
.../leveldb-1.7.0/port/thread_annotations.h | 59 ++++
.../port/win/stdint.h | 0
.../table/block.cc | 4 +-
.../{leveldb-1.5.0 => leveldb-1.7.0}/table/block.h | 0
.../table/block_builder.cc | 0
.../table/block_builder.h | 0
.../table/filter_block.cc | 0
.../table/filter_block.h | 0
.../table/filter_block_test.cc | 0
.../table/format.cc | 0
.../table/format.h | 0
.../table/iterator.cc | 0
.../table/iterator_wrapper.h | 0
.../table/merger.cc | 0
.../table/merger.h | 0
.../table/table.cc | 0
.../table/table_builder.cc | 0
.../table/table_test.cc | 0
.../table/two_level_iterator.cc | 0
.../table/two_level_iterator.h | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/util/arena.cc | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/util/arena.h | 0
.../util/arena_test.cc | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/util/bloom.cc | 0
.../util/bloom_test.cc | 5 +-
.../{leveldb-1.5.0 => leveldb-1.7.0}/util/cache.cc | 0
.../util/cache_test.cc | 0
.../util/coding.cc | 40 +--
.../{leveldb-1.5.0 => leveldb-1.7.0}/util/coding.h | 0
.../util/coding_test.cc | 0
.../util/comparator.cc | 0
.../util/crc32c.cc | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/util/crc32c.h | 0
.../util/crc32c_test.cc | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/util/env.cc | 0
.../util/env_posix.cc | 101 ++++++-
.../util/env_test.cc | 0
.../util/filter_policy.cc | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/util/hash.cc | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/util/hash.h | 0
.../util/histogram.cc | 0
.../util/histogram.h | 0
.../util/logging.cc | 0
.../util/logging.h | 0
.../util/mutexlock.h | 8 +-
.../util/options.cc | 0
.../util/posix_logger.h | 0
.../{leveldb-1.5.0 => leveldb-1.7.0}/util/random.h | 0
.../util/status.cc | 0
.../util/testharness.cc | 0
.../util/testharness.h | 0
.../util/testutil.cc | 0
.../util/testutil.h | 0
deps/leveldb/leveldb.gyp | 301 +++++++++++----------
deps/snappy/snappy.gyp | 92 +++----
134 files changed, 644 insertions(+), 321 deletions(-)
diff --git a/.gitignore b/.gitignore
index b96b959..3f95dec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,5 +2,4 @@ node_modules/
build/
libleveldb.so
libleveldb.a
-leveldb-1.7*
test-data/
\ No newline at end of file
diff --git a/deps/leveldb/leveldb-1.5.0/.gitignore b/deps/leveldb/leveldb-1.5.0/.gitignore
deleted file mode 100644
index f030430..0000000
--- a/deps/leveldb/leveldb-1.5.0/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-build_config.mk
-*.a
-*.o
-*.dylib*
-*.so
-*.so.*
-*_test
-db_bench
diff --git a/deps/leveldb/leveldb-1.5.0/AUTHORS b/deps/leveldb/leveldb-1.7.0/AUTHORS
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/AUTHORS
rename to deps/leveldb/leveldb-1.7.0/AUTHORS
diff --git a/deps/leveldb/leveldb-1.5.0/LICENSE b/deps/leveldb/leveldb-1.7.0/LICENSE
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/LICENSE
rename to deps/leveldb/leveldb-1.7.0/LICENSE
diff --git a/deps/leveldb/leveldb-1.5.0/Makefile b/deps/leveldb/leveldb-1.7.0/Makefile
similarity index 68%
rename from deps/leveldb/leveldb-1.5.0/Makefile
rename to deps/leveldb/leveldb-1.7.0/Makefile
index c648a28..fdc66f9 100644
--- a/deps/leveldb/leveldb-1.5.0/Makefile
+++ b/deps/leveldb/leveldb-1.7.0/Makefile
@@ -2,9 +2,6 @@
# 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.
@@ -15,7 +12,8 @@ OPT ?= -O2 -DNDEBUG # (A) Production use (optimized mode)
#-----------------------------------------------
# detect what platform we're building on
-$(shell ./build_detect_platform build_config.mk)
+$(shell CC=$(CC) CXX=$(CXX) TARGET_OS=$(TARGET_OS) \
+ ./build_detect_platform build_config.mk ./)
# this file is generated by the previous line to set build flags and sources
include build_config.mk
@@ -23,6 +21,7 @@ CFLAGS += -I. -I./include $(PLATFORM_CCFLAGS) $(OPT)
CXXFLAGS += -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT)
LDFLAGS += $(PLATFORM_LDFLAGS)
+LIBS += $(PLATFORM_LIBS)
LIBOBJECTS = $(SOURCES:.cc=.o)
MEMENVOBJECTS = $(MEMENV_SOURCES:.cc=.o)
@@ -70,7 +69,7 @@ SHARED = $(SHARED1)
else
# Update db.h if you change these.
SHARED_MAJOR = 1
-SHARED_MINOR = 5
+SHARED_MINOR = 7
SHARED1 = libleveldb.$(PLATFORM_SHARED_EXT)
SHARED2 = $(SHARED1).$(SHARED_MAJOR)
SHARED3 = $(SHARED1).$(SHARED_MAJOR).$(SHARED_MINOR)
@@ -82,7 +81,7 @@ $(SHARED2): $(SHARED3)
endif
$(SHARED3):
- $(CXX) $(LDFLAGS) $(PLATFORM_SHARED_LDFLAGS)$(SHARED2) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) $(SOURCES) -o $(SHARED3)
+ $(CXX) $(LDFLAGS) $(PLATFORM_SHARED_LDFLAGS)$(SHARED2) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) $(SOURCES) -o $(SHARED3) $(LIBS)
endif # PLATFORM_SHARED_EXT
@@ -100,74 +99,74 @@ $(LIBRARY): $(LIBOBJECTS)
$(AR) -rs $@ $(LIBOBJECTS)
db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL)
- $(CXX) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) -o $@ $(LIBS)
db_bench_sqlite3: doc/bench/db_bench_sqlite3.o $(LIBOBJECTS) $(TESTUTIL)
- $(CXX) doc/bench/db_bench_sqlite3.o $(LIBOBJECTS) $(TESTUTIL) -o $@ $(LDFLAGS) -lsqlite3
+ $(CXX) $(LDFLAGS) doc/bench/db_bench_sqlite3.o $(LIBOBJECTS) $(TESTUTIL) -o $@ -lsqlite3 $(LIBS)
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
+ $(CXX) $(LDFLAGS) doc/bench/db_bench_tree_db.o $(LIBOBJECTS) $(TESTUTIL) -o $@ -lkyotocabinet $(LIBS)
arena_test: util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS)
- $(CXX) util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
bloom_test: util/bloom_test.o $(LIBOBJECTS) $(TESTHARNESS)
- $(CXX) util/bloom_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) util/bloom_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
c_test: db/c_test.o $(LIBOBJECTS) $(TESTHARNESS)
- $(CXX) db/c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) db/c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
cache_test: util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS)
- $(CXX) util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
coding_test: util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS)
- $(CXX) util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
corruption_test: db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS)
- $(CXX) db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
crc32c_test: util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS)
- $(CXX) util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
db_test: db/db_test.o $(LIBOBJECTS) $(TESTHARNESS)
- $(CXX) db/db_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) db/db_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
dbformat_test: db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS)
- $(CXX) db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
env_test: util/env_test.o $(LIBOBJECTS) $(TESTHARNESS)
- $(CXX) util/env_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) util/env_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
filename_test: db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS)
- $(CXX) db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
filter_block_test: table/filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS)
- $(CXX) table/filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) table/filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
log_test: db/log_test.o $(LIBOBJECTS) $(TESTHARNESS)
- $(CXX) db/log_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) db/log_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
table_test: table/table_test.o $(LIBOBJECTS) $(TESTHARNESS)
- $(CXX) table/table_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) table/table_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
skiplist_test: db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS)
- $(CXX) db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
version_edit_test: db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS)
- $(CXX) db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
version_set_test: db/version_set_test.o $(LIBOBJECTS) $(TESTHARNESS)
- $(CXX) db/version_set_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) db/version_set_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
write_batch_test: db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS)
- $(CXX) db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
+ $(CXX) $(LDFLAGS) db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
$(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)
+ $(CXX) $(LDFLAGS) helpers/memenv/memenv_test.o $(MEMENVLIBRARY) $(LIBRARY) $(TESTHARNESS) -o $@ $(LIBS)
ifeq ($(PLATFORM), IOS)
# For iOS, create universal object files to be used on both the simulator and
@@ -179,14 +178,14 @@ IOSVERSION=$(shell defaults read $(PLATFORMSROOT)/iPhoneOS.platform/version CFBu
.cc.o:
mkdir -p ios-x86/$(dir $@)
- $(SIMULATORROOT)/usr/bin/$(CXX) $(CXXFLAGS) -isysroot $(SIMULATORROOT)/SDKs/iPhoneSimulator$(IOSVERSION).sdk -arch i686 -c $< -o ios-x86/$@
+ $(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/$@
+ $(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 $@
diff --git a/deps/leveldb/leveldb-1.5.0/NEWS b/deps/leveldb/leveldb-1.7.0/NEWS
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/NEWS
rename to deps/leveldb/leveldb-1.7.0/NEWS
diff --git a/deps/leveldb/leveldb-1.5.0/README b/deps/leveldb/leveldb-1.7.0/README
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/README
rename to deps/leveldb/leveldb-1.7.0/README
diff --git a/deps/leveldb/leveldb-1.5.0/TODO b/deps/leveldb/leveldb-1.7.0/TODO
similarity index 92%
rename from deps/leveldb/leveldb-1.5.0/TODO
rename to deps/leveldb/leveldb-1.7.0/TODO
index 9130b6a..e603c07 100644
--- a/deps/leveldb/leveldb-1.5.0/TODO
+++ b/deps/leveldb/leveldb-1.7.0/TODO
@@ -7,6 +7,7 @@ db
within [start_key..end_key]? For Chrome, deletion of obsolete
object stores, etc. can be done in the background anyway, so
probably not that important.
+- There have been requests for MultiGet.
After a range is completely deleted, what gets rid of the
corresponding files if we do no future changes to that range. Make
diff --git a/deps/leveldb/leveldb-1.5.0/build_detect_platform b/deps/leveldb/leveldb-1.7.0/build_detect_platform
similarity index 69%
rename from deps/leveldb/leveldb-1.5.0/build_detect_platform
rename to deps/leveldb/leveldb-1.7.0/build_detect_platform
index 959a7d6..7cdb793 100755
--- a/deps/leveldb/leveldb-1.5.0/build_detect_platform
+++ b/deps/leveldb/leveldb-1.7.0/build_detect_platform
@@ -7,8 +7,11 @@
# CC C Compiler path
# CXX C++ Compiler path
# PLATFORM_LDFLAGS Linker flags
+# PLATFORM_LIBS Libraries flags
# PLATFORM_SHARED_EXT Extension for shared libraries
# PLATFORM_SHARED_LDFLAGS Flags for building shared library
+# This flag is embedded just before the name
+# of the shared library without intervening spaces
# PLATFORM_SHARED_CFLAGS Flags for compiling objects for shared library
# PLATFORM_CCFLAGS C compiler flags
# PLATFORM_CXXFLAGS C++ compiler flags. Will contain:
@@ -23,8 +26,9 @@
#
OUTPUT=$1
-if test -z "$OUTPUT"; then
- echo "usage: $0 <output-filename>" >&2
+PREFIX=$2
+if test -z "$OUTPUT" || test -z "$PREFIX"; then
+ echo "usage: $0 <output-filename> <directory_prefix>" >&2
exit 1
fi
@@ -50,63 +54,79 @@ CROSS_COMPILE=
PLATFORM_CCFLAGS=
PLATFORM_CXXFLAGS=
PLATFORM_LDFLAGS=
+PLATFORM_LIBS=
PLATFORM_SHARED_EXT="so"
PLATFORM_SHARED_LDFLAGS="-shared -Wl,-soname -Wl,"
PLATFORM_SHARED_CFLAGS="-fPIC"
PLATFORM_SHARED_VERSIONED=true
-# On GCC, we pick libc's memcmp over GCC's memcmp via -fno-builtin-memcmp
+MEMCMP_FLAG=
+if [ "$CXX" = "g++" ]; then
+ # Use libc's memcmp instead of GCC's memcmp. This results in ~40%
+ # performance improvement on readrandom under gcc 4.4.3 on Linux/x86.
+ MEMCMP_FLAG="-fno-builtin-memcmp"
+fi
+
case "$TARGET_OS" in
Darwin)
PLATFORM=OS_MACOSX
- COMMON_FLAGS="-fno-builtin-memcmp -DOS_MACOSX"
+ COMMON_FLAGS="$MEMCMP_FLAG -DOS_MACOSX"
PLATFORM_SHARED_EXT=dylib
- PLATFORM_SHARED_LDFLAGS="-dynamiclib -install_name "
+ [ -z "$INSTALL_PATH" ] && INSTALL_PATH=`pwd`
+ PLATFORM_SHARED_LDFLAGS="-dynamiclib -install_name $INSTALL_PATH/"
PORT_FILE=port/port_posix.cc
;;
Linux)
PLATFORM=OS_LINUX
- COMMON_FLAGS="-fno-builtin-memcmp -pthread -DOS_LINUX"
+ COMMON_FLAGS="$MEMCMP_FLAG -pthread -DOS_LINUX"
PLATFORM_LDFLAGS="-pthread"
PORT_FILE=port/port_posix.cc
;;
SunOS)
PLATFORM=OS_SOLARIS
- COMMON_FLAGS="-fno-builtin-memcmp -D_REENTRANT -DOS_SOLARIS"
- PLATFORM_LDFLAGS="-lpthread -lrt"
+ COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_SOLARIS"
+ PLATFORM_LIBS="-lpthread -lrt"
PORT_FILE=port/port_posix.cc
;;
FreeBSD)
PLATFORM=OS_FREEBSD
- COMMON_FLAGS="-fno-builtin-memcmp -D_REENTRANT -DOS_FREEBSD"
- PLATFORM_LDFLAGS="-lpthread"
+ COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_FREEBSD"
+ PLATFORM_LIBS="-lpthread"
PORT_FILE=port/port_posix.cc
;;
NetBSD)
PLATFORM=OS_NETBSD
- COMMON_FLAGS="-fno-builtin-memcmp -D_REENTRANT -DOS_NETBSD"
- PLATFORM_LDFLAGS="-lpthread -lgcc_s"
+ COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_NETBSD"
+ PLATFORM_LIBS="-lpthread -lgcc_s"
PORT_FILE=port/port_posix.cc
;;
OpenBSD)
PLATFORM=OS_OPENBSD
- COMMON_FLAGS="-fno-builtin-memcmp -D_REENTRANT -DOS_OPENBSD"
+ COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_OPENBSD"
PLATFORM_LDFLAGS="-pthread"
PORT_FILE=port/port_posix.cc
;;
DragonFly)
PLATFORM=OS_DRAGONFLYBSD
- COMMON_FLAGS="-fno-builtin-memcmp -D_REENTRANT -DOS_DRAGONFLYBSD"
- PLATFORM_LDFLAGS="-lpthread"
+ COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_DRAGONFLYBSD"
+ PLATFORM_LIBS="-lpthread"
PORT_FILE=port/port_posix.cc
;;
OS_ANDROID_CROSSCOMPILE)
PLATFORM=OS_ANDROID
- COMMON_FLAGS="-fno-builtin-memcmp -D_REENTRANT -DOS_ANDROID -DLEVELDB_PLATFORM_POSIX"
+ COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_ANDROID -DLEVELDB_PLATFORM_POSIX"
PLATFORM_LDFLAGS="" # All pthread features are in the Android C library
PORT_FILE=port/port_posix.cc
CROSS_COMPILE=true
;;
+ HP-UX)
+ PLATFORM=OS_HPUX
+ COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_HPUX"
+ PLATFORM_LDFLAGS="-pthread"
+ PORT_FILE=port/port_posix.cc
+ # man ld: +h internal_name
+ PLATFORM_SHARED_LDFLAGS="-shared -Wl,+h -Wl,"
+ ;;
*)
echo "Unknown platform!" >&2
exit 1
@@ -116,11 +136,13 @@ esac
# except for the test and benchmark files. By default, find will output a list
# of all files matching either rule, so we need to append -print to make the
# prune take effect.
-DIRS="util db table"
+DIRS="$PREFIX/db $PREFIX/util $PREFIX/table"
+
set -f # temporarily disable globbing so that our patterns aren't expanded
PRUNE_TEST="-name *test*.cc -prune"
PRUNE_BENCH="-name *_bench.cc -prune"
-PORTABLE_FILES=`find $DIRS $PRUNE_TEST -o $PRUNE_BENCH -o -name '*.cc' -print | sort | tr "\n" " "`
+PORTABLE_FILES=`find $DIRS $PRUNE_TEST -o $PRUNE_BENCH -o -name '*.cc' -print | sort | sed "s,^$PREFIX/,," | tr "\n" " "`
+
set +f # re-enable globbing
# The sources consist of the portable files, plus the platform-specific port
@@ -133,7 +155,7 @@ if [ "$CROSS_COMPILE" = "true" ]; then
true
else
# If -std=c++0x works, use <cstdatomic>. Otherwise use port_posix.h.
- $CXX $CFLAGS -std=c++0x -x c++ - -o /dev/null 2>/dev/null <<EOF
+ $CXX $CXXFLAGS -std=c++0x -x c++ - -o /dev/null 2>/dev/null <<EOF
#include <cstdatomic>
int main() {}
EOF
@@ -146,21 +168,21 @@ EOF
# Test whether Snappy library is installed
# http://code.google.com/p/snappy/
- $CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF
+ $CXX $CXXFLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF
#include <snappy.h>
int main() {}
EOF
if [ "$?" = 0 ]; then
COMMON_FLAGS="$COMMON_FLAGS -DSNAPPY"
- PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lsnappy"
+ PLATFORM_LIBS="$PLATFORM_LIBS -lsnappy"
fi
# Test whether tcmalloc is available
- $CXX $CFLAGS -x c++ - -o /dev/null -ltcmalloc 2>/dev/null <<EOF
+ $CXX $CXXFLAGS -x c++ - -o /dev/null -ltcmalloc 2>/dev/null <<EOF
int main() {}
EOF
if [ "$?" = 0 ]; then
- PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -ltcmalloc"
+ PLATFORM_LIBS="$PLATFORM_LIBS -ltcmalloc"
fi
fi
@@ -171,6 +193,7 @@ echo "CC=$CC" >> $OUTPUT
echo "CXX=$CXX" >> $OUTPUT
echo "PLATFORM=$PLATFORM" >> $OUTPUT
echo "PLATFORM_LDFLAGS=$PLATFORM_LDFLAGS" >> $OUTPUT
+echo "PLATFORM_LIBS=$PLATFORM_LIBS" >> $OUTPUT
echo "PLATFORM_CCFLAGS=$PLATFORM_CCFLAGS" >> $OUTPUT
echo "PLATFORM_CXXFLAGS=$PLATFORM_CXXFLAGS" >> $OUTPUT
echo "PLATFORM_SHARED_CFLAGS=$PLATFORM_SHARED_CFLAGS" >> $OUTPUT
diff --git a/deps/leveldb/leveldb-1.5.0/db/builder.cc b/deps/leveldb/leveldb-1.7.0/db/builder.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/builder.cc
rename to deps/leveldb/leveldb-1.7.0/db/builder.cc
diff --git a/deps/leveldb/leveldb-1.5.0/db/builder.h b/deps/leveldb/leveldb-1.7.0/db/builder.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/builder.h
rename to deps/leveldb/leveldb-1.7.0/db/builder.h
diff --git a/deps/leveldb/leveldb-1.5.0/db/c.cc b/deps/leveldb/leveldb-1.7.0/db/c.cc
similarity index 98%
rename from deps/leveldb/leveldb-1.5.0/db/c.cc
rename to deps/leveldb/leveldb-1.7.0/db/c.cc
index 2dde400..08ff0ad 100644
--- a/deps/leveldb/leveldb-1.5.0/db/c.cc
+++ b/deps/leveldb/leveldb-1.7.0/db/c.cc
@@ -24,6 +24,8 @@ using leveldb::Env;
using leveldb::FileLock;
using leveldb::FilterPolicy;
using leveldb::Iterator;
+using leveldb::kMajorVersion;
+using leveldb::kMinorVersion;
using leveldb::Logger;
using leveldb::NewBloomFilterPolicy;
using leveldb::NewLRUCache;
@@ -578,4 +580,16 @@ void leveldb_env_destroy(leveldb_env_t* env) {
delete env;
}
+void leveldb_free(void* ptr) {
+ free(ptr);
+}
+
+int leveldb_major_version() {
+ return kMajorVersion;
+}
+
+int leveldb_minor_version() {
+ return kMinorVersion;
+}
+
} // end extern "C"
diff --git a/deps/leveldb/leveldb-1.5.0/db/c_test.c b/deps/leveldb/leveldb-1.7.0/db/c_test.c
similarity index 97%
rename from deps/leveldb/leveldb-1.5.0/db/c_test.c
rename to deps/leveldb/leveldb-1.7.0/db/c_test.c
index 9792447..7cd5ee0 100644
--- a/deps/leveldb/leveldb-1.5.0/db/c_test.c
+++ b/deps/leveldb/leveldb-1.7.0/db/c_test.c
@@ -165,6 +165,9 @@ int main(int argc, char** argv) {
char* err = NULL;
int run = -1;
+ CheckCondition(leveldb_major_version() >= 1);
+ CheckCondition(leveldb_minor_version() >= 1);
+
snprintf(dbname, sizeof(dbname),
"%s/leveldb_c_test-%d",
GetTempDir(),
@@ -204,6 +207,12 @@ int main(int argc, char** argv) {
CheckCondition(err != NULL);
Free(&err);
+ StartPhase("leveldb_free");
+ db = leveldb_open(options, dbname, &err);
+ CheckCondition(err != NULL);
+ leveldb_free(err);
+ err = NULL;
+
StartPhase("open");
leveldb_options_set_create_if_missing(options, 1);
db = leveldb_open(options, dbname, &err);
diff --git a/deps/leveldb/leveldb-1.5.0/db/corruption_test.cc b/deps/leveldb/leveldb-1.7.0/db/corruption_test.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/corruption_test.cc
rename to deps/leveldb/leveldb-1.7.0/db/corruption_test.cc
diff --git a/deps/leveldb/leveldb-1.5.0/db/db_bench.cc b/deps/leveldb/leveldb-1.7.0/db/db_bench.cc
similarity index 99%
rename from deps/leveldb/leveldb-1.5.0/db/db_bench.cc
rename to deps/leveldb/leveldb-1.7.0/db/db_bench.cc
index 21d3e25..7abdf87 100644
--- a/deps/leveldb/leveldb-1.5.0/db/db_bench.cc
+++ b/deps/leveldb/leveldb-1.7.0/db/db_bench.cc
@@ -693,6 +693,7 @@ class Benchmark {
options.create_if_missing = !FLAGS_use_existing_db;
options.block_cache = cache_;
options.write_buffer_size = FLAGS_write_buffer_size;
+ options.max_open_files = FLAGS_open_files;
options.filter_policy = filter_policy_;
Status s = DB::Open(options, FLAGS_db, &db_);
if (!s.ok()) {
diff --git a/deps/leveldb/leveldb-1.5.0/db/db_impl.cc b/deps/leveldb/leveldb-1.7.0/db/db_impl.cc
similarity index 99%
rename from deps/leveldb/leveldb-1.5.0/db/db_impl.cc
rename to deps/leveldb/leveldb-1.7.0/db/db_impl.cc
index 90c1c81..c9de169 100644
--- a/deps/leveldb/leveldb-1.5.0/db/db_impl.cc
+++ b/deps/leveldb/leveldb-1.7.0/db/db_impl.cc
@@ -609,7 +609,11 @@ void DBImpl::BackgroundCall() {
assert(bg_compaction_scheduled_);
if (!shutting_down_.Acquire_Load()) {
Status s = BackgroundCompaction();
- if (!s.ok()) {
+ if (s.ok()) {
+ // Success
+ } else if (shutting_down_.Acquire_Load()) {
+ // Error most likely due to shutdown; do not wait
+ } else {
// Wait a little bit before retrying background compaction in
// case this is an environmental problem and we do not want to
// chew up resources for failed compactions for the duration of
diff --git a/deps/leveldb/leveldb-1.5.0/db/db_impl.h b/deps/leveldb/leveldb-1.7.0/db/db_impl.h
similarity index 88%
rename from deps/leveldb/leveldb-1.5.0/db/db_impl.h
rename to deps/leveldb/leveldb-1.7.0/db/db_impl.h
index 8d2bb34..bd29dd8 100644
--- a/deps/leveldb/leveldb-1.5.0/db/db_impl.h
+++ b/deps/leveldb/leveldb-1.7.0/db/db_impl.h
@@ -13,6 +13,7 @@
#include "leveldb/db.h"
#include "leveldb/env.h"
#include "port/port.h"
+#include "port/thread_annotations.h"
namespace leveldb {
@@ -71,7 +72,7 @@ class DBImpl : public DB {
// Recover the descriptor from persistent storage. May do a significant
// amount of work to recover recently logged updates. Any changes to
// be made to the descriptor are added to *edit.
- Status Recover(VersionEdit* edit);
+ Status Recover(VersionEdit* edit) EXCLUSIVE_LOCKS_REQUIRED(mutex_);
void MaybeIgnoreError(Status* s) const;
@@ -80,27 +81,34 @@ class DBImpl : public DB {
// Compact the in-memory write buffer to disk. Switches to a new
// log-file/memtable and writes a new descriptor iff successful.
- Status CompactMemTable();
+ Status CompactMemTable()
+ EXCLUSIVE_LOCKS_REQUIRED(mutex_);
Status RecoverLogFile(uint64_t log_number,
VersionEdit* edit,
- SequenceNumber* max_sequence);
+ SequenceNumber* max_sequence)
+ EXCLUSIVE_LOCKS_REQUIRED(mutex_);
- Status WriteLevel0Table(MemTable* mem, VersionEdit* edit, Version* base);
+ Status WriteLevel0Table(MemTable* mem, VersionEdit* edit, Version* base)
+ EXCLUSIVE_LOCKS_REQUIRED(mutex_);
- Status MakeRoomForWrite(bool force /* compact even if there is room? */);
+ Status MakeRoomForWrite(bool force /* compact even if there is room? */)
+ EXCLUSIVE_LOCKS_REQUIRED(mutex_);
WriteBatch* BuildBatchGroup(Writer** last_writer);
- void MaybeScheduleCompaction();
+ void MaybeScheduleCompaction() EXCLUSIVE_LOCKS_REQUIRED(mutex_);
static void BGWork(void* db);
void BackgroundCall();
- Status BackgroundCompaction();
- void CleanupCompaction(CompactionState* compact);
- Status DoCompactionWork(CompactionState* compact);
+ Status BackgroundCompaction() EXCLUSIVE_LOCKS_REQUIRED(mutex_);
+ void CleanupCompaction(CompactionState* compact)
+ EXCLUSIVE_LOCKS_REQUIRED(mutex_);
+ Status DoCompactionWork(CompactionState* compact)
+ EXCLUSIVE_LOCKS_REQUIRED(mutex_);
Status OpenCompactionOutputFile(CompactionState* compact);
Status FinishCompactionOutputFile(CompactionState* compact, Iterator* input);
- Status InstallCompactionResults(CompactionState* compact);
+ Status InstallCompactionResults(CompactionState* compact)
+ EXCLUSIVE_LOCKS_REQUIRED(mutex_);
// Constant after construction
Env* const env_;
diff --git a/deps/leveldb/leveldb-1.5.0/db/db_iter.cc b/deps/leveldb/leveldb-1.7.0/db/db_iter.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/db_iter.cc
rename to deps/leveldb/leveldb-1.7.0/db/db_iter.cc
diff --git a/deps/leveldb/leveldb-1.5.0/db/db_iter.h b/deps/leveldb/leveldb-1.7.0/db/db_iter.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/db_iter.h
rename to deps/leveldb/leveldb-1.7.0/db/db_iter.h
diff --git a/deps/leveldb/leveldb-1.5.0/db/db_test.cc b/deps/leveldb/leveldb-1.7.0/db/db_test.cc
similarity index 99%
rename from deps/leveldb/leveldb-1.5.0/db/db_test.cc
rename to deps/leveldb/leveldb-1.7.0/db/db_test.cc
index 3744d0e..74abd13 100644
--- a/deps/leveldb/leveldb-1.5.0/db/db_test.cc
+++ b/deps/leveldb/leveldb-1.7.0/db/db_test.cc
@@ -1442,6 +1442,12 @@ TEST(DBTest, DBOpen_Options) {
db = NULL;
}
+TEST(DBTest, Locking) {
+ DB* db2 = NULL;
+ Status s = DB::Open(CurrentOptions(), dbname_, &db2);
+ ASSERT_TRUE(!s.ok()) << "Locking did not prevent re-opening db";
+}
+
// Check that number of files does not grow when we are out of space
TEST(DBTest, NoSpace) {
Options options = CurrentOptions();
diff --git a/deps/leveldb/leveldb-1.5.0/db/dbformat.cc b/deps/leveldb/leveldb-1.7.0/db/dbformat.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/dbformat.cc
rename to deps/leveldb/leveldb-1.7.0/db/dbformat.cc
diff --git a/deps/leveldb/leveldb-1.5.0/db/dbformat.h b/deps/leveldb/leveldb-1.7.0/db/dbformat.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/dbformat.h
rename to deps/leveldb/leveldb-1.7.0/db/dbformat.h
diff --git a/deps/leveldb/leveldb-1.5.0/db/dbformat_test.cc b/deps/leveldb/leveldb-1.7.0/db/dbformat_test.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/dbformat_test.cc
rename to deps/leveldb/leveldb-1.7.0/db/dbformat_test.cc
diff --git a/deps/leveldb/leveldb-1.5.0/db/filename.cc b/deps/leveldb/leveldb-1.7.0/db/filename.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/filename.cc
rename to deps/leveldb/leveldb-1.7.0/db/filename.cc
diff --git a/deps/leveldb/leveldb-1.5.0/db/filename.h b/deps/leveldb/leveldb-1.7.0/db/filename.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/filename.h
rename to deps/leveldb/leveldb-1.7.0/db/filename.h
diff --git a/deps/leveldb/leveldb-1.5.0/db/filename_test.cc b/deps/leveldb/leveldb-1.7.0/db/filename_test.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/filename_test.cc
rename to deps/leveldb/leveldb-1.7.0/db/filename_test.cc
diff --git a/deps/leveldb/leveldb-1.5.0/db/log_format.h b/deps/leveldb/leveldb-1.7.0/db/log_format.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/log_format.h
rename to deps/leveldb/leveldb-1.7.0/db/log_format.h
diff --git a/deps/leveldb/leveldb-1.5.0/db/log_reader.cc b/deps/leveldb/leveldb-1.7.0/db/log_reader.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/log_reader.cc
rename to deps/leveldb/leveldb-1.7.0/db/log_reader.cc
diff --git a/deps/leveldb/leveldb-1.5.0/db/log_reader.h b/deps/leveldb/leveldb-1.7.0/db/log_reader.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/log_reader.h
rename to deps/leveldb/leveldb-1.7.0/db/log_reader.h
diff --git a/deps/leveldb/leveldb-1.5.0/db/log_test.cc b/deps/leveldb/leveldb-1.7.0/db/log_test.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/log_test.cc
rename to deps/leveldb/leveldb-1.7.0/db/log_test.cc
diff --git a/deps/leveldb/leveldb-1.5.0/db/log_writer.cc b/deps/leveldb/leveldb-1.7.0/db/log_writer.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/log_writer.cc
rename to deps/leveldb/leveldb-1.7.0/db/log_writer.cc
diff --git a/deps/leveldb/leveldb-1.5.0/db/log_writer.h b/deps/leveldb/leveldb-1.7.0/db/log_writer.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/log_writer.h
rename to deps/leveldb/leveldb-1.7.0/db/log_writer.h
diff --git a/deps/leveldb/leveldb-1.5.0/db/memtable.cc b/deps/leveldb/leveldb-1.7.0/db/memtable.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/memtable.cc
rename to deps/leveldb/leveldb-1.7.0/db/memtable.cc
diff --git a/deps/leveldb/leveldb-1.5.0/db/memtable.h b/deps/leveldb/leveldb-1.7.0/db/memtable.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/memtable.h
rename to deps/leveldb/leveldb-1.7.0/db/memtable.h
diff --git a/deps/leveldb/leveldb-1.5.0/db/repair.cc b/deps/leveldb/leveldb-1.7.0/db/repair.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/repair.cc
rename to deps/leveldb/leveldb-1.7.0/db/repair.cc
diff --git a/deps/leveldb/leveldb-1.5.0/db/skiplist.h b/deps/leveldb/leveldb-1.7.0/db/skiplist.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/skiplist.h
rename to deps/leveldb/leveldb-1.7.0/db/skiplist.h
diff --git a/deps/leveldb/leveldb-1.5.0/db/skiplist_test.cc b/deps/leveldb/leveldb-1.7.0/db/skiplist_test.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/skiplist_test.cc
rename to deps/leveldb/leveldb-1.7.0/db/skiplist_test.cc
diff --git a/deps/leveldb/leveldb-1.5.0/db/snapshot.h b/deps/leveldb/leveldb-1.7.0/db/snapshot.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/snapshot.h
rename to deps/leveldb/leveldb-1.7.0/db/snapshot.h
diff --git a/deps/leveldb/leveldb-1.5.0/db/table_cache.cc b/deps/leveldb/leveldb-1.7.0/db/table_cache.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/table_cache.cc
rename to deps/leveldb/leveldb-1.7.0/db/table_cache.cc
diff --git a/deps/leveldb/leveldb-1.5.0/db/table_cache.h b/deps/leveldb/leveldb-1.7.0/db/table_cache.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/table_cache.h
rename to deps/leveldb/leveldb-1.7.0/db/table_cache.h
diff --git a/deps/leveldb/leveldb-1.5.0/db/version_edit.cc b/deps/leveldb/leveldb-1.7.0/db/version_edit.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/version_edit.cc
rename to deps/leveldb/leveldb-1.7.0/db/version_edit.cc
diff --git a/deps/leveldb/leveldb-1.5.0/db/version_edit.h b/deps/leveldb/leveldb-1.7.0/db/version_edit.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/version_edit.h
rename to deps/leveldb/leveldb-1.7.0/db/version_edit.h
diff --git a/deps/leveldb/leveldb-1.5.0/db/version_edit_test.cc b/deps/leveldb/leveldb-1.7.0/db/version_edit_test.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/version_edit_test.cc
rename to deps/leveldb/leveldb-1.7.0/db/version_edit_test.cc
diff --git a/deps/leveldb/leveldb-1.5.0/db/version_set.cc b/deps/leveldb/leveldb-1.7.0/db/version_set.cc
similarity index 99%
rename from deps/leveldb/leveldb-1.5.0/db/version_set.cc
rename to deps/leveldb/leveldb-1.7.0/db/version_set.cc
index cf976b4..bdd4a57 100644
--- a/deps/leveldb/leveldb-1.5.0/db/version_set.cc
+++ b/deps/leveldb/leveldb-1.7.0/db/version_set.cc
@@ -865,7 +865,7 @@ Status VersionSet::Recover() {
if (edit.has_comparator_ &&
edit.comparator_ != icmp_.user_comparator()->Name()) {
s = Status::InvalidArgument(
- edit.comparator_ + "does not match existing comparator ",
+ edit.comparator_ + " does not match existing comparator ",
icmp_.user_comparator()->Name());
}
}
diff --git a/deps/leveldb/leveldb-1.5.0/db/version_set.h b/deps/leveldb/leveldb-1.7.0/db/version_set.h
similarity index 99%
rename from deps/leveldb/leveldb-1.5.0/db/version_set.h
rename to deps/leveldb/leveldb-1.7.0/db/version_set.h
index 61c4c99..792899b 100644
--- a/deps/leveldb/leveldb-1.5.0/db/version_set.h
+++ b/deps/leveldb/leveldb-1.7.0/db/version_set.h
@@ -21,6 +21,7 @@
#include "db/dbformat.h"
#include "db/version_edit.h"
#include "port/port.h"
+#include "port/thread_annotations.h"
namespace leveldb {
@@ -159,7 +160,8 @@ class VersionSet {
// current version. Will release *mu while actually writing to the file.
// REQUIRES: *mu is held on entry.
// REQUIRES: no other thread concurrently calls LogAndApply()
- Status LogAndApply(VersionEdit* edit, port::Mutex* mu);
+ Status LogAndApply(VersionEdit* edit, port::Mutex* mu)
+ EXCLUSIVE_LOCKS_REQUIRED(mu);
// Recover the last saved descriptor from persistent storage.
Status Recover();
diff --git a/deps/leveldb/leveldb-1.5.0/db/version_set_test.cc b/deps/leveldb/leveldb-1.7.0/db/version_set_test.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/version_set_test.cc
rename to deps/leveldb/leveldb-1.7.0/db/version_set_test.cc
diff --git a/deps/leveldb/leveldb-1.5.0/db/write_batch.cc b/deps/leveldb/leveldb-1.7.0/db/write_batch.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/write_batch.cc
rename to deps/leveldb/leveldb-1.7.0/db/write_batch.cc
diff --git a/deps/leveldb/leveldb-1.5.0/db/write_batch_internal.h b/deps/leveldb/leveldb-1.7.0/db/write_batch_internal.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/write_batch_internal.h
rename to deps/leveldb/leveldb-1.7.0/db/write_batch_internal.h
diff --git a/deps/leveldb/leveldb-1.5.0/db/write_batch_test.cc b/deps/leveldb/leveldb-1.7.0/db/write_batch_test.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/db/write_batch_test.cc
rename to deps/leveldb/leveldb-1.7.0/db/write_batch_test.cc
diff --git a/deps/leveldb/leveldb-1.5.0/doc/bench/db_bench_sqlite3.cc b/deps/leveldb/leveldb-1.7.0/doc/bench/db_bench_sqlite3.cc
similarity index 99%
rename from deps/leveldb/leveldb-1.5.0/doc/bench/db_bench_sqlite3.cc
rename to deps/leveldb/leveldb-1.7.0/doc/bench/db_bench_sqlite3.cc
index 256793a..e63aaa8 100644
--- a/deps/leveldb/leveldb-1.5.0/doc/bench/db_bench_sqlite3.cc
+++ b/deps/leveldb/leveldb-1.7.0/doc/bench/db_bench_sqlite3.cc
@@ -618,7 +618,7 @@ class Benchmark {
ErrorCheck(status);
// Execute read statement
- while ((status = sqlite3_step(read_stmt)) == SQLITE_ROW);
+ while ((status = sqlite3_step(read_stmt)) == SQLITE_ROW) {}
StepErrorCheck(status);
// Reset SQLite statement for another use
diff --git a/deps/leveldb/leveldb-1.5.0/doc/bench/db_bench_tree_db.cc b/deps/leveldb/leveldb-1.7.0/doc/bench/db_bench_tree_db.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/doc/bench/db_bench_tree_db.cc
rename to deps/leveldb/leveldb-1.7.0/doc/bench/db_bench_tree_db.cc
diff --git a/deps/leveldb/leveldb-1.5.0/doc/benchmark.html b/deps/leveldb/leveldb-1.7.0/doc/benchmark.html
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/doc/benchmark.html
rename to deps/leveldb/leveldb-1.7.0/doc/benchmark.html
diff --git a/deps/leveldb/leveldb-1.5.0/doc/doc.css b/deps/leveldb/leveldb-1.7.0/doc/doc.css
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/doc/doc.css
rename to deps/leveldb/leveldb-1.7.0/doc/doc.css
diff --git a/deps/leveldb/leveldb-1.5.0/doc/impl.html b/deps/leveldb/leveldb-1.7.0/doc/impl.html
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/doc/impl.html
rename to deps/leveldb/leveldb-1.7.0/doc/impl.html
diff --git a/deps/leveldb/leveldb-1.5.0/doc/index.html b/deps/leveldb/leveldb-1.7.0/doc/index.html
similarity index 98%
rename from deps/leveldb/leveldb-1.5.0/doc/index.html
rename to deps/leveldb/leveldb-1.7.0/doc/index.html
index 521d2ba..3ed0ed9 100644
--- a/deps/leveldb/leveldb-1.5.0/doc/index.html
+++ b/deps/leveldb/leveldb-1.7.0/doc/index.html
@@ -408,7 +408,7 @@ The optional <code>FilterPolicy</code> mechanism can be used to reduce
the number of disk reads substantially.
<pre>
leveldb::Options options;
- options.filter_policy = NewBloomFilter(10);
+ options.filter_policy = NewBloomFilterPolicy(10);
leveldb::DB* db;
leveldb::DB::Open(options, "/tmp/testdb", &db);
... use the database ...
@@ -420,7 +420,7 @@ The preceding code associates a
based filtering policy with the database. Bloom filter based
filtering relies on keeping some number of bits of data in memory per
key (in this case 10 bits per key since that is the argument we passed
-to NewBloomFilter). This filter will reduce the number of unnecessary
+to NewBloomFilterPolicy). This filter will reduce the number of unnecessary
disk reads needed for <code>Get()</code> calls by a factor of
approximately a 100. Increasing the bits per key will lead to a
larger reduction at the cost of more memory usage. We recommend that
@@ -430,7 +430,7 @@ lot of random reads set a filter policy.
If you are using a custom comparator, you should ensure that the filter
policy you are using is compatible with your comparator. For example,
consider a comparator that ignores trailing spaces when comparing keys.
-<code>NewBloomFilter</code> must not be used with such a comparator.
+<code>NewBloomFilterPolicy</code> must not be used with such a comparator.
Instead, the application should provide a custom filter policy that
also ignores trailing spaces. For example:
<pre>
@@ -438,7 +438,7 @@ also ignores trailing spaces. For example:
private:
FilterPolicy* builtin_policy_;
public:
- CustomFilterPolicy() : builtin_policy_(NewBloomFilter(10)) { }
+ CustomFilterPolicy() : builtin_policy_(NewBloomFilterPolicy(10)) { }
~CustomFilterPolicy() { delete builtin_policy_; }
const char* Name() const { return "IgnoreTrailingSpacesFilter"; }
diff --git a/deps/leveldb/leveldb-1.5.0/doc/log_format.txt b/deps/leveldb/leveldb-1.7.0/doc/log_format.txt
similarity index 96%
rename from deps/leveldb/leveldb-1.5.0/doc/log_format.txt
rename to deps/leveldb/leveldb-1.7.0/doc/log_format.txt
index 3a0414b..5228f62 100644
--- a/deps/leveldb/leveldb-1.5.0/doc/log_format.txt
+++ b/deps/leveldb/leveldb-1.7.0/doc/log_format.txt
@@ -4,8 +4,8 @@ exception is that the tail of the file may contain a partial block.
Each block consists of a sequence of records:
block := record* trailer?
record :=
- checksum: uint32 // crc32c of type and data[]
- length: uint16
+ checksum: uint32 // crc32c of type and data[] ; little-endian
+ length: uint16 // little-endian
type: uint8 // One of FULL, FIRST, MIDDLE, LAST
data: uint8[length]
diff --git a/deps/leveldb/leveldb-1.5.0/doc/table_format.txt b/deps/leveldb/leveldb-1.7.0/doc/table_format.txt
similarity index 87%
rename from deps/leveldb/leveldb-1.5.0/doc/table_format.txt
rename to deps/leveldb/leveldb-1.7.0/doc/table_format.txt
index d0f3065..ca8f9b4 100644
--- a/deps/leveldb/leveldb-1.5.0/doc/table_format.txt
+++ b/deps/leveldb/leveldb-1.7.0/doc/table_format.txt
@@ -18,6 +18,8 @@ The file contains internal pointers. Each such pointer is called
a BlockHandle and contains the following information:
offset: varint64
size: varint64
+See https://developers.google.com/protocol-buffers/docs/encoding#varints
+for an explanation of varint64 format.
(1) The sequence of key/value pairs in the file are stored in sorted
order and partitioned into a sequence of data blocks. These blocks
@@ -41,11 +43,11 @@ BlockHandle for the data block.
(6) At the very end of the file is a fixed length footer that contains
the BlockHandle of the metaindex and index blocks as well as a magic number.
- metaindex_handle: char[p]; // Block handle for metaindex
- index_handle: char[q]; // Block handle for index
- padding: char[40-p-q]; // 0 bytes to make fixed length
- // (40==2*BlockHandle::kMaxEncodedLength)
- magic: fixed64; // == 0xdb4775248b80fb57
+ metaindex_handle: char[p]; // Block handle for metaindex
+ index_handle: char[q]; // Block handle for index
+ padding: char[40-p-q]; // zeroed bytes to make fixed length
+ // (40==2*BlockHandle::kMaxEncodedLength)
+ magic: fixed64; // == 0xdb4775248b80fb57 (little-endian)
"filter" Meta Block
-------------------
diff --git a/deps/leveldb/leveldb-1.5.0/helpers/memenv/memenv.cc b/deps/leveldb/leveldb-1.7.0/helpers/memenv/memenv.cc
similarity index 97%
rename from deps/leveldb/leveldb-1.5.0/helpers/memenv/memenv.cc
rename to deps/leveldb/leveldb-1.7.0/helpers/memenv/memenv.cc
index 2082083..5879de1 100644
--- a/deps/leveldb/leveldb-1.5.0/helpers/memenv/memenv.cc
+++ b/deps/leveldb/leveldb-1.7.0/helpers/memenv/memenv.cc
@@ -221,6 +221,11 @@ class WritableFileImpl : public WritableFile {
FileState* file_;
};
+class NoOpLogger : public Logger {
+ public:
+ virtual void Logv(const char* format, va_list ap) { }
+};
+
class InMemoryEnv : public EnvWrapper {
public:
explicit InMemoryEnv(Env* base_env) : EnvWrapper(base_env) { }
@@ -358,6 +363,11 @@ class InMemoryEnv : public EnvWrapper {
return Status::OK();
}
+ virtual Status NewLogger(const std::string& fname, Logger** result) {
+ *result = new NoOpLogger;
+ return Status::OK();
+ }
+
private:
// Map from filenames to FileState objects, representing a simple file system.
typedef std::map<std::string, FileState*> FileSystem;
diff --git a/deps/leveldb/leveldb-1.5.0/helpers/memenv/memenv.h b/deps/leveldb/leveldb-1.7.0/helpers/memenv/memenv.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/helpers/memenv/memenv.h
rename to deps/leveldb/leveldb-1.7.0/helpers/memenv/memenv.h
diff --git a/deps/leveldb/leveldb-1.5.0/helpers/memenv/memenv_test.cc b/deps/leveldb/leveldb-1.7.0/helpers/memenv/memenv_test.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/helpers/memenv/memenv_test.cc
rename to deps/leveldb/leveldb-1.7.0/helpers/memenv/memenv_test.cc
diff --git a/deps/leveldb/leveldb-1.5.0/include/leveldb/c.h b/deps/leveldb/leveldb-1.7.0/include/leveldb/c.h
similarity index 94%
rename from deps/leveldb/leveldb-1.5.0/include/leveldb/c.h
rename to deps/leveldb/leveldb-1.7.0/include/leveldb/c.h
index 70e3cc6..1fa5886 100644
--- a/deps/leveldb/leveldb-1.5.0/include/leveldb/c.h
+++ b/deps/leveldb/leveldb-1.7.0/include/leveldb/c.h
@@ -28,6 +28,7 @@
be true on entry:
*errptr == NULL
*errptr points to a malloc()ed null-terminated error message
+ (On Windows, *errptr must have been malloc()-ed by this library.)
On success, a leveldb routine leaves *errptr unchanged.
On failure, leveldb frees the old value of *errptr and
set *errptr to a malloc()ed error message.
@@ -268,6 +269,21 @@ extern void leveldb_cache_destroy(leveldb_cache_t* cache);
extern leveldb_env_t* leveldb_create_default_env();
extern void leveldb_env_destroy(leveldb_env_t*);
+/* Utility */
+
+/* Calls free(ptr).
+ REQUIRES: ptr was malloc()-ed and returned by one of the routines
+ in this file. Note that in certain cases (typically on Windows), you
+ may need to call this routine instead of free(ptr) to dispose of
+ malloc()-ed memory returned by this library. */
+extern void leveldb_free(void* ptr);
+
+/* Return the major version number for this release. */
+extern int leveldb_major_version();
+
+/* Return the minor version number for this release. */
+extern int leveldb_minor_version();
+
#ifdef __cplusplus
} /* end extern "C" */
#endif
diff --git a/deps/leveldb/leveldb-1.5.0/include/leveldb/cache.h b/deps/leveldb/leveldb-1.7.0/include/leveldb/cache.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/include/leveldb/cache.h
rename to deps/leveldb/leveldb-1.7.0/include/leveldb/cache.h
diff --git a/deps/leveldb/leveldb-1.5.0/include/leveldb/comparator.h b/deps/leveldb/leveldb-1.7.0/include/leveldb/comparator.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/include/leveldb/comparator.h
rename to deps/leveldb/leveldb-1.7.0/include/leveldb/comparator.h
diff --git a/deps/leveldb/leveldb-1.5.0/include/leveldb/db.h b/deps/leveldb/leveldb-1.7.0/include/leveldb/db.h
similarity index 99%
rename from deps/leveldb/leveldb-1.5.0/include/leveldb/db.h
rename to deps/leveldb/leveldb-1.7.0/include/leveldb/db.h
index ed56b87..79142f5 100644
--- a/deps/leveldb/leveldb-1.5.0/include/leveldb/db.h
+++ b/deps/leveldb/leveldb-1.7.0/include/leveldb/db.h
@@ -14,7 +14,7 @@ namespace leveldb {
// Update Makefile if you change these
static const int kMajorVersion = 1;
-static const int kMinorVersion = 5;
+static const int kMinorVersion = 7;
struct Options;
struct ReadOptions;
diff --git a/deps/leveldb/leveldb-1.5.0/include/leveldb/env.h b/deps/leveldb/leveldb-1.7.0/include/leveldb/env.h
similarity index 97%
rename from deps/leveldb/leveldb-1.5.0/include/leveldb/env.h
rename to deps/leveldb/leveldb-1.7.0/include/leveldb/env.h
index 2720667..fa32289 100644
--- a/deps/leveldb/leveldb-1.5.0/include/leveldb/env.h
+++ b/deps/leveldb/leveldb-1.7.0/include/leveldb/env.h
@@ -175,6 +175,11 @@ class SequentialFile {
//
// REQUIRES: External synchronization
virtual Status Skip(uint64_t n) = 0;
+
+ private:
+ // No copying allowed
+ SequentialFile(const SequentialFile&);
+ void operator=(const SequentialFile&);
};
// A file abstraction for randomly reading the contents of a file.
@@ -194,6 +199,11 @@ class RandomAccessFile {
// Safe for concurrent use by multiple threads.
virtual Status Read(uint64_t offset, size_t n, Slice* result,
char* scratch) const = 0;
+
+ private:
+ // No copying allowed
+ RandomAccessFile(const RandomAccessFile&);
+ void operator=(const RandomAccessFile&);
};
// A file abstraction for sequential writing. The implementation
diff --git a/deps/leveldb/leveldb-1.5.0/include/leveldb/filter_policy.h b/deps/leveldb/leveldb-1.7.0/include/leveldb/filter_policy.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/include/leveldb/filter_policy.h
rename to deps/leveldb/leveldb-1.7.0/include/leveldb/filter_policy.h
diff --git a/deps/leveldb/leveldb-1.5.0/include/leveldb/iterator.h b/deps/leveldb/leveldb-1.7.0/include/leveldb/iterator.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/include/leveldb/iterator.h
rename to deps/leveldb/leveldb-1.7.0/include/leveldb/iterator.h
diff --git a/deps/leveldb/leveldb-1.5.0/include/leveldb/options.h b/deps/leveldb/leveldb-1.7.0/include/leveldb/options.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/include/leveldb/options.h
rename to deps/leveldb/leveldb-1.7.0/include/leveldb/options.h
diff --git a/deps/leveldb/leveldb-1.5.0/include/leveldb/slice.h b/deps/leveldb/leveldb-1.7.0/include/leveldb/slice.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/include/leveldb/slice.h
rename to deps/leveldb/leveldb-1.7.0/include/leveldb/slice.h
diff --git a/deps/leveldb/leveldb-1.5.0/include/leveldb/status.h b/deps/leveldb/leveldb-1.7.0/include/leveldb/status.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/include/leveldb/status.h
rename to deps/leveldb/leveldb-1.7.0/include/leveldb/status.h
diff --git a/deps/leveldb/leveldb-1.5.0/include/leveldb/table.h b/deps/leveldb/leveldb-1.7.0/include/leveldb/table.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/include/leveldb/table.h
rename to deps/leveldb/leveldb-1.7.0/include/leveldb/table.h
diff --git a/deps/leveldb/leveldb-1.5.0/include/leveldb/table_builder.h b/deps/leveldb/leveldb-1.7.0/include/leveldb/table_builder.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/include/leveldb/table_builder.h
rename to deps/leveldb/leveldb-1.7.0/include/leveldb/table_builder.h
diff --git a/deps/leveldb/leveldb-1.5.0/include/leveldb/write_batch.h b/deps/leveldb/leveldb-1.7.0/include/leveldb/write_batch.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/include/leveldb/write_batch.h
rename to deps/leveldb/leveldb-1.7.0/include/leveldb/write_batch.h
diff --git a/deps/leveldb/leveldb-1.5.0/port/README b/deps/leveldb/leveldb-1.7.0/port/README
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/port/README
rename to deps/leveldb/leveldb-1.7.0/port/README
diff --git a/deps/leveldb/leveldb-1.5.0/port/atomic_pointer.h b/deps/leveldb/leveldb-1.7.0/port/atomic_pointer.h
similarity index 70%
rename from deps/leveldb/leveldb-1.5.0/port/atomic_pointer.h
rename to deps/leveldb/leveldb-1.7.0/port/atomic_pointer.h
index c58bffb..e17bf43 100644
--- a/deps/leveldb/leveldb-1.5.0/port/atomic_pointer.h
+++ b/deps/leveldb/leveldb-1.7.0/port/atomic_pointer.h
@@ -36,6 +36,8 @@
#define ARCH_CPU_X86_FAMILY 1
#elif defined(__ARMEL__)
#define ARCH_CPU_ARM_FAMILY 1
+#elif defined(__ppc__) || defined(__powerpc__) || defined(__powerpc64__)
+#define ARCH_CPU_PPC_FAMILY 1
#endif
namespace leveldb {
@@ -91,6 +93,15 @@ inline void MemoryBarrier() {
}
#define LEVELDB_HAVE_MEMORY_BARRIER
+// PPC
+#elif defined(ARCH_CPU_PPC_FAMILY) && defined(__GNUC__)
+inline void MemoryBarrier() {
+ // TODO for some powerpc expert: is there a cheaper suitable variant?
+ // Perhaps by having separate barriers for acquire and release ops.
+ asm volatile("sync" : : : "memory");
+}
+#define LEVELDB_HAVE_MEMORY_BARRIER
+
#endif
// AtomicPointer built using platform-specific MemoryBarrier()
@@ -136,6 +147,66 @@ class AtomicPointer {
}
};
+// Atomic pointer based on sparc memory barriers
+#elif defined(__sparcv9) && defined(__GNUC__)
+class AtomicPointer {
+ private:
+ void* rep_;
+ public:
+ AtomicPointer() { }
+ explicit AtomicPointer(void* v) : rep_(v) { }
+ inline void* Acquire_Load() const {
+ void* val;
+ __asm__ __volatile__ (
+ "ldx [%[rep_]], %[val] \n\t"
+ "membar #LoadLoad|#LoadStore \n\t"
+ : [val] "=r" (val)
+ : [rep_] "r" (&rep_)
+ : "memory");
+ return val;
+ }
+ inline void Release_Store(void* v) {
+ __asm__ __volatile__ (
+ "membar #LoadStore|#StoreStore \n\t"
+ "stx %[v], [%[rep_]] \n\t"
+ :
+ : [rep_] "r" (&rep_), [v] "r" (v)
+ : "memory");
+ }
+ inline void* NoBarrier_Load() const { return rep_; }
+ inline void NoBarrier_Store(void* v) { rep_ = v; }
+};
+
+// Atomic pointer based on ia64 acq/rel
+#elif defined(__ia64) && defined(__GNUC__)
+class AtomicPointer {
+ private:
+ void* rep_;
+ public:
+ AtomicPointer() { }
+ explicit AtomicPointer(void* v) : rep_(v) { }
+ inline void* Acquire_Load() const {
+ void* val ;
+ __asm__ __volatile__ (
+ "ld8.acq %[val] = [%[rep_]] \n\t"
+ : [val] "=r" (val)
+ : [rep_] "r" (&rep_)
+ : "memory"
+ );
+ return val;
+ }
+ inline void Release_Store(void* v) {
+ __asm__ __volatile__ (
+ "st8.rel [%[rep_]] = %[v] \n\t"
+ :
+ : [rep_] "r" (&rep_), [v] "r" (v)
+ : "memory"
+ );
+ }
+ inline void* NoBarrier_Load() const { return rep_; }
+ inline void NoBarrier_Store(void* v) { rep_ = v; }
+};
+
// We have neither MemoryBarrier(), nor <cstdatomic>
#else
#error Please implement AtomicPointer for this platform.
@@ -145,6 +216,7 @@ class AtomicPointer {
#undef LEVELDB_HAVE_MEMORY_BARRIER
#undef ARCH_CPU_X86_FAMILY
#undef ARCH_CPU_ARM_FAMILY
+#undef ARCH_CPU_PPC_FAMILY
} // namespace port
} // namespace leveldb
diff --git a/deps/leveldb/leveldb-1.5.0/port/port.h b/deps/leveldb/leveldb-1.7.0/port/port.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/port/port.h
rename to deps/leveldb/leveldb-1.7.0/port/port.h
diff --git a/deps/leveldb/leveldb-1.5.0/port/port_example.h b/deps/leveldb/leveldb-1.7.0/port/port_example.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/port/port_example.h
rename to deps/leveldb/leveldb-1.7.0/port/port_example.h
diff --git a/deps/leveldb/leveldb-1.5.0/port/port_posix.cc b/deps/leveldb/leveldb-1.7.0/port/port_posix.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/port/port_posix.cc
rename to deps/leveldb/leveldb-1.7.0/port/port_posix.cc
diff --git a/deps/leveldb/leveldb-1.5.0/port/port_posix.h b/deps/leveldb/leveldb-1.7.0/port/port_posix.h
similarity index 92%
rename from deps/leveldb/leveldb-1.5.0/port/port_posix.h
rename to deps/leveldb/leveldb-1.7.0/port/port_posix.h
index 654a4b9..6ca352e 100644
--- a/deps/leveldb/leveldb-1.5.0/port/port_posix.h
+++ b/deps/leveldb/leveldb-1.7.0/port/port_posix.h
@@ -21,13 +21,20 @@
#else
#define PLATFORM_IS_LITTLE_ENDIAN false
#endif
-#elif defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_NETBSD) ||\
+#elif defined(OS_FREEBSD)
+ #include <sys/types.h>
+ #include <sys/endian.h>
+ #define PLATFORM_IS_LITTLE_ENDIAN (_BYTE_ORDER == _LITTLE_ENDIAN)
+#elif defined(OS_OPENBSD) || defined(OS_NETBSD) ||\
defined(OS_DRAGONFLYBSD) || defined(OS_ANDROID)
#include <sys/types.h>
#include <sys/endian.h>
+#elif defined(OS_HPUX)
+ #define PLATFORM_IS_LITTLE_ENDIAN false
#else
#include <endian.h>
#endif
+
#include <pthread.h>
#ifdef SNAPPY
#include <snappy.h>
@@ -42,7 +49,7 @@
#if defined(OS_MACOSX) || defined(OS_SOLARIS) || defined(OS_FREEBSD) ||\
defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLYBSD) ||\
- defined(OS_ANDROID)
+ defined(OS_ANDROID) || defined(OS_HPUX)
// Use fread/fwrite/fflush on platforms without _unlocked variants
#define fread_unlocked fread
#define fwrite_unlocked fwrite
diff --git a/deps/leveldb/leveldb-1.7.0/port/thread_annotations.h b/deps/leveldb/leveldb-1.7.0/port/thread_annotations.h
new file mode 100644
index 0000000..6f9b6a7
--- /dev/null
+++ b/deps/leveldb/leveldb-1.7.0/port/thread_annotations.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2012 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.
+
+#ifndef STORAGE_LEVELDB_PORT_THREAD_ANNOTATIONS_H
+
+// Some environments provide custom macros to aid in static thread-safety
+// analysis. Provide empty definitions of such macros unless they are already
+// defined.
+
+#ifndef EXCLUSIVE_LOCKS_REQUIRED
+#define EXCLUSIVE_LOCKS_REQUIRED(...)
+#endif
+
+#ifndef SHARED_LOCKS_REQUIRED
+#define SHARED_LOCKS_REQUIRED(...)
+#endif
+
+#ifndef LOCKS_EXCLUDED
+#define LOCKS_EXCLUDED(...)
+#endif
+
+#ifndef LOCK_RETURNED
+#define LOCK_RETURNED(x)
+#endif
+
+#ifndef LOCKABLE
+#define LOCKABLE
+#endif
+
+#ifndef SCOPED_LOCKABLE
+#define SCOPED_LOCKABLE
+#endif
+
+#ifndef EXCLUSIVE_LOCK_FUNCTION
+#define EXCLUSIVE_LOCK_FUNCTION(...)
+#endif
+
+#ifndef SHARED_LOCK_FUNCTION
+#define SHARED_LOCK_FUNCTION(...)
+#endif
+
+#ifndef EXCLUSIVE_TRYLOCK_FUNCTION
+#define EXCLUSIVE_TRYLOCK_FUNCTION(...)
+#endif
+
+#ifndef SHARED_TRYLOCK_FUNCTION
+#define SHARED_TRYLOCK_FUNCTION(...)
+#endif
+
+#ifndef UNLOCK_FUNCTION
+#define UNLOCK_FUNCTION(...)
+#endif
+
+#ifndef NO_THREAD_SAFETY_ANALYSIS
+#define NO_THREAD_SAFETY_ANALYSIS
+#endif
+
+#endif // STORAGE_LEVELDB_PORT_THREAD_ANNOTATIONS_H
diff --git a/deps/leveldb/leveldb-1.5.0/port/win/stdint.h b/deps/leveldb/leveldb-1.7.0/port/win/stdint.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/port/win/stdint.h
rename to deps/leveldb/leveldb-1.7.0/port/win/stdint.h
diff --git a/deps/leveldb/leveldb-1.5.0/table/block.cc b/deps/leveldb/leveldb-1.7.0/table/block.cc
similarity index 98%
rename from deps/leveldb/leveldb-1.5.0/table/block.cc
rename to deps/leveldb/leveldb-1.7.0/table/block.cc
index 199d453..ab83c11 100644
--- a/deps/leveldb/leveldb-1.5.0/table/block.cc
+++ b/deps/leveldb/leveldb-1.7.0/table/block.cc
@@ -162,8 +162,8 @@ class Block::Iter : public Iterator {
}
virtual void Seek(const Slice& target) {
- // Binary search in restart array to find the first restart point
- // with a key >= target
+ // Binary search in restart array to find the last restart point
+ // with a key < target
uint32_t left = 0;
uint32_t right = num_restarts_ - 1;
while (left < right) {
diff --git a/deps/leveldb/leveldb-1.5.0/table/block.h b/deps/leveldb/leveldb-1.7.0/table/block.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/table/block.h
rename to deps/leveldb/leveldb-1.7.0/table/block.h
diff --git a/deps/leveldb/leveldb-1.5.0/table/block_builder.cc b/deps/leveldb/leveldb-1.7.0/table/block_builder.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/table/block_builder.cc
rename to deps/leveldb/leveldb-1.7.0/table/block_builder.cc
diff --git a/deps/leveldb/leveldb-1.5.0/table/block_builder.h b/deps/leveldb/leveldb-1.7.0/table/block_builder.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/table/block_builder.h
rename to deps/leveldb/leveldb-1.7.0/table/block_builder.h
diff --git a/deps/leveldb/leveldb-1.5.0/table/filter_block.cc b/deps/leveldb/leveldb-1.7.0/table/filter_block.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/table/filter_block.cc
rename to deps/leveldb/leveldb-1.7.0/table/filter_block.cc
diff --git a/deps/leveldb/leveldb-1.5.0/table/filter_block.h b/deps/leveldb/leveldb-1.7.0/table/filter_block.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/table/filter_block.h
rename to deps/leveldb/leveldb-1.7.0/table/filter_block.h
diff --git a/deps/leveldb/leveldb-1.5.0/table/filter_block_test.cc b/deps/leveldb/leveldb-1.7.0/table/filter_block_test.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/table/filter_block_test.cc
rename to deps/leveldb/leveldb-1.7.0/table/filter_block_test.cc
diff --git a/deps/leveldb/leveldb-1.5.0/table/format.cc b/deps/leveldb/leveldb-1.7.0/table/format.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/table/format.cc
rename to deps/leveldb/leveldb-1.7.0/table/format.cc
diff --git a/deps/leveldb/leveldb-1.5.0/table/format.h b/deps/leveldb/leveldb-1.7.0/table/format.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/table/format.h
rename to deps/leveldb/leveldb-1.7.0/table/format.h
diff --git a/deps/leveldb/leveldb-1.5.0/table/iterator.cc b/deps/leveldb/leveldb-1.7.0/table/iterator.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/table/iterator.cc
rename to deps/leveldb/leveldb-1.7.0/table/iterator.cc
diff --git a/deps/leveldb/leveldb-1.5.0/table/iterator_wrapper.h b/deps/leveldb/leveldb-1.7.0/table/iterator_wrapper.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/table/iterator_wrapper.h
rename to deps/leveldb/leveldb-1.7.0/table/iterator_wrapper.h
diff --git a/deps/leveldb/leveldb-1.5.0/table/merger.cc b/deps/leveldb/leveldb-1.7.0/table/merger.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/table/merger.cc
rename to deps/leveldb/leveldb-1.7.0/table/merger.cc
diff --git a/deps/leveldb/leveldb-1.5.0/table/merger.h b/deps/leveldb/leveldb-1.7.0/table/merger.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/table/merger.h
rename to deps/leveldb/leveldb-1.7.0/table/merger.h
diff --git a/deps/leveldb/leveldb-1.5.0/table/table.cc b/deps/leveldb/leveldb-1.7.0/table/table.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/table/table.cc
rename to deps/leveldb/leveldb-1.7.0/table/table.cc
diff --git a/deps/leveldb/leveldb-1.5.0/table/table_builder.cc b/deps/leveldb/leveldb-1.7.0/table/table_builder.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/table/table_builder.cc
rename to deps/leveldb/leveldb-1.7.0/table/table_builder.cc
diff --git a/deps/leveldb/leveldb-1.5.0/table/table_test.cc b/deps/leveldb/leveldb-1.7.0/table/table_test.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/table/table_test.cc
rename to deps/leveldb/leveldb-1.7.0/table/table_test.cc
diff --git a/deps/leveldb/leveldb-1.5.0/table/two_level_iterator.cc b/deps/leveldb/leveldb-1.7.0/table/two_level_iterator.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/table/two_level_iterator.cc
rename to deps/leveldb/leveldb-1.7.0/table/two_level_iterator.cc
diff --git a/deps/leveldb/leveldb-1.5.0/table/two_level_iterator.h b/deps/leveldb/leveldb-1.7.0/table/two_level_iterator.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/table/two_level_iterator.h
rename to deps/leveldb/leveldb-1.7.0/table/two_level_iterator.h
diff --git a/deps/leveldb/leveldb-1.5.0/util/arena.cc b/deps/leveldb/leveldb-1.7.0/util/arena.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/arena.cc
rename to deps/leveldb/leveldb-1.7.0/util/arena.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/arena.h b/deps/leveldb/leveldb-1.7.0/util/arena.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/arena.h
rename to deps/leveldb/leveldb-1.7.0/util/arena.h
diff --git a/deps/leveldb/leveldb-1.5.0/util/arena_test.cc b/deps/leveldb/leveldb-1.7.0/util/arena_test.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/arena_test.cc
rename to deps/leveldb/leveldb-1.7.0/util/arena_test.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/bloom.cc b/deps/leveldb/leveldb-1.7.0/util/bloom.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/bloom.cc
rename to deps/leveldb/leveldb-1.7.0/util/bloom.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/bloom_test.cc b/deps/leveldb/leveldb-1.7.0/util/bloom_test.cc
similarity index 97%
rename from deps/leveldb/leveldb-1.5.0/util/bloom_test.cc
rename to deps/leveldb/leveldb-1.7.0/util/bloom_test.cc
index 4a6ea1b..0bf8e8d 100644
--- a/deps/leveldb/leveldb-1.5.0/util/bloom_test.cc
+++ b/deps/leveldb/leveldb-1.7.0/util/bloom_test.cc
@@ -4,6 +4,7 @@
#include "leveldb/filter_policy.h"
+#include "util/coding.h"
#include "util/logging.h"
#include "util/testharness.h"
#include "util/testutil.h"
@@ -13,8 +14,8 @@ namespace leveldb {
static const int kVerbose = 1;
static Slice Key(int i, char* buffer) {
- memcpy(buffer, &i, sizeof(i));
- return Slice(buffer, sizeof(i));
+ EncodeFixed32(buffer, i);
+ return Slice(buffer, sizeof(uint32_t));
}
class BloomTest {
diff --git a/deps/leveldb/leveldb-1.5.0/util/cache.cc b/deps/leveldb/leveldb-1.7.0/util/cache.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/cache.cc
rename to deps/leveldb/leveldb-1.7.0/util/cache.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/cache_test.cc b/deps/leveldb/leveldb-1.7.0/util/cache_test.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/cache_test.cc
rename to deps/leveldb/leveldb-1.7.0/util/cache_test.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/coding.cc b/deps/leveldb/leveldb-1.7.0/util/coding.cc
similarity index 88%
rename from deps/leveldb/leveldb-1.5.0/util/coding.cc
rename to deps/leveldb/leveldb-1.7.0/util/coding.cc
index dbd7a65..21e3186 100644
--- a/deps/leveldb/leveldb-1.5.0/util/coding.cc
+++ b/deps/leveldb/leveldb-1.7.0/util/coding.cc
@@ -7,29 +7,29 @@
namespace leveldb {
void EncodeFixed32(char* buf, uint32_t value) {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
- memcpy(buf, &value, sizeof(value));
-#else
- buf[0] = value & 0xff;
- buf[1] = (value >> 8) & 0xff;
- buf[2] = (value >> 16) & 0xff;
- buf[3] = (value >> 24) & 0xff;
-#endif
+ if (port::kLittleEndian) {
+ memcpy(buf, &value, sizeof(value));
+ } else {
+ buf[0] = value & 0xff;
+ buf[1] = (value >> 8) & 0xff;
+ buf[2] = (value >> 16) & 0xff;
+ buf[3] = (value >> 24) & 0xff;
+ }
}
void EncodeFixed64(char* buf, uint64_t value) {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
- memcpy(buf, &value, sizeof(value));
-#else
- buf[0] = value & 0xff;
- buf[1] = (value >> 8) & 0xff;
- buf[2] = (value >> 16) & 0xff;
- buf[3] = (value >> 24) & 0xff;
- buf[4] = (value >> 32) & 0xff;
- buf[5] = (value >> 40) & 0xff;
- buf[6] = (value >> 48) & 0xff;
- buf[7] = (value >> 56) & 0xff;
-#endif
+ if (port::kLittleEndian) {
+ memcpy(buf, &value, sizeof(value));
+ } else {
+ buf[0] = value & 0xff;
+ buf[1] = (value >> 8) & 0xff;
+ buf[2] = (value >> 16) & 0xff;
+ buf[3] = (value >> 24) & 0xff;
+ buf[4] = (value >> 32) & 0xff;
+ buf[5] = (value >> 40) & 0xff;
+ buf[6] = (value >> 48) & 0xff;
+ buf[7] = (value >> 56) & 0xff;
+ }
}
void PutFixed32(std::string* dst, uint32_t value) {
diff --git a/deps/leveldb/leveldb-1.5.0/util/coding.h b/deps/leveldb/leveldb-1.7.0/util/coding.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/coding.h
rename to deps/leveldb/leveldb-1.7.0/util/coding.h
diff --git a/deps/leveldb/leveldb-1.5.0/util/coding_test.cc b/deps/leveldb/leveldb-1.7.0/util/coding_test.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/coding_test.cc
rename to deps/leveldb/leveldb-1.7.0/util/coding_test.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/comparator.cc b/deps/leveldb/leveldb-1.7.0/util/comparator.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/comparator.cc
rename to deps/leveldb/leveldb-1.7.0/util/comparator.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/crc32c.cc b/deps/leveldb/leveldb-1.7.0/util/crc32c.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/crc32c.cc
rename to deps/leveldb/leveldb-1.7.0/util/crc32c.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/crc32c.h b/deps/leveldb/leveldb-1.7.0/util/crc32c.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/crc32c.h
rename to deps/leveldb/leveldb-1.7.0/util/crc32c.h
diff --git a/deps/leveldb/leveldb-1.5.0/util/crc32c_test.cc b/deps/leveldb/leveldb-1.7.0/util/crc32c_test.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/crc32c_test.cc
rename to deps/leveldb/leveldb-1.7.0/util/crc32c_test.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/env.cc b/deps/leveldb/leveldb-1.7.0/util/env.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/env.cc
rename to deps/leveldb/leveldb-1.7.0/util/env.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/env_posix.cc b/deps/leveldb/leveldb-1.7.0/util/env_posix.cc
similarity index 86%
rename from deps/leveldb/leveldb-1.5.0/util/env_posix.cc
rename to deps/leveldb/leveldb-1.7.0/util/env_posix.cc
index cb1f6fc..78e09c9 100644
--- a/deps/leveldb/leveldb-1.5.0/util/env_posix.cc
+++ b/deps/leveldb/leveldb-1.7.0/util/env_posix.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#include <deque>
+#include <set>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
@@ -23,6 +24,7 @@
#include "leveldb/slice.h"
#include "port/port.h"
#include "util/logging.h"
+#include "util/mutexlock.h"
#include "util/posix_logger.h"
namespace leveldb {
@@ -90,18 +92,75 @@ class PosixRandomAccessFile: public RandomAccessFile {
}
};
+// Helper class to limit mmap file usage so that we do not end up
+// running out virtual memory or running into kernel performance
+// problems for very large databases.
+class MmapLimiter {
+ public:
+ // Up to 1000 mmaps for 64-bit binaries; none for smaller pointer sizes.
+ MmapLimiter() {
+ SetAllowed(sizeof(void*) >= 8 ? 1000 : 0);
+ }
+
+ // If another mmap slot is available, acquire it and return true.
+ // Else return false.
+ bool Acquire() {
+ if (GetAllowed() <= 0) {
+ return false;
+ }
+ MutexLock l(&mu_);
+ intptr_t x = GetAllowed();
+ if (x <= 0) {
+ return false;
+ } else {
+ SetAllowed(x - 1);
+ return true;
+ }
+ }
+
+ // Release a slot acquired by a previous call to Acquire() that returned true.
+ void Release() {
+ MutexLock l(&mu_);
+ SetAllowed(GetAllowed() + 1);
+ }
+
+ private:
+ port::Mutex mu_;
+ port::AtomicPointer allowed_;
+
+ intptr_t GetAllowed() const {
+ return reinterpret_cast<intptr_t>(allowed_.Acquire_Load());
+ }
+
+ // REQUIRES: mu_ must be held
+ void SetAllowed(intptr_t v) {
+ allowed_.Release_Store(reinterpret_cast<void*>(v));
+ }
+
+ MmapLimiter(const MmapLimiter&);
+ void operator=(const MmapLimiter&);
+};
+
// mmap() based random-access
class PosixMmapReadableFile: public RandomAccessFile {
private:
std::string filename_;
void* mmapped_region_;
size_t length_;
+ MmapLimiter* limiter_;
public:
// base[0,length-1] contains the mmapped contents of the file.
- PosixMmapReadableFile(const std::string& fname, void* base, size_t length)
- : filename_(fname), mmapped_region_(base), length_(length) { }
- virtual ~PosixMmapReadableFile() { munmap(mmapped_region_, length_); }
+ PosixMmapReadableFile(const std::string& fname, void* base, size_t length,
+ MmapLimiter* limiter)
+ : filename_(fname), mmapped_region_(base), length_(length),
+ limiter_(limiter) {
+ }
+
+ virtual ~PosixMmapReadableFile() {
+ munmap(mmapped_region_, length_);
+ limiter_->Release();
+ }
virtual Status Read(uint64_t offset, size_t n, Slice* result,
char* scratch) const {
@@ -300,6 +359,25 @@ static int LockOrUnlock(int fd, bool lock) {
class PosixFileLock : public FileLock {
public:
int fd_;
+ std::string name_;
+};
+
+// Set of locked files. We keep a separate set instead of just
+// relying on fcntrl(F_SETLK) since fcntl(F_SETLK) does not provide
+// any protection against multiple uses from the same process.
+class PosixLockTable {
+ private:
+ port::Mutex mu_;
+ std::set<std::string> locked_files_;
+ public:
+ bool Insert(const std::string& fname) {
+ MutexLock l(&mu_);
+ return locked_files_.insert(fname).second;
+ }
+ void Remove(const std::string& fname) {
+ MutexLock l(&mu_);
+ locked_files_.erase(fname);
+ }
};
class PosixEnv : public Env {
@@ -329,19 +407,21 @@ class PosixEnv : public Env {
int fd = open(fname.c_str(), O_RDONLY);
if (fd < 0) {
s = IOError(fname, errno);
- } else if (sizeof(void*) >= 8) {
- // Use mmap when virtual address-space is plentiful.
+ } else if (mmap_limit_.Acquire()) {
uint64_t size;
s = GetFileSize(fname, &size);
if (s.ok()) {
void* base = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
if (base != MAP_FAILED) {
- *result = new PosixMmapReadableFile(fname, base, size);
+ *result = new PosixMmapReadableFile(fname, base, size, &mmap_limit_);
} else {
s = IOError(fname, errno);
}
}
close(fd);
+ if (!s.ok()) {
+ mmap_limit_.Release();
+ }
} else {
*result = new PosixRandomAccessFile(fname, fd);
}
@@ -430,12 +510,17 @@ class PosixEnv : public Env {
int fd = open(fname.c_str(), O_RDWR | O_CREAT, 0644);
if (fd < 0) {
result = IOError(fname, errno);
+ } else if (!locks_.Insert(fname)) {
+ close(fd);
+ result = Status::IOError("lock " + fname, "already held by process");
} else if (LockOrUnlock(fd, true) == -1) {
result = IOError("lock " + fname, errno);
close(fd);
+ locks_.Remove(fname);
} else {
PosixFileLock* my_lock = new PosixFileLock;
my_lock->fd_ = fd;
+ my_lock->name_ = fname;
*lock = my_lock;
}
return result;
@@ -447,6 +532,7 @@ class PosixEnv : public Env {
if (LockOrUnlock(my_lock->fd_, false) == -1) {
result = IOError("unlock", errno);
}
+ locks_.Remove(my_lock->name_);
close(my_lock->fd_);
delete my_lock;
return result;
@@ -523,6 +609,9 @@ class PosixEnv : public Env {
struct BGItem { void* arg; void (*function)(void*); };
typedef std::deque<BGItem> BGQueue;
BGQueue queue_;
+
+ PosixLockTable locks_;
+ MmapLimiter mmap_limit_;
};
PosixEnv::PosixEnv() : page_size_(getpagesize()),
diff --git a/deps/leveldb/leveldb-1.5.0/util/env_test.cc b/deps/leveldb/leveldb-1.7.0/util/env_test.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/env_test.cc
rename to deps/leveldb/leveldb-1.7.0/util/env_test.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/filter_policy.cc b/deps/leveldb/leveldb-1.7.0/util/filter_policy.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/filter_policy.cc
rename to deps/leveldb/leveldb-1.7.0/util/filter_policy.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/hash.cc b/deps/leveldb/leveldb-1.7.0/util/hash.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/hash.cc
rename to deps/leveldb/leveldb-1.7.0/util/hash.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/hash.h b/deps/leveldb/leveldb-1.7.0/util/hash.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/hash.h
rename to deps/leveldb/leveldb-1.7.0/util/hash.h
diff --git a/deps/leveldb/leveldb-1.5.0/util/histogram.cc b/deps/leveldb/leveldb-1.7.0/util/histogram.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/histogram.cc
rename to deps/leveldb/leveldb-1.7.0/util/histogram.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/histogram.h b/deps/leveldb/leveldb-1.7.0/util/histogram.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/histogram.h
rename to deps/leveldb/leveldb-1.7.0/util/histogram.h
diff --git a/deps/leveldb/leveldb-1.5.0/util/logging.cc b/deps/leveldb/leveldb-1.7.0/util/logging.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/logging.cc
rename to deps/leveldb/leveldb-1.7.0/util/logging.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/logging.h b/deps/leveldb/leveldb-1.7.0/util/logging.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/logging.h
rename to deps/leveldb/leveldb-1.7.0/util/logging.h
diff --git a/deps/leveldb/leveldb-1.5.0/util/mutexlock.h b/deps/leveldb/leveldb-1.7.0/util/mutexlock.h
similarity index 81%
rename from deps/leveldb/leveldb-1.5.0/util/mutexlock.h
rename to deps/leveldb/leveldb-1.7.0/util/mutexlock.h
index c3f3306..1ff5a9e 100644
--- a/deps/leveldb/leveldb-1.5.0/util/mutexlock.h
+++ b/deps/leveldb/leveldb-1.7.0/util/mutexlock.h
@@ -6,6 +6,7 @@
#define STORAGE_LEVELDB_UTIL_MUTEXLOCK_H_
#include "port/port.h"
+#include "port/thread_annotations.h"
namespace leveldb {
@@ -19,12 +20,13 @@ namespace leveldb {
// ... some complex code, possibly with multiple return paths ...
// }
-class MutexLock {
+class SCOPED_LOCKABLE MutexLock {
public:
- explicit MutexLock(port::Mutex *mu) : mu_(mu) {
+ explicit MutexLock(port::Mutex *mu) EXCLUSIVE_LOCK_FUNCTION(mu)
+ : mu_(mu) {
this->mu_->Lock();
}
- ~MutexLock() { this->mu_->Unlock(); }
+ ~MutexLock() UNLOCK_FUNCTION() { this->mu_->Unlock(); }
private:
port::Mutex *const mu_;
diff --git a/deps/leveldb/leveldb-1.5.0/util/options.cc b/deps/leveldb/leveldb-1.7.0/util/options.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/options.cc
rename to deps/leveldb/leveldb-1.7.0/util/options.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/posix_logger.h b/deps/leveldb/leveldb-1.7.0/util/posix_logger.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/posix_logger.h
rename to deps/leveldb/leveldb-1.7.0/util/posix_logger.h
diff --git a/deps/leveldb/leveldb-1.5.0/util/random.h b/deps/leveldb/leveldb-1.7.0/util/random.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/random.h
rename to deps/leveldb/leveldb-1.7.0/util/random.h
diff --git a/deps/leveldb/leveldb-1.5.0/util/status.cc b/deps/leveldb/leveldb-1.7.0/util/status.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/status.cc
rename to deps/leveldb/leveldb-1.7.0/util/status.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/testharness.cc b/deps/leveldb/leveldb-1.7.0/util/testharness.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/testharness.cc
rename to deps/leveldb/leveldb-1.7.0/util/testharness.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/testharness.h b/deps/leveldb/leveldb-1.7.0/util/testharness.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/testharness.h
rename to deps/leveldb/leveldb-1.7.0/util/testharness.h
diff --git a/deps/leveldb/leveldb-1.5.0/util/testutil.cc b/deps/leveldb/leveldb-1.7.0/util/testutil.cc
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/testutil.cc
rename to deps/leveldb/leveldb-1.7.0/util/testutil.cc
diff --git a/deps/leveldb/leveldb-1.5.0/util/testutil.h b/deps/leveldb/leveldb-1.7.0/util/testutil.h
similarity index 100%
rename from deps/leveldb/leveldb-1.5.0/util/testutil.h
rename to deps/leveldb/leveldb-1.7.0/util/testutil.h
diff --git a/deps/leveldb/leveldb.gyp b/deps/leveldb/leveldb.gyp
index 6ff42d9..f525149 100644
--- a/deps/leveldb/leveldb.gyp
+++ b/deps/leveldb/leveldb.gyp
@@ -1,145 +1,158 @@
-{
- 'targets': [{
- 'target_name': 'leveldb',
- 'type': 'static_library',
- 'dependencies': [
- "../snappy/snappy.gyp:snappy",
- ],
- 'direct_dependent_settings': {
- 'include_dirs': [
- 'leveldb-1.5.0/include/',
- 'leveldb-1.5.0/',
- ],
- },
- 'defines': [
- 'SNAPPY=1',
- ],
- 'include_dirs': [
- 'leveldb-1.5.0/',
- 'leveldb-1.5.0/include/',
- ],
- 'conditions': [
- ['OS == "win"', {
+{'targets': [{
+ 'target_name': 'leveldb'
+ , 'variables': {
+ 'ldbversion': '1.7.0'
+ }
+ , 'type': 'static_library'
+ , 'dependencies': [
+ '../snappy/snappy.gyp:snappy'
+ ]
+ , 'direct_dependent_settings': {
'include_dirs': [
- 'leveldb-1.5.0/port/win',
- ],
- }],
- ['OS == "linux"', {
- 'defines': [
- 'OS_LINUX=1',
- 'LEVELDB_PLATFORM_POSIX=1',
- ],
- 'CCFLAGS': [
- '-fno-builtin-memcmp',
- '-pthread',
- '-fPIC',
- ],
- }],
- ['OS == "solaris"', {
- 'defines': [
- 'OS_SOLARIS=1',
- 'LEVELDB_PLATFORM_POSIX=1',
- ],
- 'CCFLAGS': [
- '-fno-builtin-memcmp',
- '-pthread',
- '-fPIC',
- ],
- }],
- ['OS == "mac"', {
- 'defines': [
- 'OS_MACOSX=1',
- 'LEVELDB_PLATFORM_POSIX=1',
- ],
- 'CCFLAGS': [
- '-fno-builtin-memcmp',
- '-fPIC',
- ],
- }],
- ],
- 'sources': [
- 'leveldb-1.5.0/db/builder.cc',
- 'leveldb-1.5.0/db/builder.h',
- 'leveldb-1.5.0/db/db_impl.cc',
- 'leveldb-1.5.0/db/db_impl.h',
- 'leveldb-1.5.0/db/db_iter.cc',
- 'leveldb-1.5.0/db/db_iter.h',
- 'leveldb-1.5.0/db/filename.cc',
- 'leveldb-1.5.0/db/filename.h',
- 'leveldb-1.5.0/db/dbformat.cc',
- 'leveldb-1.5.0/db/dbformat.h',
- 'leveldb-1.5.0/db/log_format.h',
- 'leveldb-1.5.0/db/log_reader.cc',
- 'leveldb-1.5.0/db/log_reader.h',
- 'leveldb-1.5.0/db/log_writer.cc',
- 'leveldb-1.5.0/db/log_writer.h',
- 'leveldb-1.5.0/db/memtable.cc',
- 'leveldb-1.5.0/db/memtable.h',
- 'leveldb-1.5.0/db/repair.cc',
- 'leveldb-1.5.0/db/skiplist.h',
- 'leveldb-1.5.0/db/snapshot.h',
- 'leveldb-1.5.0/db/table_cache.cc',
- 'leveldb-1.5.0/db/table_cache.h',
- 'leveldb-1.5.0/db/version_edit.cc',
- 'leveldb-1.5.0/db/version_edit.h',
- 'leveldb-1.5.0/db/version_set.cc',
- 'leveldb-1.5.0/db/version_set.h',
- 'leveldb-1.5.0/db/write_batch.cc',
- 'leveldb-1.5.0/db/write_batch_internal.h',
- 'leveldb-1.5.0/helpers/memenv/memenv.cc',
- 'leveldb-1.5.0/helpers/memenv/memenv.h',
- 'leveldb-1.5.0/include/leveldb/cache.h',
- 'leveldb-1.5.0/include/leveldb/comparator.h',
- 'leveldb-1.5.0/include/leveldb/db.h',
- 'leveldb-1.5.0/include/leveldb/env.h',
- 'leveldb-1.5.0/include/leveldb/filter_policy.h',
- 'leveldb-1.5.0/include/leveldb/iterator.h',
- 'leveldb-1.5.0/include/leveldb/options.h',
- 'leveldb-1.5.0/include/leveldb/slice.h',
- 'leveldb-1.5.0/include/leveldb/status.h',
- 'leveldb-1.5.0/include/leveldb/table.h',
- 'leveldb-1.5.0/include/leveldb/table_builder.h',
- 'leveldb-1.5.0/include/leveldb/write_batch.h',
- 'leveldb-1.5.0/port/port.h',
- 'leveldb-1.5.0/port/port_example.h',
- 'leveldb-1.5.0/port/port_posix.cc',
- 'leveldb-1.5.0/port/port_posix.h',
- 'leveldb-1.5.0/table/block.cc',
- 'leveldb-1.5.0/table/block.h',
- 'leveldb-1.5.0/table/block_builder.cc',
- 'leveldb-1.5.0/table/block_builder.h',
- 'leveldb-1.5.0/table/filter_block.cc',
- 'leveldb-1.5.0/table/filter_block.h',
- 'leveldb-1.5.0/table/format.cc',
- 'leveldb-1.5.0/table/format.h',
- 'leveldb-1.5.0/table/iterator.cc',
- 'leveldb-1.5.0/table/iterator_wrapper.h',
- 'leveldb-1.5.0/table/merger.cc',
- 'leveldb-1.5.0/table/merger.h',
- 'leveldb-1.5.0/table/table.cc',
- 'leveldb-1.5.0/table/table_builder.cc',
- 'leveldb-1.5.0/table/two_level_iterator.cc',
- 'leveldb-1.5.0/table/two_level_iterator.h',
- 'leveldb-1.5.0/util/arena.cc',
- 'leveldb-1.5.0/util/arena.h',
- 'leveldb-1.5.0/util/bloom.cc',
- 'leveldb-1.5.0/util/cache.cc',
- 'leveldb-1.5.0/util/coding.cc',
- 'leveldb-1.5.0/util/coding.h',
- 'leveldb-1.5.0/util/comparator.cc',
- 'leveldb-1.5.0/util/crc32c.cc',
- 'leveldb-1.5.0/util/crc32c.h',
- 'leveldb-1.5.0/util/env.cc',
- 'leveldb-1.5.0/util/env_posix.cc',
- 'leveldb-1.5.0/util/filter_policy.cc',
- 'leveldb-1.5.0/util/hash.cc',
- 'leveldb-1.5.0/util/hash.h',
- 'leveldb-1.5.0/util/logging.cc',
- 'leveldb-1.5.0/util/logging.h',
- 'leveldb-1.5.0/util/mutexlock.h',
- 'leveldb-1.5.0/util/options.cc',
- 'leveldb-1.5.0/util/random.h',
- 'leveldb-1.5.0/util/status.cc',
- ],
- }],
-}
\ No newline at end of file
+ 'leveldb-<(ldbversion)/include/'
+ , 'leveldb-<(ldbversion)/'
+ ]
+ }
+ , 'defines': [
+ 'SNAPPY=1'
+ ]
+ , 'include_dirs': [
+ 'leveldb-<(ldbversion)/'
+ , 'leveldb-<(ldbversion)/include/'
+ ]
+ , 'conditions': [
+ ['OS == "win"', {
+ 'include_dirs': [
+ 'leveldb-<(ldbversion)/port/win'
+ ]
+ }]
+ , ['OS == "linux"', {
+ 'defines': [
+ 'OS_LINUX=1'
+ , 'LEVELDB_PLATFORM_POSIX=1'
+ ]
+ , 'libraries': [
+ '-lpthread'
+ ]
+ , 'ccflags': [
+ '-fno-builtin-memcmp'
+ , '-pthread'
+ , '-fPIC'
+ ]
+ , 'cflags': [
+ '-Wno-sign-compare'
+ , '-Wno-unused-but-set-variable'
+ ]
+ }]
+ , ['OS == "solaris"', {
+ 'defines': [
+ 'OS_SOLARIS=1'
+ , 'LEVELDB_PLATFORM_POSIX=1'
+ ]
+ , 'libraries': [
+ '-lrt'
+ , '-lpthread'
+ ]
+ , 'ccflags': [
+ '-fno-builtin-memcmp'
+ , '-pthread'
+ , '-fPIC'
+ ]
+ }]
+ , ['OS == "mac"', {
+ 'defines': [
+ 'OS_MACOSX=1'
+ , 'LEVELDB_PLATFORM_POSIX=1'
+ ]
+ , 'libraries': []
+ , 'ccflags': [
+ '-fno-builtin-memcmp'
+ , '-fPIC'
+ ]
+ }]
+ ]
+ , 'sources': [
+ 'leveldb-<(ldbversion)/db/builder.cc'
+ , 'leveldb-<(ldbversion)/db/builder.h'
+ , 'leveldb-<(ldbversion)/db/db_impl.cc'
+ , 'leveldb-<(ldbversion)/db/db_impl.h'
+ , 'leveldb-<(ldbversion)/db/db_iter.cc'
+ , 'leveldb-<(ldbversion)/db/db_iter.h'
+ , 'leveldb-<(ldbversion)/db/filename.cc'
+ , 'leveldb-<(ldbversion)/db/filename.h'
+ , 'leveldb-<(ldbversion)/db/dbformat.cc'
+ , 'leveldb-<(ldbversion)/db/dbformat.h'
+ , 'leveldb-<(ldbversion)/db/log_format.h'
+ , 'leveldb-<(ldbversion)/db/log_reader.cc'
+ , 'leveldb-<(ldbversion)/db/log_reader.h'
+ , 'leveldb-<(ldbversion)/db/log_writer.cc'
+ , 'leveldb-<(ldbversion)/db/log_writer.h'
+ , 'leveldb-<(ldbversion)/db/memtable.cc'
+ , 'leveldb-<(ldbversion)/db/memtable.h'
+ , 'leveldb-<(ldbversion)/db/repair.cc'
+ , 'leveldb-<(ldbversion)/db/skiplist.h'
+ , 'leveldb-<(ldbversion)/db/snapshot.h'
+ , 'leveldb-<(ldbversion)/db/table_cache.cc'
+ , 'leveldb-<(ldbversion)/db/table_cache.h'
+ , 'leveldb-<(ldbversion)/db/version_edit.cc'
+ , 'leveldb-<(ldbversion)/db/version_edit.h'
+ , 'leveldb-<(ldbversion)/db/version_set.cc'
+ , 'leveldb-<(ldbversion)/db/version_set.h'
+ , 'leveldb-<(ldbversion)/db/write_batch.cc'
+ , 'leveldb-<(ldbversion)/db/write_batch_internal.h'
+ , 'leveldb-<(ldbversion)/helpers/memenv/memenv.cc'
+ , 'leveldb-<(ldbversion)/helpers/memenv/memenv.h'
+ , 'leveldb-<(ldbversion)/include/leveldb/cache.h'
+ , 'leveldb-<(ldbversion)/include/leveldb/comparator.h'
+ , 'leveldb-<(ldbversion)/include/leveldb/db.h'
+ , 'leveldb-<(ldbversion)/include/leveldb/env.h'
+ , 'leveldb-<(ldbversion)/include/leveldb/filter_policy.h'
+ , 'leveldb-<(ldbversion)/include/leveldb/iterator.h'
+ , 'leveldb-<(ldbversion)/include/leveldb/options.h'
+ , 'leveldb-<(ldbversion)/include/leveldb/slice.h'
+ , 'leveldb-<(ldbversion)/include/leveldb/status.h'
+ , 'leveldb-<(ldbversion)/include/leveldb/table.h'
+ , 'leveldb-<(ldbversion)/include/leveldb/table_builder.h'
+ , 'leveldb-<(ldbversion)/include/leveldb/write_batch.h'
+ , 'leveldb-<(ldbversion)/port/port.h'
+ , 'leveldb-<(ldbversion)/port/port_example.h'
+ , 'leveldb-<(ldbversion)/port/port_posix.cc'
+ , 'leveldb-<(ldbversion)/port/port_posix.h'
+ , 'leveldb-<(ldbversion)/table/block.cc'
+ , 'leveldb-<(ldbversion)/table/block.h'
+ , 'leveldb-<(ldbversion)/table/block_builder.cc'
+ , 'leveldb-<(ldbversion)/table/block_builder.h'
+ , 'leveldb-<(ldbversion)/table/filter_block.cc'
+ , 'leveldb-<(ldbversion)/table/filter_block.h'
+ , 'leveldb-<(ldbversion)/table/format.cc'
+ , 'leveldb-<(ldbversion)/table/format.h'
+ , 'leveldb-<(ldbversion)/table/iterator.cc'
+ , 'leveldb-<(ldbversion)/table/iterator_wrapper.h'
+ , 'leveldb-<(ldbversion)/table/merger.cc'
+ , 'leveldb-<(ldbversion)/table/merger.h'
+ , 'leveldb-<(ldbversion)/table/table.cc'
+ , 'leveldb-<(ldbversion)/table/table_builder.cc'
+ , 'leveldb-<(ldbversion)/table/two_level_iterator.cc'
+ , 'leveldb-<(ldbversion)/table/two_level_iterator.h'
+ , 'leveldb-<(ldbversion)/util/arena.cc'
+ , 'leveldb-<(ldbversion)/util/arena.h'
+ , 'leveldb-<(ldbversion)/util/bloom.cc'
+ , 'leveldb-<(ldbversion)/util/cache.cc'
+ , 'leveldb-<(ldbversion)/util/coding.cc'
+ , 'leveldb-<(ldbversion)/util/coding.h'
+ , 'leveldb-<(ldbversion)/util/comparator.cc'
+ , 'leveldb-<(ldbversion)/util/crc32c.cc'
+ , 'leveldb-<(ldbversion)/util/crc32c.h'
+ , 'leveldb-<(ldbversion)/util/env.cc'
+ , 'leveldb-<(ldbversion)/util/env_posix.cc'
+ , 'leveldb-<(ldbversion)/util/filter_policy.cc'
+ , 'leveldb-<(ldbversion)/util/hash.cc'
+ , 'leveldb-<(ldbversion)/util/hash.h'
+ , 'leveldb-<(ldbversion)/util/logging.cc'
+ , 'leveldb-<(ldbversion)/util/logging.h'
+ , 'leveldb-<(ldbversion)/util/mutexlock.h'
+ , 'leveldb-<(ldbversion)/util/options.cc'
+ , 'leveldb-<(ldbversion)/util/random.h'
+ , 'leveldb-<(ldbversion)/util/status.cc'
+ ]
+}]}
\ No newline at end of file
diff --git a/deps/snappy/snappy.gyp b/deps/snappy/snappy.gyp
index 1bb5332..37ce1d8 100644
--- a/deps/snappy/snappy.gyp
+++ b/deps/snappy/snappy.gyp
@@ -1,55 +1,39 @@
-# Originally taken from the Chromium source snappy.gyp, adapted & simplified for node-levelup
-
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-{
-'variables': {
- 'conditions': [
- # Define an "os_include" variable that points at the OS-specific generated
- # headers. These were generated by running the configure script offline.
- ['OS=="linux"', {'os_include': 'linux'}],
- ['OS=="mac"', {'os_include': 'mac'}],
- ['OS=="solaris"', {'os_include': 'solaris'}],
- ['OS=="win"', {'os_include': 'win32'}],
- ],
- },
- 'targets': [
- {
- 'target_name': 'snappy',
- 'type': 'static_library',
- 'include_dirs': [
- '<(os_include)',
- 'snappy-1.0.5',
- ],
- 'direct_dependent_settings': {
+{'targets': [{
+ 'variables': {
+ 'conditions': [
+ ['OS=="linux"', {'os_include': 'linux'}]
+ , ['OS=="mac"', {'os_include': 'mac'}]
+ , ['OS=="solaris"', {'os_include': 'solaris'}]
+ , ['OS=="win"', {'os_include': 'win32'}]
+ ]
+ }
+ , 'target_name': 'snappy'
+ , 'type': 'static_library'
+ , 'include_dirs': [
+ '<(os_include)'
+ , 'snappy-1.0.5'
+ ]
+ , 'direct_dependent_settings': {
'include_dirs': [
- '<(os_include)',
- 'snappy-1.0.5',
- ],
- },
- 'sources': [
- 'snappy-1.0.5/snappy-internal.h',
- 'snappy-1.0.5/snappy-sinksource.cc',
- 'snappy-1.0.5/snappy-sinksource.h',
- 'snappy-1.0.5/snappy-stubs-internal.cc',
- 'snappy-1.0.5/snappy-stubs-internal.h',
- 'snappy-1.0.5/snappy.cc',
- 'snappy-1.0.5/snappy.h',
- ],
- },
- {
- 'target_name': 'snappy_unittest',
- 'type': 'executable',
- 'sources': [
- 'snappy-1.0.5/snappy-test.cc',
- 'snappy-1.0.5/snappy-test.h',
- 'snappy-1.0.5/snappy_unittest.cc',
- ],
- 'dependencies': [
- 'snappy'
- ],
- },
- ],
-}
+ '<(os_include)'
+ , 'snappy-1.0.5'
+ ]
+ }
+ , 'conditions': [
+ ['OS == "linux"', {
+ 'cflags': [
+ '-Wno-sign-compare'
+ , '-Wno-unused-function'
+ ]
+ }]
+ ]
+ , 'sources': [
+ 'snappy-1.0.5/snappy-internal.h'
+ , 'snappy-1.0.5/snappy-sinksource.cc'
+ , 'snappy-1.0.5/snappy-sinksource.h'
+ , 'snappy-1.0.5/snappy-stubs-internal.cc'
+ , 'snappy-1.0.5/snappy-stubs-internal.h'
+ , 'snappy-1.0.5/snappy.cc'
+ , 'snappy-1.0.5/snappy.h'
+ ]
+}]}
\ No newline at end of file
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-leveldown.git
More information about the Pkg-javascript-commits
mailing list