CHASM

Crytpograph-Hash-Algorithm-Secured Mirroring

The Refractions of Design: Part II

I would like to digress a bit and talk about the whole design of the CHASM peer-to-peer protocol, eventually leading to design specifics with code samples. The material in this post is for a technical document I am writing, so it may come off as dry and boring to most. For those whose native tongue is C or C++, the new direction of this thread will have its redeeming qualities in the end.

CHASM Peer-to-Peer Design

The Boost.Asio ("asio") library is used for communicating over the network, all calls are made using asynchronous variants. Asynchronous calls were deliberately chosen to provide a level of concurrency within the daemon without the need for multiple threads or forking. Two functions are primarily used: async_read and async_write.

The chasm-p2p daemon is composed of two central parts, the downstream client ("downstream") and upstream server ("upstream"). Downstream uses a timer object to periodically check for manifest revisions and will make connections to one or more upstream nodes when necessary. Both of these components follow a similar structure utilizing the pimpl idiom for separation of interface and implementation. The public interface of each is defined in a downstream and upstream class with the implementation being in downstream::priv and upstream::priv, respectively.

A protocol namespace is used along with a unique version number namespace. The version number depends on the official peer-to-peer protocol in use and will be utilized for protocol version negotiation between upstream and downstream. Specifics of this functionality are yet to be determined.

...

-mfm

Copyright © 2010 Robert Escriva ¦ Powered by Firmant