From a15ae5212269dc72aa4bb89f52cbdf802c453b41 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 11 Aug 2008 20:19:30 -0700 Subject: [PATCH] mutable/servermap: add summarize_version --- src/allmydata/mutable/servermap.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/allmydata/mutable/servermap.py b/src/allmydata/mutable/servermap.py index 606a4f6b..282192d6 100644 --- a/src/allmydata/mutable/servermap.py +++ b/src/allmydata/mutable/servermap.py @@ -209,16 +209,20 @@ class ServerMap: seqnums.append(0) return max(seqnums) + def summarize_version(self, verinfo): + """Take a versionid, return a string that describes it.""" + (seqnum, root_hash, IV, segsize, datalength, k, N, prefix, + offsets_tuple) = verinfo + return "seq%d-%s" % (seqnum, base32.b2a(root_hash)[:4]) + def summarize_versions(self): """Return a string describing which versions we know about.""" versionmap = self.make_versionmap() bits = [] for (verinfo, shares) in versionmap.items(): - (seqnum, root_hash, IV, segsize, datalength, k, N, prefix, - offsets_tuple) = verinfo + vstr = self.summarize_version(verinfo) shnums = set([shnum for (shnum, peerid, timestamp) in shares]) - bits.append("%d*seq%d-%s" % - (len(shnums), seqnum, base32.b2a(root_hash)[:4])) + bits.append("%d*%s" % (len(shnums), vstr)) return "/".join(bits) def recoverable_versions(self): -- 2.45.2