X-Git-Url: https://git.rkrishnan.org/?a=blobdiff_plain;f=src%2Fallmydata%2Fscripts%2Fdebug.py;h=16e57b33dce3ea2e489e6f4c8b31d599bac15ca6;hb=d575ccba2864cbf701ff51ea76b7cf15b0f771ee;hp=a507b7cfe15777f0a0105766b6a6adfd1539e0e2;hpb=97b601f75abdcd112b9dbcd447c9d97634595ba2;p=tahoe-lafs%2Ftahoe-lafs.git diff --git a/src/allmydata/scripts/debug.py b/src/allmydata/scripts/debug.py index a507b7cf..16e57b33 100644 --- a/src/allmydata/scripts/debug.py +++ b/src/allmydata/scripts/debug.py @@ -728,9 +728,12 @@ def describe_share(abs_sharefile, si_s, shnum_s, now, out): share_type = "unknown" f.seek(m.DATA_OFFSET) - if f.read(1) == "\x00": + version = f.read(1) + if version == "\x00": # this slot contains an SMDF share share_type = "SDMF" + elif version == "\x01": + share_type = "MDMF" if share_type == "SDMF": f.seek(m.DATA_OFFSET) @@ -752,6 +755,35 @@ def describe_share(abs_sharefile, si_s, shnum_s, now, out): (si_s, k, N, datalen, seqnum, base32.b2a(root_hash), expiration, quote_output(abs_sharefile)) + elif share_type == "MDMF": + from allmydata.mutable.layout import MDMFSlotReadProxy + fake_shnum = 0 + # TODO: factor this out with dump_MDMF_share() + class ShareDumper(MDMFSlotReadProxy): + def _read(self, readvs, force_remote=False, queue=False): + data = [] + for (where,length) in readvs: + f.seek(m.DATA_OFFSET+where) + data.append(f.read(length)) + return defer.succeed({fake_shnum: data}) + + p = ShareDumper(None, "fake-si", fake_shnum) + def extract(func): + stash = [] + # these methods return Deferreds, but we happen to know that + # they run synchronously when not actually talking to a + # remote server + d = func() + d.addCallback(stash.append) + return stash[0] + + verinfo = extract(p.get_verinfo) + (seqnum, root_hash, salt_to_use, segsize, datalen, k, N, prefix, + offsets) = verinfo + print >>out, "MDMF %s %d/%d %d #%d:%s %d %s" % \ + (si_s, k, N, datalen, + seqnum, base32.b2a(root_hash), + expiration, quote_output(abs_sharefile)) else: print >>out, "UNKNOWN mutable %s" % quote_output(abs_sharefile)