wingo - in flumotion/trunk: . flumotion/manager

commits at core.fluendo.com commits at core.fluendo.com
Tue May 16 19:10:26 CEST 2006


Author: wingo
Date: Tue May 16 19:10:26 2006
New Revision: 3232

Modified:
   flumotion/trunk/ChangeLog
   flumotion/trunk/flumotion/manager/admin.py
   flumotion/trunk/flumotion/manager/manager.py
Log:
2006-05-16  Andy Wingo  <wingo at pobox.com>

	* flumotion/manager/admin.py
	(AdminAvatar.perspective_deleteComponent): New remote method for
	deleting components.

	* flumotion/manager/manager.py (Vishnu.deleteComponent): New
	method, deletes a component from the state.



Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog	(original)
+++ flumotion/trunk/ChangeLog	Tue May 16 19:10:26 2006
@@ -1,5 +1,12 @@
 2006-05-16  Andy Wingo  <wingo at pobox.com>
 
+	* flumotion/manager/admin.py
+	(AdminAvatar.perspective_deleteComponent): New remote method for
+	deleting components.
+
+	* flumotion/manager/manager.py (Vishnu.deleteComponent): New
+	method, deletes a component from the state.
+
 	* flumotion/common/worker.py (ProcessProtocol): 
 	* flumotion/worker/worker.py (JobProcessProtocol): Rework to
 	export the guts of the process protocol in common/.

Modified: flumotion/trunk/flumotion/manager/admin.py
==============================================================================
--- flumotion/trunk/flumotion/manager/admin.py	(original)
+++ flumotion/trunk/flumotion/manager/admin.py	Tue May 16 19:10:26 2006
@@ -275,6 +275,18 @@
     def perspective_deleteFlow(self, flowName):
         return self.vishnu.deleteFlow(flowName)
 
+    def perspective_deleteComponent(self, componentState):
+        """Delete a component from the manager.
+
+        A component can only be deleted when it is sleeping or sad. It
+        is the caller's job to ensure this is the case; calling this
+        function on a running component will raise a ComponentBusyError.
+
+        @returns: a deferred that will fire when all listeners have been
+        notified of the component removal
+        """
+        return self.vishnu.deleteComponent(componentState)
+
     # Deprecated -- remove me when no one uses me any more
     def perspective_cleanComponents(self):
         return self.vishnu.emptyPlanet()

Modified: flumotion/trunk/flumotion/manager/manager.py
==============================================================================
--- flumotion/trunk/flumotion/manager/manager.py	(original)
+++ flumotion/trunk/flumotion/manager/manager.py	Tue May 16 19:10:26 2006
@@ -686,11 +686,29 @@
 
         return list
 
+    def deleteComponent(self, componentState):
+        """
+        Empty the planet of the given component.
+
+        @returns: a deferred that will fire when all listeners have been
+        notified of the removal of the component.
+        """
+        self.debug('deleting component %r from state', componentState)
+        c = componentState
+        flow = componentState.get('parent')
+        if (c.get('moodPending') != None
+            or c.get('mood') is not moods.sleeping.value):
+            raise errors.BusyComponentError(c)
+
+        del self._componentMappers[self._componentMappers[c].id]
+        del self._componentMappers[c]
+        return flow.remove('components', c)
+        
     def deleteFlow(self, flowName):
         """
         Empty the planet of all components, and flows.
 
-        @returns: a deferred that will fire when the planet is empty.
+        @returns: a deferred that will fire when the flow is empty.
         """
 
         # first get all components to sleep


More information about the flumotion-commit mailing list