diff --git a/cc/src/device/file_system_disk.h b/cc/src/device/file_system_disk.h index 4d6336766..1e074418c 100644 --- a/cc/src/device/file_system_disk.h +++ b/cc/src/device/file_system_disk.h @@ -52,29 +52,29 @@ class FileSystemFile { return *this; } - Status Open(handler_t* handler) { + core::Status Open(handler_t* handler) { return file_.Open(FASTER::environment::FileCreateDisposition::OpenOrCreate, file_options_, handler, nullptr); } - Status Close() { + core::Status Close() { return file_.Close(); } - Status Delete() { + core::Status Delete() { return file_.Delete(); } - void Truncate(uint64_t new_begin_offset, GcState::truncate_callback_t callback) { + void Truncate(uint64_t new_begin_offset, core::GcState::truncate_callback_t callback) { // Truncation is a no-op. if(callback) { callback(new_begin_offset); } } - Status ReadAsync(uint64_t source, void* dest, uint32_t length, - AsyncIOCallback callback, IAsyncContext& context) const { + core::Status ReadAsync(uint64_t source, void* dest, uint32_t length, + core::AsyncIOCallback callback, core::IAsyncContext& context) const { return file_.Read(source, length, reinterpret_cast(dest), context, callback); } - Status WriteAsync(const void* source, uint64_t dest, uint32_t length, - AsyncIOCallback callback, IAsyncContext& context) { + core::Status WriteAsync(const void* source, uint64_t dest, uint32_t length, + core::AsyncIOCallback callback, core::IAsyncContext& context) { return file_.Write(dest, length, reinterpret_cast(source), context, callback); } @@ -106,8 +106,8 @@ class FileSystemSegmentBundle { for(uint64_t idx = begin_segment; idx < end_segment; ++idx) { new(files() + (idx - begin_segment)) file_t{ filename_ + std::to_string(idx), file_options_ }; - Status result = file(idx).Open(handler); - assert(result == Status::Ok); + core::Status result = file(idx).Open(handler); + assert(result == core::Status::Ok); } } @@ -128,8 +128,8 @@ class FileSystemSegmentBundle { for(uint64_t idx = begin_segment; idx < begin_copy; ++idx) { new(files() + (idx - begin_segment)) file_t{ filename_ + std::to_string(idx), file_options_ }; - Status result = file(idx).Open(handler); - assert(result == Status::Ok); + core::Status result = file(idx).Open(handler); + assert(result == core::Status::Ok); } for(uint64_t idx = begin_copy; idx < end_copy; ++idx) { // Move file handles for segments already opened. @@ -138,8 +138,8 @@ class FileSystemSegmentBundle { for(uint64_t idx = end_copy; idx < end_new; ++idx) { new(files() + (idx - begin_segment)) file_t{ filename_ + std::to_string(idx), file_options_ }; - Status result = file(idx).Open(handler); - assert(result == Status::Ok); + core::Status result = file(idx).Open(handler); + assert(result == core::Status::Ok); } other.owner_ = false; @@ -153,12 +153,12 @@ class FileSystemSegmentBundle { } } - Status Close() { + core::Status Close() { assert(owner_); - Status result = Status::Ok; + core::Status result = core::Status::Ok; for(uint64_t idx = begin_segment; idx < end_segment; ++idx) { - Status r = file(idx).Close(); - if(r != Status::Ok) { + core::Status r = file(idx).Close(); + if(r != core::Status::Ok) { // We'll report the last error. result = r; } @@ -166,12 +166,12 @@ class FileSystemSegmentBundle { return result; } - Status Delete() { + core::Status Delete() { assert(owner_); - Status result = Status::Ok; + core::Status result = core::Status::Ok; for(uint64_t idx = begin_segment; idx < end_segment; ++idx) { - Status r = file(idx).Delete(); - if(r != Status::Ok) { + core::Status r = file(idx).Delete(); + if(r != core::Status::Ok) { // We'll report the last error. result = r; } @@ -211,10 +211,10 @@ class FileSystemSegmentedFile { typedef FileSystemSegmentBundle bundle_t; static constexpr uint64_t kSegmentSize = S; - static_assert(Utility::IsPowerOfTwo(S), "template parameter S is not a power of two!"); + static_assert(core::Utility::IsPowerOfTwo(S), "template parameter S is not a power of two!"); FileSystemSegmentedFile(const std::string& filename, - const environment::FileOptions& file_options, LightEpoch* epoch) + const environment::FileOptions& file_options, core::LightEpoch* epoch) : begin_segment_{ 0 } , files_{ nullptr } , handler_{ nullptr } @@ -231,32 +231,32 @@ class FileSystemSegmentedFile { } } - Status Open(handler_t* handler) { + core::Status Open(handler_t* handler) { handler_ = handler; - return Status::Ok; + return core::Status::Ok; } - Status Close() { - return (files_) ? files_->Close() : Status::Ok; + core::Status Close() { + return (files_) ? files_->Close() : core::Status::Ok; } - Status Delete() { - return (files_) ? files_->Delete() : Status::Ok; + core::Status Delete() { + return (files_) ? files_->Delete() : core::Status::Ok; } - void Truncate(uint64_t new_begin_offset, GcState::truncate_callback_t callback) { + void Truncate(uint64_t new_begin_offset, core::GcState::truncate_callback_t callback) { uint64_t new_begin_segment = new_begin_offset / kSegmentSize; begin_segment_ = new_begin_segment; TruncateSegments(new_begin_segment, callback); } - Status ReadAsync(uint64_t source, void* dest, uint32_t length, AsyncIOCallback callback, - IAsyncContext& context) const { + core::Status ReadAsync(uint64_t source, void* dest, uint32_t length, core::AsyncIOCallback callback, + core::IAsyncContext& context) const { uint64_t segment = source / kSegmentSize; assert(source % kSegmentSize + length <= kSegmentSize); bundle_t* files = files_.load(); if(!files || !files->exists(segment)) { - Status result = const_cast*>(this)->OpenSegment(segment); - if(result != Status::Ok) { + core::Status result = const_cast*>(this)->OpenSegment(segment); + if(result != core::Status::Ok) { return result; } files = files_.load(); @@ -264,16 +264,16 @@ class FileSystemSegmentedFile { return files->file(segment).ReadAsync(source % kSegmentSize, dest, length, callback, context); } - Status WriteAsync(const void* source, uint64_t dest, uint32_t length, - AsyncIOCallback callback, IAsyncContext& context) { + core::Status WriteAsync(const void* source, uint64_t dest, uint32_t length, + core::AsyncIOCallback callback, core::IAsyncContext& context) { uint64_t segment = dest / kSegmentSize; assert(dest % kSegmentSize + length <= kSegmentSize); bundle_t* files = files_.load(); if(!files || !files->exists(segment)) { - Status result = OpenSegment(segment); - if(result != Status::Ok) { + core::Status result = OpenSegment(segment); + if(result != core::Status::Ok) { return result; } files = files_.load(); @@ -286,8 +286,8 @@ class FileSystemSegmentedFile { } private: - Status OpenSegment(uint64_t segment) { - class Context : public IAsyncContext { + core::Status OpenSegment(uint64_t segment) { + class Context : public core::IAsyncContext { public: Context(void* files_) : files{ files_ } { @@ -297,15 +297,15 @@ class FileSystemSegmentedFile { : files{ other.files} { } protected: - Status DeepCopy_Internal(IAsyncContext*& context_copy) final { - return IAsyncContext::DeepCopy_Internal(*this, context_copy); + core::Status DeepCopy_Internal(core::IAsyncContext*& context_copy) final { + return core::IAsyncContext::DeepCopy_Internal(*this, context_copy); } public: void* files; }; - auto callback = [](IAsyncContext* ctxt) { - CallbackContext context{ ctxt }; + auto callback = [](core::IAsyncContext* ctxt) { + core::CallbackContext context{ ctxt }; std::free(context->files); }; @@ -315,11 +315,11 @@ class FileSystemSegmentedFile { if(segment < begin_segment_) { // The requested segment has been truncated. - return Status::IOError; + return core::Status::IOError; } if(files && files->exists(segment)) { // Some other thread already opened this segment for us. - return Status::Ok; + return core::Status::Ok; } if(!files) { @@ -328,7 +328,7 @@ class FileSystemSegmentedFile { bundle_t* new_files = new(buffer) bundle_t{ filename_, file_options_, handler_, segment, segment + 1 }; files_.store(new_files); - return Status::Ok; + return core::Status::Ok; } // Expand the list of files_. @@ -340,18 +340,18 @@ class FileSystemSegmentedFile { files_.store(new_files); // Delete the old list only after all threads have finished looking at it. Context context{ files }; - IAsyncContext* context_copy; - Status result = context.DeepCopy(context_copy); - assert(result == Status::Ok); + core::IAsyncContext* context_copy; + core::Status result = context.DeepCopy(context_copy); + assert(result == core::Status::Ok); epoch_->BumpCurrentEpoch(callback, context_copy); - return Status::Ok; + return core::Status::Ok; } - void TruncateSegments(uint64_t new_begin_segment, GcState::truncate_callback_t caller_callback) { - class Context : public IAsyncContext { + void TruncateSegments(uint64_t new_begin_segment, core::GcState::truncate_callback_t caller_callback) { + class Context : public core::IAsyncContext { public: Context(bundle_t* files_, uint64_t new_begin_segment_, - GcState::truncate_callback_t caller_callback_) + core::GcState::truncate_callback_t caller_callback_) : files{ files_ } , new_begin_segment{ new_begin_segment_ } , caller_callback{ caller_callback_ } { @@ -363,17 +363,17 @@ class FileSystemSegmentedFile { , caller_callback{ other.caller_callback } { } protected: - Status DeepCopy_Internal(IAsyncContext*& context_copy) final { - return IAsyncContext::DeepCopy_Internal(*this, context_copy); + core::Status DeepCopy_Internal(core::IAsyncContext*& context_copy) final { + return core::IAsyncContext::DeepCopy_Internal(*this, context_copy); } public: bundle_t* files; uint64_t new_begin_segment; - GcState::truncate_callback_t caller_callback; + core::GcState::truncate_callback_t caller_callback; }; - auto callback = [](IAsyncContext* ctxt) { - CallbackContext context{ ctxt }; + auto callback = [](core::IAsyncContext* ctxt) { + core::CallbackContext context{ ctxt }; for(uint64_t idx = context->files->begin_segment; idx < context->new_begin_segment; ++idx) { file_t& file = context->files->file(idx); file.Close(); @@ -404,9 +404,9 @@ class FileSystemSegmentedFile { files_.store(new_files); // Delete the old list only after all threads have finished looking at it. Context context{ files, new_begin_segment, caller_callback }; - IAsyncContext* context_copy; - Status result = context.DeepCopy(context_copy); - assert(result == Status::Ok); + core::IAsyncContext* context_copy; + core::Status result = context.DeepCopy(context_copy); + assert(result == core::Status::Ok); epoch_->BumpCurrentEpoch(callback, context_copy); } @@ -415,7 +415,7 @@ class FileSystemSegmentedFile { handler_t* handler_; std::string filename_; environment::FileOptions file_options_; - LightEpoch* epoch_; + core::LightEpoch* epoch_; std::mutex mutex_; }; @@ -435,14 +435,14 @@ class FileSystemDisk { } public: - FileSystemDisk(const std::string& root_path, LightEpoch& epoch, bool enablePrivileges = false, + FileSystemDisk(const std::string& root_path, core::LightEpoch& epoch, bool enablePrivileges = false, bool unbuffered = true, bool delete_on_close = false) : root_path_{ NormalizePath(root_path) } , handler_{ 16 /*max threads*/ } , default_file_options_{ unbuffered, delete_on_close } , log_{ root_path_ + "log.log", default_file_options_, &epoch} { - Status result = log_.Open(&handler_); - assert(result == Status::Ok); + core::Status result = log_.Open(&handler_); + assert(result == core::Status::Ok); } /// Methods required by the (implicit) disk interface. @@ -457,29 +457,29 @@ class FileSystemDisk { return log_; } - std::string relative_index_checkpoint_path(const Guid& token) const { + std::string relative_index_checkpoint_path(const core::Guid& token) const { std::string retval = "index-checkpoints"; retval += FASTER::environment::kPathSeparator; retval += token.ToString(); retval += FASTER::environment::kPathSeparator; return retval; } - std::string index_checkpoint_path(const Guid& token) const { + std::string index_checkpoint_path(const core::Guid& token) const { return root_path_ + relative_index_checkpoint_path(token); } - std::string relative_cpr_checkpoint_path(const Guid& token) const { + std::string relative_cpr_checkpoint_path(const core::Guid& token) const { std::string retval = "cpr-checkpoints"; retval += FASTER::environment::kPathSeparator; retval += token.ToString(); retval += FASTER::environment::kPathSeparator; return retval; } - std::string cpr_checkpoint_path(const Guid& token) const { + std::string cpr_checkpoint_path(const core::Guid& token) const { return root_path_ + relative_cpr_checkpoint_path(token); } - void CreateIndexCheckpointDirectory(const Guid& token) { + void CreateIndexCheckpointDirectory(const core::Guid& token) { std::string index_dir = index_checkpoint_path(token); std::experimental::filesystem::path path{ index_dir }; try { @@ -490,7 +490,7 @@ class FileSystemDisk { std::experimental::filesystem::create_directories(path); } - void CreateCprCheckpointDirectory(const Guid& token) { + void CreateCprCheckpointDirectory(const core::Guid& token) { std::string cpr_dir = cpr_checkpoint_path(token); std::experimental::filesystem::path path{ cpr_dir }; try { diff --git a/cc/src/device/null_disk.h b/cc/src/device/null_disk.h index e0deb3fc6..639e85803 100644 --- a/cc/src/device/null_disk.h +++ b/cc/src/device/null_disk.h @@ -22,30 +22,30 @@ struct NullHandler { class NullFile { public: - Status Open(NullHandler* handler) { - return Status::Ok; + core::Status Open(NullHandler* handler) { + return core::Status::Ok; } - Status Close() { - return Status::Ok; + core::Status Close() { + return core::Status::Ok; } - Status Delete() { - return Status::Ok; + core::Status Delete() { + return core::Status::Ok; } - void Truncate(uint64_t new_begin_offset, GcState::truncate_callback_t callback) { + void Truncate(uint64_t new_begin_offset, core::GcState::truncate_callback_t callback) { if(callback) { callback(new_begin_offset); } } - Status ReadAsync(uint64_t source, void* dest, uint32_t length, - AsyncIOCallback callback, IAsyncContext& context) const { - callback(&context, Status::Ok, length); - return Status::Ok; + core::Status ReadAsync(uint64_t source, void* dest, uint32_t length, + core::AsyncIOCallback callback, core::IAsyncContext& context) const { + callback(&context, core::Status::Ok, length); + return core::Status::Ok; } - Status WriteAsync(const void* source, uint64_t dest, uint32_t length, - AsyncIOCallback callback, IAsyncContext& context) { - callback(&context, Status::Ok, length); - return Status::Ok; + core::Status WriteAsync(const void* source, uint64_t dest, uint32_t length, + core::AsyncIOCallback callback, core::IAsyncContext& context) { + callback(&context, core::Status::Ok, length); + return core::Status::Ok; } static size_t alignment() { @@ -63,7 +63,7 @@ class NullDisk { typedef NullFile file_t; typedef NullFile log_file_t; - NullDisk(const std::string& filename, LightEpoch& epoch) { + NullDisk(const std::string& filename, core::LightEpoch& epoch) { } static uint32_t sector_size() { @@ -78,28 +78,28 @@ class NullDisk { return log_; } - std::string relative_index_checkpoint_path(const Guid& token) const { + std::string relative_index_checkpoint_path(const core::Guid& token) const { assert(false); return ""; } - std::string index_checkpoint_path(const Guid& token) const { + std::string index_checkpoint_path(const core::Guid& token) const { assert(false); return ""; } - std::string relative_cpr_checkpoint_path(const Guid& token) const { + std::string relative_cpr_checkpoint_path(const core::Guid& token) const { assert(false); return ""; } - std::string cpr_checkpoint_path(const Guid& token) const { + std::string cpr_checkpoint_path(const core::Guid& token) const { assert(false); return ""; } - void CreateIndexCheckpointDirectory(const Guid& token) { + void CreateIndexCheckpointDirectory(const core::Guid& token) { assert(false); } - void CreateCprCheckpointDirectory(const Guid& token) { + void CreateCprCheckpointDirectory(const core::Guid& token) { assert(false); } diff --git a/cc/src/environment/file_common.h b/cc/src/environment/file_common.h index af8c8fa3b..a7848b9bb 100644 --- a/cc/src/environment/file_common.h +++ b/cc/src/environment/file_common.h @@ -8,8 +8,6 @@ #include "../core/async.h" #include "../core/lss_allocator.h" -using namespace FASTER::core; - namespace FASTER { namespace environment { diff --git a/cc/src/environment/file_linux.cc b/cc/src/environment/file_linux.cc index 2c0277d81..9eb21b9be 100644 --- a/cc/src/environment/file_linux.cc +++ b/cc/src/environment/file_linux.cc @@ -14,6 +14,8 @@ namespace FASTER { namespace environment { +using namespace FASTER::core; + #ifdef _DEBUG #define DCHECK_ALIGNMENT(o, l, b) \ do { \ @@ -105,7 +107,7 @@ int File::GetCreateDisposition(FileCreateDisposition create_disposition) { void QueueIoHandler::IoCompletionCallback(io_context_t ctx, struct iocb* iocb, long res, long res2) { - auto callback_context = make_context_unique_ptr( + auto callback_context = core::make_context_unique_ptr( reinterpret_cast(iocb)); size_t bytes_transferred; Status return_status; @@ -172,7 +174,7 @@ Status QueueFile::Write(size_t offset, uint32_t length, const uint8_t* buffer, Status QueueFile::ScheduleOperation(FileOperationType operationType, uint8_t* buffer, size_t offset, uint32_t length, IAsyncContext& context, AsyncIOCallback callback) { - auto io_context = alloc_context(sizeof( + auto io_context = core::alloc_context(sizeof( QueueIoHandler::IoCallbackContext)); if(!io_context.get()) return Status::OutOfMemory; diff --git a/cc/src/environment/file_linux.h b/cc/src/environment/file_linux.h index fd47b33d4..1b98d9ce7 100644 --- a/cc/src/environment/file_linux.h +++ b/cc/src/environment/file_linux.h @@ -66,7 +66,7 @@ class File { ~File() { if(owner_) { - Status s = Close(); + core::Status s = Close(); } } @@ -86,11 +86,11 @@ class File { } protected: - Status Open(int flags, FileCreateDisposition create_disposition, bool* exists = nullptr); + core::Status Open(int flags, FileCreateDisposition create_disposition, bool* exists = nullptr); public: - Status Close(); - Status Delete(); + core::Status Close(); + core::Status Delete(); uint64_t size() const { struct stat stat_buffer; @@ -119,7 +119,7 @@ class File { #endif private: - Status GetDeviceAlignment(); + core::Status GetDeviceAlignment(); static int GetCreateDisposition(FileCreateDisposition create_disposition); protected: @@ -175,7 +175,7 @@ class QueueIoHandler { struct IoCallbackContext { IoCallbackContext(FileOperationType operation, int fd, size_t offset, uint32_t length, - uint8_t* buffer, IAsyncContext* context_, AsyncIOCallback callback_) + uint8_t* buffer, core::IAsyncContext* context_, core::AsyncIOCallback callback_) : caller_context{ context_ } , callback{ callback_ } { if(FileOperationType::Read == operation) { @@ -193,10 +193,10 @@ class QueueIoHandler { struct iocb parent_iocb; /// Caller callback context. - IAsyncContext* caller_context; + core::IAsyncContext* caller_context; /// The caller's asynchronous callback function - AsyncIOCallback callback; + core::AsyncIOCallback callback; }; inline io_context_t io_object() const { @@ -235,17 +235,17 @@ class QueueFile : public File { return *this; } - Status Open(FileCreateDisposition create_disposition, const FileOptions& options, + core::Status Open(FileCreateDisposition create_disposition, const FileOptions& options, QueueIoHandler* handler, bool* exists = nullptr); - Status Read(size_t offset, uint32_t length, uint8_t* buffer, - IAsyncContext& context, AsyncIOCallback callback) const; - Status Write(size_t offset, uint32_t length, const uint8_t* buffer, - IAsyncContext& context, AsyncIOCallback callback); + core::Status Read(size_t offset, uint32_t length, uint8_t* buffer, + core::IAsyncContext& context, core::AsyncIOCallback callback) const; + core::Status Write(size_t offset, uint32_t length, const uint8_t* buffer, + core::IAsyncContext& context, core::AsyncIOCallback callback); private: - Status ScheduleOperation(FileOperationType operationType, uint8_t* buffer, size_t offset, - uint32_t length, IAsyncContext& context, AsyncIOCallback callback); + core::Status ScheduleOperation(FileOperationType operationType, uint8_t* buffer, size_t offset, + uint32_t length, core::IAsyncContext& context, core::AsyncIOCallback callback); io_context_t io_object_; }; diff --git a/cc/src/environment/file_windows.h b/cc/src/environment/file_windows.h index aa1aa5c8e..d051a51dd 100644 --- a/cc/src/environment/file_windows.h +++ b/cc/src/environment/file_windows.h @@ -69,7 +69,7 @@ class File { ~File() { if(owner_) { - Status s = Close(); + core::Status s = Close(); } } @@ -89,11 +89,11 @@ class File { } protected: - Status Open(DWORD flags, FileCreateDisposition create_disposition, bool* exists = nullptr); + core::Status Open(DWORD flags, FileCreateDisposition create_disposition, bool* exists = nullptr); public: - Status Close(); - Status Delete(); + core::Status Close(); + core::Status Delete(); uint64_t size() const { LARGE_INTEGER file_size; @@ -122,7 +122,7 @@ class File { #endif private: - Status GetDeviceAlignment(); + core::Status GetDeviceAlignment(); static DWORD GetCreateDisposition(FileCreateDisposition create_disposition); protected: @@ -168,7 +168,7 @@ class WindowsPtpThreadPool { ~WindowsPtpThreadPool(); - Status Schedule(Task task, void* task_argument); + core::Status Schedule(Task task, void* task_argument); PTP_CALLBACK_ENVIRON callback_environment() { return callback_environment_; @@ -247,7 +247,7 @@ class ThreadPoolIoHandler { } struct IoCallbackContext { - IoCallbackContext(size_t offset, IAsyncContext* context_, AsyncIOCallback callback_) + IoCallbackContext(size_t offset, core::IAsyncContext* context_, core::AsyncIOCallback callback_) : caller_context{ context_ } , callback{ callback_ } { ::memset(&parent_overlapped, 0, sizeof(parent_overlapped)); @@ -261,9 +261,9 @@ class ThreadPoolIoHandler { /// The overlapped structure for Windows IO OVERLAPPED parent_overlapped; /// Caller callback context. - IAsyncContext* caller_context; + core::IAsyncContext* caller_context; /// The caller's asynchronous callback function - AsyncIOCallback callback; + core::AsyncIOCallback callback; }; inline static constexpr bool TryComplete() { @@ -287,7 +287,7 @@ class QueueIoHandler { QueueIoHandler(size_t max_threads) : io_completion_port_{ 0 } { io_completion_port_ = ::CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, - (DWORD)Thread::kMaxNumThreads); + (DWORD)core::Thread::kMaxNumThreads); } /// Move constructor @@ -309,7 +309,7 @@ class QueueIoHandler { } struct IoCallbackContext { - IoCallbackContext(size_t offset, IAsyncContext* context_, AsyncIOCallback callback_) + IoCallbackContext(size_t offset, core::IAsyncContext* context_, core::AsyncIOCallback callback_) : caller_context{ context_ } , callback{ callback_ } { ::memset(&parent_overlapped, 0, sizeof(parent_overlapped)); @@ -323,9 +323,9 @@ class QueueIoHandler { /// The overlapped structure for Windows IO OVERLAPPED parent_overlapped; /// Caller callback context. - IAsyncContext* caller_context; + core::IAsyncContext* caller_context; /// The caller's asynchronous callback function - AsyncIOCallback callback; + core::AsyncIOCallback callback; }; bool TryComplete(); @@ -362,17 +362,17 @@ class ThreadPoolFile : public File { return *this; } - Status Open(FileCreateDisposition create_disposition, const FileOptions& options, + core::Status Open(FileCreateDisposition create_disposition, const FileOptions& options, ThreadPoolIoHandler* handler, bool* exists = nullptr); - Status Read(size_t offset, uint32_t length, uint8_t* buffer, - IAsyncContext& context, AsyncIOCallback callback) const; - Status Write(size_t offset, uint32_t length, const uint8_t* buffer, - IAsyncContext& context, AsyncIOCallback callback); + core::Status Read(size_t offset, uint32_t length, uint8_t* buffer, + core::IAsyncContext& context, core::AsyncIOCallback callback) const; + core::Status Write(size_t offset, uint32_t length, const uint8_t* buffer, + core::IAsyncContext& context, core::AsyncIOCallback callback); private: - Status ScheduleOperation(FileOperationType operationType, uint8_t* buffer, size_t offset, - uint32_t length, IAsyncContext& context, AsyncIOCallback callback); + core::Status ScheduleOperation(FileOperationType operationType, uint8_t* buffer, size_t offset, + uint32_t length, core::IAsyncContext& context, core::AsyncIOCallback callback); PTP_IO io_object_; }; @@ -398,17 +398,17 @@ class QueueFile : public File { return *this; } - Status Open(FileCreateDisposition create_disposition, const FileOptions& options, + core::Status Open(FileCreateDisposition create_disposition, const FileOptions& options, QueueIoHandler* handler, bool* exists = nullptr); - Status Read(size_t offset, uint32_t length, uint8_t* buffer, - IAsyncContext& context, AsyncIOCallback callback) const; - Status Write(size_t offset, uint32_t length, const uint8_t* buffer, - IAsyncContext& context, AsyncIOCallback callback); + core::Status Read(size_t offset, uint32_t length, uint8_t* buffer, + core::IAsyncContext& context, core::AsyncIOCallback callback) const; + core::Status Write(size_t offset, uint32_t length, const uint8_t* buffer, + core::IAsyncContext& context, core::AsyncIOCallback callback); private: - Status ScheduleOperation(FileOperationType operationType, uint8_t* buffer, size_t offset, - uint32_t length, IAsyncContext& context, AsyncIOCallback callback); + core::Status ScheduleOperation(FileOperationType operationType, uint8_t* buffer, size_t offset, + uint32_t length, core::IAsyncContext& context, core::AsyncIOCallback callback); }; } diff --git a/cc/test/test_types.h b/cc/test/test_types.h index 56dbe0bbc..cc56a2c0a 100644 --- a/cc/test/test_types.h +++ b/cc/test/test_types.h @@ -22,9 +22,9 @@ class FixedSizeKey { return static_cast(sizeof(FixedSizeKey)); } - inline KeyHash GetHash() const { + inline core::KeyHash GetHash() const { HashFn hash_fn; - return KeyHash{ hash_fn(key) }; + return core::KeyHash{ hash_fn(key) }; } inline bool operator==(const FixedSizeKey& other) const {