Loading...
Searching...
No Matches
caf::buffered_downstream_manager< T > Class Template Reference

Mixin for streams with any number of downstreams. More...

`#include <buffered_downstream_manager.hpp>`

Inheritance diagram for caf::buffered_downstream_manager< T >:

## Public Types

using | super = downstream_manager_base
using | output_type = T
using | buffer_type = std::deque<output_type>
using | chunk_type = std::vector<output_type>
Public Types inherited from caf::downstream_manager_base
using | super = downstream_manager
| Base type.
using | map_type = detail::unordered_flat_map<stream_slot, unique_path_ptr>
| Maps slots to paths.
Public Types inherited from caf::downstream_manager
enum | path_algorithm { all_of , any_of , none_of }
| Selects a check algorithms.
using | path_type = outbound_path
| Outbound path.
using | path_ptr = path_type*
| Pointer to an outbound path.
using | const_path_ptr = const path_type*
| Pointer to an immutable outbound path.
using | unique_path_ptr = std::unique_ptr<path_type>
| Unique pointer to an outbound path.

## Public Member Functions

| buffered_downstream_manager (stream_manager *parent)
template<class T0, class... Ts>
void | push (T0 &&x, Ts &&... xs)
chunk_type | get_chunk (size_t n)
bool | terminal () const noexcept override
| Returns true if this manager belongs to a sink, i.e., terminates the stream and never has outbound paths.
size_t | capacity () const noexcept override
| Queries the currently available capacity for the output buffer.
size_t | buffered () const noexcept override
| Queries the size of the output buffer.
buffer_type & | buf ()
const buffer_type & | buf () const
Public Member Functions inherited from caf::downstream_manager_base
| downstream_manager_base (stream_manager *parent)
const map_type & | paths () const
map_type & | paths ()
size_t | num_paths () const noexcept override
| Returns the current number of paths.
bool | remove_path (stream_slot slots, error reason, bool silent) noexcept override
| Removes a path from the manager.
path_ptr | path (stream_slot slots) noexcept override
| Returns the path associated to slot or nullptr.
void | clear_paths () override
| Silently removes all paths.
Public Member Functions inherited from caf::downstream_manager
| downstream_manager (stream_manager *parent)
scheduled_actor * | self () const noexcept
stream_manager * | parent () const noexcept
template<class F>
void | for_each_path (F f)
| Applies f to each path.
std::vector< stream_slot > | path_slots ()
| Returns all used slots.
std::vector< stream_slot > | open_path_slots ()
| Returns all open slots, i.e., slots assigned to outbound paths with closing == false.
template<class Predicate>
bool | all_paths (Predicate predicate) const noexcept
| Checks whether predicate holds true for all paths.
template<class Predicate>
bool | any_path (Predicate predicate) const noexcept
| Checks whether predicate holds true for any path.
template<class Predicate>
bool | no_path (Predicate predicate) const noexcept
| Checks whether predicate holds true for no path.
path_ptr | add_path (stream_slot slot, strong_actor_ptr target)
| Adds a pending path to target to the manager.
const_path_ptr | path (stream_slot slot) const noexcept
| Returns the path associated to slot or nullptr.
bool | clean () const noexcept
| Returns true if there is no data pending and all batches are acknowledged batch on all paths.
bool | clean (stream_slot slot) const noexcept
| Returns true if slot is unknown or if there is no data pending and all batches are acknowledged on slot.
virtual void | close ()
| Removes all paths gracefully.
virtual void | close (stream_slot slot)
| Removes path slot gracefully by sending pending batches before removing it.
virtual void | abort (error reason)
| Removes all paths with an error message.
bool | empty () const noexcept
| Returns num_paths() == 0.
size_t | min_credit () const
| Returns the minimum amount of credit on all output paths.
size_t | max_credit () const
| Returns the maximum amount of credit on all output paths.
size_t | total_credit () const
| Returns the total amount of credit on all output paths, i.e., the sum of all individual credits.
virtual void | emit_batches ()
| Sends batches to sinks.
virtual void | force_emit_batches ()
| Sends batches to sinks regardless of whether or not the batches reach the desired batch size.
virtual size_t | buffered (stream_slot slot) const noexcept
| Queries an estimate of the size of the output buffer for slot.
virtual int32_t | max_capacity () const noexcept
| Computes the maximum available downstream capacity.
bool | stalled () const noexcept
| Queries whether the manager cannot make any progress, because its buffer is full and no more credit is available.

## Static Public Member Functions

static chunk_type | get_chunk (buffer_type &buf, size_t n)

## Protected Attributes

buffer_type | buf_
Protected Attributes inherited from caf::downstream_manager_base
map_type | paths_
Protected Attributes inherited from caf::downstream_manager
stream_manager * | parent_

## Additional Inherited Members

Protected Member Functions inherited from caf::downstream_manager_base
bool | insert_path (unique_path_ptr ptr) override
| Inserts ptr to the implementation-specific container.
void | for_each_path_impl (path_visitor &f) override
| Applies f to each path.
bool | check_paths_impl (path_algorithm algo, path_predicate &pred) const noexcept override
| Dispatches the predicate to std::all_of, std::any_of, or std::none_of.
Protected Member Functions inherited from caf::downstream_manager
virtual void | about_to_erase (path_ptr ptr, bool silent, error *reason)
| Emits a regular (reason == nullptr) or irregular (reason != nullptr) shutdown if silent == false.
template<class Predicate>
bool | check_paths (path_algorithm algorithm, Predicate predicate) const noexcept
| Delegates to check_paths_impl.

## Detailed Description

template<class T>
class caf::buffered_downstream_manager< T >

Mixin for streams with any number of downstreams.

Subtype must provide a member function buf() returning a queue with std::deque-like interface.

## Member Function Documentation

## buffered()

template<class T>

size_t caf::buffered_downstream_manager< T >::buffered | ( |  | ) | const

override virtual noexcept

Queries the size of the output buffer.

Reimplemented from caf::downstream_manager.

## capacity()

template<class T>

size_t caf::buffered_downstream_manager< T >::capacity | ( |  | ) | const

override virtual noexcept

Queries the currently available capacity for the output buffer.

Reimplemented from caf::downstream_manager.

## get_chunk()

template<class T>

chunk_type caf::buffered_downstream_manager< T >::get_chunk | ( | buffer_type & | buf,
|  | size_t | n )

static

Precondition
  n <= buf_.size()

## terminal()

template<class T>

bool caf::buffered_downstream_manager< T >::terminal | ( |  | ) | const

override virtual noexcept

Returns true if this manager belongs to a sink, i.e., terminates the stream and never has outbound paths.

Reimplemented from caf::downstream_manager.

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

- /build/actor-framework-Z9pIPl/actor-framework-0.17.6/libcaf_core/caf/buffered_downstream_manager.hpp