changeset 1345:13f758eda3b4

refactor rdfdb: sendGraphToClient Ignore-this: 77dc47e091494adabca4cf04173547de
author Drew Perttula <drewp@bigasterisk.com>
date Sun, 05 Jun 2016 00:49:15 +0000
parents 01f7ece0cb13
children 2809a8b732f6
files bin/rdfdb
diffstat 1 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/bin/rdfdb	Sun Jun 05 00:43:21 2016 +0000
+++ b/bin/rdfdb	Sun Jun 05 00:49:15 2016 +0000
@@ -129,6 +129,15 @@
 
 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 @@
     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 @@
          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()