1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 from flumotion.common import log
23
24 __version__ = "$Rev: 8626 $"
25
26
27 -class Plug(object, log.Loggable):
28 """
29 Base class for plugs. Provides an __init__ method that receives the
30 plug args and sets them to the 'args' attribute.
31 """
32
34 """
35 @param args: The plug args
36 @type args: dict with keys 'socket', 'type', and 'properties'.
37 'properties' has the same format as component
38 properties.
39 """
40 self.args = args
41
42
44 """
45 Base class for plugs that live in a component. Subclasses can
46 implement the start and stop vmethods, which will be called with the
47 component as an argument. Both of them can return a deferred.
48 """
49
50 - def start(self, component):
52
53 - def stop(self, component):
55
59
60
62 """
63 Base class for plugs that live in the manager. Subclasses can
64 implement the start and stop vmethods, which will be called with the
65 manager vishnu as an argument.
66 """
67
70
71 - def stop(self, vishnu):
73
77
78
80 """
81 Example implementation of the ManagerLifecyle socket, just prints
82 things on the console. Pretty stupid!
83 """
84
86 info = vishnu.connectionInfo
87 print ('started manager running on %s:%d (%s)'
88 % (info['host'], info['port'],
89 info['using_ssl'] and 'with ssl' or 'without ssl'))
90
91 - def stop(self, vishnu):
92 info = vishnu.connectionInfo
93 print ('stopped manager running on %s:%d (%s)'
94 % (info['host'], info['port'],
95 info['using_ssl'] and 'with ssl' or 'without ssl'))
96
97
99 """
100 Example implementation of the ComponentLifecyle socket, just prints
101 things on the console. Pretty stupid!
102 """
103
104 - def start(self, component):
105 print 'Component has been started'
106
107 - def stop(self, component):
108 print 'Component is stopping'
109