|
@@ -75,12 +75,17 @@ class DoInterestManager(DirectObject.DirectObject):
|
|
|
_debug_interestHistory = []
|
|
_debug_interestHistory = []
|
|
|
_debug_maxDescriptionLen = 20
|
|
_debug_maxDescriptionLen = 20
|
|
|
|
|
|
|
|
|
|
+ _Serial = SerialNum()
|
|
|
|
|
+
|
|
|
def __init__(self):
|
|
def __init__(self):
|
|
|
assert DoInterestManager.notify.debugCall()
|
|
assert DoInterestManager.notify.debugCall()
|
|
|
DirectObject.DirectObject.__init__(self)
|
|
DirectObject.DirectObject.__init__(self)
|
|
|
self._addInterestEvent = uniqueName('DoInterestManager-Add')
|
|
self._addInterestEvent = uniqueName('DoInterestManager-Add')
|
|
|
self._removeInterestEvent = uniqueName('DoInterestManager-Remove')
|
|
self._removeInterestEvent = uniqueName('DoInterestManager-Remove')
|
|
|
|
|
|
|
|
|
|
+ def _getAnonymousEvent(self, desc):
|
|
|
|
|
+ return 'anonymous-%s-%s' % (desc, DoInterestManager._Serial.next())
|
|
|
|
|
+
|
|
|
def addInterest(self, parentId, zoneIdList, description, event=None):
|
|
def addInterest(self, parentId, zoneIdList, description, event=None):
|
|
|
"""
|
|
"""
|
|
|
Look into a (set of) zone(s).
|
|
Look into a (set of) zone(s).
|
|
@@ -88,6 +93,8 @@ class DoInterestManager(DirectObject.DirectObject):
|
|
|
assert DoInterestManager.notify.debugCall()
|
|
assert DoInterestManager.notify.debugCall()
|
|
|
handle = self._getNextHandle()
|
|
handle = self._getNextHandle()
|
|
|
scopeId = self._getNextScopeId()
|
|
scopeId = self._getNextScopeId()
|
|
|
|
|
+ if event is None:
|
|
|
|
|
+ event = self._getAnonymousEvent('addInterest')
|
|
|
DoInterestManager._interests[handle] = InterestState(
|
|
DoInterestManager._interests[handle] = InterestState(
|
|
|
description, InterestState.StateActive, scopeId, event, parentId, zoneIdList)
|
|
description, InterestState.StateActive, scopeId, event, parentId, zoneIdList)
|
|
|
if self.InterestDebug:
|
|
if self.InterestDebug:
|
|
@@ -116,6 +123,8 @@ class DoInterestManager(DirectObject.DirectObject):
|
|
|
"""
|
|
"""
|
|
|
assert DoInterestManager.notify.debugCall()
|
|
assert DoInterestManager.notify.debugCall()
|
|
|
existed = False
|
|
existed = False
|
|
|
|
|
+ if event is None:
|
|
|
|
|
+ event = self._getAnonymousEvent('removeInterest')
|
|
|
if DoInterestManager._interests.has_key(handle):
|
|
if DoInterestManager._interests.has_key(handle):
|
|
|
existed = True
|
|
existed = True
|
|
|
intState = DoInterestManager._interests[handle]
|
|
intState = DoInterestManager._interests[handle]
|
|
@@ -166,6 +175,8 @@ class DoInterestManager(DirectObject.DirectObject):
|
|
|
"""
|
|
"""
|
|
|
assert DoInterestManager.notify.debugCall()
|
|
assert DoInterestManager.notify.debugCall()
|
|
|
exists = False
|
|
exists = False
|
|
|
|
|
+ if event is None:
|
|
|
|
|
+ event = self._getAnonymousEvent('alterInterest')
|
|
|
if DoInterestManager._interests.has_key(handle):
|
|
if DoInterestManager._interests.has_key(handle):
|
|
|
if description is not None:
|
|
if description is not None:
|
|
|
DoInterestManager._interests[handle].desc = description
|
|
DoInterestManager._interests[handle].desc = description
|