AuroraRuntime/Include/Aurora/IO/IOPipeRequest.hpp

55 lines
1.6 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
*/
AuUInt32 lengthOrZero {};
/**
* @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)
*/
bool isStream {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)
*/
AuUInt32 pageLengthOrZero {};
/**
* @brief internal buffer size or zero if fallback
*/
AuUInt32 bufferLengthOrZero {};
/**
* @brief event listener
*/
AuSPtr<IIOPipeEventListener> listener;
/**
* @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};
};
}