]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
#509: remove non-streaming 'tahoe manifest' CLI form
authorBrian Warner <warner@allmydata.com>
Sat, 24 Jan 2009 00:00:02 +0000 (17:00 -0700)
committerBrian Warner <warner@allmydata.com>
Sat, 24 Jan 2009 00:00:02 +0000 (17:00 -0700)
src/allmydata/scripts/cli.py
src/allmydata/scripts/tahoe_manifest.py
src/allmydata/test/test_system.py

index 583035056690e79439f6b31318c0165196e06de5..7ad2e5ea0db1f9b7d3a40e1c9d65822c8cbd3355 100644 (file)
@@ -203,7 +203,6 @@ class ManifestOptions(VDriveOptions):
         ("verify-cap", None, "Only print verifycap, not pathname+cap"),
         ("repair-cap", None, "Only print repaircap, not pathname+cap"),
         ("raw", "r", "Display raw JSON data instead of parsed"),
-        ("stream", None, "Stream lines of JSON to stdout. With --storage-index or --verify-cap, stream those strings to stdout."),
         ]
     def parseArgs(self, where=''):
         self.where = where
index be1c3295654beb6117f43a7382aef4c150f860b0..0f20f9a92fbefd6e8f1b5ea41b8340d52ef2209d 100644 (file)
@@ -1,17 +1,17 @@
 
 import urllib, simplejson
 from twisted.protocols.basic import LineOnlyReceiver
-from allmydata.util import base32
 from allmydata.util.abbreviate import abbreviate_space_both
-from allmydata import uri
 from allmydata.scripts.slow_operation import SlowOperationRunner
 from allmydata.scripts.common import get_alias, DEFAULT_ALIAS, escape_path
 from allmydata.scripts.common_http import do_http
 
 class FakeTransport:
     disconnecting = False
+
 class ManifestStreamer(LineOnlyReceiver):
     delimiter = "\n"
+
     def __init__(self):
         self.transport = FakeTransport()
 
@@ -71,35 +71,8 @@ class ManifestStreamer(LineOnlyReceiver):
                     print >>stdout, d["cap"], "/".join([p.encode("utf-8")
                                                         for p in d["path"]])
 
-
-
-class ManifestGrabber(SlowOperationRunner):
-
-    def make_url(self, base, ophandle):
-        return base + "?t=start-manifest&ophandle=" + ophandle
-
-    def write_results(self, data):
-        stdout = self.options.stdout
-        stderr = self.options.stderr
-        if self.options["storage-index"]:
-            for (path, cap) in data["manifest"]:
-                u = uri.from_string(str(cap))
-                si = u.get_storage_index()
-                if si is not None:
-                    print >>stdout, base32.b2a(si)
-        else:
-            for (path, cap) in data["manifest"]:
-                try:
-                    print >>stdout, cap, "/".join(path)
-                except UnicodeEncodeError:
-                    print >>stdout, cap, "/".join([p.encode("utf-8")
-                                                   for p in path])
-
 def manifest(options):
-    if options["stream"]:
-        return ManifestStreamer().run(options)
-    else:
-        return ManifestGrabber().run(options)
+    return ManifestStreamer().run(options)
 
 class StatsGrabber(SlowOperationRunner):
 
index 1715b0a35da3b1ff18bab6673538fc1b591290b6..fbd281e15a3a82c67ccf4df8a1946625bc2480bd 100644 (file)
@@ -2478,9 +2478,6 @@ class DeepCheckWebGood(DeepCheckBase, unittest.TestCase):
 
     def do_test_cli_good(self, ignored):
         d = defer.succeed(None)
-        d.addCallback(lambda ign: self.do_cli_manifest1())
-        d.addCallback(lambda ign: self.do_cli_manifest2())
-        d.addCallback(lambda ign: self.do_cli_manifest3())
         d.addCallback(lambda ign: self.do_cli_manifest_stream1())
         d.addCallback(lambda ign: self.do_cli_manifest_stream2())
         d.addCallback(lambda ign: self.do_cli_manifest_stream3())
@@ -2490,43 +2487,6 @@ class DeepCheckWebGood(DeepCheckBase, unittest.TestCase):
         d.addCallback(lambda ign: self.do_cli_stats2())
         return d
 
-    def do_cli_manifest1(self):
-        basedir = self.getdir("client0")
-        d = self._run_cli(["manifest",
-                           "--node-directory", basedir,
-                           self.root_uri])
-        def _check((out,err)):
-            self.failUnlessEqual(err, "")
-            lines = [l for l in out.split("\n") if l]
-            self.failUnlessEqual(len(lines), 5)
-            caps = {}
-            for l in lines:
-                try:
-                    cap, path = l.split(None, 1)
-                except ValueError:
-                    cap = l.strip()
-                    path = ""
-                caps[cap] = path
-            self.failUnless(self.root.get_uri() in caps)
-            self.failUnlessEqual(caps[self.root.get_uri()], "")
-            self.failUnlessEqual(caps[self.mutable.get_uri()], "mutable")
-            self.failUnlessEqual(caps[self.large.get_uri()], "large")
-            self.failUnlessEqual(caps[self.small.get_uri()], "small")
-            self.failUnlessEqual(caps[self.small2.get_uri()], "small2")
-        d.addCallback(_check)
-        return d
-
-    def do_cli_manifest2(self):
-        basedir = self.getdir("client0")
-        d = self._run_cli(["manifest",
-                           "--node-directory", basedir,
-                           "--storage-index", self.root_uri])
-        def _check((out,err)):
-            self.failUnlessEqual(err, "")
-            self._check_manifest_storage_index(out)
-        d.addCallback(_check)
-        return d
-
     def _check_manifest_storage_index(self, out):
         lines = [l for l in out.split("\n") if l]
         self.failUnlessEqual(len(lines), 3)
@@ -2534,35 +2494,10 @@ class DeepCheckWebGood(DeepCheckBase, unittest.TestCase):
         self.failUnless(base32.b2a(self.mutable.get_storage_index()) in lines)
         self.failUnless(base32.b2a(self.large.get_storage_index()) in lines)
 
-    def do_cli_manifest3(self):
-        basedir = self.getdir("client0")
-        d = self._run_cli(["manifest",
-                           "--node-directory", basedir,
-                           "--raw", self.root_uri])
-        def _check2r((out,err)):
-            self.failUnlessEqual(err, "")
-            data = simplejson.loads(out)
-            sis = data["storage-index"]
-            self.failUnlessEqual(len(sis), 3)
-            self.failUnless(base32.b2a(self.root.get_storage_index()) in sis)
-            self.failUnless(base32.b2a(self.mutable.get_storage_index()) in sis)
-            self.failUnless(base32.b2a(self.large.get_storage_index()) in sis)
-            self.failUnlessEqual(data["stats"]["count-files"], 4)
-            self.failUnlessEqual(data["origin"],
-                                 base32.b2a(self.root.get_storage_index()))
-            verifycaps = data["verifycaps"]
-            self.failUnlessEqual(len(verifycaps), 3)
-            self.failUnless(self.root.get_verify_cap().to_string() in verifycaps)
-            self.failUnless(self.mutable.get_verify_cap().to_string() in verifycaps)
-            self.failUnless(self.large.get_verify_cap().to_string() in verifycaps)
-        d.addCallback(_check2r)
-        return d
-
     def do_cli_manifest_stream1(self):
         basedir = self.getdir("client0")
         d = self._run_cli(["manifest",
                            "--node-directory", basedir,
-                           "--stream",
                            self.root_uri])
         def _check((out,err)):
             self.failUnlessEqual(err, "")
@@ -2589,7 +2524,7 @@ class DeepCheckWebGood(DeepCheckBase, unittest.TestCase):
         basedir = self.getdir("client0")
         d = self._run_cli(["manifest",
                            "--node-directory", basedir,
-                           "--stream", "--raw",
+                           "--raw",
                            self.root_uri])
         def _check((out,err)):
             self.failUnlessEqual(err, "")
@@ -2602,7 +2537,7 @@ class DeepCheckWebGood(DeepCheckBase, unittest.TestCase):
         basedir = self.getdir("client0")
         d = self._run_cli(["manifest",
                            "--node-directory", basedir,
-                           "--stream", "--storage-index",
+                           "--storage-index",
                            self.root_uri])
         def _check((out,err)):
             self.failUnlessEqual(err, "")
@@ -2614,7 +2549,7 @@ class DeepCheckWebGood(DeepCheckBase, unittest.TestCase):
         basedir = self.getdir("client0")
         d = self._run_cli(["manifest",
                            "--node-directory", basedir,
-                           "--stream", "--verify-cap",
+                           "--verify-cap",
                            self.root_uri])
         def _check((out,err)):
             self.failUnlessEqual(err, "")
@@ -2630,7 +2565,7 @@ class DeepCheckWebGood(DeepCheckBase, unittest.TestCase):
         basedir = self.getdir("client0")
         d = self._run_cli(["manifest",
                            "--node-directory", basedir,
-                           "--stream", "--repair-cap",
+                           "--repair-cap",
                            self.root_uri])
         def _check((out,err)):
             self.failUnlessEqual(err, "")