8000 Initial checkin. · facebook/rocksdb@f67e15e · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit f67e15e

Browse files
author
jorlow@chromium.org
committed
Initial checkin.
git-svn-id: https://leveldb.googlecode.com/svn/trunk@2 62dab493-f737-651d-591e-8d6aee1b9529
1 parent 54f1fd7 commit f67e15e

Some content is hidden

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

118 files changed

+19207
-0
lines changed

AUTHORS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Names should be added to this file like so:
2+
# Name or Organization <email address>
3+
4+
Google Inc.
5+
6+
# Initial version authors:
7+
Jeffrey Dean <jeff@google.com>
8+
Sanjay Ghemawat <sanjay@google.com>

Android.mk

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Copyright (c) 2011 The LevelDB Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file. See the AUTHORS file for names of contributors.
4+
5+
# INSTRUCTIONS
6+
# After you've downloaded and installed the Android NDK from:
7+
# http://developer.android.com/sdk/ndk/index.html
8+
# 1. In the same directory as this file, Android.mk, type:
9+
# $ ln -s leveldb ../jni
10+
# (The Android NDK will only build native projects in
11+
# subdirectories named "jni".)
12+
# 2. $ cd ..
13+
# 3. Execute ndk-build:
14+
# $ $(ANDROID_NDK_DIR)/ndk-build
15+
16+
LOCAL_PATH := $(call my-dir)
17+
18+
include $(CLEAR_VARS)
19+
LOCAL_MODULE := leveldb
20+
# Build flags:
21+
# - LEVELDB_PLATFORM_ANDROID to use the correct port header: port_android.h
22+
LOCAL_CFLAGS := -DLEVELDB_PLATFORM_ANDROID -std=gnu++0x
23+
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../
24+
LOCAL_CPP_EXTENSION := .cc
25+
26+
LOCAL_SRC_FILES := ./db/builder.cc \
27+
./db/db_bench.cc \
28+
./db/db_impl.cc \
29+
./db/db_iter.cc \
30+
./db/filename.cc \
31+
./db/dbformat.cc \
32+
./db/log_reader.cc \ 7438
33+
./db/log_writer.cc \
34+
./db/memtable.cc \
35+
./db/repair.cc \
36+
./db/table_cache.cc \
37+
./db/version_edit.cc \
38+
./db/version_set.cc \
39+
./db/write_batch.cc \
40+
./port/port_android.cc \
41+
./table/block.cc \
42+
./table/block_builder.cc \
43+
./table/format.cc \
44+
./table/iterator.cc \
45+
./table/merger.cc \
46+
./table/table.cc \
47+
./table/table_builder.cc \
48+
./table/two_level_iterator.cc \
49+
./util/arena.cc \
50+
./util/cache.cc \
51+
./util/coding.cc \
52+
./util/comparator.cc \
53+
./util/crc32c.cc \
54+
./util/env.cc \
55+
./util/env_posix.cc \
56+
./util/hash.cc \
57+
./util/histogram.cc \
58+
./util/logging.cc \
59+
./util/options.cc \
60+
./util/status.cc \
61+
./util/testharness.cc \
62+
./util/testutil.cc
63+
64+
include $(BUILD_SHARED_LIBRARY)

Application.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2011 The LevelDB Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file. See the AUTHORS file for names of contributors.
4+
5+
APP_ABI := armeabi-v7a
6+
APP_STL := gnustl_static

LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2011 The LevelDB Authors. All rights reserved.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above
10+
copyright notice, this list of conditions and the following disclaimer
11+
in the documentation and/or other materials provided with the
12+
distribution.
13+
* Neither the name of Google Inc. nor the names of its
14+
contributors may be used to endorse or promote products derived from
15+
this software without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Makefile

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Copyright (c) 2011 The LevelDB Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file. See the AUTHORS file for names of contributors.
4+
5+
CC = g++
6+
7+
# Uncomment one of the following to switch between debug and opt mode
8+
#OPT = -O2 -DNDEBUG
9+
OPT = -g2
10+
11+
CFLAGS = -c -DLEVELDB_PLATFORM_POSIX -I. -std=c++0x $(OPT)
12+
13+
LDFLAGS=-lpthread
14+
15+
LIBOBJECTS = \
16+
./db/builder.o \
17+
./db/db_impl.o \
18+
./db/db_iter.o \
19+
./db/filename.o \
20+
./db/format.o \
21+
./db/log_reader.o \
22+
./db/log_writer.o \
23+
./db/memtable.o \
24+
./db/repair.o \
25+
./db/table_cache.o \
26+
./db/version_edit.o \
27+
./db/version_set.o \
28+
./db/write_batch.o \
29+
./port/port_posix.o \
30+
./port/sha1_portable.o \
31+
./table/block.o \
32+
./table/block_builder.o \
33+
./table/format.o \
34+
./table/iterator.o \
35+
./table/merger.o \
36+
./table/table.o \
37+
./table/table_builder.o \
38+
./table/two_level_iterator.o \
39+
./util/arena.o \
40+
./util/cache.o \
41+
./util/coding.o \
42+
./util/comparator.o \
43+
./util/crc32c.o \
44+
./util/env.o \
45+
./util/env_posix.o \
46+
./util/hash.o \
47+
./util/histogram.o \
48+
./util/logging.o \
49+
./util/options.o \
50+
./util/status.o
51+
52+
TESTUTIL = ./util/testutil.o
53+
TESTHARNESS = ./util/testharness.o $(TESTUTIL)
54+
55+
TESTS = \
56+
arena_test \
57+
cache_test \
58+
coding_test \
59+
corruption_test \
60+
crc32c_test \
61+
db_test \
62+
dbformat_test \
63+
env_test \
64+
filename_test \
65+
log_test \
66+
sha1_test \
67+
skiplist_test \
68+
table_test \
69+
version_edit_test \
70+
write_batch_test
71+
72+
PROGRAMS = db_bench $(TESTS)
73+
74+
all: $(PROGRAMS)
75+
76+
check: $(TESTS)
77+
for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done
78+
79+
clean:
80+
rm -f $(PROGRAMS) */*.o
81+
82+
db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL)
83+
$(CC) $(LDFLAGS) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) -o $@
84+
85+
arena_test: util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS)
86+
$(CC) $(LDFLAGS) util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
87+
88+
cache_test: util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS)
89+
$(CC) $(LDFLAGS) util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
90+
91+
coding_test: util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS)
92+
$(CC) $(LDFLAGS) util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
93+
94+
corruption_test: db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS)
95+
$(CC) $(LDFLAGS) db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
96+
97+
crc32c_test: util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS)
98+
$(CC) $(LDFLAGS) util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
99+
100+
db_test: db/db_test.o $(LIBOBJECTS) $(TESTHARNESS)
101+
$(CC) $(LDFLAGS) db/db_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
102+
103+
dbformat_test: db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS)
104+
$(CC) $(LDFLAGS) db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
105+
106+
env_test: util/env_test.o $(LIBOBJECTS) $(TESTHARNESS)
107+
$(CC) $(LDFLAGS) util/env_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
108+
109+
filename_test: db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS)
110+
$(CC) $(LDFLAGS) db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
111+
112+
log_test: db/log_test.o $(LIBOBJECTS) $(TESTHARNESS)
113+
$(CC) $(LDFLAGS) db/log_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
114+
115+
table_test: table/table_test.o $(LIBOBJECTS) $(TESTHARNESS)
116+
$(CC) $(LDFLAGS) table/table_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
117+
118+
sha1_test: port/sha1_test.o $(LIBOBJECTS) $(TESTHARNESS)
119+
$(CC) $(LDFLAGS) port/sha1_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
120+
121+
skiplist_test: db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS)
122+
$(CC) $(LDFLAGS) db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
< 17AE code>123+
124+
version_edit_test: db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS)
125+
$(CC) $(LDFLAGS) db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
126+
127+
write_batch_test: db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS)
128+
$(CC) $(LDFLAGS) db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
129+
130+
.cc.o:
131+
$(CC) $(CFLAGS) $< -o $@
132+
133+
# TODO(gabor): dependencies for .o files
134+
# TODO(gabor): Build library

README

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
leveldb: A key-value store
2+
Authors: Sanjay Ghemawat (sanjay@google.com) and Jeff Dean (jeff@google.com)
3+
4+
The code under this directory implements a system for maintaining a
5+
persistent key/value store.
6+
7+
See doc/index.html for more explanation.
8+
See doc/db_layout.txt for a brief overview of the implementation.
9+
10+
The public interface is in include/*.h. Callers should not include or
11+
rely on the details of any other header files in this package. Those
12+
internal APIs may be changed without warning.
13+
14+
Guide to header files:
15+
16+
include/db.h
17+
Main interface to the DB: Start here
18+
19+
include/options.h
20+
Control over the behavior of an entire database, and also
21+
control over the behavior of individual reads and writes.
22+
23+
include/comparator.h
24+
Abstraction for user-specified comparison function. If you want
25+
just bytewise comparison of keys, you can use the default comparator,
26+
but clients can write their own comparator implementations if they
27+
want custom ordering (e.g. to handle different character
28+
encodings, etc.)
29+
30+
include/iterator.h
31+
Interface for iterating over data. You can get an iterator
32+
from a DB object.
33+
34+
include/write_batch.h
35+
Interface for atomically applying multiple updates to a database.
36+
37+
include/slice.h
38+
A simple module for maintaining a pointer and a length into some
39+
other byte array.
40+
41+
include/status.h
42+
Status is returned from many of the public interfaces and is used
43+
to report success and various kinds of errors.
44+
45+
include/env.h
46+
Abstraction of the OS environment. A posix implementation of
47+
this interface is in util/env_posix.cc
48+
49+
include/table.h
50+
include/table_builder.h
51+
Lower-level modules that most clients probably won't use directly

TODO

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Before adding to chrome
2+
-----------------------
3+
- multi-threaded test/benchmark
4+
- Allow missing crc32c in Table format?
5+
6+
Maybe afterwards
7+
----------------
8+
9+
ss
10+
- Stats
11+
- Speed up backwards scan (avoid three passes over data)
12+
13+
db
14+
- Maybe implement DB::BulkDeleteForRange(start_key, end_key)
15+
that would blow away files whose ranges are entirely contained
16+
within [start_key..end_key]? For Chrome, deletion of obsolete
17+
object stores, etc. can be done in the background anyway, so
18+
probably not that important.
19+
20+
api changes?
21+
- Efficient large value reading and writing
22+
23+
Faster Get implementation

0 commit comments

Comments
 (0)
0