diff options
| author | Dan Engelbrecht <[email protected]> | 2024-08-12 10:52:54 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-08-12 10:52:54 +0200 |
| commit | cb9d622042f7f649ae626d5e8237932536fe1725 (patch) | |
| tree | 5cff4a2299c33b5912bb71266f5328703cf84e3b /src/zenserver/projectstore/projectstore.cpp | |
| parent | project/oplog delete improvements (#105) (diff) | |
| download | zen-cb9d622042f7f649ae626d5e8237932536fe1725.tar.xz zen-cb9d622042f7f649ae626d5e8237932536fe1725.zip | |
make oplog lsn unsigned (#107)
* change oplog lsn to uint32
Diffstat (limited to 'src/zenserver/projectstore/projectstore.cpp')
| -rw-r--r-- | src/zenserver/projectstore/projectstore.cpp | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp index a0dbed741..438943f75 100644 --- a/src/zenserver/projectstore/projectstore.cpp +++ b/src/zenserver/projectstore/projectstore.cpp @@ -694,7 +694,7 @@ ProjectStore::Oplog::ScrubStorage(ScrubContext& Ctx) using namespace std::literals; - IterateOplogWithKey([&](int Lsn, const Oid& Key, CbObjectView Op) { + IterateOplogWithKey([&](uint32_t Lsn, const Oid& Key, CbObjectView Op) { ZEN_UNUSED(Lsn); std::vector<IoHash> Cids; @@ -1209,7 +1209,7 @@ ProjectStore::Oplog::GetOplogEntryCount() const } void -ProjectStore::Oplog::IterateOplogWithKey(std::function<void(int, const Oid&, CbObjectView)>&& Handler) +ProjectStore::Oplog::IterateOplogWithKey(std::function<void(uint32_t, const Oid&, CbObjectView)>&& Handler) { RwLock::SharedLockScope _(m_OplogLock); if (!m_Storage) @@ -1219,7 +1219,7 @@ ProjectStore::Oplog::IterateOplogWithKey(std::function<void(int, const Oid&, CbO std::vector<OplogEntryAddress> SortedEntries; std::vector<Oid> SortedKeys; - std::vector<int> SortedLSNs; + std::vector<uint32_t> SortedLSNs; { const auto TargetEntryCount = m_LatestOpMap.size(); @@ -1227,7 +1227,7 @@ ProjectStore::Oplog::IterateOplogWithKey(std::function<void(int, const Oid&, CbO std::vector<size_t> EntryIndexes; std::vector<OplogEntryAddress> Entries; std::vector<Oid> Keys; - std::vector<int> LSNs; + std::vector<uint32_t> LSNs; Entries.reserve(TargetEntryCount); EntryIndexes.reserve(TargetEntryCount); @@ -1270,7 +1270,7 @@ ProjectStore::Oplog::IterateOplogWithKey(std::function<void(int, const Oid&, CbO }); } -int +std::optional<uint32_t> ProjectStore::Oplog::GetOpIndexByKey(const Oid& Key) { RwLock::SharedLockScope _(m_OplogLock); @@ -1282,18 +1282,7 @@ ProjectStore::Oplog::GetOpIndexByKey(const Oid& Key) { return LatestOp->second; } - return -1; -} - -int -ProjectStore::Oplog::GetMaxOpIndex() const -{ - RwLock::SharedLockScope _(m_OplogLock); - if (!m_Storage) - { - return -1; - } - return gsl::narrow<int>(m_Storage->GetMaxLsn()); + return {}; } std::optional<CbObject> @@ -1317,7 +1306,7 @@ ProjectStore::Oplog::GetOpByKey(const Oid& Key) } std::optional<CbObject> -ProjectStore::Oplog::GetOpByIndex(int Index) +ProjectStore::Oplog::GetOpByIndex(uint32_t Index) { RwLock::SharedLockScope _(m_OplogLock); if (!m_Storage) @@ -1413,7 +1402,7 @@ ProjectStore::Oplog::IterateCapturedLSNs(std::function<bool(const CbObjectView& { return; } - for (int UpdatedLSN : *m_CapturedLSNs) + for (uint32_t UpdatedLSN : *m_CapturedLSNs) { if (const auto AddressEntryIt = m_OpAddressMap.find(UpdatedLSN); AddressEntryIt != m_OpAddressMap.end()) { @@ -3665,7 +3654,7 @@ ProjectStore::Rpc(HttpServerRequest& HttpReq, // Snapshot all referenced files. This brings the content of all // files into the CID store - int OpCount = 0; + uint32_t OpCount = 0; uint64_t InlinedBytes = 0; uint64_t InlinedFiles = 0; uint64_t TotalBytes = 0; |