Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::BufferedSource Class Referenceabstract

#include <serialise.hh>

Inheritance diagram for nix::BufferedSource:
nix::Source nix::FdSource

Public Member Functions

 BufferedSource (size_t bufSize=32 *1024)
size_t read (char *data, size_t len) override
std::string readLine (bool eofOk=false, char terminator='\n')
bool hasData ()
Public Member Functions inherited from nix::Source
void operator() (char *data, size_t len)
void operator() (std::string_view data)
virtual bool good ()
void drainInto (Sink &sink)
virtual void drainInto (Sink &sink, uint64_t len)
std::string drain ()
virtual void skip (size_t len)

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

Detailed Description

A buffered abstract source. Warning: a BufferedSource should not be used from multiple threads concurrently.

Member Function Documentation

◆ hasData()

bool nix::BufferedSource::hasData ( )

Return true if the buffer is not empty.

◆ read()

size_t nix::BufferedSource::read ( char * data,
size_t len )
overridevirtual

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.

◆ readUnbuffered()

virtual size_t nix::BufferedSource::readUnbuffered ( char * data,
size_t len )
protectedpure virtual

Underlying read call, to be overridden.

Implemented in nix::FdSource.


The documentation for this class was generated from the following files:
  • libutil/include/nix/util/serialise.hh
  • libutil/serialise.cc