Exemplo n.º 1
0
 def make_servermap(self, mode=MODE_READ, oldmap=None):
     if oldmap is None:
         oldmap = ServerMap()
     smu = ServermapUpdater(self._fn, self._storage_broker, Monitor(),
                            oldmap, mode)
     d = smu.update()
     return d
Exemplo n.º 2
0
 def make_servermap(self, mode=MODE_CHECK, fn=None, sb=None, update_range=None):
     if fn is None:
         fn = self._fn
     if sb is None:
         sb = self._storage_broker
     smu = ServermapUpdater(fn, sb, Monitor(), ServerMap(), mode, update_range=update_range)
     d = smu.update()
     return d
Exemplo n.º 3
0
 def make_servermap(self, mode=MODE_READ, oldmap=None, sb=None):
     if oldmap is None:
         oldmap = ServerMap()
     if sb is None:
         sb = self._storage_broker
     smu = ServermapUpdater(self._fn, sb, Monitor(), oldmap, mode)
     d = smu.update()
     return d
Exemplo n.º 4
0
 def check(self, verify=False, add_lease=False):
     servermap = ServerMap()
     u = ServermapUpdater(self._node, self._storage_broker, self._monitor,
                          servermap, MODE_CHECK, add_lease=add_lease)
     if self._history:
         self._history.notify_mapupdate(u.get_status())
     d = u.update()
     d.addCallback(self._got_mapupdate_results)
     if verify:
         d.addCallback(self._verify_all_shares)
     d.addCallback(lambda res: servermap)
     d.addCallback(self._fill_checker_results, self.results)
     d.addCallback(lambda res: self.results)
     return d
Exemplo n.º 5
0
 def _update_servermap(self, mode=MODE_WRITE, update_range=None):
     """
     I update the servermap. I return a Deferred that fires when the
     servermap update is done.
     """
     if update_range:
         u = ServermapUpdater(self._node, self._storage_broker, Monitor(),
                              self._servermap,
                              mode=mode,
                              update_range=update_range)
     else:
         u = ServermapUpdater(self._node, self._storage_broker, Monitor(),
                              self._servermap,
                              mode=mode)
     return u.update()
Exemplo n.º 6
0
 def _update_servermap(self, mode=MODE_WRITE, update_range=None):
     """
     I update the servermap. I return a Deferred that fires when the
     servermap update is done.
     """
     if update_range:
         u = ServermapUpdater(self._node, self._storage_broker, Monitor(),
                              self._servermap,
                              mode=mode,
                              update_range=update_range)
     else:
         u = ServermapUpdater(self._node, self._storage_broker, Monitor(),
                              self._servermap,
                              mode=mode)
     return u.update()
Exemplo n.º 7
0
 def make_servermap(self,
                    mode=MODE_CHECK,
                    fn=None,
                    sb=None,
                    update_range=None):
     if fn is None:
         fn = self._fn
     if sb is None:
         sb = self._storage_broker
     smu = ServermapUpdater(fn,
                            sb,
                            Monitor(),
                            ServerMap(),
                            mode,
                            update_range=update_range)
     d = smu.update()
     return d
Exemplo n.º 8
0
 def check(self, verify=False, add_lease=False):
     servermap = ServerMap()
     # Updating the servermap in MODE_CHECK will stand a good chance
     # of finding all of the shares, and getting a good idea of
     # recoverability, etc, without verifying.
     u = ServermapUpdater(self._node, self._storage_broker, self._monitor,
                          servermap, self.SERVERMAP_MODE,
                          add_lease=add_lease)
     if self._history:
         self._history.notify_mapupdate(u.get_status())
     d = u.update()
     d.addCallback(self._got_mapupdate_results)
     if verify:
         d.addCallback(self._verify_all_shares)
     d.addCallback(lambda res: servermap)
     d.addCallback(self._make_checker_results)
     return d
Exemplo n.º 9
0
 def check(self, verify=False, add_lease=False):
     servermap = ServerMap()
     u = ServermapUpdater(self._node,
                          self._storage_broker,
                          self._monitor,
                          servermap,
                          MODE_CHECK,
                          add_lease=add_lease)
     if self._history:
         self._history.notify_mapupdate(u.get_status())
     d = u.update()
     d.addCallback(self._got_mapupdate_results)
     if verify:
         d.addCallback(self._verify_all_shares)
     d.addCallback(lambda res: servermap)
     d.addCallback(self._fill_checker_results, self.results)
     d.addCallback(lambda res: self.results)
     return d
Exemplo n.º 10
0
    def start(self, force=False):
        # download, then re-publish. If a server had a bad share, try to
        # replace it with a good one of the same shnum.

        # The normal repair operation should not be used to replace
        # application-specific merging of alternate versions: i.e if there
        # are multiple highest seqnums with different roothashes. In this
        # case, the application must use node.upload() (referencing the
        # servermap that indicates the multiple-heads condition), or
        # node.overwrite(). The repair() operation will refuse to run in
        # these conditions unless a force=True argument is provided. If
        # force=True is used, then the highest root hash will be reinforced.

        # Likewise, the presence of an unrecoverable latest version is an
        # unusual event, and should ideally be handled by retrying a couple
        # times (spaced out over hours or days) and hoping that new shares
        # will become available. If repair(force=True) is called, data will
        # be lost: a new seqnum will be generated with the same contents as
        # the most recent recoverable version, skipping over the lost
        # version. repair(force=False) will refuse to run in a situation like
        # this.

        # Repair is designed to fix the following injuries:
        #  missing shares: add new ones to get at least N distinct ones
        #  old shares: replace old shares with the latest version
        #  bogus shares (bad sigs): replace the bad one with a good one

        # first, update the servermap in MODE_REPAIR, which files all shares
        # and makes sure we get the privkey.
        u = ServermapUpdater(self.node, self._storage_broker, self._monitor,
                             ServerMap(), MODE_REPAIR)
        if self._history:
            self._history.notify_mapupdate(u.get_status())
        d = u.update()
        d.addCallback(self._got_full_servermap, force)
        return d
Exemplo n.º 11
0
    def start(self, force=False):
        # download, then re-publish. If a server had a bad share, try to
        # replace it with a good one of the same shnum.

        # The normal repair operation should not be used to replace
        # application-specific merging of alternate versions: i.e if there
        # are multiple highest seqnums with different roothashes. In this
        # case, the application must use node.upload() (referencing the
        # servermap that indicates the multiple-heads condition), or
        # node.overwrite(). The repair() operation will refuse to run in
        # these conditions unless a force=True argument is provided. If
        # force=True is used, then the highest root hash will be reinforced.

        # Likewise, the presence of an unrecoverable latest version is an
        # unusual event, and should ideally be handled by retrying a couple
        # times (spaced out over hours or days) and hoping that new shares
        # will become available. If repair(force=True) is called, data will
        # be lost: a new seqnum will be generated with the same contents as
        # the most recent recoverable version, skipping over the lost
        # version. repair(force=False) will refuse to run in a situation like
        # this.

        # Repair is designed to fix the following injuries:
        #  missing shares: add new ones to get at least N distinct ones
        #  old shares: replace old shares with the latest version
        #  bogus shares (bad sigs): replace the bad one with a good one

        # first, update the servermap in MODE_REPAIR, which files all shares
        # and makes sure we get the privkey.
        u = ServermapUpdater(self.node, self._storage_broker, self._monitor,
                             ServerMap(), MODE_REPAIR)
        if self._history:
            self._history.notify_mapupdate(u.get_status())
        d = u.update()
        d.addCallback(self._got_full_servermap, force)
        return d
Exemplo n.º 12
0
 def update_servermap(self, oldmap, mode=MODE_CHECK):
     smu = ServermapUpdater(self._fn, self._storage_broker, Monitor(), oldmap, mode)
     d = smu.update()
     return d
Exemplo n.º 13
0
 def update_servermap(self, oldmap, mode=MODE_CHECK):
     smu = ServermapUpdater(self._fn, self._storage_broker, Monitor(),
                            oldmap, mode)
     d = smu.update()
     return d
Exemplo n.º 14
0
 def _update_servermap(self, servermap, mode):
     u = ServermapUpdater(self, self._storage_broker, Monitor(), servermap,
                          mode)
     if self._history:
         self._history.notify_mapupdate(u.get_status())
     return u.update()
Exemplo n.º 15
0
 def _update_servermap(self, servermap, mode):
     u = ServermapUpdater(self, self._storage_broker, Monitor(), servermap,
                          mode)
     if self._history:
         self._history.notify_mapupdate(u.get_status())
     return u.update()