C++ Actor Framework 0.18
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
caf::detail::size_based_credit_controller Class Reference

A credit controller that estimates the bytes required to store incoming batches and constrains credit based on upper bounds for memory usage. More...

#include <size_based_credit_controller.hpp>

Inheritance diagram for caf::detail::size_based_credit_controller:
caf::credit_controller

Public Member Functions

 size_based_credit_controller (local_actor *self)
 
calibration init () override
 Returns an initial calibration for the path.
 
calibration calibrate () override
 Computes a credit assignment to the source after crossing the low-threshold.
 
- Public Member Functions inherited from caf::credit_controller
virtual void before_processing (downstream_msg::batch &batch)=0
 Called before processing the batch x in order to allow the controller to keep statistics on incoming batches.
 
virtual calibration init ()=0
 Returns an initial calibration for the path.
 
virtual calibration calibrate ()=0
 Computes a credit assignment to the source after crossing the low-threshold.
 

Static Public Member Functions

template<class T >
static auto make (local_actor *self, stream< T >)
 

Public Attributes

int32_t initial_buffer_size = 10
 Stores how many elements we buffer at most after the handshake.
 
int32_t initial_batch_size = 2
 Stores how many elements we allow per batch after the handshake.
 

Static Public Attributes

static constexpr int32_t min_samples = 50
 Configures how many samples we require for recalculating buffer sizes.
 

Protected Attributes

local_actorself_
 
int32_t sample_counter_ = 0
 Keeps track of when to sample a batch.
 
int32_t bytes_per_element_ = 0
 Stores the last computed (moving) average for the serialized size per element in the stream.
 
int32_t sampled_elements_ = 0
 Stores how many elements were sampled since last calling calibrate.
 
int64_t sampled_total_size_ = 0
 Stores how many bytes the sampled batches required when serialized.
 
serialized_size_inspector inspector_
 Computes how many bytes elements require on the wire.
 
bool initializing_ = true
 Stores whether this is the first run.
 
int32_t bytes_per_batch_
 
int32_t buffer_capacity_
 
int32_t sampling_rate_ = 1
 
int32_t calibration_interval_
 
float smoothing_factor_
 

Detailed Description

A credit controller that estimates the bytes required to store incoming batches and constrains credit based on upper bounds for memory usage.

Member Function Documentation

◆ calibrate()

calibration caf::detail::size_based_credit_controller::calibrate ( )
overridevirtual

Computes a credit assignment to the source after crossing the low-threshold.

May assign zero credit.

Implements caf::credit_controller.

◆ init()

calibration caf::detail::size_based_credit_controller::init ( )
overridevirtual

Returns an initial calibration for the path.

Implements caf::credit_controller.


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