#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/services/storage/indexed_db/scopes/leveldb_scopes_coding.h"
#include <sstream>
#include <string_view>
#include <utility>
#include "base/containers/span.h"
#include "base/numerics/byte_conversions.h"
#include "components/services/storage/indexed_db/scopes/varint_coding.h"
namespace content {
namespace {
void EncodeBigEndianFixed64(uint64_t number, std::string* output) { … }
std::string_view MakeStringView(base::span<const uint8_t> bytes) { … }
}
namespace leveldb_scopes {
std::tuple<bool, int64_t> ParseScopeMetadataId(
leveldb::Slice key,
base::span<const uint8_t> scopes_prefix) { … }
std::string KeyToDebugString(base::span<const uint8_t> key_without_prefix) { … }
}
leveldb::Slice ScopesEncoder::GlobalMetadataKey(
base::span<const uint8_t> scopes_prefix) { … }
leveldb::Slice ScopesEncoder::ScopeMetadataKey(
base::span<const uint8_t> scopes_prefix,
int64_t scope_number) { … }
leveldb::Slice ScopesEncoder::ScopeMetadataPrefix(
base::span<const uint8_t> scopes_prefix) { … }
leveldb::Slice ScopesEncoder::TasksKeyPrefix(base::span<const uint8_t> prefix) { … }
leveldb::Slice ScopesEncoder::TasksKeyPrefix(base::span<const uint8_t> prefix,
int64_t scope_number) { … }
leveldb::Slice ScopesEncoder::UndoTaskKeyPrefix(
base::span<const uint8_t> prefix,
int64_t scope_number) { … }
leveldb::Slice ScopesEncoder::CleanupTaskKeyPrefix(
base::span<const uint8_t> prefix,
int64_t scope_number) { … }
leveldb::Slice ScopesEncoder::UndoTaskKey(
base::span<const uint8_t> scopes_prefix,
int64_t scope_number,
int64_t undo_sequence_number) { … }
leveldb::Slice ScopesEncoder::CleanupTaskKey(
base::span<const uint8_t> scopes_prefix,
int64_t scope_number,
int64_t cleanup_sequence_number) { … }
}