/*** Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved. File: IAsyncTransaction.hpp Date: 2022-2-14 Author: Reece ***/ #pragma once namespace Aurora::Loop { struct ILoopSource; } namespace Aurora::IO::FS { struct IAsyncTransaction { virtual bool StartRead(AuUInt64 offset, const AuSPtr &memoryView) = 0; virtual bool StartWrite(AuUInt64 offset, const AuSPtr &memoryView) = 0; /** * @brief Non-blocking is-signaled and call callback poll routine */ virtual bool Complete() = 0; /** * @brief Returns the last packets length assuming ::Complete() is true or you are within the registered callback */ virtual AuUInt32 GetLastPacketLength() = 0; /** * @brief Registers an NT-like APC callback for the IO transaction. * Can be executed under any Aurora loop subsystem sleep */ virtual void SetCallback(const AuSPtr &sub) = 0; /** * @brief Block for completion */ virtual bool Wait(AuUInt32 timeout) = 0; /** * @brief Provides a loop source that becomes signaled once the transaction is complete. * Polling the transaction may result in the execution of the callback. */ virtual AuSPtr NewLoopSource() = 0; }; }