AuroraRuntime/Include/Aurora/IO/FS/Async.hpp
Reece 510928e62e [*] Linux should not raise int3 unless the binary is a debug one
TODO: investigate registering an int3 signal handler to prevent crashing under internal builds
[*] Amend MemoryViews
[*] Begin shifting towards MemoryView based binary APIs
[*] Fix public RSA key leak
[+] Some clean up and possible bug fixes
2021-09-15 00:56:26 +01:00

46 lines
1.4 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AFIO.hpp
Date: 2021-8-21
Author: Reece
***/
#pragma once
namespace Aurora::IO::FS
{
class IAsyncTransaction;
class IAsyncFileStream
{
public:
virtual AuSPtr<IAsyncTransaction> NewTransaction() = 0;
};
class IAsyncFinishedSubscriber
{
public:
virtual void OnAsyncFileOpFinished(AuUInt64 offset, AuUInt32 length) = 0;
};
class IAsyncTransaction
{
public:
// Do not switch to Aurora::Memory::MemoryView, you must use a raw pointer to the parent RAII object that effectively owns the IAsyncTransaction
virtual bool StartRead(AuUInt64 offset, void *, AuUInt32 length) = 0;
virtual bool StartWrite(AuUInt64 offset, const void *, AuUInt32 length) = 0;
virtual bool Complete() = 0;
virtual AuUInt32 GetLastPacketLength() = 0;
virtual void SetCallback(const AuSPtr<IAsyncFinishedSubscriber> &sub) = 0;
virtual bool Wait(AuUInt32 timeout) = 0;
};
AUKN_SHARED_API(OpenAsync, IAsyncFileStream, const AuString &path, bool readOnly = true, bool directIO = false);
/// \param transactions Array of FIO transactions
/// \param timeout Aurora Timeout
AUKN_SYM bool WaitMultiple(const AuList<AuSPtr<IAsyncTransaction>> &transactions, AuUInt32 timeout);
}