diff options
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 |