CAF  0.17.3
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Related Functions | List of all members
caf::outbound_path Class Reference

State for a single path to a sink of a downstream_manager. More...

#include <outbound_path.hpp>

Public Types

using regular_shutdown = downstream_msg::close
 Propagates graceful shutdowns.
using irregular_shutdown = downstream_msg::forced_close
 Propagates errors.
using cache_type = std::deque< std::pair< int64_t, downstream_msg::batch > >
 Stores batches until receiving corresponding ACKs.

Public Member Functions

 outbound_path (stream_slot sender_slot, strong_actor_ptr receiver_hdl)
 Constructs a pending path for given slot and handle.
void emit_batch (local_actor *self, int32_t xs_size, message xs)
 Sends a downstream_msg::batch on this path. More...
template<class Iterator >
Iterator emit_batches_impl (local_actor *self, Iterator i, Iterator e, bool force_underfull)
template<class T >
void emit_batches (local_actor *self, std::vector< T > &cache, bool force_underfull)
 Calls emit_batch for each chunk in the cache, whereas each chunk is of size desired_batch_size. More...
void emit_regular_shutdown (local_actor *self)
 Sends a downstream_msg::close on this path.
void emit_irregular_shutdown (local_actor *self, error reason)
 Sends a downstream_msg::forced_close on this path.
bool pending () const noexcept
 Returns whether this path is pending, i.e., didn't receive an ack_open yet.
bool clean () const noexcept
 Returns whether no pending ACKs exist.
void set_desired_batch_size (int32_t value) noexcept

Static Public Member Functions

static void emit_open (local_actor *self, stream_slot slot, strong_actor_ptr to, message handshake_data, stream_priority prio)
 Sends an open_stream_msg handshake.
static void emit_irregular_shutdown (local_actor *self, stream_slots slots, const strong_actor_ptr &hdl, error reason)
 Sends a downstream_msg::forced_close.

Public Attributes

stream_slots slots
 Slot IDs for sender (self) and receiver (hdl).
strong_actor_ptr hdl
 Handle to the sink.
int64_t next_batch_id
 Next expected batch ID.
int32_t open_credit
 Currently available credit on this path.
int32_t desired_batch_size
 Ideal batch size. Configured by the sink.
int64_t next_ack_id
 ID of the first unacknowledged batch. More...
int32_t max_capacity
 Stores the maximum capacity of the downstream actor.
bool closing
 Stores whether an outbound path is marked for removal. More...

Static Public Attributes

static constexpr const auto aborter_type = stream_aborter::sink_aborter
 Stream aborter flag to monitor a path.

Related Functions

(Note that these are not member functions.)

template<class Inspector >
Inspector::result_type inspect (Inspector &f, outbound_path &x)

Detailed Description

State for a single path to a sink of a downstream_manager.

Member Function Documentation

◆ emit_batch()

void caf::outbound_path::emit_batch ( local_actor *  self,
int32_t  xs_size,
message  xs 

Sends a downstream_msg::batch on this path.

Decrements open_credit by xs_size and increments next_batch_id by 1.

◆ emit_batches()

template<class T >
void caf::outbound_path::emit_batches ( local_actor *  self,
std::vector< T > &  cache,
bool  force_underfull 

Calls emit_batch for each chunk in the cache, whereas each chunk is of size desired_batch_size.

Does nothing for pending paths.

Member Data Documentation

◆ closing

bool caf::outbound_path::closing

Stores whether an outbound path is marked for removal.

The downstream_manger no longer sends new batches to a closing path, but buffered batches are still shipped. The owning stream_manager removes the path when receiving an upstream_msg::ack_batch and no pending batches for this path exist.

◆ next_ack_id

int64_t caf::outbound_path::next_ack_id

ID of the first unacknowledged batch.

Note that CAF uses accumulative ACKs, i.e., receiving an ACK with a higher ID is not an error.

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