mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
RocksDBLite
Summary: Introducing RocksDBLite! Removes all the non-essential features and reduces the binary size. This effort should help our adoption on mobile. Binary size when compiling for IOS (`TARGET_OS=IOS m static_lib`) is down to 9MB from 15MB (without stripping) Test Plan: compiles :) Reviewers: dhruba, haobo, ljin, sdong, yhchiang Reviewed By: yhchiang CC: leveldb Differential Revision: https://reviews.facebook.net/D17835
This commit is contained in:
@@ -12,6 +12,10 @@
|
||||
|
||||
namespace rocksdb {
|
||||
|
||||
#ifdef ROCKSDB_LITE
|
||||
template <class T, size_t kSize = 8>
|
||||
class autovector : public std::vector<T> {};
|
||||
#else
|
||||
// A vector that leverages pre-allocated stack-based array to achieve better
|
||||
// performance for array with small amount of items.
|
||||
//
|
||||
@@ -299,5 +303,5 @@ autovector<T, kSize>& autovector<T, kSize>::assign(const autovector& other) {
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
} // rocksdb
|
||||
#endif // ROCKSDB_LITE
|
||||
} // namespace rocksdb
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// 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 ROCKSDB_LITE
|
||||
#include "util/blob_store.h"
|
||||
|
||||
namespace rocksdb {
|
||||
@@ -266,3 +267,4 @@ Status BlobStore::CreateNewBucket() {
|
||||
}
|
||||
|
||||
} // namespace rocksdb
|
||||
#endif // ROCKSDB_LITE
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// 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 ROCKSDB_LITE
|
||||
#pragma once
|
||||
#include "rocksdb/env.h"
|
||||
#include "rocksdb/status.h"
|
||||
@@ -159,3 +160,4 @@ class BlobStore {
|
||||
};
|
||||
|
||||
} // namespace rocksdb
|
||||
#endif // ROCKSDB_LITE
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// of patent rights can be found in the PATENTS file in the same directory.
|
||||
//
|
||||
|
||||
#ifndef ROCKSDB_LITE
|
||||
#include "util/hash_linklist_rep.h"
|
||||
|
||||
#include "rocksdb/memtablerep.h"
|
||||
@@ -484,3 +485,4 @@ MemTableRepFactory* NewHashLinkListRepFactory(size_t bucket_count) {
|
||||
}
|
||||
|
||||
} // namespace rocksdb
|
||||
#endif // ROCKSDB_LITE
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
// 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 ROCKSDB_LITE
|
||||
#pragma once
|
||||
#include "rocksdb/slice_transform.h"
|
||||
#include "rocksdb/memtablerep.h"
|
||||
@@ -32,3 +33,4 @@ class HashLinkListRepFactory : public MemTableRepFactory {
|
||||
};
|
||||
|
||||
}
|
||||
#endif // ROCKSDB_LITE
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// of patent rights can be found in the PATENTS file in the same directory.
|
||||
//
|
||||
|
||||
#ifndef ROCKSDB_LITE
|
||||
#include "util/hash_skiplist_rep.h"
|
||||
|
||||
#include "rocksdb/memtablerep.h"
|
||||
@@ -339,3 +340,4 @@ MemTableRepFactory* NewHashSkipListRepFactory(
|
||||
}
|
||||
|
||||
} // namespace rocksdb
|
||||
#endif // ROCKSDB_LITE
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
// 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 ROCKSDB_LITE
|
||||
#pragma once
|
||||
#include "rocksdb/slice_transform.h"
|
||||
#include "rocksdb/memtablerep.h"
|
||||
@@ -39,3 +40,4 @@ class HashSkipListRepFactory : public MemTableRepFactory {
|
||||
};
|
||||
|
||||
}
|
||||
#endif // ROCKSDB_LITE
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// LICENSE file in the root directory of this source tree. An additional grant
|
||||
// of patent rights can be found in the PATENTS file in the same directory.
|
||||
//
|
||||
#ifndef ROCKSDB_LITE
|
||||
#include "util/ldb_cmd.h"
|
||||
|
||||
#include "db/dbformat.h"
|
||||
@@ -1834,3 +1835,4 @@ void CheckConsistencyCommand::DoCommand() {
|
||||
}
|
||||
|
||||
} // namespace rocksdb
|
||||
#endif // ROCKSDB_LITE
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// LICENSE file in the root directory of this source tree. An additional grant
|
||||
// of patent rights can be found in the PATENTS file in the same directory.
|
||||
//
|
||||
#ifndef ROCKSDB_LITE
|
||||
#include "rocksdb/ldb_tool.h"
|
||||
#include "util/ldb_cmd.h"
|
||||
|
||||
@@ -103,3 +104,4 @@ void LDBTool::Run(int argc, char** argv, Options options) {
|
||||
}
|
||||
} // namespace rocksdb
|
||||
|
||||
#endif // ROCKSDB_LITE
|
||||
|
||||
@@ -50,15 +50,6 @@ std::string EscapeString(const Slice& value) {
|
||||
return r;
|
||||
}
|
||||
|
||||
bool ConsumeChar(Slice* in, char c) {
|
||||
if (!in->empty() && (*in)[0] == c) {
|
||||
in->remove_prefix(1);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool ConsumeDecimalNumber(Slice* in, uint64_t* val) {
|
||||
uint64_t v = 0;
|
||||
int digits = 0;
|
||||
|
||||
@@ -35,10 +35,6 @@ extern std::string NumberToString(uint64_t num);
|
||||
// Escapes any non-printable characters found in "value".
|
||||
extern std::string EscapeString(const Slice& value);
|
||||
|
||||
// If *in starts with "c", advances *in past the first character and
|
||||
// returns true. Otherwise, returns false.
|
||||
extern bool ConsumeChar(Slice* in, char c);
|
||||
|
||||
// Parse a human-readable number from "*in" into *value. On success,
|
||||
// advances "*in" past the consumed number and sets "*val" to the
|
||||
// numeric value. Otherwise, returns false and leaves *in in an
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// LICENSE file in the root directory of this source tree. An additional grant
|
||||
// of patent rights can be found in the PATENTS file in the same directory.
|
||||
//
|
||||
#ifndef ROCKSDB_LITE
|
||||
#include "rocksdb/memtablerep.h"
|
||||
|
||||
#include <unordered_set>
|
||||
@@ -278,3 +279,4 @@ MemTableRep* VectorRepFactory::CreateMemTableRep(
|
||||
return new VectorRep(compare, arena, count_);
|
||||
}
|
||||
} // namespace rocksdb
|
||||
#endif // ROCKSDB_LITE
|
||||
|
||||
Reference in New Issue
Block a user