summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api/local/local_storage.hpp
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2022-07-07 17:28:29 +0200
committerSascha Roloff <sascha.roloff@huawei.com>2022-08-05 14:41:31 +0200
commitdaca274041e31636f08927b0cebc56fd33c7bbdf (patch)
treed6b2c838d92abf7b4a4e98557359edf68fb84bcc /src/buildtool/execution_api/local/local_storage.hpp
parent13fd883b8cfa9531523f3113b32794f803c1176a (diff)
downloadjustbuild-daca274041e31636f08927b0cebc56fd33c7bbdf.tar.gz
LocalExecution: Use Git tree format
- LocalStorage Add tree CAS and support reading Git trees - LocalAction: Create Git tree for output directory - LocalApi: Support availability and upload of Git trees - LocalStorage: Support dumping tree to stream in native mode
Diffstat (limited to 'src/buildtool/execution_api/local/local_storage.hpp')
-rw-r--r--src/buildtool/execution_api/local/local_storage.hpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/buildtool/execution_api/local/local_storage.hpp b/src/buildtool/execution_api/local/local_storage.hpp
index 4560a859..4ffe2881 100644
--- a/src/buildtool/execution_api/local/local_storage.hpp
+++ b/src/buildtool/execution_api/local/local_storage.hpp
@@ -43,6 +43,11 @@ class LocalStorage {
: cas_file_.StoreBlobFromBytes(bytes);
}
+ [[nodiscard]] auto StoreTree(std::string const& bytes) const noexcept
+ -> std::optional<bazel_re::Digest> {
+ return cas_tree_.StoreBlobFromBytes(bytes);
+ }
+
/// \brief Obtain blob path from digest with x-bit.
/// NOLINTNEXTLINE(misc-no-recursion)
[[nodiscard]] auto BlobPath(bazel_re::Digest const& digest,
@@ -53,6 +58,11 @@ class LocalStorage {
return path ? path : TrySyncBlob(digest, is_executable);
}
+ [[nodiscard]] auto TreePath(bazel_re::Digest const& digest) const noexcept
+ -> std::optional<std::filesystem::path> {
+ return cas_tree_.BlobPath(digest);
+ }
+
[[nodiscard]] auto StoreActionResult(
bazel_re::Digest const& action_id,
bazel_re::ActionResult const& result) const noexcept -> bool {
@@ -70,13 +80,14 @@ class LocalStorage {
-> std::optional<std::pair<std::vector<std::filesystem::path>,
std::vector<Artifact::ObjectInfo>>>;
- [[nodiscard]] auto DumpToStream(
- Artifact::ObjectInfo const& info,
- gsl::not_null<FILE*> const& stream) const noexcept -> bool;
+ [[nodiscard]] auto DumpToStream(Artifact::ObjectInfo const& info,
+ gsl::not_null<FILE*> const& stream,
+ bool raw_tree) const noexcept -> bool;
private:
LocalCAS<ObjectType::File> cas_file_{};
LocalCAS<ObjectType::Executable> cas_exec_{};
+ LocalCAS<ObjectType::Tree> cas_tree_{};
LocalAC ac_{&cas_file_};
std::shared_ptr<LocalTreeMap> tree_map_;