Beispiel #1
0
 def _transfer(self, collector, filepath, d=None):
     try:
         fd = open(filepath.path, 'rb')
         pager = TransferPager(collector, fd)
         if d is not None:
             pager.wait().chainDeferred(d)
         print '%s, %d bytes' % (filepath.path, filepath.getsize())
     except (OSError, IOError) as e:
         print "Error:", e
         if d is not None:
             # make sure we callback, otherwise the queue will stick
             d.errback(e)
Beispiel #2
0
 def _restore(collector):
     fd = self.server.storage.get(self.api.get_hostname(), from_path,
                                  version_id)
     pager = TransferPager(collector, fd)
     pager.wait().addCallback(_restore_complete)