File: components.rst

package info (click to toggle)
circuits 2.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 7,384 kB
  • ctags: 3,037
  • sloc: python: 14,416; makefile: 146; sh: 61
file content (32 lines) | stat: -rw-r--r-- 1,446 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Components
==========

The architectural concept of circuits is to encapsulate system 
functionality into discrete manageable and reusable units, called *Components*, 
that interact by sending and handling events that flow throughout the system.

Technically, a circuits *Component* is a Python class that inherits
(directly or indirectly) from 
:class:`~circuits.core.components.BaseComponent`.

Components can be sub-classed like any other normal Python class, however
components can also be composed of other components and it is natural
to do so. These are called *Complex Components*. An example of a Complex
Component within the circuits library is the 
:class:`circuits.web.servers.Server` Component which is comprised of:

- :class:`circuits.net.sockets.TCPServer`
- :class:`circuits.web.servers.BaseServer`
- :class:`circuits.web.http.HTTP`
- :class:`circuits.web.dispatchers.dispatcher.Dispatcher`

Note that there is no class or other technical means to mark a component
as a complex component. Rather, all component instances in a circuits 
based application belong to some component tree (there may be several),
with Complex Components being a subtree within that structure.

A Component is attached to the tree by registering with the parent and
detached by un-registering itself (methods
:meth:`~circuits.core.components.BaseComponent.register` and
:meth:`~circuits.core.components.BaseComponent.unregister` of 
``BaseComponent``).