aboutsummaryrefslogtreecommitdiff
path: root/zenstore/compactcas.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zenstore/compactcas.cpp')
-rw-r--r--zenstore/compactcas.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/zenstore/compactcas.cpp b/zenstore/compactcas.cpp
index fe38f0fde..f17b8d376 100644
--- a/zenstore/compactcas.cpp
+++ b/zenstore/compactcas.cpp
@@ -5,6 +5,7 @@
#include "CompactCas.h"
#include <zencore/except.h>
+#include <zencore/logging.h>
#include <zencore/memory.h>
#include <zencore/string.h>
#include <zencore/thread.h>
@@ -32,7 +33,9 @@ CasContainerStrategy::Initialize(const std::string_view ContainerBaseName, uint6
ZEN_ASSERT(IsPow2(Alignment));
ZEN_ASSERT(!m_IsInitialized);
- m_PayloadAlignment = Alignment;
+ m_ContainerBaseName = ContainerBaseName;
+ m_PayloadAlignment = Alignment;
+
std::string BaseName(ContainerBaseName);
std::filesystem::path SobsPath = m_Config.RootDirectory / (BaseName + ".ucas");
std::filesystem::path SidxPath = m_Config.RootDirectory / (BaseName + ".uidx");
@@ -210,7 +213,7 @@ CasContainerStrategy::Scrub(ScrubContext& Ctx)
continue;
}
- const IoHash ComputedHash = IoHash::HashBuffer(BufferBase, Entry.second.Size);
+ const IoHash ComputedHash = IoHash::HashBuffer(reinterpret_cast<uint8_t*>(BufferBase) + Entry.second.Offset - WindowStart, Entry.second.Size);
if (Entry.first != ComputedHash)
{
@@ -242,6 +245,13 @@ CasContainerStrategy::Scrub(ScrubContext& Ctx)
}
}
+ if (BadChunks.empty())
+ {
+ return;
+ }
+
+ ZEN_ERROR("Scrubbing found {} bad chunks in '{}'", BadChunks.size(), m_ContainerBaseName);
+
// Deal with bad chunks by removing them from our lookup map
std::vector<IoHash> BadChunkHashes;