summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/execution_api/serve/TARGETS29
-rw-r--r--src/buildtool/execution_api/serve/mr_git_api.cpp16
-rw-r--r--src/buildtool/execution_api/serve/mr_local_api.cpp14
-rw-r--r--src/buildtool/execution_api/utils/TARGETS19
-rw-r--r--src/buildtool/execution_api/utils/rehash_utils.cpp (renamed from src/buildtool/execution_api/serve/utils.cpp)6
-rw-r--r--src/buildtool/execution_api/utils/rehash_utils.hpp (renamed from src/buildtool/execution_api/serve/utils.hpp)10
-rw-r--r--src/buildtool/serve_api/serve_service/TARGETS2
-rw-r--r--src/buildtool/serve_api/serve_service/source_tree.cpp10
-rw-r--r--src/other_tools/ops_maps/TARGETS2
-rw-r--r--src/other_tools/ops_maps/content_cas_map.cpp4
-rw-r--r--src/other_tools/root_maps/TARGETS2
-rw-r--r--src/other_tools/root_maps/root_utils.cpp11
12 files changed, 63 insertions, 62 deletions
diff --git a/src/buildtool/execution_api/serve/TARGETS b/src/buildtool/execution_api/serve/TARGETS
index f4d999b2..cfc23515 100644
--- a/src/buildtool/execution_api/serve/TARGETS
+++ b/src/buildtool/execution_api/serve/TARGETS
@@ -1,23 +1,4 @@
-{ "utils":
- { "type": ["@", "rules", "CC", "library"]
- , "name": ["utils"]
- , "hdrs": ["utils.hpp"]
- , "srcs": ["utils.cpp"]
- , "deps":
- [ ["src/buildtool/common", "common"]
- , ["src/buildtool/file_system", "object_type"]
- , ["src/buildtool/storage", "config"]
- , ["src/utils/cpp", "expected"]
- ]
- , "stage": ["src", "buildtool", "execution_api", "serve"]
- , "private-deps":
- [ ["@", "fmt", "", "fmt"]
- , ["src/buildtool/crypto", "hash_function"]
- , ["src/buildtool/file_system", "file_system_manager"]
- , ["src/buildtool/storage", "fs_utils"]
- ]
- }
-, "mr_git_api":
+{ "mr_git_api":
{ "type": ["@", "rules", "CC", "library"]
, "name": ["mr_git_api"]
, "hdrs": ["mr_git_api.hpp"]
@@ -34,9 +15,9 @@
]
, "stage": ["src", "buildtool", "execution_api", "serve"]
, "private-deps":
- [ "utils"
- , ["src/buildtool/execution_api/bazel_msg", "bazel_msg_factory"]
+ [ ["src/buildtool/execution_api/bazel_msg", "bazel_msg_factory"]
, ["src/buildtool/execution_api/git", "git"]
+ , ["src/buildtool/execution_api/utils", "rehash_utils"]
, ["src/buildtool/file_system", "object_type"]
, ["src/buildtool/logging", "log_level"]
, ["src/buildtool/logging", "logging"]
@@ -58,9 +39,9 @@
]
, "stage": ["src", "buildtool", "execution_api", "serve"]
, "private-deps":
- [ "utils"
- , ["src/buildtool/common", "protocol_traits"]
+ [ ["src/buildtool/common", "protocol_traits"]
, ["src/buildtool/execution_api/bazel_msg", "bazel_msg_factory"]
+ , ["src/buildtool/execution_api/utils", "rehash_utils"]
, ["src/buildtool/file_system", "object_type"]
, ["src/buildtool/logging", "log_level"]
, ["src/buildtool/logging", "logging"]
diff --git a/src/buildtool/execution_api/serve/mr_git_api.cpp b/src/buildtool/execution_api/serve/mr_git_api.cpp
index 46bc4c83..6630e891 100644
--- a/src/buildtool/execution_api/serve/mr_git_api.cpp
+++ b/src/buildtool/execution_api/serve/mr_git_api.cpp
@@ -19,7 +19,7 @@
#include "src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp"
#include "src/buildtool/execution_api/git/git_api.hpp"
-#include "src/buildtool/execution_api/serve/utils.hpp"
+#include "src/buildtool/execution_api/utils/rehash_utils.hpp"
#include "src/buildtool/file_system/object_type.hpp"
#include "src/buildtool/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
@@ -56,7 +56,7 @@ auto MRGitApi::RetrieveToCas(
[native_sc = native_storage_config_,
compat_sc = compat_storage_config_](ArtifactDigest const& digest)
-> expected<std::optional<Artifact::ObjectInfo>, std::string> {
- return MRApiUtils::ReadRehashedDigest(
+ return RehashUtils::ReadRehashedDigest(
digest, *native_sc, *compat_sc, /*from_git=*/true);
};
auto store_rehashed =
@@ -65,12 +65,12 @@ auto MRGitApi::RetrieveToCas(
ArtifactDigest const& source_digest,
ArtifactDigest const& target_digest,
ObjectType obj_type) -> std::optional<std::string> {
- return MRApiUtils::StoreRehashedDigest(source_digest,
- target_digest,
- obj_type,
- *native_sc,
- *compat_sc,
- /*from_git=*/true);
+ return RehashUtils::StoreRehashedDigest(source_digest,
+ target_digest,
+ obj_type,
+ *native_sc,
+ *compat_sc,
+ /*from_git=*/true);
};
// collect the native blobs and rehash them as compatible to be able to
diff --git a/src/buildtool/execution_api/serve/mr_local_api.cpp b/src/buildtool/execution_api/serve/mr_local_api.cpp
index 7a8eb61a..55dddafc 100644
--- a/src/buildtool/execution_api/serve/mr_local_api.cpp
+++ b/src/buildtool/execution_api/serve/mr_local_api.cpp
@@ -19,7 +19,7 @@
#include "src/buildtool/common/protocol_traits.hpp"
#include "src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp"
-#include "src/buildtool/execution_api/serve/utils.hpp"
+#include "src/buildtool/execution_api/utils/rehash_utils.hpp"
#include "src/buildtool/file_system/object_type.hpp"
#include "src/buildtool/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
@@ -89,7 +89,7 @@ auto MRLocalApi::RetrieveToCas(
compat_storage = compat_context_->storage_config](
ArtifactDigest const& digest)
-> expected<std::optional<Artifact::ObjectInfo>, std::string> {
- return MRApiUtils::ReadRehashedDigest(
+ return RehashUtils::ReadRehashedDigest(
digest, *native_storage, *compat_storage);
};
auto store_rehashed =
@@ -98,11 +98,11 @@ auto MRLocalApi::RetrieveToCas(
ArtifactDigest const& source_digest,
ArtifactDigest const& target_digest,
ObjectType obj_type) -> std::optional<std::string> {
- return MRApiUtils::StoreRehashedDigest(source_digest,
- target_digest,
- obj_type,
- *native_storage,
- *compat_storage);
+ return RehashUtils::StoreRehashedDigest(source_digest,
+ target_digest,
+ obj_type,
+ *native_storage,
+ *compat_storage);
};
// collect the native blobs and rehash them as compatible to be able to
diff --git a/src/buildtool/execution_api/utils/TARGETS b/src/buildtool/execution_api/utils/TARGETS
index bff656ec..afaabeb0 100644
--- a/src/buildtool/execution_api/utils/TARGETS
+++ b/src/buildtool/execution_api/utils/TARGETS
@@ -31,4 +31,23 @@
]
, "stage": ["src", "buildtool", "execution_api", "utils"]
}
+, "rehash_utils":
+ { "type": ["@", "rules", "CC", "library"]
+ , "name": ["utils"]
+ , "hdrs": ["rehash_utils.hpp"]
+ , "srcs": ["rehash_utils.cpp"]
+ , "deps":
+ [ ["src/buildtool/common", "common"]
+ , ["src/buildtool/file_system", "object_type"]
+ , ["src/buildtool/storage", "config"]
+ , ["src/utils/cpp", "expected"]
+ ]
+ , "stage": ["src", "buildtool", "execution_api", "utils"]
+ , "private-deps":
+ [ ["@", "fmt", "", "fmt"]
+ , ["src/buildtool/crypto", "hash_function"]
+ , ["src/buildtool/file_system", "file_system_manager"]
+ , ["src/buildtool/storage", "fs_utils"]
+ ]
+ }
}
diff --git a/src/buildtool/execution_api/serve/utils.cpp b/src/buildtool/execution_api/utils/rehash_utils.cpp
index 39c4f7d3..660d8cec 100644
--- a/src/buildtool/execution_api/serve/utils.cpp
+++ b/src/buildtool/execution_api/utils/rehash_utils.cpp
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#include "src/buildtool/execution_api/serve/utils.hpp"
+#include "src/buildtool/execution_api/utils/rehash_utils.hpp"
#include <cstddef> // std::size_t
#include <filesystem>
@@ -24,7 +24,7 @@
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/storage/fs_utils.hpp"
-namespace MRApiUtils {
+namespace RehashUtils {
auto ReadRehashedDigest(ArtifactDigest const& digest,
StorageConfig const& source_config,
@@ -115,4 +115,4 @@ auto StoreRehashedDigest(ArtifactDigest const& source_digest,
return std::nullopt; // a-ok
}
-} // namespace MRApiUtils
+} // namespace RehashUtils
diff --git a/src/buildtool/execution_api/serve/utils.hpp b/src/buildtool/execution_api/utils/rehash_utils.hpp
index 3b588cf3..7ed7cb11 100644
--- a/src/buildtool/execution_api/serve/utils.hpp
+++ b/src/buildtool/execution_api/utils/rehash_utils.hpp
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#ifndef INCLUDED_SRC_BUILDTOOL_EXECUTION_API_SERVE_UTILS_HPP
-#define INCLUDED_SRC_BUILDTOOL_EXECUTION_API_SERVE_UTILS_HPP
+#ifndef INCLUDED_SRC_BUILDTOOL_EXECUTION_API_UTILS_REHASH_UTILS_HPP
+#define INCLUDED_SRC_BUILDTOOL_EXECUTION_API_UTILS_REHASH_UTILS_HPP
#include <optional>
#include <string>
@@ -24,7 +24,7 @@
#include "src/buildtool/storage/config.hpp"
#include "src/utils/cpp/expected.hpp"
-namespace MRApiUtils {
+namespace RehashUtils {
/// \brief Get a corresponding known object from a different local CAS, as
/// stored in a mapping file, if exists.
@@ -59,6 +59,6 @@ namespace MRApiUtils {
bool from_git = false) noexcept
-> std::optional<std::string>;
-} // namespace MRApiUtils
+} // namespace RehashUtils
-#endif // INCLUDED_SRC_BUILDTOOL_EXECUTION_API_SERVE_UTILS_HPP
+#endif // INCLUDED_SRC_BUILDTOOL_EXECUTION_API_UTILS_REHASH_UTILS_HPP
diff --git a/src/buildtool/serve_api/serve_service/TARGETS b/src/buildtool/serve_api/serve_service/TARGETS
index 7f74ef66..96bc41d1 100644
--- a/src/buildtool/serve_api/serve_service/TARGETS
+++ b/src/buildtool/serve_api/serve_service/TARGETS
@@ -38,7 +38,7 @@
, ["src/buildtool/crypto", "hash_function"]
, ["src/buildtool/execution_api/common", "common"]
, ["src/buildtool/execution_api/serve", "mr_git_api"]
- , ["src/buildtool/execution_api/serve", "utils"]
+ , ["src/buildtool/execution_api/utils", "rehash_utils"]
, ["src/buildtool/file_system", "file_system_manager"]
, ["src/buildtool/file_system", "git_cas"]
, ["src/buildtool/file_system", "git_repo"]
diff --git a/src/buildtool/serve_api/serve_service/source_tree.cpp b/src/buildtool/serve_api/serve_service/source_tree.cpp
index dfbb04f5..3e9153ee 100644
--- a/src/buildtool/serve_api/serve_service/source_tree.cpp
+++ b/src/buildtool/serve_api/serve_service/source_tree.cpp
@@ -32,7 +32,7 @@
#include "src/buildtool/crypto/hash_function.hpp"
#include "src/buildtool/execution_api/common/execution_api.hpp"
#include "src/buildtool/execution_api/serve/mr_git_api.hpp"
-#include "src/buildtool/execution_api/serve/utils.hpp"
+#include "src/buildtool/execution_api/utils/rehash_utils.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/file_system/git_cas.hpp"
#include "src/buildtool/file_system/git_repo.hpp"
@@ -423,10 +423,10 @@ auto SourceTreeService::SetDigestInResponse(
// get the compatible digest from the mapping that was created during
// upload from Git cache
auto const cached_obj =
- MRApiUtils::ReadRehashedDigest(*native_digest,
- *native_context_->storage_config,
- *compat_context_->storage_config,
- from_git);
+ RehashUtils::ReadRehashedDigest(*native_digest,
+ *native_context_->storage_config,
+ *compat_context_->storage_config,
+ from_git);
if (not cached_obj) {
logger_->Emit(
LogLevel::Error, "SetDigestInResponse: {}", cached_obj.error());
diff --git a/src/other_tools/ops_maps/TARGETS b/src/other_tools/ops_maps/TARGETS
index 22a91d0c..d0b82175 100644
--- a/src/other_tools/ops_maps/TARGETS
+++ b/src/other_tools/ops_maps/TARGETS
@@ -81,7 +81,7 @@
[ ["@", "fmt", "", "fmt"]
, ["src/buildtool/common", "common"]
, ["src/buildtool/crypto", "hasher"]
- , ["src/buildtool/execution_api/serve", "utils"]
+ , ["src/buildtool/execution_api/utils", "rehash_utils"]
, ["src/buildtool/file_system", "file_system_manager"]
, ["src/buildtool/file_system", "git_repo"]
, ["src/buildtool/file_system", "object_type"]
diff --git a/src/other_tools/ops_maps/content_cas_map.cpp b/src/other_tools/ops_maps/content_cas_map.cpp
index 9cfef72a..89024fa2 100644
--- a/src/other_tools/ops_maps/content_cas_map.cpp
+++ b/src/other_tools/ops_maps/content_cas_map.cpp
@@ -22,7 +22,7 @@
#include "src/buildtool/common/artifact.hpp"
#include "src/buildtool/common/artifact_digest.hpp"
#include "src/buildtool/crypto/hasher.hpp"
-#include "src/buildtool/execution_api/serve/utils.hpp"
+#include "src/buildtool/execution_api/utils/rehash_utils.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/file_system/git_repo.hpp"
#include "src/buildtool/file_system/object_type.hpp"
@@ -318,7 +318,7 @@ auto CreateContentCASMap(
return;
}
// cache association between digests
- auto error_msg = MRApiUtils::StoreRehashedDigest(
+ auto error_msg = RehashUtils::StoreRehashedDigest(
native_digest,
*rehashed_digest,
ObjectType::File,
diff --git a/src/other_tools/root_maps/TARGETS b/src/other_tools/root_maps/TARGETS
index 11f6b4e6..81c72d1c 100644
--- a/src/other_tools/root_maps/TARGETS
+++ b/src/other_tools/root_maps/TARGETS
@@ -240,7 +240,7 @@
, ["src/buildtool/common", "config"]
, ["src/buildtool/crypto", "hash_function"]
, ["src/buildtool/execution_api/serve", "mr_git_api"]
- , ["src/buildtool/execution_api/serve", "utils"]
+ , ["src/buildtool/execution_api/utils", "rehash_utils"]
, ["src/buildtool/file_system", "object_type"]
, ["src/utils/cpp", "expected"]
]
diff --git a/src/other_tools/root_maps/root_utils.cpp b/src/other_tools/root_maps/root_utils.cpp
index 85c0ee62..13e18d06 100644
--- a/src/other_tools/root_maps/root_utils.cpp
+++ b/src/other_tools/root_maps/root_utils.cpp
@@ -25,7 +25,7 @@
#include "src/buildtool/common/repository_config.hpp"
#include "src/buildtool/crypto/hash_function.hpp"
#include "src/buildtool/execution_api/serve/mr_git_api.hpp"
-#include "src/buildtool/execution_api/serve/utils.hpp"
+#include "src/buildtool/execution_api/utils/rehash_utils.hpp"
#include "src/buildtool/file_system/object_type.hpp"
#include "src/utils/cpp/expected.hpp"
@@ -92,10 +92,11 @@ auto EnsureAbsentRootOnServe(
ArtifactDigest remote_digest = *native_digest;
if (compat_storage_config != nullptr) {
// in compatible mode, get compatible digest from mapping, if exists
- auto cached_obj = MRApiUtils::ReadRehashedDigest(*native_digest,
- *native_storage_config,
- *compat_storage_config,
- /*from_git=*/true);
+ auto cached_obj =
+ RehashUtils::ReadRehashedDigest(*native_digest,
+ *native_storage_config,
+ *compat_storage_config,
+ /*from_git=*/true);
if (not cached_obj) {
(*logger)(cached_obj.error(), /*fatal=*/true);
return false;