Name-spaces for Message Passing and Name-spaces Connection Protocol Specification

Version 0.1

Yigong Liu

Updated 10/15/2009


Status of this Document

This is a draft

Copyright Notice

Copyright (C) 2005-2009 Yigong Liu. All Rights Reserved. Licensed Under Creative Commons Attribution 3.0.

Abstract

Channel framework provides communication name-spaces shared by loosely coupled peers (threads or callbacks) for asynchronous / distributed message passing. Peers (message senders and receivers) bind to each other thru names in name spaces and exchange messages.
Distributed channels can be connected or "mounted" to allow transparent distributed message passing. Connected channels create a decentralized peer to peer communication systems.

Based on Channel's design, this document further explores the details of name-space connection / merge protocol for connecting distributed channels. The discussions here focus on generic interactions and is based on Gerard J. Holzmann's protocol model. So no details related to any specific transport layer are presented. The author has implemented the protocol on top of both tcp connections and shared memory queues.

Table of Contents

  1. Requirements notation
  2. Introduction to Name-space Terminology
    1. Names (in name-space)
    2. Types of name-space:
    3. Binding
    4. Interface
  3. Elements of Protocol Specification
  4. Protocol Service Overview
  5. Assumptions About Environment
  6. Protocol Vocabulary
  7. Message Format
  8. Protocol Operations (Procedure Rules)
    1. Channel connection
    2. Channel disconnection
    3. Publication of names
    4. Unpublication of names
    5. Subscription of names
    6. Unsubscription of names
  9. References

Requirements notation

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].

Introduction to Name-space Terminology

The following introduces the basic concepts of message passing name-spaces. For more details please refer to section 4.1 of Channel's design doc.

To use channel for message passing, senders and receivers bind to names in name space; 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.
  1. Names (in name-space)

A name has the following attributes:
A channel is a process local name space which can be connected to other local or remote channels. So we have 2 types of communicating peers:
When sending/receiving messages, we can specify the scope of operations:
  1. Types of name-space:

There are 3 types of name spaces based on its id-matching algorithms and naming structures:
There are ordering relationship among ids, so they can be arranged in linear range. Exact matching is used for id-matching.
There are containment relationship among ids, so they can be arranged in tree/trie structures. Prefix matching is used for id-matching
Id-matching is based on associative lookup similar to Linda's tuple space or regular expression matching algorithms
  1. Binding

Names are ONLY created into name space when bound for sending/receiving msgs:
Name binding sets:
Binding_sets are decided by two algorithms:
There are four kinds of binding_sets: 1-1, 1-N, N-1, N-M.
  1. Interface

The interface of a function is :
Similarly, a channel's interface to outside world (and other channels) is:

Elements of Protocol Specification

Qute from Gerard J. Holzmann's DESIGN AND VALIDATION OF COMPUTER PROTOCOLS:
"A protocol specification consists of five distinct parts. To be complete, each specification should include explicitly:
  1. The service to be provided by the protocol
  2. The assumptions about the environment in which the protocol is executed
  3. The vocabulary of messages used to implement the protocol
  4. The encoding (format) of each message in the vocabulary
  5. The procedure rules guarding the consistency of message exchanges"
The following discussions will be divided into these five parts.

Protocol Service Overview

When 2 channels (A & B) are connected (or mounted), their name-spaces will interact according to this protocol so that transparent distributed message passing can be achieved. The interactions specified in this protocol will have one result - the name-spaces of connected channels are "merged":
The purpose is that peers in channel A can communicate with remote peers in channel B "transparently" in similar way as with the local peers in channel A.

Filter, translator can be specified at connections among channels to control name space merge:
Please note that channel A will not automatically propogate the names/ids it receive from channel B to channel C (suppose that channel A connects to channel B and to channel C, and there is no connection between channel B and C). If peers in channel B need to exchange messages with peers in channel C, either channel B should directly connect to channel C, or some peer at channel A should do the forwarding between B and C.

Assumptions About Environment

The basic assumption is that the transport connection between channels deliver messages reliably. However when we build distributed applications with mechanism for redundancy and failure-detection with retry, high level logic can provide capability to guard against transport failures.

Protocol Vocabulary

There are two categories of message types or ids:
There are eight system messages which can further divided into two parts:

Message Format

Here we use generic terms to describe the formats. Different transports may use different formats and encodings, such as plain text, xml based, or binary formats.

A general format is used to marshal/demarshal all messages to/from transport layer frames:
        [id_len, id_data, message_len, message_data]

Applications will define specific message data formats for application message types/ids. The eight system messages use the following 2 message data formats:

The connection related messages (channel_conn_msg / channel_disconn_msg /  connection_ready_msg) use the following data formats:
    struct channel_info_msg_t {
      string host_addr;
      //other connection info in future:
      //1. protocol version
      //2. authentication
      ...
    }

The pub/sub related messages (init_subscription_info_msg / subscription_info_msg / unsubscription_info_msg / publication_info_msg / unpublication_info_msg) use:
    struct pubsub_info_msg_t {
      vector<id_type> msg_types;
    }

Protocol Operations (Procedure Rules)

  1. Channel connection

When a channel A starts connecting to channel B, the following handshaking will be happen:
  1. Channel disconnection

When channel A disconnect from channel B because of either intentional disconnect or transport connection failure, the following will happen:
  1. Publication of names

if a new local (MEMBER_LOCAL) Named_Out with id "N" is added (name "N" is published) with global/remote scope in channel A, channel A will send publication_info_msg containing "N" to all connected channels. If channel B receives this message, it will check its name space. If there is local (MEMBER_LOCAL) Named_In with id matching "N" (using the above discussed id matching algorithms defined with id_trait) and global/remote scope, the following will happen at channel A and B:
  1. Unpublication of names

if a local (MEMBER_LOCAL) Named_Out with id "N" and global/remote scope is removed (name "N" is unpublished) in channel A, channel A will send unpublication_info_msg containing "N" to all connected channels. If channel B receives this message, the following will happen at channel A and B:
  1. Subscription of names

if a new local (MEMBER_LOCAL) Named_In with id "N" is added (name "N" is subscribed) with global/remote scope in channel A, channel A will send subscription_info_msg containing "N" to all connected channels. If channel B receives this message, it will check its name space. If there is local (MEMBER_LOCAL) Named_Out with id matching "N" (using the above discussed id matching algorithms defined with id_trait) and global/remote scope, the following will happen at channel A and B:
  1. Unsubscription of names

if a local (MEMBER_LOCAL) Named_In with id "N" and global/remote scope is removed (name "N" is unsubscribed) in channel A, channel A will send unsubscription_info_msg containing "N" to all connected channels. If channel B receives this message, the following will happen at channel A and B:

References

  1. DESIGN AND VALIDATION OF COMPUTER PROTOCOLS
  2. Plan 9 Remote Resource Protocol
  3. RFC 2119, "Key words for use in RFCs to Indicate Requirement Levels"
  4. Channel design document: "Channel - A Name Space Based C++ Framework For Asynchronous Distributed Message Passing and Event Dispatching"
  5. Channel project website