diff options
Diffstat (limited to 'zenstore/blockstore.cpp')
| -rw-r--r-- | zenstore/blockstore.cpp | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/zenstore/blockstore.cpp b/zenstore/blockstore.cpp index 3d2d77b4e..350d9bb39 100644 --- a/zenstore/blockstore.cpp +++ b/zenstore/blockstore.cpp @@ -24,7 +24,6 @@ BlockStoreFile::BlockStoreFile(const std::filesystem::path& BlockPath) : m_Path( BlockStoreFile::~BlockStoreFile() { - RwLock::ExclusiveLockScope _(m_FileLock); m_IoBuffer = IoBuffer(); m_File.Detach(); } @@ -38,11 +37,6 @@ BlockStoreFile::GetPath() const void BlockStoreFile::Open() { - RwLock::ExclusiveLockScope _(m_FileLock); - if (m_File.Handle()) - { - return; - } m_File.Open(m_Path, BasicFile::EMode::kDelete); void* FileHandle = m_File.Handle(); m_IoBuffer = IoBuffer(IoBuffer::File, FileHandle, 0, m_File.FileSize()); @@ -51,8 +45,6 @@ BlockStoreFile::Open() void BlockStoreFile::Create(uint64_t InitialSize) { - RwLock::ExclusiveLockScope _(m_FileLock); - auto ParentPath = m_Path.parent_path(); if (!std::filesystem::is_directory(ParentPath)) { @@ -71,24 +63,13 @@ BlockStoreFile::Create(uint64_t InitialSize) uint64_t BlockStoreFile::FileSize() { - RwLock::SharedLockScope _(m_FileLock); return m_File.FileSize(); } void BlockStoreFile::MarkAsDeleteOnClose(std::error_code& Ec) { - RwLock::ExclusiveLockScope _(m_FileLock); - if (m_File.Handle()) - { - m_File.MarkAsDeleteOnClose(Ec); - return; - } - if (std::filesystem::is_regular_file(m_Path)) - { - Ec.clear(); - std::filesystem::remove(m_Path, Ec); - } + m_File.MarkAsDeleteOnClose(Ec); } IoBuffer @@ -100,32 +81,24 @@ BlockStoreFile::GetChunk(uint64_t Offset, uint64_t Size) void BlockStoreFile::Read(void* Data, uint64_t Size, uint64_t FileOffset) { - RwLock::SharedLockScope _(m_FileLock); m_File.Read(Data, Size, FileOffset); } void BlockStoreFile::Write(const void* Data, uint64_t Size, uint64_t FileOffset) { - RwLock::SharedLockScope _(m_FileLock); m_File.Write(Data, Size, FileOffset); } void BlockStoreFile::Flush() { - RwLock::ExclusiveLockScope _(m_FileLock); - if (!m_File.Handle()) - { - return; - } m_File.Flush(); } void BlockStoreFile::StreamByteRange(uint64_t FileOffset, uint64_t Size, std::function<void(const void* Data, uint64_t Size)>&& ChunkFun) { - RwLock::SharedLockScope _(m_FileLock); m_File.StreamByteRange(FileOffset, Size, std::move(ChunkFun)); } |