Porytiles
Loading...
Searching...
No Matches
artifact_checksum_provider.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <unordered_map>
5
9
10namespace porytiles2 {
11
24 public:
25 virtual ~ArtifactChecksumProvider() = default;
26
33 [[nodiscard]] virtual std::unordered_map<ArtifactKey, std::string>
34 compute_tileset_artifact_checksums(const std::string &tileset_name) const = 0;
35
42 [[nodiscard]] virtual std::unordered_map<ArtifactKey, std::string>
43 load_cached_tileset_checksums(const std::string &tileset_name) const = 0;
44
53 const std::string &tileset_name, const std::unordered_map<ArtifactKey, std::string> &checksums) const = 0;
54
66 [[nodiscard]] virtual std::vector<ArtifactKey> find_unsynced_tileset_artifacts(
67 const std::string &tileset_name, const std::vector<ArtifactKey> &artifact_keys) const;
68
81 [[nodiscard]] virtual bool
82 all_checksums_tileset_match(const std::string &tileset_name, const std::vector<ArtifactKey> &artifact_keys) const;
83};
84
85} // namespace porytiles2
Abstract service for managing artifact checksums.
virtual std::unordered_map< ArtifactKey, std::string > compute_tileset_artifact_checksums(const std::string &tileset_name) const =0
Computes checksums for the artifacts that belong to the given Tileset.
virtual std::vector< ArtifactKey > find_unsynced_tileset_artifacts(const std::string &tileset_name, const std::vector< ArtifactKey > &artifact_keys) const
Finds all artifacts for the given Tileset with unsynced changes compared to cached checksums.
virtual bool all_checksums_tileset_match(const std::string &tileset_name, const std::vector< ArtifactKey > &artifact_keys) const
Checks if all artifact checksums for the given Tileset match their cached values.
virtual ~ArtifactChecksumProvider()=default
virtual Result< void > cache_tileset_checksums(const std::string &tileset_name, const std::unordered_map< ArtifactKey, std::string > &checksums) const =0
Caches checksums for the given Tileset to persistent storage.
virtual std::unordered_map< ArtifactKey, std::string > load_cached_tileset_checksums(const std::string &tileset_name) const =0
Loads the cached checksums for the given Tileset.
std::expected< T, E > Result
A result with some type T on success, otherwise an error of type E.
Definition result.hpp:25