Package Products :: Package ZenHub :: Module interfaces
[hide private]
[frames] | no frames]

Source Code for Module Products.ZenHub.interfaces

  1  ############################################################################## 
  2  #  
  3  # Copyright (C) Zenoss, Inc. 2007, all rights reserved. 
  4  #  
  5  # This content is made available according to terms specified in 
  6  # License.zenoss under the directory where your Zenoss product is installed. 
  7  #  
  8  ############################################################################## 
  9   
 10   
 11  from zope.component.interfaces import Interface, IObjectEvent 
 12  from zope.interface import Attribute 
 13   
 14   
 15  # "Enum" for return values for IInvalidationFilters. 
 16  FILTER_EXCLUDE = 0 
 17  FILTER_INCLUDE = 1 
 18  FILTER_CONTINUE = 2 
 19   
 20   
21 -class IInvalidationEvent(IObjectEvent):
22 """ 23 ZenHub has noticed an invalidation. 24 """ 25 oid = Attribute("OID of the changed object")
26 27
28 -class IUpdateEvent(IInvalidationEvent):
29 """ 30 An object has been updated. 31 """
32 33
34 -class IDeletionEvent(IInvalidationEvent):
35 """ 36 An object has been deleted. 37 """
38 39
40 -class IBatchNotifier(Interface):
41 """ 42 Processes subdevices in batches. 43 """ 44
45 - def notify_subdevices(device_class, service_uid, callback):
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
53 -class IInvalidationProcessor(Interface):
54 """ 55 Accepts an invalidation queue. 56 """
57 - def processQueue(queue):
58 """ 59 Read invalidations off a queue and deal with them. Return a Deferred 60 that fires when all invalidations are done processing. 61 """
62 - def setHub(hub):
63 """ 64 Set the instance of ZenHub that this processor will deal with. 65 """
66 67
68 -class IServiceAddedEvent(Interface):
69 """ 70 ZenHub has created a service. 71 """ 72 name = Attribute("Dotted class name of the service") 73 instance = Attribute("Collector name")
74 75
76 -class IHubWillBeCreatedEvent(Interface):
77 """ 78 A hub has been instantiated. 79 """ 80 hub = Attribute("The hub")
81 82
83 -class IHubCreatedEvent(Interface):
84 """ 85 A hub has been instantiated. 86 """ 87 hub = Attribute("The hub")
88 89
90 -class IParserReadyForOptionsEvent(Interface):
91 """ 92 A parser is ready for extra options to be added. 93 """ 94 parser = Attribute("The option parser")
95 96
97 -class IInvalidationFilter(Interface):
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
103 - def initialize(context):
104 """ 105 Initialize any state necessary for this filter to function. 106 """
107 - def include(obj):
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
114 -class IInvalidationOid(Interface):
115 """ 116 Allows an invalidation OID to be changed to a different OID or dropped 117 """
118 - def tranformOid(oid):
119 """ 120 Given an OID, return the same oid, a different one, a list of other oids or None. 121 """
122 123
124 -class IHubConfProvider(Interface):
125 """ 126 """ 127
128 - def getHubConf():
129 """ 130 """
131
132 -class IHubHeartBeatCheck(Interface):
133 """ 134 """ 135
136 - def check():
137 """ 138 """
139
140 -class IWorkerSelectionAlgorithm(Interface):
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 """
146 - def getCandidateWorkerIds(workerlist, options):
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