diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-05-02 19:12:26 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-05-02 19:12:26 +1000 |
| commit | 1573a8c4cde1cd9528b422b2dcc598e37ffe94a7 (patch) | |
| tree | d162822b8fd7054f81bace0c7a65ab4d5e6f93ef /src/database/include/records.hpp | |
| parent | a231fd1c8afedbeb14b0bc77d76bad61db986059 (diff) | |
| download | tangara-fw-1573a8c4cde1cd9528b422b2dcc598e37ffe94a7.tar.gz | |
WIP merge cyclically dependent components into one big component
Diffstat (limited to 'src/database/include/records.hpp')
| -rw-r--r-- | src/database/include/records.hpp | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/src/database/include/records.hpp b/src/database/include/records.hpp deleted file mode 100644 index 3ca68fea..00000000 --- a/src/database/include/records.hpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2023 jacqueline <me@jacqueline.id.au> - * - * SPDX-License-Identifier: GPL-3.0-only - */ - -#pragma once - -#include <stdint.h> - -#include <string> -#include <variant> -#include <vector> - -#include "leveldb/db.h" -#include "leveldb/slice.h" - -#include "index.hpp" -#include "memory_resource.hpp" -#include "track.hpp" - -namespace database { - -auto EncodePathKey(std::string_view path) -> std::string; - -/* - * Returns the prefix added to every TrackData key. This can be used to iterate - * over every data record in the database. - */ -auto EncodeDataPrefix() -> std::string; - -/* Encodes a data key for a track with the specified id. */ -auto EncodeDataKey(const TrackId& id) -> std::string; - -/* - * Encodes a TrackData instance into bytes, in preparation for storing it within - * the database. This encoding is consistent, and will remain stable over time. - */ -auto EncodeDataValue(const TrackData& track) -> std::string; - -/* - * Parses bytes previously encoded via EncodeDataValue back into a TrackData. - * May return nullopt if parsing fails. - */ -auto ParseDataValue(const leveldb::Slice& slice) -> std::shared_ptr<TrackData>; - -/* Encodes a hash key for the specified hash. */ -auto EncodeHashKey(const uint64_t& hash) -> std::string; - -/* - * Encodes a hash value (at this point just a track id) into bytes, in - * preparation for storing within the database. This encoding is consistent, and - * will remain stable over time. - */ -auto EncodeHashValue(TrackId id) -> std::string; - -/* Encodes a hash key for the specified hash. */ -auto EncodeTagHashKey(const uint64_t& hash) -> std::string; - -/* - * Parses bytes previously encoded via EncodeHashValue back into a track id. May - * return nullopt if parsing fails. - */ -auto ParseHashValue(const leveldb::Slice&) -> std::optional<TrackId>; - -/* Encodes a prefix that matches all index keys, of all ids and depths. */ -auto EncodeAllIndexesPrefix() -> std::string; - -/* - */ -auto EncodeIndexPrefix(const IndexKey::Header&) -> std::string; - -auto EncodeIndexKey(const IndexKey&) -> std::string; -auto ParseIndexKey(const leveldb::Slice&) -> std::optional<IndexKey>; - -/* Encodes a TrackId as bytes. */ -auto TrackIdToBytes(TrackId id) -> std::string; - -/* - * Converts a track id encoded via TrackIdToBytes back into a TrackId. May - * return nullopt if parsing fails. - */ -auto BytesToTrackId(std::span<const char> bytes) -> std::optional<TrackId>; - -} // namespace database |
