# HG changeset patch # User Drew Perttula # Date 2016-06-05 00:35:32 # Node ID a214a9d6f2f033137304008fd75ab82222c3de4e # Parent aa97bc796f2df2ceab2c7b6d70560ff46c448885 refactor rdfdb: Client doesn't need Db at construction Ignore-this: 9a3591d13c4ff821dd6e543bf78f8583 diff --git a/bin/rdfdb b/bin/rdfdb --- a/bin/rdfdb +++ b/bin/rdfdb @@ -133,21 +133,19 @@ class Client(object): """ one of our syncedgraph clients """ - def __init__(self, updateUri, label, db): - self.db = db + def __init__(self, updateUri, label): self.label = label self.updateUri = updateUri - self.sendAll() def __repr__(self): return "<%s client at %s>" % (self.label, self.updateUri) - def sendAll(self): + def sendAll(self, graph): """send the client the whole graph contents""" log.info("sending all graphs to %s at %s" % (self.label, self.updateUri)) self.sendPatch(Patch( - addQuads=self.db.graph.quads(ALLSTMTS), + addQuads=graph.quads(ALLSTMTS), delQuads=[])) def sendPatch(self, p): @@ -337,7 +335,9 @@ class Db(object): for c in self.clients if c.updateUri == updateUri] log.info("new client %s at %s" % (label, updateUri)) - self.clients.append(Client(updateUri, label, self)) + c = Client(updateUri, label) + c.sendAll(self.graph) + self.clients.append(c) self.sendClientsToAllLivePages() def sendClientsToAllLivePages(self):