]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
helper: add SI to logged progress messages
authorBrian Warner <warner@allmydata.com>
Tue, 15 Apr 2008 02:26:53 +0000 (19:26 -0700)
committerBrian Warner <warner@allmydata.com>
Tue, 15 Apr 2008 02:26:53 +0000 (19:26 -0700)
src/allmydata/offloaded.py

index 81c61156aaf1deb988626ae3a25b6831582adb60..4a298f1fec26d52d2b7ed84b26a2433bdc11f61a 100644 (file)
@@ -138,7 +138,7 @@ class CHKUploadHelper(Referenceable, upload.CHKUploader):
         self._helper = helper
         self._incoming_file = incoming_file
         self._encoding_file = encoding_file
-        upload_id = storage.si_b2a(storage_index)[:5]
+        self._upload_id = storage.si_b2a(storage_index)[:5]
         self._log_number = log_number
         self._results = results
         self._upload_status = upload.UploadStatus()
@@ -146,7 +146,7 @@ class CHKUploadHelper(Referenceable, upload.CHKUploader):
         self._upload_status.set_storage_index(storage_index)
         self._upload_status.set_status("fetching ciphertext")
         self._upload_status.set_progress(0, 1.0)
-        self._helper.log("CHKUploadHelper starting for SI %s" % upload_id,
+        self._helper.log("CHKUploadHelper starting for SI %s" % self._upload_id,
                          parent=log_number)
 
         self._client = helper.parent
@@ -261,6 +261,7 @@ class CHKCiphertextFetcher(AskUntilSuccessMixin):
         self._upload_helper = helper
         self._incoming_file = incoming_file
         self._encoding_file = encoded_file
+        self._upload_id = helper._upload_id
         self._log_parent = logparent
         self._done_observers = observer.OneShotObserverList()
         self._readers = []
@@ -378,7 +379,8 @@ class CHKCiphertextFetcher(AskUntilSuccessMixin):
         percent = 0.0
         if self._expected_size:
             percent = 1.0 * (self._have+fetch_size) / self._expected_size
-        self.log(format="fetching %(start)d-%(end)d of %(total)d (%(percent)d%%)",
+        self.log(format="fetching [%(si)s] %(start)d-%(end)d of %(total)d (%(percent)d%%)",
+                 si=self._upload_id,
                  start=self._have,
                  end=self._have+fetch_size,
                  total=self._expected_size,
@@ -437,9 +439,6 @@ class LocalCiphertextReader(AskUntilSuccessMixin):
         self._encoding_file = encoding_file
         self._status = None
 
-    def set_upload_status(self, upload_status):
-        self._status = interfaces.IUploadStatus(upload_status)
-
     def start(self):
         self._upload_helper._upload_status.set_status("pushing")
         self._size = os.stat(self._encoding_file)[stat.ST_SIZE]