# HG changeset patch # User Drew Perttula # Date 2016-06-05 00:49:15 # Node ID 13f758eda3b4998929defc44ddebda3733c197fa # Parent 01f7ece0cb131be4f3a82c0f83168469d1808665 refactor rdfdb: sendGraphToClient Ignore-this: 77dc47e091494adabca4cf04173547de diff --git a/bin/rdfdb b/bin/rdfdb --- a/bin/rdfdb +++ b/bin/rdfdb @@ -129,6 +129,15 @@ log.setLevel(logging.DEBUG) from lib.cycloneerr import PrettyErrorHandler +def sendGraphToClient(graph, client): + """send the client the whole graph contents""" + log.info("sending all graphs to %s at %s" % + (client.label, client.updateUri)) + client.sendPatch(Patch( + addQuads=graph.quads(ALLSTMTS), + delQuads=[])) + + class Client(object): """ one of our syncedgraph clients @@ -140,14 +149,6 @@ class Client(object): def __repr__(self): return "<%s client at %s>" % (self.label, self.updateUri) - 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=graph.quads(ALLSTMTS), - delQuads=[])) - def sendPatch(self, p): return sendPatch(self.updateUri, p) @@ -335,7 +336,7 @@ class Db(object): for c in self.clients if c.updateUri == newClient.updateUri] log.info("new client %s at %s" % (newClient.label, newClient.updateUri)) - newClient.sendAll(self.graph) + sendGraphToClient(self.graph, newClient) self.clients.append(newClient) self.sendClientsToAllLivePages()