chromium/components/services/storage/indexed_db/scopes/leveldb_scopes_coding.h

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_SERVICES_STORAGE_INDEXED_DB_SCOPES_LEVELDB_SCOPES_CODING_H_
#define COMPONENTS_SERVICES_STORAGE_INDEXED_DB_SCOPES_LEVELDB_SCOPES_CODING_H_

#include <stdint.h>
#include <limits>
#include <string>
#include <tuple>

#include "base/containers/span.h"
#include "third_party/leveldatabase/src/include/leveldb/slice.h"

namespace content {
namespace leveldb_scopes {

inline constexpr uint8_t kGlobalMetadataByte =;
inline constexpr uint8_t kScopesMetadataByte =;
inline constexpr uint8_t kLogByte =;

// One of these bytes follows the |kLogByte| to specify whether the log is for
// undo tasks or a cleanup tasks.
inline constexpr uint8_t kUndoTasksByte =;
inline constexpr uint8_t kCleanupTasksByte =;

inline constexpr int64_t kMinSupportedVersion =;
inline constexpr int64_t kCurrentVersion =;

inline constexpr int64_t kFirstScopeNumber =;
inline constexpr int64_t kFirstSequenceNumberToWrite =;

std::tuple<bool /*success*/, int64_t /*scope_id*/> ParseScopeMetadataId(
    leveldb::Slice key,
    base::span<const uint8_t> scopes_prefix);

std::string KeyToDebugString(base::span<const uint8_t> key_without_prefix);

}  // namespace leveldb_scopes

// This class helps the re-use of a common std::string buffer. All calls modify
// the internal std::string buffer and return a slice to it.
// Important: Every call to this class will invalidate any 'old' slices that
// were returned by previous calls.
class ScopesEncoder {};

}  // namespace content

#endif  // COMPONENTS_SERVICES_STORAGE_INDEXED_DB_SCOPES_LEVELDB_SCOPES_CODING_H_