1
2
3
4
5
6
7
8
9
10
11 from zope.component.interfaces import Interface, IObjectEvent
12 from zope.interface import Attribute
13
14
15
16 FILTER_EXCLUDE = 0
17 FILTER_INCLUDE = 1
18 FILTER_CONTINUE = 2
19
20
22 """
23 ZenHub has noticed an invalidation.
24 """
25 oid = Attribute("OID of the changed object")
26
27
29 """
30 An object has been updated.
31 """
32
33
35 """
36 An object has been deleted.
37 """
38
39
41 """
42 Processes subdevices in batches.
43 """
44
46 """
47 Process subdevices of device class in batches calling callback with
48 each device. The service UID uniquely identifies the service, so the
49 processing of the same device_class-service pair is not duplicated.
50 """
51
52
54 """
55 Accepts an invalidation queue.
56 """
58 """
59 Read invalidations off a queue and deal with them. Return a Deferred
60 that fires when all invalidations are done processing.
61 """
63 """
64 Set the instance of ZenHub that this processor will deal with.
65 """
66
67
69 """
70 ZenHub has created a service.
71 """
72 name = Attribute("Dotted class name of the service")
73 instance = Attribute("Collector name")
74
75
77 """
78 A hub has been instantiated.
79 """
80 hub = Attribute("The hub")
81
82
84 """
85 A hub has been instantiated.
86 """
87 hub = Attribute("The hub")
88
89
91 """
92 A parser is ready for extra options to be added.
93 """
94 parser = Attribute("The option parser")
95
96
98 """
99 Filters invalidations before they're pushed to workers.
100 """
101 weight = Attribute("Where this filter should be in the process. Lower is earlier.")
102
104 """
105 Initialize any state necessary for this filter to function.
106 """
108 """
109 Return whether to exclude this device, include it absolutely, or move
110 on to the next filter (L{FILTER_EXCLUDE}, L{FILTER_INCLUDE} or
111 L{FILTER_CONTINUE}).
112 """
113
115 """
116 Allows an invalidation OID to be changed to a different OID or dropped
117 """
122
123
131
139
141 """
142 Strategy class for selecting eligible zenhub workers for a given function. A default
143 strategy will be created with simple selection algorithm, additional named strategies
144 (named by zenhub service method) can be defined using more elaborate algorithms.
145 """
147 """
148 For a given list of workers/worker state and configured options, return a
149 generator of valid worker id's. This will factor in concepts of priority and
150 allocation, to accommodate methods that are short duration and high-frequency,
151 and those of long duration and low-frequency (but may also potentially come in
152 bursts).
153 """
154