44#include <StormByte/type_traits/safe.hxx>
53#include <StormByte/safe/pointers.hxx>
54#include <StormByte/safe/string.hxx>
55#include <StormByte/type_traits.hxx>
235 friend class StormByte::Buffer::Backend::IO::BufferedWriter;
236 friend class StormByte::Buffer::Backend::Bridge;
258 template<
typename... Knobs>
353 virtual explicit operator
bool() const noexcept final;
395 virtual
bool IsOpen() const noexcept final;
641 parameters.BackPressure().value_or(0),
642 parameters.MaxWait().value_or(0),
756 std::unique_ptr<StormByte::Buffer::Backend::IO::BufferedWriter> m_io;
Private pump for StormByte::Buffer::Bridge.
Private implementation of StormByte::Buffer::IO::BufferedWriter.
Byte-oriented FIFO buffer with grow-on-demand and close/error support.
Definition fifo.hxx:86
Writer knobs.
Definition buffered_writer.hxx:246
Parameters(Parameters &&other) noexcept=default
Transfer Safe-owned knobs.
Parameters(Knobs... knobs)
Store writer knobs in Safe-owned optional values.
Definition buffered_writer.hxx:259
~Parameters() noexcept=default
Release knobs through provider callbacks.
Parameters()=default
Construct an empty Safe-owned parameter bag.
Parameters(const Parameters &other)=default
Copy Safe-owned knobs; may allocate and throw.
Coordinated binary write sink with optional chunked write-behind and a delayed-seek page map.
Definition buffered_writer.hxx:234
BufferedWriter(StormByte::Safe::String path, enum Location location, WriterConfiguration configuration)
Construct an unopened coordinator (State::Unavailable).
TransferSnapshot Transfers() const noexcept
Read effective limits and real origin activity without I/O.
void SetTell(StormByte::ByteSize offset) noexcept
Publish the logical write offset from a leaf Seek.
virtual Result Flush() final
Materialise every dirty page, drain the ring and OriginFlush.
StormByte::ByteSize WriteThreshold() const noexcept
Page drain high watermark.
virtual StormByte::ByteSize Tell() const noexcept
Logical write offset.
WriterConfiguration Configuration() const noexcept
Read the complete policy without I/O.
virtual enum State State() const noexcept final
Session state.
virtual Result OriginFlush()=0
Make accepted bytes visible on the device.
virtual bool Rewind() final
Re-arm: Close then Open when currently armed.
virtual bool Close() final
Flush then close the origin.
friend class StormByte::Buffer::Backend::IO::BufferedWriter
Definition buffered_writer.hxx:235
virtual Result OriginPush(std::span< const std::byte > data)=0
Write data to the device.
virtual Result OriginClose()=0
Release the device and SetState Unavailable.
StormByte::ByteSize MaxMemory() const noexcept
Byte budget for dirty pages that are not yet on the origin.
virtual Result Write(const FIFO &src) final
Write every unread byte of src.
virtual void Setup()
Leaf policy hook.
virtual StormByte::ByteSize Size() const noexcept
Logical sink length in bytes.
virtual Result OriginTruncate()=0
Discard origin contents.
virtual StormByte::Safe::Shared< StormByte::Buffer::WriteTelemetry > CreateTelemetry() const
Allocate the telemetry object this instance will keep.
virtual StormByte::ByteSize Dirty() const noexcept
Bytes not yet on the origin.
virtual Result Seek(std::ptrdiff_t offset, Position mode)
Move the write cursor.
std::size_t BackPressure() const noexcept
Configured dirty cap in WriteChunk units.
virtual Result OriginSeek(StormByte::ByteSize absolute)
Seek the origin to absolute.
StormByte::ByteSize WriteChunk() const noexcept
Configured ring unit and drain trigger, not a transfer maximum.
void SetState(enum State state) noexcept
Publish session state from a leaf hook.
virtual Result Truncate() final
Drop dirty pages and the ring, then truncate the origin.
Result Configure(WriterConfiguration configuration)
Flush old policy and atomically replace it, including ring capacity.
std::chrono::milliseconds MaxWait() const noexcept
Wait cap for OriginPush.
const StormByte::Safe::String & Path() const noexcept
Locator stored at construction.
const StormByte::Safe::Shared< StormByte::Buffer::WriteTelemetry > Telemetry() const noexcept
Shared write counters.
virtual Result OriginOpen()=0
Arm the device and SetState.
virtual bool WillWrite(StormByte::ByteSize n) const
Whether n more bytes can be accepted now.
enum Location Location() const noexcept
Where Path points.
StormByte::ByteSize WriteTransfer() const noexcept
Maximum origin request in every mode.
virtual bool IsOpen() const noexcept final
Whether Open succeeded and Close has not.
virtual bool Open() final
Arm the origin.
Writer counters on top of StormByte::Buffer::WriteTelemetry.
Definition telemetry.hxx:328
WriterParameters()=default
No knobs.
STORMBYTE_DECLARE_MAYBE_SAFE(class StormByte::System::Device::Access)
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.
Per-call status plus how many bytes this call transferred.
Definition typedefs.hxx:214
Non-I/O snapshot.
Definition parameters.hxx:256
Complete non-owning writer policy; Configure applies all fields together.
Definition parameters.hxx:244
#define STORMBYTE_BUFFER_PUBLIC
Definition visibility.h:54