aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-05-21 20:43:36 +0200
committerStefan Boberg <[email protected]>2021-05-21 20:43:36 +0200
commitedb2ea0cae30aeac74d1d48ab9754754f010c818 (patch)
tree5b0fc3aa38ea21cdf06c004ee7acf2915d5a369f
parentPartial refactoring of structured cache implementation - WIP (diff)
downloadzen-edb2ea0cae30aeac74d1d48ab9754754f010c818.tar.xz
zen-edb2ea0cae30aeac74d1d48ab9754754f010c818.zip
Renamed CasBlobFile -> BasicFile
-rw-r--r--zenserver/projectstore.cpp6
-rw-r--r--zenstore/basicfile.cpp12
-rw-r--r--zenstore/compactcas.h4
-rw-r--r--zenstore/include/zenstore/basicfile.h6
4 files changed, 16 insertions, 12 deletions
diff --git a/zenserver/projectstore.cpp b/zenserver/projectstore.cpp
index e30742e33..c99fa4232 100644
--- a/zenserver/projectstore.cpp
+++ b/zenserver/projectstore.cpp
@@ -229,7 +229,7 @@ private:
std::filesystem::path m_OplogStoragePath;
RwLock m_RwLock;
TCasLogFile<OplogEntry> m_Oplog;
- CasBlobFile m_OpBlobs;
+ BasicFile m_OpBlobs;
std::atomic<uint64_t> m_NextOpsOffset{0};
uint64_t m_OpsAlign = 32;
std::atomic<uint32_t> m_MaxLsn{0};
@@ -463,7 +463,7 @@ ProjectStore::Project::Read()
spdlog::info("reading config for project '{}' from {}", Identifier, ProjectStateFilePath);
- CasBlobFile Blob;
+ BasicFile Blob;
Blob.Open(ProjectStateFilePath, false);
IoBuffer Obj = Blob.ReadAll();
@@ -504,7 +504,7 @@ ProjectStore::Project::Write()
spdlog::info("persisting config for project '{}' to {}", Identifier, ProjectStateFilePath);
- CasBlobFile Blob;
+ BasicFile Blob;
Blob.Open(ProjectStateFilePath, true);
Blob.Write(Mem.Data(), Mem.Size(), 0);
Blob.Flush();
diff --git a/zenstore/basicfile.cpp b/zenstore/basicfile.cpp
index 961e43735..05af4f792 100644
--- a/zenstore/basicfile.cpp
+++ b/zenstore/basicfile.cpp
@@ -11,7 +11,7 @@ namespace zen {
using namespace fmt::literals;
void
-CasBlobFile::Open(std::filesystem::path FileName, bool isCreate)
+BasicFile::Open(std::filesystem::path FileName, bool isCreate)
{
const DWORD dwCreationDisposition = isCreate ? CREATE_ALWAYS : OPEN_EXISTING;
@@ -24,7 +24,7 @@ CasBlobFile::Open(std::filesystem::path FileName, bool isCreate)
}
void
-CasBlobFile::Read(void* Data, uint64_t Size, uint64_t Offset)
+BasicFile::Read(void* Data, uint64_t Size, uint64_t Offset)
{
OVERLAPPED Ovl{};
@@ -42,7 +42,7 @@ CasBlobFile::Read(void* Data, uint64_t Size, uint64_t Offset)
}
IoBuffer
-CasBlobFile::ReadAll()
+BasicFile::ReadAll()
{
IoBuffer Buffer(FileSize());
@@ -52,7 +52,7 @@ CasBlobFile::ReadAll()
}
void
-CasBlobFile::Write(const void* Data, uint64_t Size, uint64_t Offset)
+BasicFile::Write(const void* Data, uint64_t Size, uint64_t Offset)
{
OVERLAPPED Ovl{};
@@ -68,13 +68,13 @@ CasBlobFile::Write(const void* Data, uint64_t Size, uint64_t Offset)
}
void
-CasBlobFile::Flush()
+BasicFile::Flush()
{
m_File.Flush();
}
uint64_t
-CasBlobFile::FileSize()
+BasicFile::FileSize()
{
ULONGLONG Sz;
m_File.GetSize(Sz);
diff --git a/zenstore/compactcas.h b/zenstore/compactcas.h
index abea83dbd..3ce91cc52 100644
--- a/zenstore/compactcas.h
+++ b/zenstore/compactcas.h
@@ -53,8 +53,8 @@ private:
CasStore::Stats& m_Stats;
uint64_t m_PayloadAlignment = 1 << 4;
bool m_IsInitialized = false;
- CasBlobFile m_SmallObjectFile;
- CasBlobFile m_SmallObjectIndex;
+ BasicFile m_SmallObjectFile;
+ BasicFile m_SmallObjectIndex;
TCasLogFile<CasDiskIndexEntry> m_CasLog;
RwLock m_LocationMapLock;
diff --git a/zenstore/include/zenstore/basicfile.h b/zenstore/include/zenstore/basicfile.h
index e3d218a78..ac4f48744 100644
--- a/zenstore/include/zenstore/basicfile.h
+++ b/zenstore/include/zenstore/basicfile.h
@@ -12,7 +12,11 @@
namespace zen {
-class CasBlobFile
+/**
+ * Probably the most basic file abstraction in the universe
+ */
+
+class BasicFile
{
public:
void Open(std::filesystem::path FileName, bool IsCreate);