create a stub Storage service, start work on publishing it

This commit is contained in:
Brian Warner 2006-11-30 15:29:52 -07:00
parent a97596ab9a
commit b879ad2962

View File

@ -1,9 +1,12 @@
from foolscap import Tub from foolscap import Tub, Referenceable
from twisted.application import service from twisted.application import service
from twisted.python import log from twisted.python import log
import os.path import os.path
class Storage(service.MultiService, Referenceable):
pass
class Client(service.MultiService): class Client(service.MultiService):
CERTFILE = "client.pem" CERTFILE = "client.pem"
@ -18,6 +21,10 @@ class Client(service.MultiService):
f.write(self.tub.getCertData()) f.write(self.tub.getCertData())
f.close() f.close()
self.queen = None # self.queen is either None or a RemoteReference self.queen = None # self.queen is either None or a RemoteReference
self.urls = {}
s = Storage()
s.setServiceParent(self)
#self.urls["storage"] = self.tub.registerReference(s, "storage")
def startService(self): def startService(self):
service.MultiService.startService(self) service.MultiService.startService(self)
@ -34,6 +41,7 @@ class Client(service.MultiService):
log.msg("connected to queen") log.msg("connected to queen")
self.queen = queen self.queen = queen
queen.notifyOnDisconnect(self._lost_queen) queen.notifyOnDisconnect(self._lost_queen)
queen.callRemote("hello", urls=self.urls)
def _lost_queen(self): def _lost_queen(self):
log.msg("lost connection to queen") log.msg("lost connection to queen")