CAF  0.17.2
Public Types | Public Member Functions | Protected Attributes | List of all members
caf::stream_stage_driver< Input, DownstreamManager > Class Template Referenceabstract

Encapsulates user-provided functionality for generating a stream stage. More...

#include <stream_stage_driver.hpp>

Inheritance diagram for caf::stream_stage_driver< Input, DownstreamManager >:
caf::detail::stream_stage_driver_impl< Input, DownstreamManager, Process, Finalize >

Public Types

using input_type = Input
 Element type of the input stream.
 
using downstream_manager_type = DownstreamManager
 Policy for distributing data to outbound paths.
 
using output_type = typename downstream_manager_type::output_type
 Element type of the output stream.
 
using stream_type = stream< output_type >
 Type of the output stream.
 
using stage_type = stream_stage< input_type, DownstreamManager >
 Implemented stream_stage interface.
 
using stage_ptr_type = intrusive_ptr< stage_type >
 Smart pointer to the interface type.
 

Public Member Functions

 stream_stage_driver (DownstreamManager &out)
 
virtual void process (downstream< output_type > &out, std::vector< input_type > &batch)=0
 Processes a single batch.
 
virtual void finalize (const error &)
 Cleans up any state.
 
virtual bool congested () const noexcept
 Can mark the stage as congested. More...
 
virtual int32_t acquire_credit (inbound_path *path, int32_t desired)
 Acquires credit on an inbound path. More...
 

Protected Attributes

DownstreamManager & out_
 

Detailed Description

template<class Input, class DownstreamManager>
class caf::stream_stage_driver< Input, DownstreamManager >

Encapsulates user-provided functionality for generating a stream stage.

Member Function Documentation

◆ acquire_credit()

template<class Input , class DownstreamManager >
virtual int32_t caf::stream_stage_driver< Input, DownstreamManager >::acquire_credit ( inbound_path path,
int32_t  desired 
)
virtual

Acquires credit on an inbound path.

The calculated credit to fill our queue fro two cycles is desired, but the driver is allowed to return any non-negative value.

◆ congested()

template<class Input , class DownstreamManager >
virtual bool caf::stream_stage_driver< Input, DownstreamManager >::congested ( ) const
virtualnoexcept

Can mark the stage as congested.

The default implementation signals a congestion if the downstream manager has no capacity left in its buffer.


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