From 3c64357cec1ff484e4b410eff47c8b7006e55c66 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Mon, 13 Jun 2022 13:30:13 +0200 Subject: LocalCAS: Add singleton pattern --- src/buildtool/execution_api/local/local_cas.hpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') 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& { + static auto instance = LocalCAS{}; + return instance; + } + [[nodiscard]] auto StoreBlobFromBytes(std::string const& bytes) const noexcept -> std::optional { return StoreBlob(bytes, /*is_owner=*/true); -- cgit v1.2.3