#include <serialise.hh>
Public Member Functions | |
BufferedSource (size_t bufSize=32 *1024) | |
size_t | read (char *data, size_t len) override |
bool | hasData () |
![]() | |
void | operator() (char *data, size_t len) |
void | operator() (std::string_view data) |
virtual bool | good () |
void | drainInto (Sink &sink) |
std::string | drain () |
Public Attributes | |
size_t | bufSize |
size_t | bufPosIn |
size_t | bufPosOut |
std::unique_ptr< char[]> | buffer |
Protected Member Functions | |
virtual size_t | readUnbuffered (char *data, size_t len)=0 |
A buffered abstract source. Warning: a BufferedSource should not be used from multiple threads concurrently.
bool nix::BufferedSource::hasData | ( | ) |
Return true if the buffer is not empty.
Store up to ‘len’ in the buffer pointed to by ‘data’, and return the number of bytes stored. It blocks until at least one byte is available.
Implements nix::Source.
|
protectedpure virtual |
Underlying read call, to be overridden.
Implemented in nix::daemon::TunnelSource, and nix::FdSource.