diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-12-04 12:31:15 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-12-04 18:03:44 +0100 |
commit | f2c7776e00d6a0ed9f601fbfbf082cab0393d640 (patch) | |
tree | ffc286fb7eff4e00b434eabdc57f9608ed4e475d /src/buildtool/execution_api/utils/rehash_utils.hpp | |
parent | ee5dac3d832d4951fc0141aaf9b642e499d8189d (diff) | |
download | justbuild-f2c7776e00d6a0ed9f601fbfbf082cab0393d640.tar.gz |
rehash_utils: add a class for the rehash function
... to allow a more specific signature when passing around
the rehash function.
Diffstat (limited to 'src/buildtool/execution_api/utils/rehash_utils.hpp')
-rw-r--r-- | src/buildtool/execution_api/utils/rehash_utils.hpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/buildtool/execution_api/utils/rehash_utils.hpp b/src/buildtool/execution_api/utils/rehash_utils.hpp index e4a09ca9..f21d5e41 100644 --- a/src/buildtool/execution_api/utils/rehash_utils.hpp +++ b/src/buildtool/execution_api/utils/rehash_utils.hpp @@ -17,6 +17,7 @@ #include <optional> #include <string> +#include <utility> #include <vector> #include "gsl/gsl" @@ -77,6 +78,24 @@ namespace RehashUtils { RepositoryConfig const& repo_config) -> expected<std::vector<Artifact::ObjectInfo>, std::string>; +class Rehasher { + public: + Rehasher(StorageConfig source_config, + StorageConfig target_config, + std::optional<gsl::not_null<ApiBundle const*>> apis) + : source_{std::move(source_config)}, + target_{std::move(target_config)}, + apis_{std::move(apis)} {} + + [[nodiscard]] auto Rehash(Artifact::ObjectInfo const& info) const + -> expected<Artifact::ObjectInfo, std::string>; + + private: + StorageConfig const source_; + StorageConfig const target_; + std::optional<gsl::not_null<ApiBundle const*>> const apis_; +}; + } // namespace RehashUtils #endif // INCLUDED_SRC_BUILDTOOL_EXECUTION_API_UTILS_REHASH_UTILS_HPP |