File: backends.rst

package info (click to toggle)
twisted 25.5.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,560 kB
  • sloc: python: 203,171; makefile: 200; sh: 92; javascript: 36; xml: 31
file content (94 lines) | stat: -rw-r--r-- 1,905 bytes parent folder | download | duplicates (8)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

:LastChangedDate: $LastChangedDate$
:LastChangedRevision: $LastChangedRevision$
:LastChangedBy: $LastChangedBy$

The Evolution of Finger: pluggable backends
===========================================






Introduction
------------



This is the fifth part of the Twisted tutorial :doc:`Twisted from Scratch, or The Evolution of Finger <index>` .




In this part we will add new several new backends to our finger service using
the component-based architecture developed in :doc:`The Evolution of Finger: moving to a component based architecture <components>` . This will
show just how convenient it is to implement new back-ends when we move to a
component based architecture. Note that here we also use an interface we
previously wrote, ``FingerSetterFactory`` , by supporting one single
method. We manage to preserve the service's ignorance of the network.





Another Back-end
----------------




:download:`finger19b_changes.py <listings/finger/finger19b_changes.py>`

.. literalinclude:: listings/finger/finger19b_changes.py



Full source code here: 

:download:`finger19b.tac <listings/finger/finger19b.tac>`

.. literalinclude:: listings/finger/finger19b.tac






We've already written this, but now we get more for less work:
the network code is completely separate from the back-end.






Yet Another Back-end: Doing the Standard Thing
----------------------------------------------




:download:`finger19c_changes.py <listings/finger/finger19c_changes.py>`

.. literalinclude:: listings/finger/finger19c_changes.py



Full source code here: 

:download:`finger19c.tac <listings/finger/finger19c.tac>`

.. literalinclude:: listings/finger/finger19c.tac






Not much to say except that now we can be churn out backends like crazy. Feel
like doing a back-end for `Advogato <http://www.advogato.org/>`_ , for
example? Dig out the XML-RPC client support Twisted has, and get to work!