Skip to content

Instantly share code, notes, and snippets.

@mlsteele
Created May 21, 2019 14:09
Show Gist options
  • Save mlsteele/cf599287b4cbd86d51ac1a929c2e3a21 to your computer and use it in GitHub Desktop.
Save mlsteele/cf599287b4cbd86d51ac1a929c2e3a21 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import plyvel
import sys
import collections
db = plyvel.DB(sys.argv[1])
tab = {
b"00": "DBUser",
b"0f": "DBSig",
b"10": "DBTeamChain",
b"19": "DBUserPlusAllKeysV1",
b"bf": "DBChatCollapses",
b"ca": "DBMerkleAudit",
b"cb": "DBUnfurler",
b"cc": "DBStellarDisclaimer",
b"cd": "DBFTLStorage",
b"ce": "DBTeamAuditor",
b"cf": "DBAttachmentUploader",
b"d0": "DBHasRandomPW",
b"da": "DBDiskLRUEntries",
b"db": "DBDiskLRUIndex",
b"dc": "DBImplicitTeamConflictInfo",
b"dd": "DBUidToFullName",
b"de": "DBUidToUsername",
b"df": "DBUserPlusKeysVersioned",
b"e0": "DBLink",
b"e1": "DBLocalTrack",
b"e3": "DBPGPKey",
b"e4": "DBSigHints",
b"e5": "DBProofCheck",
b"e6": "DBUserSecretKeys",
b"e7": "DBSigChainTailPublic",
b"e8": "DBSigChainTailSemiprivate",
b"e9": "DBSigChainTailEncrypted",
b"ea": "DBChatActive",
b"eb": "DBUserEKBox",
b"ec": "DBTeamEKBox",
b"ed": "DBChatIndex",
b"f0": "DBMerkleRoot",
b"f1": "DBTrackers",
b"f2": "DBGregor",
b"f3": "DBTrackers2",
b"f4": "DBTrackers2Reverse",
b"f5": "DBNotificationDismiss",
b"f6": "DBChatBlockIndex",
b"f7": "DBChatBlocks",
b"f8": "DBChatOutbox",
b"f9": "DBChatInbox",
b"fa": "DBIdentify",
b"fb": "DBResolveUsernameToUID",
b"fc": "DBChatBodyHashIndex",
b"fd": "DBMerkleStore",
b"fe": "DBChatConvFailures",
b"ff": "DBTeamList",
}
sizes = collections.defaultdict(lambda: 0)
for key, value in db:
sizes[key[:5]] += len(value)
for key, value in sorted(sizes.items(), key=lambda kv: -kv[1]):
print("key", key, "typ", tab.get(key[3:5], "unknown"),"bytes", value, "megabytes", value / 1000000.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment