Flow-IPC 3.0.0
Flow-IPC project: Full implementation reference.
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Private Attributes | Friends | Related Functions | List of all members
ipc::session::Session_mv< Session_impl_t > Class Template Reference

Implements the Session concept when it is in PEER state. More...

#include <session.hpp>

Collaboration diagram for ipc::session::Session_mv< Session_impl_t >:
[legend]

Public Types

using Channel_obj = typename Impl::Channel_obj
 Implements Session API per contract. More...
 
using Channels = typename Impl::Channels
 Container (vector<>) of Channel_obj. More...
 
using Mdt_payload_obj = typename Impl::Mdt_payload_obj
 Implements Session API per contract. More...
 
using Mdt_builder = typename Impl::Mdt_builder
 Implements Session API per contract. More...
 
using Mdt_builder_ptr = typename Impl::Mdt_builder_ptr
 Implements Session API per contract. More...
 
using Mdt_reader_ptr = typename Impl::Mdt_reader_ptr
 Implements Session API per contract. More...
 
template<typename Message_body >
using Structured_channel = typename transport::struc::Channel_via_heap< Channel_obj, Message_body >
 Implements Session API per contract. More...
 
using Structured_msg_builder_config = typename Impl::Structured_msg_builder_config
 Implements Session API per contract. More...
 
using Structured_msg_reader_config = typename Impl::Structured_msg_reader_config
 Implements Session API per contract. More...
 
using Info_collector = typename Impl::Info_collector
 Implements Session API per contract. More...
 

Public Member Functions

 Session_mv ()
 Implements Session API per contract. More...
 
 Session_mv (Session_mv &&src)
 Implements Session API per contract. More...
 
 Session_mv (const Session_mv &)=delete
 Copy construction is disallowed.
 
 ~Session_mv ()
 Implements Session API per contract.
 
Session_mv & operator= (Session_mv &&src)
 Implements Session API per contract. More...
 
Session_mv & operator= (const Session_mv &)=delete
 Copy assignment is disallowed.
 
Mdt_builder_ptr mdt_builder ()
 Implements Session API per contract. More...
 
bool open_channel (Channel_obj *target_channel, const Mdt_builder_ptr &mdt, Error_code *err_code=nullptr)
 Implements Session API per contract. More...
 
bool open_channel (Channel_obj *target_channel, Error_code *err_code=nullptr)
 Implements Session API per contract. More...
 
const Session_token & session_token () const
 Implements Session API per contract. More...
 
const util::Process_credentials & remote_peer_process_credentials () const
 Implements Session API per contract. More...
 
Info_collector * info_collector ()
 Implements Session API per contract. More...
 
const Info_collector * info_collector () const
 Implements Session API per contract. More...
 
transport::struc::Heap_reader::Config heap_reader_config ()
 Non-static counterpart to other heap_reader_config() overload, equivalent to heap_reader_config(this->get_logger()). More...
 
flow::log::Logger * get_logger () const
 Returns logger (possibly null). More...
 
const flow::log::Component & get_log_component () const
 Returns log component. More...
 

Static Public Member Functions

static transport::struc::Heap_reader::Config heap_reader_config (flow::log::Logger *logger_ptr)
 Convenience Heap_reader::Config generator similar to struc::Channel::heap_reader_config(), but no Channel arg is necessary. More...
 

Static Public Attributes

static constexpr schema::ShmType S_SHM_TYPE_OR_NONE = Impl::S_SHM_TYPE_OR_NONE
 Implements Session API per contract. More...
 
static constexpr bool S_SHM_ENABLED = Impl::S_SHM_ENABLED
 Implements Session API per contract. More...
 
static constexpr bool S_MQS_ENABLED = Impl::S_MQS_ENABLED
 Compile-time-known constant indicating whether Channel_obj shall use a blobs pipe over message queues (MQs). More...
 
static constexpr bool S_SOCKET_STREAM_ENABLED = Impl::S_SOCKET_STREAM_ENABLED
 Compile-time-known constant indicating whether Channel_obj shall use socket stream for any type of pipe. More...
 

Protected Types

using Impl = Session_impl_t
 Short-hand for pImpl-lite impl type. This shall be the deepest impl sub-class desired. More...
 
using Session_base_obj = typename Impl::Session_base_obj
 Short-hand for Impl's Session_base super-class. More...
 
using Impl_ptr = std::experimental::propagate_const< boost::movelib::unique_ptr< Impl > >
 Short-hand for const-respecting wrapper around Impl for the pImpl idiom. See impl(). More...
 

Protected Member Functions

const Session_base_obj & base () const
 Provides const access to Session_base super-object. More...
 
Impl_ptr & impl ()
 pImpl target; particularly for sub-classes that must add to the above public API. More...
 
const Impl_ptr & impl () const
 pImpl target; particularly for sub-classes that must add to the above public API. More...
 

Private Attributes

Impl_ptr m_impl
 The true implementation of this class. See also our class doc header. More...
 

Friends

template<typename Session_impl_t2 >
std::ostream & operator<< (std::ostream &os, const Session_mv< Session_impl_t2 > &val)
 Friend of Session_mv.
 

Related Functions

(Note that these are not member functions.)

template<typename Session_impl_t >
std::ostream & operator<< (std::ostream &os, const Session_mv< Session_impl_t > &val)
 Prints string representation of the given Session_mv to the given ostream. More...
 

Detailed Description

template<typename Session_impl_t>
class ipc::session::Session_mv< Session_impl_t >

Implements the Session concept when it is in PEER state.

It is, as of this writing, not to be instantiated by itself. Rather see Client_session_mv and Server_session_mv regarding what to actually instantiate and further context. As for the API in Session_mv itself, it is quite critical – but it only implements Session concept, and therefore the doc headers for Session_mv members generally just send you to Session doc headers. However the Session_mv doc headers are useful in enumerating specific Error_code values that may be emitted.

Implementation

See pImpl-lite notes in Blob_stream_mq_sender doc header. The exact same applies here.

Furthermore, sub-classes – Client_session_mv, Server_session_mv – continue the pImpl-lite pattern for their added public APIs on top of the ones from this super-class. For this reason impl() is protected. E.g., Client_session_mv doc header explains this hierarchy. In particular it explains what Session_impl_t is to be set to properly.

Template Parameters
Session_impl_tThis is an implementation detail. See Client_session_mv and Server_session_mv doc headers for how to easily set this to the proper type in a given situation.

Definition at line 557 of file session.hpp.

Member Typedef Documentation

◆ Channel_obj

template<typename Session_impl_t >
using ipc::session::Session_mv< Session_impl_t >::Channel_obj = typename Impl::Channel_obj

Implements Session API per contract.

Definition at line 569 of file session.hpp.

◆ Channels

template<typename Session_impl_t >
using ipc::session::Session_mv< Session_impl_t >::Channels = typename Impl::Channels

Container (vector<>) of Channel_obj.

Definition at line 572 of file session.hpp.

◆ Impl

template<typename Session_impl_t >
using ipc::session::Session_mv< Session_impl_t >::Impl = Session_impl_t
protected

Short-hand for pImpl-lite impl type. This shall be the deepest impl sub-class desired.

Definition at line 563 of file session.hpp.

◆ Impl_ptr

template<typename Session_impl_t >
using ipc::session::Session_mv< Session_impl_t >::Impl_ptr = std::experimental::propagate_const<boost::movelib::unique_ptr<Impl> >
protected

Short-hand for const-respecting wrapper around Impl for the pImpl idiom. See impl().

Definition at line 806 of file session.hpp.

◆ Info_collector

template<typename Session_impl_t >
using ipc::session::Session_mv< Session_impl_t >::Info_collector = typename Impl::Info_collector

Implements Session API per contract.

Definition at line 617 of file session.hpp.

◆ Mdt_builder

template<typename Session_impl_t >
using ipc::session::Session_mv< Session_impl_t >::Mdt_builder = typename Impl::Mdt_builder

Implements Session API per contract.

Definition at line 578 of file session.hpp.

◆ Mdt_builder_ptr

template<typename Session_impl_t >
using ipc::session::Session_mv< Session_impl_t >::Mdt_builder_ptr = typename Impl::Mdt_builder_ptr

Implements Session API per contract.

Definition at line 581 of file session.hpp.

◆ Mdt_payload_obj

template<typename Session_impl_t >
using ipc::session::Session_mv< Session_impl_t >::Mdt_payload_obj = typename Impl::Mdt_payload_obj

Implements Session API per contract.

Definition at line 575 of file session.hpp.

◆ Mdt_reader_ptr

template<typename Session_impl_t >
using ipc::session::Session_mv< Session_impl_t >::Mdt_reader_ptr = typename Impl::Mdt_reader_ptr

Implements Session API per contract.

Definition at line 584 of file session.hpp.

◆ Session_base_obj

template<typename Session_impl_t >
using ipc::session::Session_mv< Session_impl_t >::Session_base_obj = typename Impl::Session_base_obj
protected

Short-hand for Impl's Session_base super-class.

Definition at line 803 of file session.hpp.

◆ Structured_channel

template<typename Session_impl_t >
template<typename Message_body >
using ipc::session::Session_mv< Session_impl_t >::Structured_channel = typename transport::struc::Channel_via_heap<Channel_obj, Message_body>

Implements Session API per contract.

Note
In particular Client_session_mv and Server_session_mv inherit this, and thus they show up there and thus in Client_session and Server_session. However if you're using a SHM-enabled variant (e.g., shm::classic::Client_session, shm::classic::Server_session), then this alias will be shadowed by a better definition that will make use of SHM for zero-copy transmission of structured messages. This super-class definition then becomes, in a sense, obsolete: It can be used, if you still want to use non-zero-copy heap-based serialization; but it is usually better to use, directly, the shadowing definition: e.g., shm::classic::Session_mv::Structured_channel (which will show up in shm::classic::Server_session and shm::classic::Client_session).

Definition at line 599 of file session.hpp.

◆ Structured_msg_builder_config

template<typename Session_impl_t >
using ipc::session::Session_mv< Session_impl_t >::Structured_msg_builder_config = typename Impl::Structured_msg_builder_config

Implements Session API per contract.

Note
Same note as in Structured_channel doc header.

Definition at line 607 of file session.hpp.

◆ Structured_msg_reader_config

template<typename Session_impl_t >
using ipc::session::Session_mv< Session_impl_t >::Structured_msg_reader_config = typename Impl::Structured_msg_reader_config

Implements Session API per contract.

Note
Same note as in Structured_channel doc header.

Definition at line 614 of file session.hpp.

Constructor & Destructor Documentation

◆ Session_mv() [1/2]

template<typename Session_impl_t >
ipc::session::Session_mv< Session_impl_t >::Session_mv ( )
default

Implements Session API per contract.

Reminder: While not enforced, this ctor form is informally intended only for when one will move-from a PEER-state Session_mv. In particular Session_server::async_accept() requires these move semantics; so a default-cted Session_mv would be typically passed to it by the user.

◆ Session_mv() [2/2]

template<typename Session_impl_t >
ipc::session::Session_mv< Session_impl_t >::Session_mv ( Session_mv< Session_impl_t > &&  src)
default

Implements Session API per contract.

Parameters
srcSee above.

Member Function Documentation

◆ base()

Provides const access to Session_base super-object.

Returns
See above.

Definition at line 956 of file session.hpp.

◆ get_log_component()

template<typename Session_impl_t >
const flow::log::Component & ipc::session::Session_mv< Session_impl_t >::get_log_component

Returns log component.

Works even if *this is as-if default-cted.

Returns
See above.

Definition at line 947 of file session.hpp.

◆ get_logger()

template<typename Session_impl_t >
flow::log::Logger * ipc::session::Session_mv< Session_impl_t >::get_logger

Returns logger (possibly null).

Returns
See above.

Definition at line 941 of file session.hpp.

◆ heap_reader_config() [1/2]

Non-static counterpart to other heap_reader_config() overload, equivalent to heap_reader_config(this->get_logger()).

Returns
See above.

Definition at line 935 of file session.hpp.

◆ heap_reader_config() [2/2]

template<typename Session_impl_t >
transport::struc::Heap_reader::Config ipc::session::Session_mv< Session_impl_t >::heap_reader_config ( flow::log::Logger *  logger_ptr)
static

Convenience Heap_reader::Config generator similar to struc::Channel::heap_reader_config(), but no Channel arg is necessary.

Parameters
logger_ptrLogger to pass to the returned Config.
Returns
See above.

Definition at line 928 of file session.hpp.

◆ impl() [1/2]

pImpl target; particularly for sub-classes that must add to the above public API.

Returns
See above. May be null; namely if *this is as-if default-cted.

Definition at line 854 of file session.hpp.

◆ impl() [2/2]

pImpl target; particularly for sub-classes that must add to the above public API.

Returns
See above. May be null; namely if *this is as-if default-cted.

Definition at line 860 of file session.hpp.

◆ info_collector() [1/2]

Implements Session API per contract.

Returns
See above.

Definition at line 896 of file session.hpp.

◆ info_collector() [2/2]

Implements Session API per contract.

Return value subtlety

As required by the concept: PEER state => returns non-null.

Otherwise, however, the concept leaves it up to the impl whether to return null or something else. To wit as of this writing:

  • Client_session et al: NULL state => null; CONNECTING state => user has no access to *this.
  • Server_session et al: NULL state => null; almost-PEER state => non-null (some interesting stats have already been collected, namely those from the internal log-in procedure).
Returns
See above.

Definition at line 902 of file session.hpp.

◆ mdt_builder()

Implements Session API per contract.

Returns
See above.

Definition at line 908 of file session.hpp.

◆ open_channel() [1/2]

template<typename Session_impl_t >
bool ipc::session::Session_mv< Session_impl_t >::open_channel ( Channel_obj *  target_channel,
const Mdt_builder_ptr &  mdt,
Error_code *  err_code = nullptr 
)

Implements Session API per contract.

Reminder: Per concept requirements, open_channel() emitting an error (via standard Flow semantics) means that error is not session-hosing. Any session-hosing event is orthogonally emitted to on-error handler. Informally: in most cases even the (formally non-session-hosing) errors below indicate something seriously wrong is afoot. It would not be unreasonable to treat them as session-hosing (invoke dtor).

Todo:
Server_session::open_channel() and Client_session::open_channel() both emit error::Code::S_SESSION_OPEN_CHANNEL_SERVER_CANNOT_PROCEED_RESOURCE_UNAVAILABLE when unable to acquire the resources (as of this writing likely MQ-related ones) underpinning the would-be channel; but server-side the actual original Error_code could be emitted instead. (Client-side, due to the IPC-mechanics involved, this is less straightforward, as then: (1) it would be ambiguous as to whether it was the server-side-user-yanked-channel-immediately scenario (user's choice, not an environmental problem), or the current-RESOURCE_UNAVAILABLE scenario; and (2) transmitting an Error_code over IPC is a potentially subtle impl task. Hence the to-do is probably aimed at Server_session::open_channel() et al, not the client-side method family.)
Parameters
target_channelSee above.
mdtSee above.
err_codeSee above. Error_code generated: error::Code::S_SESSION_OPEN_CHANNEL_REMOTE_PEER_REJECTED_PASSIVE_OPEN (per concept), error::Code::S_SESSION_OPEN_CHANNEL_ACTIVE_TIMEOUT (peer neither accepted nor rejected in non-blocking time frame), error::Code::S_SESSION_OPEN_CHANNEL_SERVER_CANNOT_PROCEED_RESOURCE_UNAVAILABLE (opposing or local Server_session peer was unable to acquire resources – as of this writing MQ-related ones – required for opening channel), (client-session-side only) system errors (probably a no_such_file_or_directory a/k/a ENOENT-wrapper in Unix-likes) (explanation will be WARNING-logged, but in short: quite-probably opposing-side user upon passive-open handler firing chose to immediately close the resulting Channel, so quickly that open_channel() here had not yet returned and therefore could not open the Channel-required resources, as of this writing MQ(s)).
Returns
See above.

Definition at line 914 of file session.hpp.

◆ open_channel() [2/2]

template<typename Session_impl_t >
bool ipc::session::Session_mv< Session_impl_t >::open_channel ( Channel_obj *  target_channel,
Error_code *  err_code = nullptr 
)

Implements Session API per contract.

See other overload for brief discussion relevant here also.

Parameters
target_channelSee above.
err_codeSee above. See also other overload.
Returns
See above.

Definition at line 921 of file session.hpp.

◆ operator=()

template<typename Session_impl_t >
Session_mv< Session_impl_t > & ipc::session::Session_mv< Session_impl_t >::operator= ( Session_mv< Session_impl_t > &&  src)
default

Implements Session API per contract.

Parameters
srcSee above.
Returns
See above.

◆ remote_peer_process_credentials()

template<typename Session_impl_t >
const util::Process_credentials & ipc::session::Session_mv< Session_impl_t >::remote_peer_process_credentials

Implements Session API per contract.

Returns
See above.

Definition at line 890 of file session.hpp.

References ipc::util::NULL_PROCESS_CREDENTIALS.

◆ session_token()

template<typename Session_impl_t >
const Session_token & ipc::session::Session_mv< Session_impl_t >::session_token

Implements Session API per contract.

Returns
See above.

Definition at line 884 of file session.hpp.

References ipc::transport::struc::NULL_SESSION_TOKEN.

Friends And Related Function Documentation

◆ operator<<()

template<typename Session_impl_t >
std::ostream & operator<< ( std::ostream &  os,
const Session_mv< Session_impl_t > &  val 
)
related

Prints string representation of the given Session_mv to the given ostream.

Parameters
osStream to which to write.
valObject to serialize.
Returns
os.

Definition at line 963 of file session.hpp.

Member Data Documentation

◆ m_impl

template<typename Session_impl_t >
Impl_ptr ipc::session::Session_mv< Session_impl_t >::m_impl
private

The true implementation of this class. See also our class doc header.

Definition at line 839 of file session.hpp.

◆ S_MQS_ENABLED

template<typename Session_impl_t >
constexpr bool ipc::session::Session_mv< Session_impl_t >::S_MQS_ENABLED = Impl::S_MQS_ENABLED
staticconstexpr

Compile-time-known constant indicating whether Channel_obj shall use a blobs pipe over message queues (MQs).

Definition at line 628 of file session.hpp.

◆ S_SHM_ENABLED

template<typename Session_impl_t >
constexpr bool ipc::session::Session_mv< Session_impl_t >::S_SHM_ENABLED = Impl::S_SHM_ENABLED
staticconstexpr

Implements Session API per contract.

Definition at line 625 of file session.hpp.

◆ S_SHM_TYPE_OR_NONE

template<typename Session_impl_t >
constexpr schema::ShmType ipc::session::Session_mv< Session_impl_t >::S_SHM_TYPE_OR_NONE = Impl::S_SHM_TYPE_OR_NONE
staticconstexpr

Implements Session API per contract.

Definition at line 622 of file session.hpp.

◆ S_SOCKET_STREAM_ENABLED

template<typename Session_impl_t >
constexpr bool ipc::session::Session_mv< Session_impl_t >::S_SOCKET_STREAM_ENABLED = Impl::S_SOCKET_STREAM_ENABLED
staticconstexpr

Compile-time-known constant indicating whether Channel_obj shall use socket stream for any type of pipe.

If S_MQS_ENABLED, then a socket stream is still needed if and only if user wants to transmit native handles. If S_MQS_ENABLED is false, then a socket stream is the only transport available as of this writing and hence also enabled.

Definition at line 636 of file session.hpp.


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