From ff7b59e8b28305651a65eb214073e640e6dbffd9 Mon Sep 17 00:00:00 2001 From: Alberto Sartori Date: Wed, 15 Nov 2023 11:25:17 +0100 Subject: TargetCache: add new member function WithShard(shard) that returns a new TargetCache... ...backed by the same CAS, but the FileStorage uses the given shard. This is particularly useful for the just-serve server implementation, since the sharding must be performed according to the client's request and not following the server configuration. --- src/buildtool/file_system/file_storage.hpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/buildtool/file_system/file_storage.hpp') diff --git a/src/buildtool/file_system/file_storage.hpp b/src/buildtool/file_system/file_storage.hpp index 922cbc54..488274a5 100644 --- a/src/buildtool/file_system/file_storage.hpp +++ b/src/buildtool/file_system/file_storage.hpp @@ -70,6 +70,10 @@ class FileStorage { return storage_root_ / id.substr(0, 2) / id.substr(2, id.size() - 2); } + [[nodiscard]] auto StorageRoot() const noexcept -> std::filesystem::path { + return storage_root_; + } + private: static constexpr bool kFdLess{kType == ObjectType::Executable}; std::filesystem::path storage_root_{}; -- cgit v1.2.3