#include "components/value_store/lazy_leveldb.h"
#include <string_view>
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram.h"
#include "base/strings/string_util.h"
#include "third_party/leveldatabase/env_chromium.h"
#include "third_party/leveldatabase/src/include/leveldb/iterator.h"
#include "third_party/leveldatabase/src/include/leveldb/write_batch.h"
namespace value_store {
namespace {
const char kInvalidJson[] = …;
const char kRestoredDuringOpen[] = …;
enum LevelDBDatabaseCorruptionRecoveryValue { … };
enum LevelDBValueCorruptionRecoveryValue { … };
ValueStore::StatusCode LevelDbToValueStoreStatusCode(
const leveldb::Status& status) { … }
leveldb::Status DeleteValue(leveldb::DB* db, const std::string& key) { … }
}
LazyLevelDb::LazyLevelDb(const std::string& uma_client_name,
const base::FilePath& path)
: … { … }
LazyLevelDb::~LazyLevelDb() = default;
ValueStore::Status LazyLevelDb::Read(const std::string& key,
std::optional<base::Value>* value) { … }
ValueStore::Status LazyLevelDb::Delete(const std::string& key) { … }
ValueStore::BackingStoreRestoreStatus LazyLevelDb::FixCorruption(
const std::string* key) { … }
ValueStore::Status LazyLevelDb::EnsureDbIsOpen() { … }
ValueStore::Status LazyLevelDb::ToValueStoreError(
const leveldb::Status& status) { … }
bool LazyLevelDb::DeleteDbFile() { … }
ValueStore::Status LazyLevelDb::CreateIterator(
const leveldb::ReadOptions& read_options,
std::unique_ptr<leveldb::Iterator>* iterator) { … }
}