Documentation - High-level Design | |
A component is any piece of the Chorus project which is
compiled into a seperate loadable object file (.so / .dll).
A module is a collection of components which form
something that a user might be interested in using. A Module could be as
small as a nickname service to as large as a file sharing application. The
only sure thing is that a module must include something user
visible---at the minimum, a new configuration page.
The OSF layer provides
a strong pointer model,
a weak pointer model,
component loading,
threading,
locking,
synchronization,
and system sockets. The system sockets should only be used by the
TCP and UDP protocols. All components need the
OSF layer for, at the very least, component loading.
Generally, most components also need it for creating and synchronizing
threads and smart pointers.
The tunnel layer provides two APIs. One API is that which it
provides to transport agnostic components, the other is that which
protocols us to implement themselves and register within the system.
This layer is what breaks the N*M protocol implementation problem.
Any application which needs a p2p framework can simply use this layer and
ignore the transport layer. All the tricks it might need are handled
automatically. If it needs new tricks, they can be added as a new protocol.
Then all other applications using the tunnel layer will start using these
tricks too. Hence, given N modules and M protocols, only N+M programming
effort need be expended rather than N*M.
The API used by components which just need to make remote peer-to-peer
method calls is extremely simple. There is
an opaque Address class,
and two interface classes
FunctionI
and
ServiceI.
To expose a method, the caller simply provides a method to the ServiceI
interface factory method 'create'. This creates a handle to the ServiceI
which when no longer referenced, unexposes the method. This handle also
serves to produce the opaque address which contacts the exposed method.
To invoke a remote method, the caller simply provides an opaque address to
the 'connect' method of the FunctionI. This creates a FunctionI interface
object which may be invoked like a method. When the FunctionI object is
no longer referenced, any underlying transport mechanisms are released.
All the components shown in this diagram, those described in the section on
writing protocols, and many basic
protocols for dodging firewalls are part of the Core Module. This
module is capable of fetching all other Modules from the Chorus network.
|