Boost logo

Boost :

From: Yigong Liu (yigongliu_at_[hidden])
Date: 2006-09-26 02:21:43


Last night i sent out this email as reply to some old email. I didnot see it
appearing in my gmail mbox this morning. So i am resending it and hoping to
get more comments on design. Sorry for the duplication.
Channel is a Namespace based C++ template framework for distributed message
passing and event dispatching. It is redesigned and reimplemented based on
Boost. Initial design document and major framework code is available from
sourceforge:
http://channel.sourceforge.net/boost_channel/doc/design.html
http://sourceforge.net/projects/channel
Coding and testing is done in linux (Fedora Core 3 &4). Havent try it on
Windows yet. Comments and corrections on the design are highly appreciated.
Attached please find a introduction of the library.
Thanks
Yigong
-----------------------------------------------------------------------------------------------------

In Unix and most OSes, file systems allow applications to identify, bind to
and operate on system resources and entities (devices, files,...) using a
"name" (path name) in a hierarchical namespace (directory system) which is
different from variables and pointers in flat address space.
In Boost.Signal and libsigc++, callbacks/slots objects can be connected
explicitly to specific signals objects to allow synchronous event
dispatching.
Channel is a C++ template library to provide namespaces for asynchronous,
distributed message passing and event dispatching. Message senders and
receivers bind to names in namespace; binding and matching rules decide
which senders will bind to which receivers; then message passing and event
dispatching could happen among bound senders and receivers.
Channel's signature:
    template <
      typename idtype,
      typename platform_type = boost_platform,
      typename synchpolicy = mt_synch<platform_type>,
      typename executor_type = abstract_executor,
      typename name_space =
linear_name_space<idtype,executor_type,synchpolicy>,
      typename dispatcher = broadcast_dispatcher<name_space,platform_type>
>
    class channel;
Various namespaces (linear/hierarchical/associative) can be used for
different applications. For example, we can use integer ids as names to send
messages in linear namespace or we can use path name ids to send messages in
hierarchical namespace; User can configure namespace easily by setting a
channel template parameter.
Channel's other major components are dispatchers; which dispatch
messages/events from senders to bounded receivers. Dispatcher is also a
channel template parameter. The design of dispatchers can vary in several
dimensions:

   - how msgs move: push or pull;
   - how callbacks executed: synchronous or asynchronous.

Sample dispatchers includes : synchronous broadcast dispatcher, buffered
asynchronous dispatchers,...
Namespace and dispatchers are orthogonal; they can mix and match together
freely; just as STL algorithms can be used with any STL containers by means
of the iterator range concept, Namespace and dispatchers can be used
together because of the name binding set concept.
By combining different namespace and dispatching policies, we can achieve
various models:

   - synchronous event dispatching
   - associative space model similar to tuple space
   - asynchronous messaging model similar to Microsoft CCR (Concurrency
   Coordination Runtime)

Similar to distributed files systems, distributed channels can be connected
or "mounted" to allow transparent distributed message passing. Filters and
translators are used to control namespace changes.
Channel is built on top of Boost facilities:

   - boost::shared_ptr for message/event data life-time management
   - boost::bind, boost::function for callback
   - boost::thread for synchronization
   - boost::serialization for message marshaling/demarshaling
   - Boost.Asio and Boost.Shmem are used to build transports among remote
   channels.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk