2008-08-07 04:22:22 +00:00
|
|
|
|
|
|
|
from axiom.item import Item
|
|
|
|
from axiom.attributes import text, integer, timestamp
|
|
|
|
|
2008-11-18 04:45:16 +00:00
|
|
|
|
2008-08-07 04:22:22 +00:00
|
|
|
class Sample(Item):
|
2008-11-18 04:45:16 +00:00
|
|
|
# we didn't originally set typeName, so it was generated from the
|
|
|
|
# fully-qualified classname ("diskwatcher.Sample"), then Axiom
|
|
|
|
# automatically lowercases and un-dot-ifies it to get
|
|
|
|
# "diskwatcher_sample". Now we explicitly provide a name.
|
|
|
|
typeName = "diskwatcher_sample"
|
|
|
|
|
|
|
|
# version 2 added the 'total' field
|
|
|
|
schemaVersion = 2
|
|
|
|
|
2008-09-30 23:34:48 +00:00
|
|
|
url = text(indexed=True)
|
2008-08-07 04:22:22 +00:00
|
|
|
when = timestamp(indexed=True)
|
2008-11-18 04:45:16 +00:00
|
|
|
total = integer()
|
2008-08-07 04:22:22 +00:00
|
|
|
used = integer()
|
|
|
|
avail = integer()
|
|
|
|
|
2008-11-18 04:45:16 +00:00
|
|
|
def upgradeSample1to2(old):
|
|
|
|
return old.upgradeVersion("diskwatcher_sample", 1, 2,
|
|
|
|
url=old.url,
|
|
|
|
when=old.when,
|
|
|
|
total=0,
|
|
|
|
used=old.used,
|
|
|
|
avail=old.avail)
|
|
|
|
|
|
|
|
from axiom.upgrade import registerUpgrader
|
|
|
|
registerUpgrader(upgradeSample1to2, "diskwatcher_sample", 1, 2)
|