コード例 #1
0
ファイル: vice.py プロジェクト: StyXman/Trieste
  def init (self, net=None, url=None):
    Master.init (self)

    if net:
      peer= None
      finished= self._terminate
      while not finished:
        peer= self.discover (net)
        finished= self._terminate or peer

      if peer:
        self.gossip (peer)
        self.propalate ()
        return True
      else:
        return False

    if url:
      key= self.getNavelKey (url)
      peer= self._peers.getNavel (url, key)
      self.gossip (peer)
      self.propalate ()
      return True

    return False
コード例 #2
0
    def init(self, net=None, url=None):
        Master.init(self)

        if net:
            peer = None
            finished = self._terminate
            while not finished:
                peer = self.discover(net)
                finished = self._terminate or peer

            if peer:
                self.gossip(peer)
                self.propalate()
                return True
            else:
                return False

        if url:
            key = self.getNavelKey(url)
            peer = self._peers.getNavel(url, key)
            self.gossip(peer)
            self.propalate()
            return True

        return False
コード例 #3
0
ファイル: navel.py プロジェクト: Cloudxtreme/Trieste
  def init (self, net=None):
    Master.init (self)
    self._data= UmbData (self._key, self._key)
    self._self= self._peers.getNavel (self._url, self._key, Normal)

    if net:
      # create a challenger for new nodes and such
      self._chal= Challenger (self)
      self._chal.start ()

      # find a ring and join it or create a new one
      self.debug (1, 'ping')
      peer= self.discover (net, self._self)
      if peer==None:
        self.debug (1, "gave up! noone's here!")
        self.createRing ()
      else:
        self.join (peer)