From da0ca23fa55f7e900853bdfd06523b78fce32259 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Sat, 28 May 2022 00:29:17 +0200 Subject: Enable FILE_SHARE_DELETE on standalone files in disk buckets This allows us to delete the file even if it is open for read. We do a delete, the rename since we are not allowed to do a rename-overwrite, only delete. As we have the shard lock for the file we want to replace we can safely do a delete+rename. In the rare case that we fail to rename the file into place the old data is lost. As this is a *cache* and it should be very rare this is OK. --- zencore/include/zencore/iobuffer.h | 1 + 1 file changed, 1 insertion(+) (limited to 'zencore/include') diff --git a/zencore/include/zencore/iobuffer.h b/zencore/include/zencore/iobuffer.h index 5d9daa1c7..bf658922d 100644 --- a/zencore/include/zencore/iobuffer.h +++ b/zencore/include/zencore/iobuffer.h @@ -403,6 +403,7 @@ class IoBufferBuilder { public: ZENCORE_API static IoBuffer MakeFromFile(const std::filesystem::path& FileName, uint64_t Offset = 0, uint64_t Size = ~0ull); + ZENCORE_API static IoBuffer MakeFromFileWithSharedDelete(const std::filesystem::path& FileName); ZENCORE_API static IoBuffer MakeFromTemporaryFile(const std::filesystem::path& FileName); ZENCORE_API static IoBuffer MakeFromFileHandle(void* FileHandle, uint64_t Offset = 0, uint64_t Size = ~0ull); ZENCORE_API static IoBuffer ReadFromFileMaybe(IoBuffer& InBuffer); -- cgit v1.2.3