libcaf  0.16.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Related Functions | List of all members
caf::inbound_path Class Reference

State for a path to an upstream actor (source). More...

#include <inbound_path.hpp>

Classes

struct  stats_t
 Stores statistics for measuring complexity of incoming batches. More...
 

Public Types

using regular_shutdown = upstream_msg::drop
 Message type for propagating graceful shutdowns.
 
using irregular_shutdown = upstream_msg::forced_drop
 Message type for propagating errors.
 

Public Member Functions

 inbound_path (stream_manager_ptr mgr_ptr, stream_slots id, strong_actor_ptr ptr)
 Constructs a path for given handle and stream ID.
 
void handle (downstream_msg::batch &x)
 Updates last_batch_id and assigned_credit before dispatching to the manager. More...
 
template<class T >
void handle (T &x)
 Dispatches any downstream_msg other than batch directly to the manager. More...
 
void emit_ack_open (local_actor *self, actor_addr rebind_from)
 Emits an upstream_msg::ack_batch.
 
void emit_ack_batch (local_actor *self, int32_t queued_items, timespan cycle, timespan desired_batch_complexity)
 Sends an upstream_msg::ack_batch for granting new credit. More...
 
bool up_to_date ()
 Returns whether the path received no input since last emitting ack_batch, i.e., last_acked_batch_id == last_batch_id. More...
 
void emit_regular_shutdown (local_actor *self)
 Sends an upstream_msg::drop on this path.
 
void emit_irregular_shutdown (local_actor *self, error reason)
 Sends an upstream_msg::forced_drop on this path.
 

Static Public Member Functions

static void emit_irregular_shutdown (local_actor *self, stream_slots slots, const strong_actor_ptr &hdl, error reason)
 Sends an upstream_msg::forced_drop.
 

Public Attributes

stream_manager_ptr mgr
 Points to the manager responsible for incoming traffic.
 
strong_actor_ptr hdl
 Handle to the source.
 
stream_slots slots
 Stores slot IDs for sender (hdl) and receiver (self).
 
int32_t desired_batch_size
 Stores the last computed desired batch size.
 
int32_t assigned_credit
 Amount of credit we have signaled upstream.
 
stream_priority prio
 Priority of incoming batches from this source.
 
int64_t last_acked_batch_id
 ID of the last acknowledged batch ID.
 
int64_t last_batch_id
 ID of the last received batch.
 
stats_t stats
 

Static Public Attributes

static constexpr int initial_credit = 50
 Amount of credit we assign sources after receiving open.
 
static constexpr size_t stats_sampling_size = 16
 Keep track of measurements for the last X batches.
 

Related Functions

(Note that these are not member functions.)

template<class Inspector >
Inspector::return_type inspect (Inspector &f, inbound_path &x)
 

Detailed Description

State for a path to an upstream actor (source).

Member Function Documentation

◆ emit_ack_batch()

void caf::inbound_path::emit_ack_batch ( local_actor *  self,
int32_t  queued_items,
timespan  cycle,
timespan  desired_batch_complexity 
)

Sends an upstream_msg::ack_batch for granting new credit.

Credit is calculated from sampled batch durations, the cycle duration and the desired batch complexity.

Parameters
selfPoints to the parent actor, i.e., sender of the message.
queued_itemsAccumulated size of all batches that are currently waiting in the mailbox.
cycleTime between credit rounds.
desired_batch_complexityDesired processing time per batch.

◆ handle() [1/2]

void caf::inbound_path::handle ( downstream_msg::batch x)

Updates last_batch_id and assigned_credit before dispatching to the manager.

◆ handle() [2/2]

template<class T >
void caf::inbound_path::handle ( T &  x)

Dispatches any downstream_msg other than batch directly to the manager.

◆ up_to_date()

bool caf::inbound_path::up_to_date ( )

Returns whether the path received no input since last emitting ack_batch, i.e., last_acked_batch_id == last_batch_id.

Friends And Related Function Documentation

◆ inspect()

template<class Inspector >
Inspector::return_type inspect ( Inspector &  f,
inbound_path x 
)
related

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