#include "components/services/storage/indexed_db/scopes/leveldb_scope.h"
#include <limits>
#include <memory>
#include <sstream>
#include <utility>
#include "base/check.h"
#include "base/compiler_specific.h"
#include "base/debug/stack_trace.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/sequence_checker.h"
#include "components/services/storage/indexed_db/scopes/leveldb_scopes_coding.h"
#include "third_party/leveldatabase/src/include/leveldb/comparator.h"
#include "third_party/leveldatabase/src/include/leveldb/db.h"
namespace content {
namespace {
#if DCHECK_IS_ON()
leveldb::Slice Uint8VectorToSlice(const std::vector<uint8_t>& vector) { … }
#endif
bool IsKeyBeforeEndOfRange(const leveldb::Comparator* comparator,
const leveldb::Slice& key,
const leveldb::Slice& end,
bool end_exclusive) { … }
}
class LevelDBScope::UndoLogWriter : public leveldb::WriteBatch::Handler { … };
LevelDBScope::LevelDBScope(int64_t scope_id,
std::vector<uint8_t> prefix,
size_t write_batch_size,
scoped_refptr<LevelDBState> level_db,
std::vector<PartitionedLock> locks,
RollbackCallback rollback_callback)
: … { … }
LevelDBScope::~LevelDBScope() { … }
leveldb::Status LevelDBScope::Put(const leveldb::Slice& key,
const leveldb::Slice& value) { … }
leveldb::Status LevelDBScope::Delete(const leveldb::Slice& key) { … }
leveldb::Status LevelDBScope::DeleteRange(const leveldb::Slice& begin,
const leveldb::Slice& end,
LevelDBScopeDeletionMode mode) { … }
leveldb::Status LevelDBScope::WriteChangesAndUndoLog() { … }
void LevelDBScope::Rollback() { … }
std::pair<leveldb::Status, LevelDBScope::Mode> LevelDBScope::Commit(
bool sync_on_commit) { … }
leveldb::Status LevelDBScope::WriteChangesAndUndoLogInternal(bool sync) { … }
void LevelDBScope::AddUndoPutTask(std::string key, std::string value) { … }
void LevelDBScope::AddUndoDeleteTask(std::string key) { … }
void LevelDBScope::AddUndoDeleteRangeTask(std::string begin, std::string end) { … }
void LevelDBScope::AddBufferedUndoTask() { … }
void LevelDBScope::AddCleanupDeleteRangeTask(std::string begin,
std::string end) { … }
void LevelDBScope::AddCleanupDeleteAndCompactRangeTask(std::string begin,
std::string end) { … }
void LevelDBScope::AddBufferedCleanupTask() { … }
void LevelDBScope::SetModeToUndoLog() { … }
bool LevelDBScope::CanSkipWritingUndoEntry(const leveldb::Slice& key) { … }
void LevelDBScope::AddCommitPoint() { … }
leveldb::Status LevelDBScope::WriteBufferBatch(bool sync) { … }
#if DCHECK_IS_ON()
bool LevelDBScope::IsInDeferredDeletionRange(const leveldb::Slice& key) { … }
#endif
}