4#include <unordered_map>
32 [[nodiscard]]
virtual std::unordered_map<ArtifactKey, std::string>
41 [[nodiscard]]
virtual std::unordered_map<ArtifactKey, std::string>
52 const std::string &name,
const std::unordered_map<ArtifactKey, std::string> &checksums)
const = 0;
65 [[nodiscard]] std::vector<ArtifactKey>
71 if (cached_checksums.empty()) {
75 std::vector<ArtifactKey> mismatched_keys;
76 for (
const auto &key : keys_to_check) {
77 const auto computed_checksum_for_key = computed_checksums.contains(key) ? computed_checksums.at(key) :
"";
78 const auto cached_checksum_for_key = cached_checksums.contains(key) ? cached_checksums.at(key) :
"";
79 if (computed_checksum_for_key != cached_checksum_for_key) {
80 mismatched_keys.push_back(key);
83 return mismatched_keys;
Abstract service for managing artifact checksums.
bool all_checksums_tileset_match(const std::string &name, const std::vector< ArtifactKey > &artifact_keys) const
Checks if all artifact checksums for the given Tileset match their cached values.
std::vector< ArtifactKey > find_unsynced_tileset_artifacts(const std::string &name, const std::vector< ArtifactKey > &keys_to_check) const
Finds all artifacts for the given Tileset with unsynced changes compared to cached checksums.
virtual std::unordered_map< ArtifactKey, std::string > load_cached_tileset_checksums(const std::string &name) const =0
Loads the cached checksums for the given Tileset.
virtual ChainableResult< void > cache_tileset_checksums(const std::string &name, const std::unordered_map< ArtifactKey, std::string > &checksums) const =0
Caches checksums for the given Tileset to persistent storage.
bool cached_checksums_exist(const std::string &name) const
Check if any cached checksums exist for the given tileset.
virtual ~ArtifactChecksumProvider()=default
virtual std::unordered_map< ArtifactKey, std::string > compute_tileset_artifact_checksums(const std::vector< ArtifactKey > &keys) const =0
Computes checksums for the given Tileset artifacts.
A result type that maintains a chainable sequence of errors for debugging and error reporting.