Jamie Reece Wilson
38bf52e852
[+] Aurora::IO::Adapters::NewMemoryViewWriteSeekableAdapter [*] ViewSeekableReadable -> ViewSeekableReader [+] Aurora::IO::FS::OpenMap [+] Aurora::IO::FS::OpenMapFromSharedHandle
72 lines
2.1 KiB
C++
72 lines
2.1 KiB
C++
/***
|
|
Copyright (C) 2024 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: AuIOAdapterAsyncDelegators.hpp
|
|
Date: 2024-2-24
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
#include <Source/IO/Async/AuIOThreadPool.hpp>
|
|
#include <Source/IO/Async/AuIOAPCLessWaitable.hpp>
|
|
|
|
namespace Aurora::IO::Adapters
|
|
{
|
|
struct AsyncReaderWriter : IAsyncTransaction,
|
|
Async::APCLessWaitable,
|
|
AuAsync::IWorkItemHandler
|
|
{
|
|
AuSPtr<IStreamReader> pStreamReader;
|
|
AuSPtr<ISeekingReader> pStreamReaderEx;
|
|
AuSPtr<IStreamWriter> pStreamWriter;
|
|
AuSPtr<ISeekingWriter> pStreamWriterEx;
|
|
AuSPtr<Memory::MemoryViewRead> pReadView;
|
|
AuSPtr<Memory::MemoryViewWrite> pWriteView;
|
|
AuWorkerPId workers;
|
|
|
|
void DispatchFrame(ProcessInfo &info) override;
|
|
|
|
void OnFailure() override;
|
|
|
|
bool StartRead(AuUInt64 uOffset, const AuSPtr<Memory::MemoryViewWrite> &memoryView) override;
|
|
|
|
bool StartWrite(AuUInt64 uOffset, const AuSPtr<Memory::MemoryViewRead> &memoryView) override;
|
|
|
|
AuUInt32 GetLastPacketLength() override;
|
|
|
|
void OnOriginThreadComplete() override;
|
|
|
|
bool Complete() override;
|
|
|
|
bool HasFailed() override;
|
|
|
|
bool HasCompleted() override;
|
|
|
|
AuUInt GetOSErrorCode() override;
|
|
|
|
void SetCallback(const AuSPtr<IAsyncFinishedSubscriber> &pSubscriber) override;
|
|
|
|
bool Wait(AuUInt32 uTimeout) override;
|
|
|
|
AuSPtr<IO::Loop::ILoopSource> NewLoopSource() override;
|
|
|
|
void Reset() override;
|
|
|
|
void SetBaseOffset(AuUInt64 uBaseOffset) override;
|
|
|
|
bool TryAttachToCompletionGroup(const AuSPtr<CompletionGroup::ICompletionGroup> &pCompletionGroup) override;
|
|
|
|
CompletionGroup::ICompletionGroupWorkHandle *ToCompletionGroupHandle() override;
|
|
|
|
AuSPtr<CompletionGroup::ICompletionGroup> GetCompletionGroup() override;
|
|
|
|
AuInt64 iBaseOffset {};
|
|
private:
|
|
AuMutex mutex;
|
|
AuSPtr<IAsyncFinishedSubscriber> pSubscriber;
|
|
AuUInt64 uLastOffset {};
|
|
AuUInt uLastLength {};
|
|
bool bInProgress {};
|
|
EStreamError eStreamError = EStreamError::eErrorNone;
|
|
};
|
|
} |