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

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

Detailed Description

Writing end of an unidirectional pipe.

Definition at line 59 of file pipe.hpp.

+ Inheritance diagram for engine::io::PipeWriter:

Public Member Functions

bool IsValid () const
 Whether the writing end of the pipe is valid.
 
bool WaitWriteable (Deadline) override
 
size_t WriteAll (const void *buf, size_t len, Deadline deadline) override
 
int Fd () const
 File descriptor corresponding to the write end of the pipe.
 
int Release () noexcept
 Releases writing end file descriptor and invalidates it.
 
void Close ()
 
virtual size_t WriteAll (std::span< const IoData > list, Deadline deadline)
 Sends IoData array using vector I/O (e.g. writev).
 
virtual size_t WriteAll (std::initializer_list< IoData > list, Deadline deadline)
 Sends IoData initializer list using vector I/O (e.g. writev).
 
AwaitableToken GetAwaitableToken ()
 Satisfies engine::Awaitable, for use with engine::WaitAnyContext and friends.
 

Protected Member Functions

void SetWritableAwaitableToken (AwaitableToken token)
 

Member Function Documentation

◆ Close()

void engine::io::PipeWriter::Close ( )

Closes and invalidates the writing end of the pipe.

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

◆ GetAwaitableToken()

AwaitableToken engine::io::WriteAwaiter::GetAwaitableToken ( )
inlineinherited

Satisfies engine::Awaitable, for use with engine::WaitAnyContext and friends.

Definition at line 91 of file common.hpp.

◆ SetWritableAwaitableToken()

void engine::io::WriteAwaiter::SetWritableAwaitableToken ( AwaitableToken token)
inlineprotectedinherited

Definition at line 96 of file common.hpp.

◆ WaitWriteable()

bool engine::io::PipeWriter::WaitWriteable ( Deadline )
nodiscardoverridevirtual

Suspends current task until the pipe can accept more data.

Returns
false on timeout or on task cancellations; true otherwise.

Implements engine::io::WriteAwaiter.

◆ WriteAll() [1/3]

size_t engine::io::PipeWriter::WriteAll ( const void * buf,
size_t len,
Deadline deadline )
nodiscardoverridevirtual

Sends exactly len bytes to the pipe.

Note
Can return less than len if pipe is closed by peer.
Returns
count of bytes written to the pipe

Implements engine::io::WritableBase.

◆ WriteAll() [2/3]

virtual size_t engine::io::WritableBase::WriteAll ( std::initializer_list< IoData > list,
Deadline deadline )
inlinenodiscardvirtualinherited

Sends IoData initializer list using vector I/O (e.g. writev).

Note
Can return less than total bytes if stream is closed by peer.

Reimplemented in engine::io::TlsWrapper.

Definition at line 133 of file common.hpp.

◆ WriteAll() [3/3]

virtual size_t engine::io::WritableBase::WriteAll ( std::span< const IoData > list,
Deadline deadline )
inlinenodiscardvirtualinherited

Sends IoData array using vector I/O (e.g. writev).

Note
Can return less than total bytes if stream is closed by peer.

Reimplemented in engine::io::Socket, and engine::io::TlsWrapper.

Definition at line 123 of file common.hpp.

Friends And Related Symbol Documentation

◆ Pipe

friend class Pipe
friend

Definition at line 85 of file pipe.hpp.


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