|
|
@ -8,17 +8,16 @@ |
|
|
|
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
|
|
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
|
|
#pragma once |
|
|
|
#pragma once |
|
|
|
|
|
|
|
|
|
|
|
#include <rocksdb/Status.h> |
|
|
|
#include <stdint.h> |
|
|
|
#include <rocksdb/env.h> |
|
|
|
#include <mutex> |
|
|
|
|
|
|
|
#include <string> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "rocksdb/Status.h" |
|
|
|
|
|
|
|
#include "rocksdb/env.h" |
|
|
|
#include "util/aligned_buffer.h" |
|
|
|
#include "util/aligned_buffer.h" |
|
|
|
|
|
|
|
|
|
|
|
#include <string> |
|
|
|
|
|
|
|
#include <stdint.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <Windows.h> |
|
|
|
#include <Windows.h> |
|
|
|
|
|
|
|
|
|
|
|
#include <mutex> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace rocksdb { |
|
|
|
namespace rocksdb { |
|
|
|
namespace port { |
|
|
|
namespace port { |
|
|
@ -26,9 +25,9 @@ namespace port { |
|
|
|
std::string GetWindowsErrSz(DWORD err); |
|
|
|
std::string GetWindowsErrSz(DWORD err); |
|
|
|
|
|
|
|
|
|
|
|
inline Status IOErrorFromWindowsError(const std::string& context, DWORD err) { |
|
|
|
inline Status IOErrorFromWindowsError(const std::string& context, DWORD err) { |
|
|
|
return ((err == ERROR_HANDLE_DISK_FULL) || (err == ERROR_DISK_FULL)) ? |
|
|
|
return ((err == ERROR_HANDLE_DISK_FULL) || (err == ERROR_DISK_FULL)) |
|
|
|
Status::NoSpace(context, GetWindowsErrSz(err)) : |
|
|
|
? Status::NoSpace(context, GetWindowsErrSz(err)) |
|
|
|
Status::IOError(context, GetWindowsErrSz(err)); |
|
|
|
: Status::IOError(context, GetWindowsErrSz(err)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
inline Status IOErrorFromLastWindowsError(const std::string& context) { |
|
|
|
inline Status IOErrorFromLastWindowsError(const std::string& context) { |
|
|
@ -36,9 +35,9 @@ inline Status IOErrorFromLastWindowsError(const std::string& context) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
inline Status IOError(const std::string& context, int err_number) { |
|
|
|
inline Status IOError(const std::string& context, int err_number) { |
|
|
|
return (err_number == ENOSPC) ? |
|
|
|
return (err_number == ENOSPC) |
|
|
|
Status::NoSpace(context, strerror(err_number)) :
|
|
|
|
? Status::NoSpace(context, strerror(err_number)) |
|
|
|
Status::IOError(context, strerror(err_number)); |
|
|
|
: Status::IOError(context, strerror(err_number)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Note the below two do not set errno because they are used only here in this
|
|
|
|
// Note the below two do not set errno because they are used only here in this
|
|
|
@ -54,49 +53,34 @@ inline int fsync(HANDLE hFile) { |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SSIZE_T pwrite(HANDLE hFile, const char* src, size_t numBytes, |
|
|
|
SSIZE_T pwrite(HANDLE hFile, const char* src, size_t numBytes, uint64_t offset); |
|
|
|
uint64_t offset); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SSIZE_T pread(HANDLE hFile, char* src, size_t numBytes, uint64_t offset); |
|
|
|
SSIZE_T pread(HANDLE hFile, char* src, size_t numBytes, uint64_t offset); |
|
|
|
|
|
|
|
|
|
|
|
Status fallocate(const std::string& filename, HANDLE hFile, |
|
|
|
Status fallocate(const std::string& filename, HANDLE hFile, uint64_t to_size); |
|
|
|
uint64_t to_size); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Status ftruncate(const std::string& filename, HANDLE hFile, |
|
|
|
|
|
|
|
uint64_t toSize); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Status ftruncate(const std::string& filename, HANDLE hFile, uint64_t toSize); |
|
|
|
|
|
|
|
|
|
|
|
size_t GetUniqueIdFromFile(HANDLE hFile, char* id, size_t max_size); |
|
|
|
size_t GetUniqueIdFromFile(HANDLE hFile, char* id, size_t max_size); |
|
|
|
|
|
|
|
|
|
|
|
class WinFileData { |
|
|
|
class WinFileData { |
|
|
|
protected: |
|
|
|
protected: |
|
|
|
|
|
|
|
|
|
|
|
const std::string filename_; |
|
|
|
const std::string filename_; |
|
|
|
HANDLE hFile_; |
|
|
|
HANDLE hFile_; |
|
|
|
// There is no equivalent of advising away buffered pages as in posix.
|
|
|
|
// If ture, the I/O issued would be direct I/O which the buffer
|
|
|
|
// To implement this flag we would need to do unbuffered reads which
|
|
|
|
|
|
|
|
// will need to be aligned (not sure there is a guarantee that the buffer
|
|
|
|
// will need to be aligned (not sure there is a guarantee that the buffer
|
|
|
|
// passed in is aligned).
|
|
|
|
// passed in is aligned).
|
|
|
|
// Hence we currently ignore this flag. It is used only in a few cases
|
|
|
|
const bool use_direct_io_; |
|
|
|
// which should not be perf critical.
|
|
|
|
|
|
|
|
// If perf evaluation finds this to be a problem, we can look into
|
|
|
|
|
|
|
|
// implementing this.
|
|
|
|
|
|
|
|
const bool use_os_buffer_; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
// We want this class be usable both for inheritance (prive
|
|
|
|
// We want this class be usable both for inheritance (prive
|
|
|
|
// or protected) and for containment so __ctor and __dtor public
|
|
|
|
// or protected) and for containment so __ctor and __dtor public
|
|
|
|
WinFileData(const std::string& filename, HANDLE hFile, bool use_os_buffer) : |
|
|
|
WinFileData(const std::string& filename, HANDLE hFile, bool use_direct_io) |
|
|
|
filename_(filename), hFile_(hFile), use_os_buffer_(use_os_buffer) |
|
|
|
: filename_(filename), hFile_(hFile), use_direct_io_(use_direct_io) {} |
|
|
|
{} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual ~WinFileData() { |
|
|
|
virtual ~WinFileData() { this->CloseFile(); } |
|
|
|
this->CloseFile(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool CloseFile() { |
|
|
|
bool CloseFile() { |
|
|
|
|
|
|
|
|
|
|
|
bool result = true; |
|
|
|
bool result = true; |
|
|
|
|
|
|
|
|
|
|
|
if (hFile_ != NULL && hFile_ != INVALID_HANDLE_VALUE) { |
|
|
|
if (hFile_ != NULL && hFile_ != INVALID_HANDLE_VALUE) { |
|
|
@ -111,13 +95,12 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
HANDLE GetFileHandle() const { return hFile_; } |
|
|
|
HANDLE GetFileHandle() const { return hFile_; } |
|
|
|
|
|
|
|
|
|
|
|
bool UseOSBuffer() const { return use_os_buffer_; } |
|
|
|
bool UseDirectIO() const { return use_direct_io_; } |
|
|
|
|
|
|
|
|
|
|
|
WinFileData(const WinFileData&) = delete; |
|
|
|
WinFileData(const WinFileData&) = delete; |
|
|
|
WinFileData& operator=(const WinFileData&) = delete; |
|
|
|
WinFileData& operator=(const WinFileData&) = delete; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// mmap() based random-access
|
|
|
|
// mmap() based random-access
|
|
|
|
class WinMmapReadableFile : private WinFileData, public RandomAccessFile { |
|
|
|
class WinMmapReadableFile : private WinFileData, public RandomAccessFile { |
|
|
|
HANDLE hMap_; |
|
|
|
HANDLE hMap_; |
|
|
@ -125,7 +108,7 @@ class WinMmapReadableFile : private WinFileData, public RandomAccessFile { |
|
|
|
const void* mapped_region_; |
|
|
|
const void* mapped_region_; |
|
|
|
const size_t length_; |
|
|
|
const size_t length_; |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
// mapped_region_[0,length-1] contains the mmapped contents of the file.
|
|
|
|
// mapped_region_[0,length-1] contains the mmapped contents of the file.
|
|
|
|
WinMmapReadableFile(const std::string& fileName, HANDLE hFile, HANDLE hMap, |
|
|
|
WinMmapReadableFile(const std::string& fileName, HANDLE hFile, HANDLE hMap, |
|
|
|
const void* mapped_region, size_t length); |
|
|
|
const void* mapped_region, size_t length); |
|
|
@ -148,7 +131,7 @@ public: |
|
|
|
// file before reading from it, or for log files, the reading code
|
|
|
|
// file before reading from it, or for log files, the reading code
|
|
|
|
// knows enough to skip zero suffixes.
|
|
|
|
// knows enough to skip zero suffixes.
|
|
|
|
class WinMmapFile : private WinFileData, public WritableFile { |
|
|
|
class WinMmapFile : private WinFileData, public WritableFile { |
|
|
|
private: |
|
|
|
private: |
|
|
|
HANDLE hMap_; |
|
|
|
HANDLE hMap_; |
|
|
|
|
|
|
|
|
|
|
|
const size_t page_size_; // We flush the mapping view in page_size
|
|
|
|
const size_t page_size_; // We flush the mapping view in page_size
|
|
|
@ -184,8 +167,7 @@ private: |
|
|
|
|
|
|
|
|
|
|
|
virtual Status PreallocateInternal(uint64_t spaceToReserve); |
|
|
|
virtual Status PreallocateInternal(uint64_t spaceToReserve); |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
|
|
|
|
|
|
|
|
WinMmapFile(const std::string& fname, HANDLE hFile, size_t page_size, |
|
|
|
WinMmapFile(const std::string& fname, HANDLE hFile, size_t page_size, |
|
|
|
size_t allocation_granularity, const EnvOptions& options); |
|
|
|
size_t allocation_granularity, const EnvOptions& options); |
|
|
|
|
|
|
|
|
|
|
@ -227,7 +209,7 @@ public: |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class WinSequentialFile : private WinFileData, public SequentialFile { |
|
|
|
class WinSequentialFile : private WinFileData, public SequentialFile { |
|
|
|
public: |
|
|
|
public: |
|
|
|
WinSequentialFile(const std::string& fname, HANDLE f, |
|
|
|
WinSequentialFile(const std::string& fname, HANDLE f, |
|
|
|
const EnvOptions& options); |
|
|
|
const EnvOptions& options); |
|
|
|
|
|
|
|
|
|
|
@ -244,8 +226,7 @@ public: |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class WinRandomAccessImpl { |
|
|
|
class WinRandomAccessImpl { |
|
|
|
protected: |
|
|
|
protected: |
|
|
|
|
|
|
|
|
|
|
|
WinFileData* file_base_; |
|
|
|
WinFileData* file_base_; |
|
|
|
bool read_ahead_; |
|
|
|
bool read_ahead_; |
|
|
|
const size_t compaction_readahead_size_; |
|
|
|
const size_t compaction_readahead_size_; |
|
|
@ -300,12 +281,10 @@ protected: |
|
|
|
|
|
|
|
|
|
|
|
virtual ~WinRandomAccessImpl() {} |
|
|
|
virtual ~WinRandomAccessImpl() {} |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
|
|
|
|
|
|
|
|
WinRandomAccessImpl(const WinRandomAccessImpl&) = delete; |
|
|
|
WinRandomAccessImpl(const WinRandomAccessImpl&) = delete; |
|
|
|
WinRandomAccessImpl& operator=(const WinRandomAccessImpl&) = delete; |
|
|
|
WinRandomAccessImpl& operator=(const WinRandomAccessImpl&) = delete; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Status ReadImpl(uint64_t offset, size_t n, Slice* result, |
|
|
|
Status ReadImpl(uint64_t offset, size_t n, Slice* result, |
|
|
|
char* scratch) const; |
|
|
|
char* scratch) const; |
|
|
|
|
|
|
|
|
|
|
@ -313,11 +292,12 @@ public: |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// pread() based random-access
|
|
|
|
// pread() based random-access
|
|
|
|
class WinRandomAccessFile : private WinFileData,
|
|
|
|
class WinRandomAccessFile |
|
|
|
protected WinRandomAccessImpl, // Want to be able to override PositionedReadInternal
|
|
|
|
: private WinFileData, |
|
|
|
|
|
|
|
protected WinRandomAccessImpl, // Want to be able to override
|
|
|
|
|
|
|
|
// PositionedReadInternal
|
|
|
|
public RandomAccessFile { |
|
|
|
public RandomAccessFile { |
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
|
|
|
|
WinRandomAccessFile(const std::string& fname, HANDLE hFile, size_t alignment, |
|
|
|
WinRandomAccessFile(const std::string& fname, HANDLE hFile, size_t alignment, |
|
|
|
const EnvOptions& options); |
|
|
|
const EnvOptions& options); |
|
|
|
|
|
|
|
|
|
|
@ -337,7 +317,6 @@ public: |
|
|
|
virtual size_t GetUniqueId(char* id, size_t max_size) const override; |
|
|
|
virtual size_t GetUniqueId(char* id, size_t max_size) const override; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This is a sequential write class. It has been mimicked (as others) after
|
|
|
|
// This is a sequential write class. It has been mimicked (as others) after
|
|
|
|
// the original Posix class. We add support for unbuffered I/O on windows as
|
|
|
|
// the original Posix class. We add support for unbuffered I/O on windows as
|
|
|
|
// well
|
|
|
|
// well
|
|
|
@ -351,8 +330,7 @@ public: |
|
|
|
// No padding is required for
|
|
|
|
// No padding is required for
|
|
|
|
// buffered access.
|
|
|
|
// buffered access.
|
|
|
|
class WinWritableImpl { |
|
|
|
class WinWritableImpl { |
|
|
|
protected: |
|
|
|
protected: |
|
|
|
|
|
|
|
|
|
|
|
WinFileData* file_data_; |
|
|
|
WinFileData* file_data_; |
|
|
|
const uint64_t alignment_; |
|
|
|
const uint64_t alignment_; |
|
|
|
uint64_t filesize_; // How much data is actually written disk
|
|
|
|
uint64_t filesize_; // How much data is actually written disk
|
|
|
@ -368,7 +346,8 @@ protected: |
|
|
|
|
|
|
|
|
|
|
|
Status AppendImpl(const Slice& data); |
|
|
|
Status AppendImpl(const Slice& data); |
|
|
|
|
|
|
|
|
|
|
|
// Requires that the data is aligned as specified by GetRequiredBufferAlignment()
|
|
|
|
// Requires that the data is aligned as specified by
|
|
|
|
|
|
|
|
// GetRequiredBufferAlignment()
|
|
|
|
Status PositionedAppendImpl(const Slice& data, uint64_t offset); |
|
|
|
Status PositionedAppendImpl(const Slice& data, uint64_t offset); |
|
|
|
|
|
|
|
|
|
|
|
Status TruncateImpl(uint64_t size); |
|
|
|
Status TruncateImpl(uint64_t size); |
|
|
@ -380,7 +359,8 @@ protected: |
|
|
|
uint64_t GetFileSizeImpl() { |
|
|
|
uint64_t GetFileSizeImpl() { |
|
|
|
// Double accounting now here with WritableFileWriter
|
|
|
|
// Double accounting now here with WritableFileWriter
|
|
|
|
// and this size will be wrong when unbuffered access is used
|
|
|
|
// and this size will be wrong when unbuffered access is used
|
|
|
|
// but tests implement their own writable files and do not use WritableFileWrapper
|
|
|
|
// but tests implement their own writable files and do not use
|
|
|
|
|
|
|
|
// WritableFileWrapper
|
|
|
|
// so we need to squeeze a square peg through
|
|
|
|
// so we need to squeeze a square peg through
|
|
|
|
// a round hole here.
|
|
|
|
// a round hole here.
|
|
|
|
return filesize_; |
|
|
|
return filesize_; |
|
|
@ -388,32 +368,30 @@ protected: |
|
|
|
|
|
|
|
|
|
|
|
Status AllocateImpl(uint64_t offset, uint64_t len); |
|
|
|
Status AllocateImpl(uint64_t offset, uint64_t len); |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
|
|
|
|
|
|
|
|
WinWritableImpl(const WinWritableImpl&) = delete; |
|
|
|
WinWritableImpl(const WinWritableImpl&) = delete; |
|
|
|
WinWritableImpl& operator=(const WinWritableImpl&) = delete; |
|
|
|
WinWritableImpl& operator=(const WinWritableImpl&) = delete; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class WinWritableFile : private WinFileData, |
|
|
|
class WinWritableFile : private WinFileData, |
|
|
|
protected WinWritableImpl, |
|
|
|
protected WinWritableImpl, |
|
|
|
public WritableFile { |
|
|
|
public WritableFile { |
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
|
|
|
|
WinWritableFile(const std::string& fname, HANDLE hFile, size_t alignment, |
|
|
|
WinWritableFile(const std::string& fname, HANDLE hFile, size_t alignment, |
|
|
|
size_t capacity, const EnvOptions& options); |
|
|
|
size_t capacity, const EnvOptions& options); |
|
|
|
|
|
|
|
|
|
|
|
~WinWritableFile(); |
|
|
|
~WinWritableFile(); |
|
|
|
|
|
|
|
|
|
|
|
// Indicates if the class makes use of unbuffered I/O
|
|
|
|
// Indicates if the class makes use of direct I/O
|
|
|
|
// Use PositionedAppend
|
|
|
|
// Use PositionedAppend
|
|
|
|
virtual bool UseOSBuffer() const override; |
|
|
|
virtual bool UseDirectIO() const override; |
|
|
|
|
|
|
|
|
|
|
|
virtual size_t GetRequiredBufferAlignment() const override; |
|
|
|
virtual size_t GetRequiredBufferAlignment() const override; |
|
|
|
|
|
|
|
|
|
|
|
virtual Status Append(const Slice& data) override; |
|
|
|
virtual Status Append(const Slice& data) override; |
|
|
|
|
|
|
|
|
|
|
|
// Requires that the data is aligned as specified by GetRequiredBufferAlignment()
|
|
|
|
// Requires that the data is aligned as specified by
|
|
|
|
|
|
|
|
// GetRequiredBufferAlignment()
|
|
|
|
virtual Status PositionedAppend(const Slice& data, uint64_t offset) override; |
|
|
|
virtual Status PositionedAppend(const Slice& data, uint64_t offset) override; |
|
|
|
|
|
|
|
|
|
|
|
// Need to implement this so the file is truncated correctly
|
|
|
|
// Need to implement this so the file is truncated correctly
|
|
|
@ -437,30 +415,27 @@ public: |
|
|
|
virtual size_t GetUniqueId(char* id, size_t max_size) const override; |
|
|
|
virtual size_t GetUniqueId(char* id, size_t max_size) const override; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class WinRandomRWFile : private WinFileData, |
|
|
|
class WinRandomRWFile : private WinFileData, |
|
|
|
protected WinRandomAccessImpl, |
|
|
|
protected WinRandomAccessImpl, |
|
|
|
protected WinWritableImpl, |
|
|
|
protected WinWritableImpl, |
|
|
|
public RandomRWFile { |
|
|
|
public RandomRWFile { |
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WinRandomRWFile(const std::string& fname, HANDLE hFile, size_t alignment, |
|
|
|
WinRandomRWFile(const std::string& fname, HANDLE hFile, size_t alignment, |
|
|
|
const EnvOptions& options); |
|
|
|
const EnvOptions& options); |
|
|
|
|
|
|
|
|
|
|
|
~WinRandomRWFile() {} |
|
|
|
~WinRandomRWFile() {} |
|
|
|
|
|
|
|
|
|
|
|
// Indicates if the class makes use of unbuffered I/O
|
|
|
|
// Indicates if the class makes use of direct I/O
|
|
|
|
// If false you must pass aligned buffer to Write()
|
|
|
|
// If false you must pass aligned buffer to Write()
|
|
|
|
virtual bool UseOSBuffer() const override; |
|
|
|
virtual bool UseDirectIO() const override; |
|
|
|
|
|
|
|
|
|
|
|
// Use the returned alignment value to allocate
|
|
|
|
// Use the returned alignment value to allocate aligned
|
|
|
|
// aligned buffer for Write() when UseOSBuffer()
|
|
|
|
// buffer for Write() when UseDirectIO() returns true
|
|
|
|
// returns false
|
|
|
|
|
|
|
|
virtual size_t GetRequiredBufferAlignment() const override; |
|
|
|
virtual size_t GetRequiredBufferAlignment() const override; |
|
|
|
|
|
|
|
|
|
|
|
// Used by the file_reader_writer to decide if the ReadAhead wrapper
|
|
|
|
// Used by the file_reader_writer to decide if the ReadAhead wrapper
|
|
|
|
// should simply forward the call and do not enact read_ahead buffering or locking.
|
|
|
|
// should simply forward the call and do not enact read_ahead buffering or
|
|
|
|
|
|
|
|
// locking.
|
|
|
|
// The implementation below takes care of reading ahead
|
|
|
|
// The implementation below takes care of reading ahead
|
|
|
|
virtual bool ShouldForwardRawRequest() const override; |
|
|
|
virtual bool ShouldForwardRawRequest() const override; |
|
|
|
|
|
|
|
|
|
|
@ -469,7 +444,7 @@ public: |
|
|
|
virtual void EnableReadAhead() override; |
|
|
|
virtual void EnableReadAhead() override; |
|
|
|
|
|
|
|
|
|
|
|
// Write bytes in `data` at offset `offset`, Returns Status::OK() on success.
|
|
|
|
// Write bytes in `data` at offset `offset`, Returns Status::OK() on success.
|
|
|
|
// Pass aligned buffer when UseOSBuffer() returns false.
|
|
|
|
// Pass aligned buffer when UseDirectIO() returns true.
|
|
|
|
virtual Status Write(uint64_t offset, const Slice& data) override; |
|
|
|
virtual Status Write(uint64_t offset, const Slice& data) override; |
|
|
|
|
|
|
|
|
|
|
|
// Read up to `n` bytes starting from offset `offset` and store them in
|
|
|
|
// Read up to `n` bytes starting from offset `offset` and store them in
|
|
|
@ -487,16 +462,15 @@ public: |
|
|
|
virtual Status Close() override; |
|
|
|
virtual Status Close() override; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class WinDirectory : public Directory { |
|
|
|
class WinDirectory : public Directory { |
|
|
|
public: |
|
|
|
public: |
|
|
|
WinDirectory() {} |
|
|
|
WinDirectory() {} |
|
|
|
|
|
|
|
|
|
|
|
virtual Status Fsync() override; |
|
|
|
virtual Status Fsync() override; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class WinFileLock : public FileLock { |
|
|
|
class WinFileLock : public FileLock { |
|
|
|
public: |
|
|
|
public: |
|
|
|
explicit WinFileLock(HANDLE hFile) : hFile_(hFile) { |
|
|
|
explicit WinFileLock(HANDLE hFile) : hFile_(hFile) { |
|
|
|
assert(hFile != NULL); |
|
|
|
assert(hFile != NULL); |
|
|
|
assert(hFile != INVALID_HANDLE_VALUE); |
|
|
|
assert(hFile != INVALID_HANDLE_VALUE); |
|
|
@ -504,9 +478,8 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
~WinFileLock(); |
|
|
|
~WinFileLock(); |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
|
HANDLE hFile_; |
|
|
|
HANDLE hFile_; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|