def __init__(self, parent, name, eaters=None, feeders=None, vfeeds=None,
                 clockMaster=False, worker='localhost', host='127.0.0.1',
                 fport=-1):
        self._parent = parent
        self._name = name
        self._host = host
        if fport == -1:
            fport = FakeComponentAvatar._nextPort
            FakeComponentAvatar._nextPort += 1
        self._fport = fport
        self._worker = worker

        self._eatlog = []
        self._feedlog = []

        if eaters is None:
            eaters = {}
        self._eaters = eaters
        if feeders is None:
            feeders = ['default']
        self._feeders = feeders
        if vfeeds is None:
            vfeeds = {}
        self._vfeeds = dict([(common.fullFeedId(self._parent, vcomp, vfeed),
                              (self, feed))
                             for vcomp, vfeed, feed in vfeeds])

        self.avatarId = common.componentId(parent, name)
        self.componentState = (None, 'componentState_%s' % name)
        self.jobState = (None, 'jobState_%s' % name)
        self._clockmaster = clockMaster
        gp = (lambda: dac(host=self._host))
        self.mind = dac(broker=dac(transport=dac(getPeer=gp)))
示例#2
0
    def getFullFeedId(self, feedName):
        """
        Get the full feedId of a feed provided or consumed by this
        component.

        @param feedName: The name of the feed (i.e., eater alias or
                         feeder name)
        @rtype: L{flumotion.common.common.fullFeedId}
        """
        return common.fullFeedId(self.getParentName(), self.getName(),
                                 feedName)
示例#3
0
    def getFullFeedId(self, feedName):
        """
        Get the full feedId of a feed provided or consumed by this
        component.

        @param feedName: The name of the feed (i.e., eater alias or
                         feeder name)
        @rtype: L{flumotion.common.common.fullFeedId}
        """
        return common.fullFeedId(self.getParentName(),
                                 self.getName(), feedName)
示例#4
0
 def _getAuthenticatorForFeed(self, eaterAliasOrFeedName):
     # The avatarId on the keycards issued by the authenticator will
     # identify us to the remote component. Attempt to use our
     # fullFeedId, for debugging porpoises.
     if hasattr(self.authenticator, "copy"):
         tup = common.parseComponentId(self.authenticator.avatarId)
         flowName, componentName = tup
         fullFeedId = common.fullFeedId(flowName, componentName, eaterAliasOrFeedName)
         return self.authenticator.copy(fullFeedId)
     else:
         return self.authenticator
示例#5
0
 def _getAuthenticatorForFeed(self, eaterAliasOrFeedName):
     # The avatarId on the keycards issued by the authenticator will
     # identify us to the remote component. Attempt to use our
     # fullFeedId, for debugging porpoises.
     if hasattr(self.authenticator, 'copy'):
         tup = common.parseComponentId(self.authenticator.avatarId)
         flowName, componentName = tup
         fullFeedId = common.fullFeedId(flowName, componentName,
                                        eaterAliasOrFeedName)
         return self.authenticator.copy(fullFeedId)
     else:
         return self.authenticator
示例#6
0
 def _getFeederAvatar(self, eater, feedId):
     # FIXME: 'get' part is confusing - this methods _modifies_ structures!
     flowName = eater.getParentName()
     compName, feedName = common.parseFeedId(feedId)
     ffid = common.fullFeedId(flowName, compName, feedName)
     feeder = None
     if ffid in self.feeds:
         feeder, feedName = self.feeds[ffid][0]
         self.feedDeps.add(feeder, (eater, ffid))
         if feeder.getFeedId(feedName) != feedId:
             self.debug('chose %s for feed %s',
                        feeder.getFeedId(feedName), feedId)
     return feeder, feedName
示例#7
0
    def getVirtualFeeds(self):
        """
        Get the set of virtual feeds provided by this component.

        @rtype: dict of fullFeedId -> (ComponentAvatar, feederName)
        """
        conf = self.componentState.get('config')
        ret = {}
        for feedId, feederName in conf.get('virtual-feeds', {}).items():
            vComp, vFeed = common.parseFeedId(feedId)
            ffid = common.fullFeedId(self.getParentName(), vComp, vFeed)
            ret[ffid] = (self, feederName)
        return ret
示例#8
0
 def _getFeederAvatar(self, eater, feedId):
     # FIXME: 'get' part is confusing - this methods _modifies_ structures!
     flowName = eater.getParentName()
     compName, feedName = common.parseFeedId(feedId)
     ffid = common.fullFeedId(flowName, compName, feedName)
     feeder = None
     if ffid in self.feeds:
         feeder, feedName = self.feeds[ffid][0]
         self.feedDeps.add(feeder, (eater, ffid))
         if feeder.getFeedId(feedName) != feedId:
             self.debug('chose %s for feed %s', feeder.getFeedId(feedName),
                        feedId)
     return feeder, feedName
示例#9
0
    def getVirtualFeeds(self):
        """
        Get the set of virtual feeds provided by this component.

        @rtype: dict of fullFeedId -> (ComponentAvatar, feederName)
        """
        conf = self.componentState.get('config')
        ret = {}
        for feedId, feederName in conf.get('virtual-feeds', {}).items():
            vComp, vFeed = common.parseFeedId(feedId)
            ffid = common.fullFeedId(self.getParentName(), vComp, vFeed)
            ret[ffid] = (self, feederName)
        return ret
示例#10
0
    def __init__(self,
                 parent,
                 name,
                 eaters=None,
                 feeders=None,
                 vfeeds=None,
                 clockMaster=False,
                 worker='localhost',
                 host='127.0.0.1',
                 fport=-1):
        self._parent = parent
        self._name = name
        self._host = host
        if fport == -1:
            fport = FakeComponentAvatar._nextPort
            FakeComponentAvatar._nextPort += 1
        self._fport = fport
        self._worker = worker

        self._eatlog = []
        self._feedlog = []

        if eaters is None:
            eaters = {}
        self._eaters = eaters
        if feeders is None:
            feeders = ['default']
        self._feeders = feeders
        if vfeeds is None:
            vfeeds = {}
        self._vfeeds = dict([(common.fullFeedId(self._parent, vcomp,
                                                vfeed), (self, feed))
                             for vcomp, vfeed, feed in vfeeds])

        self.avatarId = common.componentId(parent, name)
        self.componentState = (None, 'componentState_%s' % name)
        self.jobState = (None, 'jobState_%s' % name)
        self._clockmaster = clockMaster
        gp = (lambda: dac(host=self._host))
        self.mind = dac(broker=dac(transport=dac(getPeer=gp)))
 def getFullFeedId(self, feedName):
     return common.fullFeedId(self._parent, self._name, feedName)
示例#12
0
 def getFullFeedId(self, feedName):
     return common.fullFeedId(self._parent, self._name, feedName)