From: Brian Warner Date: Thu, 30 Nov 2006 22:39:24 +0000 (-0700) Subject: add beginning queen code X-Git-Tag: tahoe_v0.1.0-0-UNSTABLE~542 X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/css/%3C?a=commitdiff_plain;h=5420aa47c61d7d35502dc556c7e5f3a11bf16ca8;p=tahoe-lafs%2Ftahoe-lafs.git add beginning queen code --- diff --git a/allmydata/queen.py b/allmydata/queen.py new file mode 100644 index 00000000..338af2ca --- /dev/null +++ b/allmydata/queen.py @@ -0,0 +1,29 @@ + +from foolscap import Tub, Referenceable +from twisted.application import service +from twisted.python import log +import os.path + +class Roster(service.MultiService, Referenceable): + pass + +class Queen(service.MultiService): + CERTFILE = "queen.pem" + + def __init__(self): + service.MultiService.__init__(self) + if os.path.exists(self.CERTFILE): + self.tub = Tub(certData=open(self.CERTFILE, "rb").read()) + else: + self.tub = Tub() + f = open(self.CERTFILE, "wb") + f.write(self.tub.getCertData()) + f.close() + self.urls = {} + r = Roster() + r.setServiceParent(self) + self.urls["roster"] = self.tub.registerReference(r, "roster") + + def startService(self): + service.MultiService.startService(self) + log.msg("queen running, roster is at %s" % self.urls["roster"]) diff --git a/queen.tac b/queen.tac new file mode 100644 index 00000000..ac9b9b1a --- /dev/null +++ b/queen.tac @@ -0,0 +1,9 @@ +# -*- python -*- + +from allmydata import queen +from twisted.application import service + +c = queen.Queen() + +application = service.Application("allmydata_queen") +c.setServiceParent(application)