Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::timeline::BoundedJsonSink Class Reference

Append-only JSON output sink with an enforced byte ceiling. More...

#include <schema_registry.hpp>

Public Member Functions

 BoundedJsonSink (std::size_t maximum, PersistenceErrorCode overflow_code=PersistenceErrorCode::OutputLimitExceeded)
 Creates an empty sink with a maximum output size and overflow code.
 BoundedJsonSink (const BoundedJsonSink &)=delete
BoundedJsonSink & operator= (const BoundedJsonSink &)=delete
 BoundedJsonSink (BoundedJsonSink &&)=delete
BoundedJsonSink & operator= (BoundedJsonSink &&)=delete
bool append (std::string_view bytes)
 Appends all bytes or none of them when the ceiling would be exceeded.
bool failed () const noexcept
 Reports whether an append has exceeded the ceiling.
std::size_t size () const noexcept
 Returns the number of bytes accepted so far.
std::size_t maximum () const noexcept
 Returns the configured byte ceiling.
std::size_t remaining () const noexcept
 Returns the number of bytes that can still be accepted.
PersistenceError error (std::string path={}) const
 Describes the recorded overflow and associates it with path.

Friends

class SchemaRegistry

Detailed Description

Append-only JSON output sink with an enforced byte ceiling.

Callback output is accepted only through this incrementally checked sink; the callback ABI has no unbounded string-returning path. The first append that would exceed the ceiling fails atomically, records the attempted total, and makes every later append fail.

Constructor & Destructor Documentation

◆ BoundedJsonSink() [1/3]

pulp::timeline::BoundedJsonSink::BoundedJsonSink ( std::size_t maximum,
PersistenceErrorCode overflow_code = PersistenceErrorCode::OutputLimitExceeded )
inlineexplicit

Creates an empty sink with a maximum output size and overflow code.

◆ BoundedJsonSink() [2/3]

pulp::timeline::BoundedJsonSink::BoundedJsonSink ( const BoundedJsonSink & )
delete

◆ BoundedJsonSink() [3/3]

pulp::timeline::BoundedJsonSink::BoundedJsonSink ( BoundedJsonSink && )
delete

Member Function Documentation

◆ append()

bool pulp::timeline::BoundedJsonSink::append ( std::string_view bytes)

Appends all bytes or none of them when the ceiling would be exceeded.

◆ error()

PersistenceError pulp::timeline::BoundedJsonSink::error ( std::string path = {}) const

Describes the recorded overflow and associates it with path.

◆ failed()

bool pulp::timeline::BoundedJsonSink::failed ( ) const
inlinenoexcept

Reports whether an append has exceeded the ceiling.

◆ maximum()

std::size_t pulp::timeline::BoundedJsonSink::maximum ( ) const
inlinenoexcept

Returns the configured byte ceiling.

◆ operator=() [1/2]

BoundedJsonSink & pulp::timeline::BoundedJsonSink::operator= ( BoundedJsonSink && )
delete

◆ operator=() [2/2]

BoundedJsonSink & pulp::timeline::BoundedJsonSink::operator= ( const BoundedJsonSink & )
delete

◆ remaining()

std::size_t pulp::timeline::BoundedJsonSink::remaining ( ) const
inlinenoexcept

Returns the number of bytes that can still be accepted.

◆ size()

std::size_t pulp::timeline::BoundedJsonSink::size ( ) const
inlinenoexcept

Returns the number of bytes accepted so far.

◆ SchemaRegistry

friend class SchemaRegistry
friend

The documentation for this class was generated from the following file: