#include "db/db_impl.h"
#include <algorithm>
#include <atomic>
#include <cstdint>
#include <cstdio>
#include <set>
#include <string>
#include <vector>
#include "db/builder.h"
#include "db/db_iter.h"
#include "db/dbformat.h"
#include "db/filename.h"
#include "db/log_reader.h"
#include "db/log_writer.h"
#include "db/memtable.h"
#include "db/table_cache.h"
#include "db/version_set.h"
#include "db/write_batch_internal.h"
#include "leveldb/db.h"
#include "leveldb/env.h"
#include "leveldb/status.h"
#include "leveldb/table.h"
#include "leveldb/table_builder.h"
#include "port/port.h"
#include "table/block.h"
#include "table/merger.h"
#include "table/two_level_iterator.h"
#include "util/coding.h"
#include "util/logging.h"
#include "util/mutexlock.h"
namespace leveldb {
const int kNumNonTableCacheFiles = …;
struct DBImpl::Writer { … };
struct DBImpl::CompactionState { … };
template <class T, class V>
static void ClipToRange(T* ptr, V minvalue, V maxvalue) { … }
Options SanitizeOptions(const std::string& dbname,
const InternalKeyComparator* icmp,
const InternalFilterPolicy* ipolicy,
const Options& src) { … }
static int TableCacheSize(const Options& sanitized_options) { … }
DBImpl::DBImpl(const Options& raw_options, const std::string& dbname)
: … { … }
DBImpl::~DBImpl() { … }
Status DBImpl::NewDB() { … }
void DBImpl::MaybeIgnoreError(Status* s) const { … }
void DBImpl::RemoveObsoleteFiles() { … }
Status DBImpl::Recover(VersionEdit* edit, bool* save_manifest) { … }
Status DBImpl::RecoverLogFile(uint64_t log_number, bool last_log,
bool* save_manifest, VersionEdit* edit,
SequenceNumber* max_sequence) { … }
Status DBImpl::WriteLevel0Table(MemTable* mem, VersionEdit* edit,
Version* base) { … }
void DBImpl::CompactMemTable() { … }
void DBImpl::CompactRange(const Slice* begin, const Slice* end) { … }
void DBImpl::TEST_CompactRange(int level, const Slice* begin,
const Slice* end) { … }
Status DBImpl::TEST_CompactMemTable() { … }
void DBImpl::RecordBackgroundError(const Status& s) { … }
void DBImpl::MaybeScheduleCompaction() { … }
void DBImpl::BGWork(void* db) { … }
void DBImpl::BackgroundCall() { … }
void DBImpl::BackgroundCompaction() { … }
void DBImpl::CleanupCompaction(CompactionState* compact) { … }
Status DBImpl::OpenCompactionOutputFile(CompactionState* compact) { … }
Status DBImpl::FinishCompactionOutputFile(CompactionState* compact,
Iterator* input) { … }
Status DBImpl::InstallCompactionResults(CompactionState* compact) { … }
Status DBImpl::DoCompactionWork(CompactionState* compact) { … }
namespace {
struct IterState { … };
static void CleanupIteratorState(void* arg1, void* arg2) { … }
}
Iterator* DBImpl::NewInternalIterator(const ReadOptions& options,
SequenceNumber* latest_snapshot,
uint32_t* seed) { … }
Iterator* DBImpl::TEST_NewInternalIterator() { … }
int64_t DBImpl::TEST_MaxNextLevelOverlappingBytes() { … }
Status DBImpl::Get(const ReadOptions& options, const Slice& key,
std::string* value) { … }
Iterator* DBImpl::NewIterator(const ReadOptions& options) { … }
void DBImpl::RecordReadSample(Slice key) { … }
const Snapshot* DBImpl::GetSnapshot() { … }
void DBImpl::ReleaseSnapshot(const Snapshot* snapshot) { … }
Status DBImpl::Put(const WriteOptions& o, const Slice& key, const Slice& val) { … }
Status DBImpl::Delete(const WriteOptions& options, const Slice& key) { … }
Status DBImpl::Write(const WriteOptions& options, WriteBatch* updates) { … }
WriteBatch* DBImpl::BuildBatchGroup(Writer** last_writer) { … }
Status DBImpl::MakeRoomForWrite(bool force) { … }
bool DBImpl::GetProperty(const Slice& property, std::string* value) { … }
void DBImpl::GetApproximateSizes(const Range* range, int n, uint64_t* sizes) { … }
Status DB::Put(const WriteOptions& opt, const Slice& key, const Slice& value) { … }
Status DB::Delete(const WriteOptions& opt, const Slice& key) { … }
DB::~DB() = default;
Status DB::Open(const Options& options, const std::string& dbname, DB** dbptr) { … }
Snapshot::~Snapshot() = default;
Status DestroyDB(const std::string& dbname, const Options& options) { … }
}