aboutsummaryrefslogtreecommitdiff
path: root/zenstore/include
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-05-08 00:11:11 +0200
committerDan Engelbrecht <[email protected]>2022-05-08 00:11:11 +0200
commit308d60e0289b2adc5c0738fe25273176e780735f (patch)
treede40771ed96d013992eb0c502317ea76940827fe /zenstore/include
parentInitialize upstream apply in background thread (#88) (diff)
downloadzen-308d60e0289b2adc5c0738fe25273176e780735f.tar.xz
zen-308d60e0289b2adc5c0738fe25273176e780735f.zip
Make sure blockstore owner and block store state does not get out of sync when fetching a chunk
Move MarkAsDeleteOnClose() to IoBuffer(ExtendedCore) and set it on close, SetFileInformationByHandle sometimes fails if done in parallel with FileMapping
Diffstat (limited to 'zenstore/include')
-rw-r--r--zenstore/include/zenstore/basicfile.h12
-rw-r--r--zenstore/include/zenstore/blockstore.h6
2 files changed, 9 insertions, 9 deletions
diff --git a/zenstore/include/zenstore/basicfile.h b/zenstore/include/zenstore/basicfile.h
index 5a500c65f..ce9988776 100644
--- a/zenstore/include/zenstore/basicfile.h
+++ b/zenstore/include/zenstore/basicfile.h
@@ -33,11 +33,12 @@ public:
enum class Mode : uint32_t
{
- kRead = 0, // Opens a existing file for read only
- kWrite = 1, // Opens (or creates) a file for read and write
- kTruncate = 2, // Opens (or creates) a file for read and write and sets the size to zero
- kDelete = 3, // Opens (or creates) a file for read and write enabling MarkAsDeleteOnClose()
- kTruncateDelete = 4 // Opens (or creates) a file for read and write and sets the size to zero enabling MarkAsDeleteOnClose()
+ kRead = 0, // Opens a existing file for read only
+ kWrite = 1, // Opens (or creates) a file for read and write
+ kTruncate = 2, // Opens (or creates) a file for read and write and sets the size to zero
+ kDelete = 3, // Opens (or creates) a file for read and write allowing .DeleteFile file disposition to be set
+ kTruncateDelete =
+ 4 // Opens (or creates) a file for read and write and sets the size to zero allowing .DeleteFile file disposition to be set
};
void Open(const std::filesystem::path& FileName, Mode Mode);
@@ -55,7 +56,6 @@ public:
void SetFileSize(uint64_t FileSize);
IoBuffer ReadAll();
void WriteAll(IoBuffer Data, std::error_code& Ec);
- void MarkAsDeleteOnClose(std::error_code& Ec);
void* Detach();
inline void* Handle() { return m_FileHandle; }
diff --git a/zenstore/include/zenstore/blockstore.h b/zenstore/include/zenstore/blockstore.h
index 9edfc36e8..34c475fb6 100644
--- a/zenstore/include/zenstore/blockstore.h
+++ b/zenstore/include/zenstore/blockstore.h
@@ -89,7 +89,7 @@ struct BlockStoreFile : public RefCounted
const std::filesystem::path& GetPath() const;
void Open();
void Create(uint64_t InitialSize);
- void MarkAsDeleteOnClose(std::error_code& Ec);
+ void MarkAsDeleteOnClose();
uint64_t FileSize();
IoBuffer GetChunk(uint64_t Offset, uint64_t Size);
void Read(void* Data, uint64_t Size, uint64_t FileOffset);
@@ -133,8 +133,8 @@ public:
void WriteChunk(const void* Data, uint64_t Size, uint64_t Alignment, WriteChunkCallback Callback);
- Ref<BlockStoreFile> GetChunkBlock(const BlockStoreLocation& Location);
- void Flush();
+ IoBuffer TryGetChunk(const BlockStoreLocation& Location);
+ void Flush();
ReclaimSnapshotState GetReclaimSnapshotState();
void ReclaimSpace(