forked from facebook/rocksdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: https://leveldb.googlecode.com/svn/trunk@2 62dab493-f737-651d-591e-8d6aee1b9529
- Loading branch information
1 parent
54f1fd7
commit f67e15e
Showing
118 changed files
with
19,207 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,8 @@ | ||
# Names should be added to this file like so: | ||
# Name or Organization <email address> | ||
|
||
Google Inc. | ||
|
||
# Initial version authors: | ||
Jeffrey Dean <[email protected]> | ||
Sanjay Ghemawat <[email protected]> |
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,64 @@ | ||
# 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. | ||
|
||
# INSTRUCTIONS | ||
# After you've downloaded and installed the Android NDK from: | ||
# http://developer.android.com/sdk/ndk/index.html | ||
# 1. In the same directory as this file, Android.mk, type: | ||
# $ ln -s leveldb ../jni | ||
# (The Android NDK will only build native projects in | ||
# subdirectories named "jni".) | ||
# 2. $ cd .. | ||
# 3. Execute ndk-build: | ||
# $ $(ANDROID_NDK_DIR)/ndk-build | ||
|
||
LOCAL_PATH := $(call my-dir) | ||
|
||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := leveldb | ||
# Build flags: | ||
# - LEVELDB_PLATFORM_ANDROID to use the correct port header: port_android.h | ||
LOCAL_CFLAGS := -DLEVELDB_PLATFORM_ANDROID -std=gnu++0x | ||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../ | ||
LOCAL_CPP_EXTENSION := .cc | ||
|
||
LOCAL_SRC_FILES := ./db/builder.cc \ | ||
./db/db_bench.cc \ | ||
./db/db_impl.cc \ | ||
./db/db_iter.cc \ | ||
./db/filename.cc \ | ||
./db/dbformat.cc \ | ||
./db/log_reader.cc \ | ||
./db/log_writer.cc \ | ||
./db/memtable.cc \ | ||
./db/repair.cc \ | ||
./db/table_cache.cc \ | ||
./db/version_edit.cc \ | ||
./db/version_set.cc \ | ||
./db/write_batch.cc \ | ||
./port/port_android.cc \ | ||
./table/block.cc \ | ||
./table/block_builder.cc \ | ||
./table/format.cc \ | ||
./table/iterator.cc \ | ||
./table/merger.cc \ | ||
./table/table.cc \ | ||
./table/table_builder.cc \ | ||
./table/two_level_iterator.cc \ | ||
./util/arena.cc \ | ||
./util/cache.cc \ | ||
./util/coding.cc \ | ||
./util/comparator.cc \ | ||
./util/crc32c.cc \ | ||
./util/env.cc \ | ||
./util/env_posix.cc \ | ||
./util/hash.cc \ | ||
./util/histogram.cc \ | ||
./util/logging.cc \ | ||
./util/options.cc \ | ||
./util/status.cc \ | ||
./util/testharness.cc \ | ||
./util/testutil.cc | ||
|
||
include $(BUILD_SHARED_LIBRARY) |
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,6 @@ | ||
# 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. | ||
|
||
APP_ABI := armeabi-v7a | ||
APP_STL := gnustl_static |
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,134 @@ | ||
# 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. | ||
|
||
CC = g++ | ||
|
||
# Uncomment one of the following to switch between debug and opt mode | ||
#OPT = -O2 -DNDEBUG | ||
OPT = -g2 | ||
|
||
CFLAGS = -c -DLEVELDB_PLATFORM_POSIX -I. -std=c++0x $(OPT) | ||
|
||
LDFLAGS=-lpthread | ||
|
||
LIBOBJECTS = \ | ||
./db/builder.o \ | ||
./db/db_impl.o \ | ||
./db/db_iter.o \ | ||
./db/filename.o \ | ||
./db/format.o \ | ||
./db/log_reader.o \ | ||
./db/log_writer.o \ | ||
./db/memtable.o \ | ||
./db/repair.o \ | ||
./db/table_cache.o \ | ||
./db/version_edit.o \ | ||
./db/version_set.o \ | ||
./db/write_batch.o \ | ||
./port/port_posix.o \ | ||
./port/sha1_portable.o \ | ||
./table/block.o \ | ||
./table/block_builder.o \ | ||
./table/format.o \ | ||
./table/iterator.o \ | ||
./table/merger.o \ | ||
./table/table.o \ | ||
./table/table_builder.o \ | ||
./table/two_level_iterator.o \ | ||
./util/arena.o \ | ||
./util/cache.o \ | ||
./util/coding.o \ | ||
./util/comparator.o \ | ||
./util/crc32c.o \ | ||
./util/env.o \ | ||
./util/env_posix.o \ | ||
./util/hash.o \ | ||
./util/histogram.o \ | ||
./util/logging.o \ | ||
./util/options.o \ | ||
./util/status.o | ||
|
||
TESTUTIL = ./util/testutil.o | ||
TESTHARNESS = ./util/testharness.o $(TESTUTIL) | ||
|
||
TESTS = \ | ||
arena_test \ | ||
cache_test \ | ||
coding_test \ | ||
corruption_test \ | ||
crc32c_test \ | ||
db_test \ | ||
dbformat_test \ | ||
env_test \ | ||
filename_test \ | ||
log_test \ | ||
sha1_test \ | ||
skiplist_test \ | ||
table_test \ | ||
version_edit_test \ | ||
write_batch_test | ||
|
||
PROGRAMS = db_bench $(TESTS) | ||
|
||
all: $(PROGRAMS) | ||
|
||
check: $(TESTS) | ||
for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done | ||
|
||
clean: | ||
rm -f $(PROGRAMS) */*.o | ||
|
||
db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) | ||
$(CC) $(LDFLAGS) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) -o $@ | ||
|
||
arena_test: util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CC) $(LDFLAGS) util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ | ||
|
||
cache_test: util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CC) $(LDFLAGS) util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ | ||
|
||
coding_test: util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CC) $(LDFLAGS) util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ | ||
|
||
corruption_test: db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CC) $(LDFLAGS) db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ | ||
|
||
crc32c_test: util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CC) $(LDFLAGS) util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ | ||
|
||
db_test: db/db_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CC) $(LDFLAGS) db/db_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ | ||
|
||
dbformat_test: db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CC) $(LDFLAGS) db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ | ||
|
||
env_test: util/env_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CC) $(LDFLAGS) util/env_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ | ||
|
||
filename_test: db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CC) $(LDFLAGS) db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ | ||
|
||
log_test: db/log_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CC) $(LDFLAGS) db/log_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ | ||
|
||
table_test: table/table_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CC) $(LDFLAGS) table/table_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ | ||
|
||
sha1_test: port/sha1_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CC) $(LDFLAGS) port/sha1_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ | ||
|
||
skiplist_test: db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CC) $(LDFLAGS) db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ | ||
|
||
version_edit_test: db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CC) $(LDFLAGS) db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ | ||
|
||
write_batch_test: db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS) | ||
$(CC) $(LDFLAGS) db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ | ||
|
||
.cc.o: | ||
$(CC) $(CFLAGS) $< -o $@ | ||
|
||
# TODO(gabor): dependencies for .o files | ||
# TODO(gabor): Build library |
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 ([email protected]) and Jeff Dean ([email protected]) | ||
|
||
The code under this directory implements a system for maintaining a | ||
persistent key/value store. | ||
|
||
See doc/index.html for more explanation. | ||
See doc/db_layout.txt 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 |
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,23 @@ | ||
Before adding to chrome | ||
----------------------- | ||
- multi-threaded test/benchmark | ||
- Allow missing crc32c in Table format? | ||
|
||
Maybe afterwards | ||
---------------- | ||
|
||
ss | ||
- Stats | ||
- Speed up backwards scan (avoid three passes over data) | ||
|
||
db | ||
- Maybe implement DB::BulkDeleteForRange(start_key, end_key) | ||
that would blow away files whose ranges are entirely contained | ||
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. | ||
|
||
api changes? | ||
- Efficient large value reading and writing | ||
|
||
Faster Get implementation |
Oops, something went wrong.