AuroraRuntime/Include/Aurora/IO/IOPipeRequest.hpp

65 lines
2.1 KiB
C++
Raw Normal View History

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: IOPipeRequest.hpp
Date: 2022-6-20
Author: Reece
***/
#pragma once
namespace Aurora::IO
{
struct IIOPipeEventListener;
struct IOPipeRequest
{
/**
* @brief Amount of bytes to transfer or zero if run until EoS/EoF
*/
2022-08-29 15:46:46 +00:00
AuUInt32 uLengthOrZero {};
/**
* @brief true if the underlying stream uses relative stream positions
* (IE: a network or pipe stream that cannot seek backwards and fowards)
* (Inversely, file devices and similar IO subsystems use IO packets with absolute offsets)
*/
2022-08-29 15:46:46 +00:00
bool bIsStream {false};
/**
* @brief internal frame size, that is one iteration of file or stream read, in bytes or zero if fallback
* Windows is inclined to read every single requested byte of a file stream asynchronously
* Streams, on all platforms, yield as soon as there is data available to copy over (usually)
*/
2022-08-29 15:46:46 +00:00
AuUInt32 uPageLengthOrZero {};
/**
* @brief internal buffer size or zero if fallback
*/
2022-08-29 15:46:46 +00:00
AuUInt32 uBufferLengthOrZero {};
/**
* @brief event listener
*/
2022-08-29 15:46:46 +00:00
AuSPtr<IIOPipeEventListener> pListener;
/**
* @brief Minimum amount of bytes to read from the stream *if not identical to uLengthOrZero*
*
* Consider padded streams where only the content itself is read from a given interceptor;
* adjusting this variable permits for under-reads without failing the pipe transaction.
*
* Recommended: 0 -> use uLengthOrZero
*/
AuUInt32 uMinBytesToRead {};
/**
* @brief Used as the buffer size for streams of page length 0
*/
static const AuUInt32 kFallbackPageSize {1024 * 1024 * 5};
/**
* @brief Used as the buffer size for streams of buffer length 0
*/
static const AuUInt32 kFallbackBufferSize {1024 * 1024 * 50};
};
}