aboutsummaryrefslogtreecommitdiff
path: root/src/leveldb/db/builder.cc
diff options
context:
space:
mode:
authorSfan5 <sfan5@live.de>2013-09-09 22:46:18 +0200
committerSfan5 <sfan5@live.de>2013-09-09 22:50:51 +0200
commit3725179736e2b5372664163470e7ef3dc76529a4 (patch)
tree7a56c929ae75530679b3d2f7c9c02fb361760219 /src/leveldb/db/builder.cc
parent1f3402e7a1e160c4be25c596f33d916b988075fb (diff)
downloadminetest-3725179736e2b5372664163470e7ef3dc76529a4.tar.gz
minetest-3725179736e2b5372664163470e7ef3dc76529a4.tar.bz2
minetest-3725179736e2b5372664163470e7ef3dc76529a4.zip
Use system-wide LevelDB instead of bundled one
Diffstat (limited to 'src/leveldb/db/builder.cc')
-rw-r--r--src/leveldb/db/builder.cc88
1 files changed, 0 insertions, 88 deletions
diff --git a/src/leveldb/db/builder.cc b/src/leveldb/db/builder.cc
deleted file mode 100644
index f41988219..000000000
--- a/src/leveldb/db/builder.cc
+++ /dev/null
@@ -1,88 +0,0 @@
-// 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.
-
-#include "db/builder.h"
-
-#include "db/filename.h"
-#include "db/dbformat.h"
-#include "db/table_cache.h"
-#include "db/version_edit.h"
-#include "leveldb/db.h"
-#include "leveldb/env.h"
-#include "leveldb/iterator.h"
-
-namespace leveldb {
-
-Status BuildTable(const std::string& dbname,
- Env* env,
- const Options& options,
- TableCache* table_cache,
- Iterator* iter,
- FileMetaData* meta) {
- Status s;
- meta->file_size = 0;
- iter->SeekToFirst();
-
- std::string fname = TableFileName(dbname, meta->number);
- if (iter->Valid()) {
- WritableFile* file;
- s = env->NewWritableFile(fname, &file);
- if (!s.ok()) {
- return s;
- }
-
- TableBuilder* builder = new TableBuilder(options, file);
- meta->smallest.DecodeFrom(iter->key());
- for (; iter->Valid(); iter->Next()) {
- Slice key = iter->key();
- meta->largest.DecodeFrom(key);
- builder->Add(key, iter->value());
- }
-
- // Finish and check for builder errors
- if (s.ok()) {
- s = builder->Finish();
- if (s.ok()) {
- meta->file_size = builder->FileSize();
- assert(meta->file_size > 0);
- }
- } else {
- builder->Abandon();
- }
- delete builder;
-
- // Finish and check for file errors
- if (s.ok()) {
- s = file->Sync();
- }
- if (s.ok()) {
- s = file->Close();
- }
- delete file;
- file = NULL;
-
- if (s.ok()) {
- // Verify that the table is usable
- Iterator* it = table_cache->NewIterator(ReadOptions(),
- meta->number,
- meta->file_size);
- s = it->status();
- delete it;
- }
- }
-
- // Check for input iterator errors
- if (!iter->status().ok()) {
- s = iter->status();
- }
-
- if (s.ok() && meta->file_size > 0) {
- // Keep it
- } else {
- env->DeleteFile(fname);
- }
- return s;
-}
-
-} // namespace leveldb