Package flumotion :: Package component :: Package combiners :: Package switch :: Module basicwatchdog
[hide private]

Source Code for Module flumotion.component.combiners.switch.basicwatchdog

 1  # -*- Mode: Python -*- 
 2  # vi:si:et:sw=4:sts=4:ts=4 
 3  # 
 4  # Flumotion - a streaming media server 
 5  # Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com). 
 6  # All rights reserved. 
 7   
 8  # This file may be distributed and/or modified under the terms of 
 9  # the GNU General Public License version 2 as published by 
10  # the Free Software Foundation. 
11  # This file is distributed without any warranty; without even the implied 
12  # warranty of merchantability or fitness for a particular purpose. 
13  # See "LICENSE.GPL" in the source distribution for more information. 
14   
15  # Licensees having purchased or holding a valid Flumotion Advanced 
16  # Streaming Server license may use this file in accordance with the 
17  # Flumotion Advanced Streaming Server Commercial License Agreement. 
18  # See "LICENSE.Flumotion" in the source distribution for more information. 
19   
20  # Headers in this file shall remain intact. 
21   
22  from flumotion.component import feedcomponent 
23  from flumotion.common import errors 
24   
25  from flumotion.component.combiners.switch import switch 
26   
27  # These basic watchdog components switch to backup 
28  # when the master eater(s) have gone hungry 
29 -class SingleBasicWatchdog(switch.SingleSwitch):
30 logCategory = "comb-single-basic-watchdog" 31
32 - def eaterSetInactive(self, feedId):
33 switch.SingleSwitch.eaterSetInactive(self, feedId) 34 eaterName = self.get_eater_name_for_feed_id(feedId) 35 oppositeEater = "backup" 36 if self._idealEater == "backup": 37 oppositeEater = "master" 38 if self._idealEater in eaterName and self.is_active(oppositeEater) and \ 39 self.uiState.get("active-eater") == self._idealEater and \ 40 self._started: 41 self.debug("Switching to %s, active eater is %s", oppositeEater, 42 self.uiState.get("active-eater")) 43 self.switch_to(oppositeEater)
44
45 - def eaterSetActive(self, feedId):
46 switch.SingleSwitch.eaterSetActive(self, feedId) 47 eaterName = self.get_eater_name_for_feed_id(feedId) 48 oppositeEater = "backup" 49 if self._idealEater == "backup": 50 oppositeEater = "master" 51 if self._idealEater in eaterName and self.is_active(self._idealEater) \ 52 and self.uiState.get("active-eater") == oppositeEater and \ 53 self._started: 54 self.debug("Switching to %s, active eater is %s", self._idealEater, 55 self.uiState.get("active-eater")) 56 self.switch_to(self._idealEater)
57
58 -class AVBasicWatchdog(switch.AVSwitch):
59 logCategory = "comb-av-basic-watchdog" 60
61 - def eaterSetInactive(self, feedId):
62 switch.AVSwitch.eaterSetInactive(self, feedId) 63 eaterName = self.get_eater_name_for_feed_id(feedId) 64 oppositeEater = "backup" 65 if self._idealEater == "backup": 66 oppositeEater = "master" 67 if self._idealEater in eaterName and self.is_active(oppositeEater) and \ 68 self.uiState.get("active-eater") == self._idealEater and \ 69 self._started: 70 self.debug("Switching to %s, active eater is %s", oppositeEater, 71 self.uiState.get("active-eater")) 72 self.switch_to(oppositeEater)
73
74 - def eaterSetActive(self, feedId):
75 switch.AVSwitch.eaterSetActive(self, feedId) 76 eaterName = self.get_eater_name_for_feed_id(feedId) 77 oppositeEater = "backup" 78 if self._idealEater == "backup": 79 oppositeEater = "master" 80 if self._idealEater in eaterName and self.is_active(self._idealEater) \ 81 and self.uiState.get("active-eater") == oppositeEater and \ 82 self._started: 83 self.debug("Switching to %s, active eater is %s", self._idealEater, 84 self.uiState.get("active-eater")) 85 self.switch_to(self._idealEater)
86