ride_d.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:ride 作者: KyleBenson 项目源码 文件源码
def update(self):
        """
        Tells RideD to update itself by getting the latest subscribers, publishers,
        publication routes, and topology.  It rebuilds and reinstalls the multicast
        trees if necessary.
        :return:
        """

        # ENHANCE: extend the REST APIs to support updating the topology rather than getting a whole new one.
        self.topology_manager.build_topology(from_scratch=True)

        # TODO: need to invalidate outstanding alerts if the MDMTs change!  or at least invalidate their changed MDMTs...

        # XXX: during lots of failures, the updated topology won't see a lot of the nodes so we'll be catching errors...
        trees = None
        try:
            trees = self.build_mdmts()
            # TODO: maybe we should only save the built MDMTs as we add their flow rules? this could ensure that any MDMT we try to use will at least be fully-installed...
            # could even use a thread lock to block until the first one is installed
            self.mdmts = trees
        except nx.NetworkXError as e:
            log.error("failed to create MDMTs (likely due to topology disconnect) due to error: \n%s" % e)

        if trees:
            # ENHANCE: error checking/handling esp. for the multicast address pool that must be shared across all topics!
            for mdmts in trees.values():
                try:
                    self.install_mdmts(mdmts)
                except nx.NetworkXError as e:
                    log.error("failed to install_mdmts due to error: %s" % e)
        elif self.subscribers:
            log.error("empty return value from build_mdmts() when we do have subscribers!")
        # ENHANCE: retrieve publication routes rather than rely on them being manually set...
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号