diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-10-06 12:18:25 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2022-10-07 13:30:06 +0200 |
commit | 51f8b186803292f111011d04d5291deb374dc34c (patch) | |
tree | 818606bb46be19cc56618f1d56eb5e3f309f4fae /src/buildtool/execution_api/common/local_tree_map.hpp | |
parent | 64b8da270611ebb997c3801f09bd06878aee026a (diff) | |
download | justbuild-51f8b186803292f111011d04d5291deb374dc34c.tar.gz |
LocalTreeMap: Prevent tree objects from being stored
... to align with the original idea of caching a flat list
of blob objects, without the need to recursively traverse
any trees. Consequently, we cannot create any map entry in
places where we do not have all sub-tree entries at hand
(e.g., LocalAPI, BazelAPI, BazelResponse).
Diffstat (limited to 'src/buildtool/execution_api/common/local_tree_map.hpp')
-rw-r--r-- | src/buildtool/execution_api/common/local_tree_map.hpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/buildtool/execution_api/common/local_tree_map.hpp b/src/buildtool/execution_api/common/local_tree_map.hpp index 2758c339..915c7a71 100644 --- a/src/buildtool/execution_api/common/local_tree_map.hpp +++ b/src/buildtool/execution_api/common/local_tree_map.hpp @@ -40,19 +40,23 @@ class LocalTreeMap { }; public: - /// \brief Maps blob locations to object infos. + /// \brief Maps blob paths to object infos. + /// Stores a flat list of blobs, without any trees. Subtrees are represented + /// by joining the tree segments for the blob's path. class LocalTree { friend class LocalTreeMap; public: /// \brief Add a new path and info pair to the tree. /// Path must not be absolute, empty, or contain dot-segments. + /// Object MUST NOT be a tree object. /// \param path The location to add the object info. /// \param info The object info to add. /// \returns true if successfully inserted or info existed before. [[nodiscard]] auto AddInfo(std::filesystem::path const& path, Artifact::ObjectInfo const& info) noexcept -> bool { + gsl_Expects(not IsTreeObject(info.type)); auto norm_path = path.lexically_normal(); if (norm_path.is_absolute() or norm_path.empty() or *norm_path.begin() == "..") { |