From 9a164558010af84d834dee86f1929bd6582a1ccb Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Wed, 4 Dec 2024 14:47:50 +0100 Subject: GitCAS: remove mutex and locks ...since there are no unique_locks any more. --- src/buildtool/file_system/git_cas.cpp | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'src/buildtool/file_system/git_cas.cpp') diff --git a/src/buildtool/file_system/git_cas.cpp b/src/buildtool/file_system/git_cas.cpp index c72da3fc..7e004934 100644 --- a/src/buildtool/file_system/git_cas.cpp +++ b/src/buildtool/file_system/git_cas.cpp @@ -150,15 +150,12 @@ auto GitCAS::ReadObject(std::string const& id, bool is_hex_id) const noexcept } git_odb_object* obj = nullptr; - { - std::shared_lock lock{mutex_}; - if (git_odb_read(&obj, odb_.get(), &oid.value()) != 0) { - Logger::Log(LogLevel::Error, - "reading git object {} from database failed with:\n{}", - is_hex_id ? id : ToHexString(id), - GitLastError()); - return std::nullopt; - } + if (git_odb_read(&obj, odb_.get(), &oid.value()) != 0) { + Logger::Log(LogLevel::Error, + "reading git object {} from database failed with:\n{}", + is_hex_id ? id : ToHexString(id), + GitLastError()); + return std::nullopt; } std::string data(static_cast(git_odb_object_data(obj)), @@ -183,16 +180,13 @@ auto GitCAS::ReadHeader(std::string const& id, bool is_hex_id) const noexcept std::size_t size{}; git_object_t type{}; - { - std::shared_lock lock{mutex_}; - if (git_odb_read_header(&size, &type, odb_.get(), &oid.value()) != 0) { - Logger::Log(LogLevel::Error, - "reading git object header {} from database failed " - "with:\n{}", - is_hex_id ? id : ToHexString(id), - GitLastError()); - return std::nullopt; - } + if (git_odb_read_header(&size, &type, odb_.get(), &oid.value()) != 0) { + Logger::Log(LogLevel::Error, + "reading git object header {} from database failed " + "with:\n{}", + is_hex_id ? id : ToHexString(id), + GitLastError()); + return std::nullopt; } if (auto obj_type = GitTypeToObjectType(type)) { -- cgit v1.2.3