diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-06-13 13:30:13 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2022-06-13 15:39:47 +0200 |
commit | 3c64357cec1ff484e4b410eff47c8b7006e55c66 (patch) | |
tree | 670b905431e23fb5d612e526e6b9c9b6ef618c6f /src | |
parent | 14c6648c71b4b8a12ac0905ff23fcd4de7f0556f (diff) | |
download | justbuild-3c64357cec1ff484e4b410eff47c8b7006e55c66.tar.gz |
LocalCAS: Add singleton pattern
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/execution_api/local/local_cas.hpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/buildtool/execution_api/local/local_cas.hpp b/src/buildtool/execution_api/local/local_cas.hpp index ea10b638..f8efbb6a 100644 --- a/src/buildtool/execution_api/local/local_cas.hpp +++ b/src/buildtool/execution_api/local/local_cas.hpp @@ -23,6 +23,11 @@ class LocalCAS { auto operator=(LocalCAS&&) -> LocalCAS& = delete; ~LocalCAS() noexcept = default; + [[nodiscard]] static auto Instance() noexcept -> LocalCAS<kType>& { + static auto instance = LocalCAS<kType>{}; + return instance; + } + [[nodiscard]] auto StoreBlobFromBytes(std::string const& bytes) const noexcept -> std::optional<bazel_re::Digest> { return StoreBlob(bytes, /*is_owner=*/true); |