]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
WIP
authorDavid Stainton <dstainton415@gmail.com>
Mon, 20 Apr 2015 22:34:33 +0000 (23:34 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 28 Apr 2015 18:46:48 +0000 (19:46 +0100)
src/allmydata/frontends/drop_upload.py
src/allmydata/test/no_network.py
src/allmydata/test/test_drop_upload.py

index ca900191d6f590cec7bf7dde6ff1ad726bdd7867..a482caf764a7be6a0bea03f226c63cffdb604041 100644 (file)
@@ -38,6 +38,8 @@ class DropUploader(service.MultiService):
                                  "could not be represented in the filesystem encoding."
                                  % quote_output(local_dir_utf8))
 
+        self._objid = None
+        self._classname = 'DropUploader'
         self._pending = set()
         self._client = client
         self._stats_provider = client.stats_provider
@@ -91,6 +93,7 @@ class DropUploader(service.MultiService):
         return not r.was_uploaded()
 
     def _scan(self, localpath):
+        print "_scan"
         if not os.path.isdir(localpath):
             raise AssertionError("Programmer error: _scan() must be passed a directory path.")
         quoted_path = quote_local_unicode_path(localpath)
@@ -112,12 +115,14 @@ class DropUploader(service.MultiService):
             if islink:
                 self.warn("WARNING: cannot backup symlink %s" % quote_local_unicode_path(childpath))
             elif isdir:
+                print "isdir"
                 # recurse on the child directory
                 self._scan(childpath)
                 must_upload = self._check_db_file(childpath)
                 if must_upload:
                     self._append_to_deque(childpath)
             elif isfile:
+                print "isfile"
                 must_upload = self._check_db_file(childpath)
                 if must_upload:
                     self._append_to_deque(childpath)
@@ -158,6 +163,7 @@ class DropUploader(service.MultiService):
         self._turn_deque()
 
     def _append_to_deque(self, path):
+        print "_append_to_deque"
         self._upload_deque.append(path)
         self._pending.add(path)
         self._stats_provider.count('drop_upload.objects_queued', 1)
index ee7a049abbb4b310b2d6542fc433a40d34e4ffa5..6c50bb17447521fc443b1422f73cf8e016b97789 100644 (file)
@@ -175,8 +175,8 @@ class NoNetworkStorageBroker:
 
 class NoNetworkClient(Client):
 
-    def disownParentService(self):
-        pass
+    def disownServiceParent(self):
+        self.disownServiceParent()
     def create_tub(self):
         pass
     def init_introducer_client(self):
index 92b2a918ecc982192e45165c899a4b78e5d76752..afbc3a4966a4c287b62cee1163f34b0d9852935c 100644 (file)
@@ -138,43 +138,41 @@ class DropUploadTestMixin(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, NonA
     def _test_persistence(self):
         self.uploader = None
         self.dir_node = None
-
         self.set_up_grid()
         self.local_dir = os.path.join(self.basedir, u"test_persistence")
         self.mkdir_nonascii(self.local_dir)
-
         self.client = self.g.clients[0]
         self.stats_provider = self.client.stats_provider
-
         d = self.client.create_dirnode()
         d.addCallback(self._made_upload_dir)
-        d.addCallback(lambda ign: self.uploader.Pause())
+        d.addCallback(self._cleanup)
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.objects_uploaded'), 0))
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.objects_queued'), 0))
+        d.addCallback(lambda ign: self.client.removeService(self.uploader))
+
+        def msg(val):
+            print "old uploader removed"
+            return None
+        d.addCallback(msg)
+        
         def create_file(val):
             myFile = os.path.join(self.local_dir, "what")
             f = open(myFile, "wb")
             f.write("meow")
             f.close()
-            # XXX
-            #self.notify_close_write(FilePath(myFile))
+            print "test file created"
             return None
         d.addCallback(create_file)
-        d.addCallback(self._cleanup)
-        #d.addCallback(lambda ign: self.client.stopService())
-        #d.addCallback(lambda ign: self.client.disownParentService(self))
-        #d.addCallback(lambda ign: self.client.startService())
+        
         d.addCallback(self._made_upload_dir)
-
         def resume_uploader(val):
-            self.uploader.Resume()
+            print "created new uploader"
             d = defer.Deferred()
             self.uploader.set_uploaded_callback(d.callback)
             return d
         d.addCallback(resume_uploader)
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.objects_queued'), 0))
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.objects_uploaded'), 1))
-
         d.addBoth(self._cleanup)
         return d