C++ Actor Framework 0.18
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
caf::fused_downstream_manager< T, Ts > Class Template Reference

A downstream manager that delegates to any number of sub-managers. More...

#include <fused_downstream_manager.hpp>

Inheritance diagram for caf::fused_downstream_manager< T, Ts >:
caf::downstream_manager

Classes

struct  non_owning_ptr
 State held for each slot. More...
 

Public Types

using super = downstream_manager
 Base type.
 
using nested_managers = std::tuple< T, Ts... >
 A tuple holding all nested managers.
 
using param_list = detail::type_list< T, Ts... >
 
using map_type = detail::unordered_flat_map< stream_slot, non_owning_ptr >
 Maps slots to path and nested managers.
 
using unassigned_map_type = detail::unordered_flat_map< stream_slot, unique_path_ptr >
 Maps slots to paths that haven't a managers assigned yet.
 
using path_ptr = path_type *
 Pointer to an outbound path.
 
using unique_path_ptr = std::unique_ptr< path_type >
 Unique pointer to an outbound path.
 
- 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.
 
using time_point = typename actor_clock::time_point
 Discrete point in time, as reported by the actor clock.
 

Public Member Functions

 fused_downstream_manager (stream_manager *parent)
 
template<class U >
U & get ()
 
template<class U >
const U & get () const
 
template<class U >
void assign (stream_slot slot)
 Requires a previous call to add_path for given slot.
 
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 num_paths () const noexcept override
 Returns the current number of paths.
 
bool remove_path (stream_slot slot, error reason, bool silent) noexcept override
 Removes a path from the manager.
 
path_ptr path (stream_slot slot) noexcept override
 Returns the path associated to slot or nullptr.
 
void close () override
 Removes all paths gracefully.
 
void abort (error reason) override
 Removes all paths with an error message.
 
void emit_batches () override
 Sends batches to sinks.
 
void force_emit_batches () override
 Sends batches to sinks regardless of whether or not the batches reach the desired batch size.
 
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.
 
size_t buffered (stream_slot slot) const noexcept override
 Queries an estimate of the size of the output buffer for slot.
 
void clear_paths () override
 Silently removes all paths.
 
virtual void close ()
 Removes all paths gracefully.
 
virtual void close (stream_slot slot)
 Removes path slot gracefully by sending pending batches before removing it.
 
- Public Member Functions inherited from caf::downstream_manager
 downstream_manager (stream_manager *parent)
 
 downstream_manager (const downstream_manager &)=delete
 
downstream_manageroperator= (const downstream_manager &)=delete
 
scheduled_actor * self () const noexcept
 
stream_managerparent () const noexcept
 
virtual bool terminal () const noexcept
 Returns true if this manager belongs to a sink, i.e., terminates the stream and never has outbound paths.
 
void tick (time_point now, timespan max_batch_delay)
 Forces underful batches after reaching the maximum delay.
 
template<class F >
void for_each_path (F f)
 Applies f to each path.
 
template<class F >
void for_each_path (F f) const
 Applies f to each path.
 
std::vector< stream_slotpath_slots ()
 Returns all used slots.
 
std::vector< stream_slotopen_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.
 
virtual size_t num_paths () const noexcept
 Returns the current number of paths.
 
path_ptr add_path (stream_slot slot, strong_actor_ptr target)
 Adds a pending path to target to the manager.
 
virtual bool remove_path (stream_slot slot, error reason, bool silent) noexcept
 Removes a path from the manager.
 
virtual path_ptr path (stream_slot slot) noexcept
 Returns the path associated to slot or nullptr.
 
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 capacity () const noexcept
 Queries the currently available capacity for the output buffer.
 
virtual size_t buffered () const noexcept
 Queries the size of the output buffer.
 
virtual size_t buffered (stream_slot slot) const noexcept
 Queries an estimate of the size of the output buffer for slot.
 
bool stalled () const noexcept
 Queries whether the manager cannot make any progress, because its buffer is full and no more credit is available.
 
virtual void clear_paths ()
 Silently removes all paths.
 

Protected Member Functions

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 bool insert_path (unique_path_ptr ptr)
 Inserts ptr to the implementation-specific container.
 
virtual void for_each_path_impl (path_visitor &f)
 Applies f to each path.
 
virtual bool check_paths_impl (path_algorithm algo, path_predicate &pred) const noexcept
 Dispatches the predicate to std::all_of, std::any_of, or std::none_of.
 
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.
 

Additional Inherited Members

- Protected Attributes inherited from caf::downstream_manager
stream_managerparent_
 
time_point last_send_
 Stores the time stamp of our last batch.
 

Detailed Description

template<class T, class... Ts>
class caf::fused_downstream_manager< T, Ts >

A downstream manager that delegates to any number of sub-managers.

Member Function Documentation

◆ abort()

template<class T , class... Ts>
void caf::fused_downstream_manager< T, Ts >::abort ( error  reason)
overridevirtual

Removes all paths with an error message.

Reimplemented from caf::downstream_manager.

◆ buffered() [1/2]

template<class T , class... Ts>
size_t caf::fused_downstream_manager< T, Ts >::buffered ( ) const
overridevirtualnoexcept

Queries the size of the output buffer.

Reimplemented from caf::downstream_manager.

◆ buffered() [2/2]

template<class T , class... Ts>
size_t caf::fused_downstream_manager< T, Ts >::buffered ( stream_slot  slot) const
overridevirtualnoexcept

Queries an estimate of the size of the output buffer for slot.

Reimplemented from caf::downstream_manager.

◆ capacity()

template<class T , class... Ts>
size_t caf::fused_downstream_manager< T, Ts >::capacity ( ) const
overridevirtualnoexcept

Queries the currently available capacity for the output buffer.

Reimplemented from caf::downstream_manager.

◆ check_paths_impl()

template<class T , class... Ts>
bool caf::fused_downstream_manager< T, Ts >::check_paths_impl ( path_algorithm  algo,
path_predicate pred 
) const
overrideprotectedvirtualnoexcept

Dispatches the predicate to std::all_of, std::any_of, or std::none_of.

Reimplemented from caf::downstream_manager.

◆ clear_paths()

template<class T , class... Ts>
void caf::fused_downstream_manager< T, Ts >::clear_paths ( )
overridevirtual

Silently removes all paths.

Reimplemented from caf::downstream_manager.

◆ close() [1/3]

template<class T , class... Ts>
virtual void caf::downstream_manager::close ( )
virtual

Removes all paths gracefully.

Reimplemented from caf::downstream_manager.

◆ close() [2/3]

template<class T , class... Ts>
void caf::fused_downstream_manager< T, Ts >::close ( )
overridevirtual

Removes all paths gracefully.

Reimplemented from caf::downstream_manager.

◆ close() [3/3]

template<class T , class... Ts>
virtual void caf::downstream_manager::close ( stream_slot  slot)
virtual

Removes path slot gracefully by sending pending batches before removing it.

Effectively calls path(slot)->closing = true.

Reimplemented from caf::downstream_manager.

◆ emit_batches()

template<class T , class... Ts>
void caf::fused_downstream_manager< T, Ts >::emit_batches ( )
overridevirtual

Sends batches to sinks.

Reimplemented from caf::downstream_manager.

◆ for_each_path_impl()

template<class T , class... Ts>
void caf::fused_downstream_manager< T, Ts >::for_each_path_impl ( path_visitor f)
overrideprotectedvirtual

Applies f to each path.

Reimplemented from caf::downstream_manager.

◆ force_emit_batches()

template<class T , class... Ts>
void caf::fused_downstream_manager< T, Ts >::force_emit_batches ( )
overridevirtual

Sends batches to sinks regardless of whether or not the batches reach the desired batch size.

Reimplemented from caf::downstream_manager.

◆ insert_path()

template<class T , class... Ts>
bool caf::fused_downstream_manager< T, Ts >::insert_path ( unique_path_ptr  ptr)
overrideprotectedvirtual

Inserts ptr to the implementation-specific container.

Reimplemented from caf::downstream_manager.

◆ num_paths()

template<class T , class... Ts>
size_t caf::fused_downstream_manager< T, Ts >::num_paths ( ) const
overridevirtualnoexcept

Returns the current number of paths.

Reimplemented from caf::downstream_manager.

◆ path()

template<class T , class... Ts>
path_ptr caf::fused_downstream_manager< T, Ts >::path ( stream_slot  slot)
overridevirtualnoexcept

Returns the path associated to slot or nullptr.

Reimplemented from caf::downstream_manager.

◆ remove_path()

template<class T , class... Ts>
bool caf::fused_downstream_manager< T, Ts >::remove_path ( stream_slot  slot,
error  reason,
bool  silent 
)
overridevirtualnoexcept

Removes a path from the manager.

Reimplemented from caf::downstream_manager.

◆ terminal()

template<class T , class... Ts>
bool caf::fused_downstream_manager< T, Ts >::terminal ( ) const
overridevirtualnoexcept

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: