From: David Stainton Date: Tue, 21 Apr 2015 17:48:14 +0000 (+0100) Subject: wip - confirming that the db persistence doesn't work X-Git-Url: https://git.rkrishnan.org/vdrive/nxhtml.html?a=commitdiff_plain;h=dd8f18f4a8b6f47367b0c074fd22700db384863c;p=tahoe-lafs%2Ftahoe-lafs.git wip - confirming that the db persistence doesn't work --- diff --git a/src/allmydata/frontends/drop_upload.py b/src/allmydata/frontends/drop_upload.py index b915b978..c2691d1e 100644 --- a/src/allmydata/frontends/drop_upload.py +++ b/src/allmydata/frontends/drop_upload.py @@ -123,9 +123,10 @@ class DropUploader(service.MultiService): if must_upload: self._append_to_deque(childpath) elif isfile: - print "isfile" + print "isfile %s" % (childpath,) must_upload = self._check_db_file(childpath) if must_upload: + print "must_upload" self._append_to_deque(childpath) else: self.warn("WARNING: cannot backup special file %s" % quote_local_unicode_path(childpath)) @@ -210,8 +211,8 @@ class DropUploader(service.MultiService): if sys.platform != "win32": name = name.decode(get_filesystem_encoding()) # XXX - #dirname = path.decode(get_filesystem_encoding()) - dirname = path + dirname = path.decode(get_filesystem_encoding()) + #dirname = path return self._parent.create_subdirectory(name) @@ -230,6 +231,20 @@ class DropUploader(service.MultiService): return None elif os.path.isfile(path): d.addCallback(_add_file) + def add_db_entry(val): + filecap = val.get_uri() + print "filename %s filecap %s" % (path, filecap) + s = os.stat(path) + self._db.did_upload_file(filecap, path.decode('UTF-8'), s.st_mtime, s.st_ctime, s.st_size) + + #r = self._db.check_file(path.decode('UTF-8')) + #was_uploaded = r.was_uploaded() + #if was_uploaded: + # print "was_uploaded true" + #else: + # print "was_uploaded false" + + d.addCallback(add_db_entry) self._stats_provider.count('drop_upload.files_uploaded', 1) return None else: diff --git a/src/allmydata/test/test_drop_upload.py b/src/allmydata/test/test_drop_upload.py index 08476f99..98f56837 100644 --- a/src/allmydata/test/test_drop_upload.py +++ b/src/allmydata/test/test_drop_upload.py @@ -158,12 +158,13 @@ class DropUploadTestMixin(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, NonA d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.objects_queued'), 0)) d.addCallback(self._cleanup) d.addCallback(lambda ign: self.client.removeService(self.uploader)) - + def msg(val): + print "stopped and removed uploader service." + d.addCallback(msg) d.addCallback(self._made_upload_dir) 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 def _test(self):