userver: engine::io::PipeReader Class Reference
Loading...
Searching...
No Matches
engine::io::PipeReader Class Referencefinal

#include <userver/engine/io/pipe.hpp>

Detailed Description

Reading end of an unidirectional pipe.

Definition at line 20 of file pipe.hpp.

+ Inheritance diagram for engine::io::PipeReader:

Public Member Functions

bool IsValid () const override
 Whether the reading end of the pipe is valid.
 
bool WaitReadable (Deadline) override
 Suspends current task until the pipe has data available.
 
size_t ReadSome (void *buf, size_t len, Deadline deadline) override
 Receives at least one bytes from the pipe.
 
size_t ReadAll (void *buf, size_t len, Deadline deadline) override
 
int Fd () const
 File descriptor corresponding to the read end of the pipe.
 
int Release () noexcept
 Releases reading end file descriptor and invalidates it.
 
void Close ()
 
virtual std::optional< size_t > ReadNoblock (void *buf, size_t len)
 
impl::ContextAccessor * TryGetContextAccessor ()
 For internal use only.
 

Protected Member Functions

void SetReadableContextAccessor (impl::ContextAccessor *ca)
 

Member Function Documentation

◆ Close()

void engine::io::PipeReader::Close ( )

Closes and invalidates the reading end of the pipe.

Warning
You should not call Close with pending I/O. This may work okay sometimes but it's loosely predictable.

◆ IsValid()

bool engine::io::PipeReader::IsValid ( ) const
overridevirtual

Whether the reading end of the pipe is valid.

Implements engine::io::ReadableBase.

◆ ReadAll()

size_t engine::io::PipeReader::ReadAll ( void * buf,
size_t len,
Deadline deadline )
overridevirtual

Receives exactly len bytes from the pipe.

Note
Can return less than len if pipe is closed by peer.

Implements engine::io::ReadableBase.

◆ ReadNoblock()

virtual std::optional< size_t > engine::io::ReadableBase::ReadNoblock ( void * buf,
size_t len )
inlinevirtualinherited

Receives up to len (including zero) bytes from the stream.

Returns
filled-in optional on data presence (e.g. 0, 1, 2... bytes) empty optional otherwise

Reimplemented in engine::io::Socket.

Definition at line 39 of file common.hpp.

◆ ReadSome()

size_t engine::io::PipeReader::ReadSome ( void * buf,
size_t len,
Deadline deadline )
overridevirtual

Receives at least one bytes from the pipe.

Implements engine::io::ReadableBase.

◆ SetReadableContextAccessor()

void engine::io::ReadableBase::SetReadableContextAccessor ( impl::ContextAccessor * ca)
inlineprotectedinherited

Definition at line 57 of file common.hpp.

◆ TryGetContextAccessor()

impl::ContextAccessor * engine::io::ReadableBase::TryGetContextAccessor ( )
inlineinherited

For internal use only.

Definition at line 54 of file common.hpp.

◆ WaitReadable()

bool engine::io::PipeReader::WaitReadable ( Deadline )
overridevirtual

Suspends current task until the pipe has data available.

Implements engine::io::ReadableBase.

Friends And Related Symbol Documentation

◆ Pipe

friend class Pipe
friend

Definition at line 47 of file pipe.hpp.


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