44#include <StormByte/type_traits/safe.hxx>
53#include <StormByte/safe/optional.hxx>
54#include <StormByte/safe/pointers.hxx>
55#include <StormByte/safe/string.hxx>
56#include <StormByte/type_traits.hxx>
215 friend class StormByte::Buffer::Backend::IO::BufferedReader;
237 template<
typename... Knobs>
332 virtual explicit operator
bool() const noexcept final;
374 virtual
bool IsOpen() const noexcept final;
387 virtual
bool EoF() const noexcept final;
630 parameters.MaxWait().value_or(0)}) {}
Private implementation of StormByte::Buffer::IO::BufferedReader.
Byte-oriented FIFO buffer with grow-on-demand and close/error support.
Definition fifo.hxx:86
Reader knobs.
Definition buffered_reader.hxx:225
Parameters(Knobs... knobs)
Store reader knobs in Safe-owned optional values.
Definition buffered_reader.hxx:238
Parameters()=default
Construct an empty Safe-owned parameter bag.
Parameters(Parameters &&other) noexcept=default
Transfer Safe-owned knobs.
~Parameters() noexcept=default
Release knobs through provider callbacks.
Parameters(const Parameters &other)=default
Copy Safe-owned knobs; may allocate and throw.
Coordinated binary read source with optional prefetch and cache.
Definition buffered_reader.hxx:214
void SetState(enum State state) noexcept
Publish session state from a leaf hook.
const StormByte::Safe::String & Path() const noexcept
Locator stored at construction.
StormByte::ByteSize ReadAhead() const noexcept
Configured prefetch length in bytes.
const StormByte::Safe::Shared< StormByte::Buffer::ReadTelemetry > Telemetry() const noexcept
Shared read counters.
virtual Result OriginClose()=0
Release the underlying device and SetState Unavailable.
BufferedReader(StormByte::Safe::String path, enum Location location, ReaderConfiguration configuration)
Construct an unopened coordinator (State::Unavailable).
virtual StormByte::ByteSize Tell() const noexcept final
Logical read offset in the stream.
virtual bool IsOpen() const noexcept final
Whether Open succeeded and Close has not.
virtual Result Close() final
Stop prefetch, drop caches, close the origin.
virtual StormByte::ByteSize Available() const noexcept final
Cached bytes readable at Tell without touching the origin.
virtual bool OriginCanSeek() const noexcept=0
Whether the device can seek.
virtual bool OriginHasSize() const noexcept=0
Whether the device reports a length.
virtual Result OriginPull(StormByte::ByteSize n, FIFO &dest)=0
Read up to n bytes from the device into dest.
virtual StormByte::Safe::Shared< StormByte::Buffer::ReadTelemetry > CreateTelemetry() const
Allocate the telemetry object this instance will keep.
enum Location Location() const noexcept
Where Path points.
virtual void Setup()
Leaf policy hook.
virtual enum State State() const noexcept final
Session state.
virtual StormByte::Safe::Optional< StormByte::ByteSize > OriginSize() const noexcept=0
Device length in bytes.
virtual bool Open() final
Arm the origin.
virtual Result Seek(std::ptrdiff_t offset, Position mode) const final
Move the logical read cursor.
StormByte::ByteSize MaxMemory() const noexcept
Configured cache memory cap in bytes.
virtual bool EoF() const noexcept final
Whether no further bytes can be produced.
virtual StormByte::Safe::Optional< StormByte::ByteSize > Size() const noexcept final
Origin length in bytes when known.
virtual bool Rewind() final
Re-arm an open source: Close then Open.
virtual bool IsSeekable() const noexcept final
Whether this instance can reposition the origin.
virtual Result Read(StormByte::ByteSize n, FIFO &dest) const final
Read n bytes into dest, consuming cache / origin.
friend class StormByte::Buffer::Backend::IO::BufferedReader
Definition buffered_reader.hxx:215
Result Configure(ReaderConfiguration configuration)
Cancel prefetch and apply a complete policy after active reads finish.
StormByte::ByteSize ReadChunk() const noexcept
Maximum request passed to the origin.
virtual bool IsReadable() const noexcept final
Whether reads may be attempted.
ReaderConfiguration Configuration() const noexcept
Read the complete policy without I/O.
virtual Result OriginOpen()=0
Arm the underlying device and SetState.
virtual Result OriginSeek(std::ptrdiff_t offset, Position mode)=0
Seek the device.
std::chrono::milliseconds MaxWait() const noexcept
Configured read wait limit.
TransferSnapshot Transfers() const noexcept
Read effective limits and real origin activity without I/O.
virtual Result Peek(StormByte::ByteSize n, FIFO &dest) const final
Copy n bytes into dest without consuming cache.
virtual bool IsSized() const noexcept final
Whether the origin length is known.
Reader counters on top of StormByte::Buffer::ReadTelemetry.
Definition telemetry.hxx:95
ReaderParameters()=default
No knobs.
STORMBYTE_DECLARE_MAYBE_SAFE(class StormByte::System::Device::Access)
PIMPL coordinators for the public IO types.
PIMPL coordinators for public Buffer types that are not IO.
Buffered binary sources and sinks.
Buffer module of the StormByte suite.
Position
Forward declaration of the WriteOnly interface.
Definition typedefs.hxx:74
Root namespace of the StormByte C++ suite.
Complete non-owning reader policy; scalar time crosses the DLL.
Definition parameters.hxx:234
Per-call status plus how many bytes this call transferred.
Definition typedefs.hxx:214
Non-I/O snapshot.
Definition parameters.hxx:256
#define STORMBYTE_BUFFER_PUBLIC
Definition visibility.h:54