diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-05-24 11:01:03 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-05-27 16:36:58 +0200 |
commit | 1c6acd97737f4d49b5e0d1dbb97e3c1d75d0e145 (patch) | |
tree | 135a90a6085d3e7205349c2f39759db5701f388b /src/buildtool/execution_api/local/local_cas_reader.hpp | |
parent | 20afd06b78c614299dc05e2044fc8ffe5dfa5977 (diff) | |
download | justbuild-1c6acd97737f4d49b5e0d1dbb97e3c1d75d0e145.tar.gz |
Use common interface for reading tree entries and leafs
...in LocalApi and BazelApi.
Diffstat (limited to 'src/buildtool/execution_api/local/local_cas_reader.hpp')
-rw-r--r-- | src/buildtool/execution_api/local/local_cas_reader.hpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/buildtool/execution_api/local/local_cas_reader.hpp b/src/buildtool/execution_api/local/local_cas_reader.hpp new file mode 100644 index 00000000..69baf3a9 --- /dev/null +++ b/src/buildtool/execution_api/local/local_cas_reader.hpp @@ -0,0 +1,39 @@ +// Copyright 2024 Huawei Cloud Computing Technology Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef INCLUDED_SRC_BUILDTOOL_EXECUTION_API_LOCAL_LOCAL_CAS_READER_HPP +#define INCLUDED_SRC_BUILDTOOL_EXECUTION_API_LOCAL_LOCAL_CAS_READER_HPP + +#include <optional> + +#include "src/buildtool/common/artifact_digest.hpp" +#include "src/buildtool/common/bazel_types.hpp" +#include "src/buildtool/file_system/git_repo.hpp" +#include "src/buildtool/storage/local_cas.hpp" + +class LocalCasReader final { + public: + explicit LocalCasReader(LocalCAS<true> const& cas) noexcept : cas_(cas) {} + + [[nodiscard]] auto ReadDirectory(ArtifactDigest const& digest) + const noexcept -> std::optional<bazel_re::Directory>; + + [[nodiscard]] auto ReadGitTree(ArtifactDigest const& digest) const noexcept + -> std::optional<GitRepo::tree_entries_t>; + + private: + LocalCAS<true> const& cas_; +}; + +#endif // INCLUDED_SRC_BUILDTOOL_EXECUTION_API_LOCAL_LOCAL_CAS_READER_HPP
\ No newline at end of file |