]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - misc/spacetime/diskwatcher.py
quickstart.html: link to snapshots page, sorted with most recent first.
[tahoe-lafs/tahoe-lafs.git] / misc / spacetime / diskwatcher.py
1
2 from axiom.item import Item
3 from axiom.attributes import text, integer, timestamp
4
5
6 class Sample(Item):
7     # we didn't originally set typeName, so it was generated from the
8     # fully-qualified classname ("diskwatcher.Sample"), then Axiom
9     # automatically lowercases and un-dot-ifies it to get
10     # "diskwatcher_sample". Now we explicitly provide a name.
11     typeName = "diskwatcher_sample"
12
13     # version 2 added the 'total' field
14     schemaVersion = 2
15
16     url = text(indexed=True)
17     when = timestamp(indexed=True)
18     total = integer()
19     used = integer()
20     avail = integer()
21
22 def upgradeSample1to2(old):
23     total = 0
24     return old.upgradeVersion("diskwatcher_sample", 1, 2,
25                               url=old.url,
26                               when=old.when,
27                               total=0,
28                               used=old.used,
29                               avail=old.avail)
30
31 from axiom.upgrade import registerUpgrader
32 registerUpgrader(upgradeSample1to2, "diskwatcher_sample", 1, 2)