Changeset 9b3a32d in trunk
- Timestamp:
- 2008-03-27T18:33:42Z (17 years ago)
- Branches:
- master
- Children:
- 36f5c02
- Parents:
- c04c279
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified docs/webapi.txt ¶
rc04c279 r9b3a32d 562 562 Return an HTML-formatted manifest of the given directory, for debugging. 563 563 564 GET $URL?t=deep-size 565 566 Return a number (in bytes) containing the sum of the filesize of all 567 immutable files reachable from the given directory. This is a rough lower 568 bound of the total space consumed by this subtree. It does not include 569 space consumed by directories or immutable files, nor does it take 570 expansion or encoding overhead into account. Later versions of the code may 571 improve this estimate upwards. 572 564 573 6. XMLRPC (coming soon) 565 574 -
TabularUnified src/allmydata/test/test_web.py ¶
rc04c279 r9b3a32d 738 738 def _got(manifest): 739 739 self.failUnless("Refresh Capabilities" in manifest) 740 d.addCallback(_got) 741 return d 742 743 def test_GET_DIRURL_deepsize(self): 744 d = self.GET(self.public_url + "/foo?t=deep-size", followRedirect=True) 745 def _got(manifest): 746 self.failUnless(re.search(r'^\d+$', manifest), manifest) 747 self.failUnlessEqual("57", manifest) 740 748 d.addCallback(_got) 741 749 return d -
TabularUnified src/allmydata/web/directory.xhtml ¶
rc04c279 r9b3a32d 17 17 <div>Other representations of this directory: 18 18 <a href="?t=manifest">manifest</a>, 19 <a href="?t=deep-size">total size</a>, 19 20 <a href="?t=uri">URI</a>, 20 21 <a href="?t=readonly-uri">read-only URI</a>, -
TabularUnified src/allmydata/webish.py ¶
rc04c279 r9b3a32d 13 13 import allmydata # to display import path 14 14 from allmydata import download 15 from allmydata.uri import from_string_verifier, CHKFileVerifierURI 15 16 from allmydata.upload import FileHandle, FileName 16 17 from allmydata import provisioning … … 1224 1225 return ctx.tag 1225 1226 1227 class DeepSize(rend.Page): 1228 1229 def __init__(self, dirnode, dirpath): 1230 self._dirnode = dirnode 1231 self._dirpath = dirpath 1232 1233 def renderHTTP(self, ctx): 1234 inevow.IRequest(ctx).setHeader("content-type", "text/plain") 1235 d = self._dirnode.build_manifest() 1236 def _measure_size(manifest): 1237 total = 0 1238 for verifiercap in manifest: 1239 u = from_string_verifier(verifiercap) 1240 if isinstance(u, CHKFileVerifierURI): 1241 total += u.size 1242 return str(total) 1243 d.addCallback(_measure_size) 1244 return d 1245 1226 1246 class ChildError: 1227 1247 implements(inevow.IResource) … … 1316 1336 elif t == "manifest": 1317 1337 return Manifest(node, path), () 1338 elif t == "deep-size": 1339 return DeepSize(node, path), () 1318 1340 elif t == 'rename-form': 1319 1341 return RenameForm(self.name, node, path), ()
Note: See TracChangeset
for help on using the changeset viewer.