#include "components/leveldb_proto/internal/proto_leveldb_wrapper.h"
#include <string>
#include "base/functional/bind.h"
#include "base/functional/callback_forward.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/task_traits.h"
#include "components/leveldb_proto/internal/leveldb_database.h"
#include "components/leveldb_proto/internal/proto_leveldb_wrapper_metrics.h"
#include "components/leveldb_proto/public/proto_database.h"
namespace leveldb_proto {
namespace {
Enums::InitStatus InitFromTaskRunner(LevelDB* database,
const base::FilePath& database_dir,
const leveldb_env::Options& options,
bool destroy_on_corruption,
const std::string& client_id) { … }
bool DestroyFromTaskRunner(LevelDB* database, const std::string& client_id) { … }
bool DestroyWithDirectoryFromTaskRunner(const base::FilePath& db_dir,
const std::string& client_id) { … }
void LoadKeysFromTaskRunner(
LevelDB* database,
const std::string& target_prefix,
const std::string& client_id,
Callbacks::LoadKeysCallback callback,
scoped_refptr<base::SequencedTaskRunner> callback_task_runner) { … }
void RemoveKeysFromTaskRunner(
LevelDB* database,
const std::string& target_prefix,
const KeyFilter& filter,
const std::string& client_id,
Callbacks::UpdateCallback callback,
scoped_refptr<base::SequencedTaskRunner> callback_task_runner) { … }
void RunLoadCallback(Callbacks::LoadCallback callback,
bool* success,
std::unique_ptr<ValueVector> entries) { … }
void RunLoadKeysAndEntriesCallback(
Callbacks::LoadKeysAndEntriesCallback callback,
bool* success,
std::unique_ptr<KeyValueMap> keys_entries) { … }
void RunGetCallback(Callbacks::GetCallback callback,
const bool* success,
const bool* found,
std::unique_ptr<std::string> entry) { … }
bool UpdateEntriesFromTaskRunner(
LevelDB* database,
std::unique_ptr<KeyValueVector> entries_to_save,
std::unique_ptr<KeyVector> keys_to_remove,
const std::string& client_id) { … }
bool UpdateEntriesWithRemoveFilterFromTaskRunner(
LevelDB* database,
std::unique_ptr<KeyValueVector> entries_to_save,
const KeyFilter& delete_key_filter,
const std::string& target_prefix,
const std::string& client_id) { … }
void LoadKeysAndEntriesFromTaskRunner(LevelDB* database,
const KeyIteratorController& controller,
const leveldb::ReadOptions& options,
const std::string& start_key,
const std::string& client_id,
bool* success,
KeyValueMap* keys_entries) { … }
void LoadEntriesFromTaskRunner(LevelDB* database,
const KeyFilter& filter,
const leveldb::ReadOptions& options,
const std::string& target_prefix,
const std::string& client_id,
bool* success,
ValueVector* entries) { … }
void GetEntryFromTaskRunner(LevelDB* database,
const std::string& key,
const std::string& client_id,
bool* success,
bool* found,
std::string* entry) { … }
}
ProtoLevelDBWrapper::ProtoLevelDBWrapper(
const scoped_refptr<base::SequencedTaskRunner>& task_runner)
: … { … }
ProtoLevelDBWrapper::ProtoLevelDBWrapper(
const scoped_refptr<base::SequencedTaskRunner>& task_runner,
LevelDB* db)
: … { … }
ProtoLevelDBWrapper::~ProtoLevelDBWrapper() = default;
void ProtoLevelDBWrapper::RunInitCallback(Callbacks::InitCallback callback,
const leveldb::Status* status) { … }
void ProtoLevelDBWrapper::InitWithDatabase(
LevelDB* database,
const base::FilePath& database_dir,
const leveldb_env::Options& options,
bool destroy_on_corruption,
Callbacks::InitStatusCallback callback) { … }
void ProtoLevelDBWrapper::UpdateEntries(
std::unique_ptr<KeyValueVector> entries_to_save,
std::unique_ptr<KeyVector> keys_to_remove,
typename Callbacks::UpdateCallback callback) { … }
void ProtoLevelDBWrapper::UpdateEntriesWithRemoveFilter(
std::unique_ptr<KeyValueVector> entries_to_save,
const KeyFilter& delete_key_filter,
Callbacks::UpdateCallback callback) { … }
void ProtoLevelDBWrapper::UpdateEntriesWithRemoveFilter(
std::unique_ptr<KeyValueVector> entries_to_save,
const KeyFilter& delete_key_filter,
const std::string& target_prefix,
Callbacks::UpdateCallback callback) { … }
void ProtoLevelDBWrapper::LoadEntries(Callbacks::LoadCallback callback) { … }
void ProtoLevelDBWrapper::LoadEntriesWithFilter(
const KeyFilter& key_filter,
Callbacks::LoadCallback callback) { … }
void ProtoLevelDBWrapper::LoadEntriesWithFilter(
const KeyFilter& key_filter,
const leveldb::ReadOptions& options,
const std::string& target_prefix,
Callbacks::LoadCallback callback) { … }
void ProtoLevelDBWrapper::LoadKeysAndEntries(
Callbacks::LoadKeysAndEntriesCallback callback) { … }
void ProtoLevelDBWrapper::LoadKeysAndEntriesWithFilter(
const KeyFilter& key_filter,
Callbacks::LoadKeysAndEntriesCallback callback) { … }
void ProtoLevelDBWrapper::LoadKeysAndEntriesWithFilter(
const KeyFilter& key_filter,
const leveldb::ReadOptions& options,
const std::string& target_prefix,
Callbacks::LoadKeysAndEntriesCallback callback) { … }
void ProtoLevelDBWrapper::LoadKeysAndEntriesInRange(
const std::string& start,
const std::string& end,
Callbacks::LoadKeysAndEntriesCallback callback) { … }
void ProtoLevelDBWrapper::LoadKeysAndEntriesWhile(
const std::string& start_key,
const KeyIteratorController& controller,
Callbacks::LoadKeysAndEntriesCallback callback) { … }
void ProtoLevelDBWrapper::LoadKeysAndEntriesWhile(
const KeyFilter& while_callback,
const KeyFilter& filter,
const leveldb::ReadOptions& options,
const std::string& start_key,
Callbacks::LoadKeysAndEntriesCallback callback) { … }
void ProtoLevelDBWrapper::LoadKeysAndEntriesWhile(
const KeyIteratorController& controller,
const leveldb::ReadOptions& options,
const std::string& start_key,
Callbacks::LoadKeysAndEntriesCallback callback) { … }
void ProtoLevelDBWrapper::GetEntry(const std::string& key,
Callbacks::GetCallback callback) { … }
void ProtoLevelDBWrapper::LoadKeys(
typename Callbacks::LoadKeysCallback callback) { … }
void ProtoLevelDBWrapper::LoadKeys(
const std::string& target_prefix,
typename Callbacks::LoadKeysCallback callback) { … }
void ProtoLevelDBWrapper::RemoveKeys(const KeyFilter& filter,
const std::string& target_prefix,
Callbacks::UpdateCallback callback) { … }
void ProtoLevelDBWrapper::Destroy(Callbacks::DestroyCallback callback) { … }
void ProtoLevelDBWrapper::Destroy(
const base::FilePath& db_dir,
const std::string& client_id,
const scoped_refptr<base::SequencedTaskRunner>& task_runner,
Callbacks::DestroyCallback callback) { … }
void ProtoLevelDBWrapper::SetMetricsId(const std::string& id) { … }
bool ProtoLevelDBWrapper::GetApproximateMemoryUse(uint64_t* approx_mem_use) { … }
const scoped_refptr<base::SequencedTaskRunner>&
ProtoLevelDBWrapper::task_runner() { … }
}