diff options
| author | Stefan Boberg <[email protected]> | 2021-05-21 20:40:09 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-05-21 20:40:09 +0200 |
| commit | 83e3c364e6403883cd60e7dda10165b6e84269f3 (patch) | |
| tree | dc190b846bc73968988690880cdf1f5f8f6aaeb0 /zenstore/caslog.cpp | |
| parent | Merge branch 'jupiter-structured' of https://github.com/EpicGames/zen into ju... (diff) | |
| download | zen-83e3c364e6403883cd60e7dda10165b6e84269f3.tar.xz zen-83e3c364e6403883cd60e7dda10165b6e84269f3.zip | |
Moved CasBlobFile into basicfile.h
Diffstat (limited to 'zenstore/caslog.cpp')
| -rw-r--r-- | zenstore/caslog.cpp | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/zenstore/caslog.cpp b/zenstore/caslog.cpp index c648cea5e..4b9aacb42 100644 --- a/zenstore/caslog.cpp +++ b/zenstore/caslog.cpp @@ -152,78 +152,4 @@ CasLogFile::Flush() m_File.Flush(); } -////////////////////////////////////////////////////////////////////////// - -void -CasBlobFile::Open(std::filesystem::path FileName, bool isCreate) -{ - const DWORD dwCreationDisposition = isCreate ? CREATE_ALWAYS : OPEN_EXISTING; - - HRESULT hRes = m_File.Create(FileName.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, dwCreationDisposition); - - if (FAILED(hRes)) - { - throw std::system_error(GetLastError(), std::system_category(), "Failed to open bucket sobs file '{}'"_format(FileName)); - } -} - -void -CasBlobFile::Read(void* Data, uint64_t Size, uint64_t Offset) -{ - OVERLAPPED Ovl{}; - - Ovl.Offset = DWORD(Offset & 0xffff'ffffu); - Ovl.OffsetHigh = DWORD(Offset >> 32); - - HRESULT hRes = m_File.Read(Data, gsl::narrow<DWORD>(Size), &Ovl); - - if (FAILED(hRes)) - { - throw std::system_error(GetLastError(), - std::system_category(), - "Failed to read from file '{}'"_format(zen::PathFromHandle(m_File))); - } -} - -IoBuffer -CasBlobFile::ReadAll() -{ - IoBuffer Buffer(FileSize()); - - Read((void*)Buffer.Data(), Buffer.Size(), 0); - - return Buffer; -} - -void -CasBlobFile::Write(const void* Data, uint64_t Size, uint64_t Offset) -{ - OVERLAPPED Ovl{}; - - Ovl.Offset = DWORD(Offset & 0xffff'ffffu); - Ovl.OffsetHigh = DWORD(Offset >> 32); - - HRESULT hRes = m_File.Write(Data, gsl::narrow<DWORD>(Size), &Ovl); - - if (FAILED(hRes)) - { - throw std::system_error(GetLastError(), std::system_category(), "Failed to write to file '{}'"_format(zen::PathFromHandle(m_File))); - } -} - -void -CasBlobFile::Flush() -{ - m_File.Flush(); -} - -uint64_t -CasBlobFile::FileSize() -{ - ULONGLONG Sz; - m_File.GetSize(Sz); - - return uint64_t(Sz); -} - } // namespace zen |