def list(self):
"""I return a Deferred that fires with a dictionary mapping child
- name to a tuple of (IFileNode or IDirectoryNode, metadata)."""
+ name to a tuple of (IFilesystemNode, metadata)."""
return self._read()
def has_child(self, name):
def get(self, name):
"""I return a Deferred that fires with the named child node,
- which is either an IFileNode or an IDirectoryNode."""
+ which is an IFilesystemNode."""
assert isinstance(name, unicode)
d = self._read()
d.addCallback(self._get, name)
def get_child_and_metadata(self, name):
"""I return a Deferred that fires with the (node, metadata) pair for
- the named child. The node is either an IFileNode or an
- IDirectoryNode, and the metadata is a dictionary."""
+ the named child. The node is an IFilesystemNode, and the metadata
+ is a dictionary."""
assert isinstance(name, unicode)
d = self._read()
d.addCallback(self._get_with_metadata, name)
return d
def get_child_at_path(self, path):
- """Transform a child path into an IDirectoryNode or IFileNode.
+ """Transform a child path into an IFilesystemNode.
I perform a recursive series of 'get' operations to find the named
descendant node. I return a Deferred that fires with the node, or
return d
def get_child_and_metadata_at_path(self, path):
- """Transform a child path into an IDirectoryNode or IFileNode and
+ """Transform a child path into an IFilesystemNode and
a metadata dictionary from the last edge that was traversed.
"""
root_si = root.get_storage_index()
self._lp = log.msg(format="deep-check starting (%(si)s),"
" verify=%(verify)s, repair=%(repair)s",
- si=base32.b2a(root_si), verify=verify, repair=repair)
+ si=base32.b2a(root_si or ""), verify=verify, repair=repair)
self._verify = verify
self._repair = repair
self._add_lease = add_lease
status = { "stats": s["stats"],
"finished": m.is_finished(),
- "origin": base32.b2a(m.origin_si),
+ "origin": base32.b2a(m.origin_si or ""),
}
if m.is_finished():
# don't return manifest/verifycaps/SIs unless the operation is
return simplejson.dumps(status, indent=1)
def _si_abbrev(self):
- return base32.b2a(self.monitor.origin_si)[:6]
+ si = self.monitor.origin_si
+ if not si:
+ return "<LIT>"
+ return base32.b2a(si)[:6]
def render_title(self, ctx):
return T.title["Manifest of SI=%s" % self._si_abbrev()]
v = node.get_verify_cap()
if v:
v = v.to_string()
- d["verifycap"] = v
+ d["verifycap"] = v or ""
r = node.get_repair_cap()
if r:
r = r.to_string()
- d["repaircap"] = r
+ d["repaircap"] = r or ""
si = node.get_storage_index()
if si:
si = base32.b2a(si)
- d["storage-index"] = si
+ d["storage-index"] = si or ""
j = simplejson.dumps(d, ensure_ascii=True)
assert "\n" not in j
v = node.get_verify_cap()
if v:
v = v.to_string()
- data["verifycap"] = v
+ data["verifycap"] = v or ""
r = node.get_repair_cap()
if r:
r = r.to_string()
- data["repaircap"] = r
+ data["repaircap"] = r or ""
si = node.get_storage_index()
if si:
si = base32.b2a(si)
- data["storage-index"] = si
+ data["storage-index"] = si or ""
if self.repair:
d = node.check_and_repair(self.monitor, self.verify, self.add_lease)