Loading...
Searching...
No Matches
caf::io::basp::instance Class Reference

Describes a protocol instance managing multiple connections. More...

`#include <instance.hpp>`

## Classes

class | callee
| Provides a callback-based interface for certain BASP events. More...

## Public Types

using | payload_writer = callback<serializer&>
| Describes a function object responsible for writing the payload for a BASP message.
using | removed_published_actor = callback<const strong_actor_ptr&, uint16_t>
| Describes a callback function object for remove_published_actor.
using | published_actor = std::pair<strong_actor_ptr, std::set<std::string>>
| Stores the address of a published actor along with its publicly visible messaging interface.
using | published_actor_map = std::unordered_map<uint16_t, published_actor>
| Maps ports to addresses and interfaces of published actors.

## Public Member Functions

| instance (abstract_broker *parent, callee &lstnr)
connection_state | handle (execution_unit *ctx, new_data_msg &dm, header &hdr, bool is_payload)
| Handles received data and returns a config for receiving the next data or none if an error occured.
void | send_heartbeats (execution_unit *ctx)
| Sends heartbeat messages to all connected nodes.
optional< routing_table::route > | lookup (const node_id &target)
| Returns a route to target or none on error.
void | flush (const routing_table::route &path)
| Flushes the underlying buffer of path.
void | write (execution_unit *ctx, const routing_table::route &r, header &hdr, payload_writer *writer=nullptr)
| Sends a BASP message and implicitly flushes the output buffer of r.
void | add_published_actor (uint16_t port, strong_actor_ptr published_actor, std::set< std::string > published_interface)
| Adds a new actor to the map of published actors.
size_t | remove_published_actor (uint16_t port, removed_published_actor *cb=nullptr)
| Removes the actor currently assigned to port.
size_t | remove_published_actor (const actor_addr &whom, uint16_t port, removed_published_actor *cb=nullptr)
| Removes whom if it is still assigned to port or from all of its current ports if port == 0.
bool | dispatch (execution_unit *ctx, const strong_actor_ptr &sender, const std::vector< strong_actor_ptr > &forwarding_stack, const node_id &dest_node, uint64_t dest_actor, uint8_t flags, message_id mid, const message &msg)
| Returns true if a path to destination existed, false otherwise.
proxy_registry & | proxies ()
| Returns the actor namespace associated to this BASP protocol instance.
routing_table & | tbl ()
| Returns the routing table of this BASP instance.
const published_actor_map & | published_actors () const
| Returns the current mapping of ports to addresses and interfaces of published actors.
void | write_server_handshake (execution_unit *ctx, buffer_type &out_buf, optional< uint16_t > port)
| Writes the server handshake containing the information of the actor published at port to buf.
void | write_client_handshake (execution_unit *ctx, buffer_type &buf, uint8_t flags=0)
| Writes the client handshake to buf.
void | write_monitor_message (execution_unit *ctx, buffer_type &buf, const node_id &dest_node, actor_id aid)
| Writes an announce_proxy to buf.
void | write_down_message (execution_unit *ctx, buffer_type &buf, const node_id &dest_node, actor_id aid, const error &rsn)
| Writes a kill_proxy to buf.
void | write_heartbeat (execution_unit *ctx, buffer_type &buf)
| Writes a heartbeat to buf.
const node_id & | this_node () const
detail::worker_hub< worker > & | hub ()
message_queue & | queue ()
actor_system & | system ()
const actor_system_config & | config ()
connection_state | handle (execution_unit *ctx, connection_handle hdl, header &hdr, std::vector< char > *payload)

## Static Public Member Functions

static void | write (execution_unit *ctx, buffer_type &buf, header &hdr, payload_writer *pw=nullptr)
| Writes a header followed by its payload to storage.

## Detailed Description

Describes a protocol instance managing multiple connections.

## Member Function Documentation

## write()

void caf::io::basp::instance::write | ( | execution_unit * | ctx,
|  | const routing_table::route & | r,
|  | header & | hdr,
|  | payload_writer * | writer = nullptr )

Sends a BASP message and implicitly flushes the output buffer of r.

This function will update hdr.payload_len if a payload was written.

## write_server_handshake()

void caf::io::basp::instance::write_server_handshake | ( | execution_unit * | ctx,
|  | buffer_type & | out_buf,
|  | optional< uint16_t > | port )

Writes the server handshake containing the information of the actor published at port to buf.

If port == none or if no actor is published at this port then a standard handshake is written (e.g. used when establishing direct connections on-the-fly).

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

- /build/actor-framework-Z9pIPl/actor-framework-0.17.6/libcaf_io/caf/io/basp/instance.hpp