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 |
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.
|
inlineexplicit |
Creates an empty sink with a maximum output size and overflow code.
|
delete |
|
delete |
| bool pulp::timeline::BoundedJsonSink::append | ( | std::string_view | bytes | ) |
Appends all bytes or none of them when the ceiling would be exceeded.
| PersistenceError pulp::timeline::BoundedJsonSink::error | ( | std::string | path = {} | ) | const |
Describes the recorded overflow and associates it with path.
|
inlinenoexcept |
Reports whether an append has exceeded the ceiling.
|
inlinenoexcept |
Returns the configured byte ceiling.
|
delete |
|
delete |
|
inlinenoexcept |
Returns the number of bytes that can still be accepted.
|
inlinenoexcept |
Returns the number of bytes accepted so far.
|
friend |