aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore/compactcas.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2024-12-05 12:44:27 +0100
committerGitHub Enterprise <[email protected]>2024-12-05 12:44:27 +0100
commit7ca7e683224918808a3a0dd8cd0a6953cc79cb4c (patch)
treea2d92895843e37292945e673642a338341f3a036 /src/zenstore/compactcas.cpp
parentenable LTO / optimize for speed (#256) (diff)
downloadzen-7ca7e683224918808a3a0dd8cd0a6953cc79cb4c.tar.xz
zen-7ca7e683224918808a3a0dd8cd0a6953cc79cb4c.zip
Unity build fixes (#253)
some fixes to make everything build using unity build mode. Mostly moved code from anonymous namespaces into local impl namespace to avoid ambiguity in name resolution.
Diffstat (limited to 'src/zenstore/compactcas.cpp')
-rw-r--r--src/zenstore/compactcas.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/zenstore/compactcas.cpp b/src/zenstore/compactcas.cpp
index f85b19264..9aa4ff613 100644
--- a/src/zenstore/compactcas.cpp
+++ b/src/zenstore/compactcas.cpp
@@ -65,7 +65,7 @@ struct CasDiskIndexHeader
static_assert(sizeof(CasDiskIndexHeader) == 32);
-namespace {
+namespace cas::impl {
const char* IndexExtension = ".uidx";
const char* LogExtension = ".ulog";
@@ -124,17 +124,17 @@ namespace {
return true;
}
-} // namespace
+} // namespace cas::impl
//////////////////////////////////////////////////////////////////////////
-static const float IndexMinLoadFactor = 0.2f;
-static const float IndexMaxLoadFactor = 0.7f;
-
CasContainerStrategy::CasContainerStrategy(GcManager& Gc) : m_Log(logging::Get("containercas")), m_Gc(Gc)
{
ZEN_MEMSCOPE(GetCasContainerTag());
+ const float IndexMinLoadFactor = 0.2f;
+ const float IndexMaxLoadFactor = 0.7f;
+
m_LocationMap.min_load_factor(IndexMinLoadFactor);
m_LocationMap.max_load_factor(IndexMaxLoadFactor);
@@ -165,7 +165,7 @@ CasContainerStrategy::Initialize(const std::filesystem::path& RootDirectory,
m_ContainerBaseName = ContainerBaseName;
m_PayloadAlignment = Alignment;
m_MaxBlockSize = MaxBlockSize;
- m_BlocksBasePath = GetBlocksBasePath(m_RootDirectory, m_ContainerBaseName);
+ m_BlocksBasePath = cas::impl::GetBlocksBasePath(m_RootDirectory, m_ContainerBaseName);
OpenContainer(IsNewStore);
@@ -919,8 +919,8 @@ CasContainerStrategy::MakeIndexSnapshot()
namespace fs = std::filesystem;
- fs::path IndexPath = GetIndexPath(m_RootDirectory, m_ContainerBaseName);
- fs::path TempIndexPath = GetTempIndexPath(m_RootDirectory, m_ContainerBaseName);
+ fs::path IndexPath = cas::impl::GetIndexPath(m_RootDirectory, m_ContainerBaseName);
+ fs::path TempIndexPath = cas::impl::GetTempIndexPath(m_RootDirectory, m_ContainerBaseName);
// Move index away, we keep it if something goes wrong
if (fs::is_regular_file(TempIndexPath))
@@ -1054,7 +1054,7 @@ CasContainerStrategy::ReadIndexFile(const std::filesystem::path& IndexPath, uint
std::string InvalidEntryReason;
for (const CasDiskIndexEntry& Entry : Entries)
{
- if (!ValidateEntry(Entry, InvalidEntryReason))
+ if (!cas::impl::ValidateEntry(Entry, InvalidEntryReason))
{
ZEN_WARN("skipping invalid entry in '{}', reason: '{}'", IndexPath, InvalidEntryReason);
continue;
@@ -1121,7 +1121,7 @@ CasContainerStrategy::ReadLog(const std::filesystem::path& LogPath, uint64_t Ski
m_LocationMap.erase(Record.Key);
return;
}
- if (!ValidateEntry(Record, InvalidEntryReason))
+ if (!cas::impl::ValidateEntry(Record, InvalidEntryReason))
{
ZEN_WARN("skipping invalid entry in '{}', reason: '{}'", LogPath, InvalidEntryReason);
return;
@@ -1147,7 +1147,7 @@ CasContainerStrategy::OpenContainer(bool IsNewStore)
m_LocationMap.clear();
m_Locations.clear();
- std::filesystem::path BasePath = GetBasePath(m_RootDirectory, m_ContainerBaseName);
+ std::filesystem::path BasePath = cas::impl::GetBasePath(m_RootDirectory, m_ContainerBaseName);
if (IsNewStore)
{
@@ -1158,8 +1158,8 @@ CasContainerStrategy::OpenContainer(bool IsNewStore)
m_BlockStore.Initialize(m_BlocksBasePath, m_MaxBlockSize, BlockStoreDiskLocation::MaxBlockIndex + 1);
- std::filesystem::path LogPath = GetLogPath(m_RootDirectory, m_ContainerBaseName);
- std::filesystem::path IndexPath = GetIndexPath(m_RootDirectory, m_ContainerBaseName);
+ std::filesystem::path LogPath = cas::impl::GetLogPath(m_RootDirectory, m_ContainerBaseName);
+ std::filesystem::path IndexPath = cas::impl::GetIndexPath(m_RootDirectory, m_ContainerBaseName);
if (std::filesystem::is_regular_file(IndexPath))
{