Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 10 additions and 27 deletions.
  1. +5 −4 README.md
  2. +5 −23 graphkeeper.py
View
9 README.md
@@ -2,16 +2,18 @@
_GraphKeeper_ is a simple, distributed RDF store in ZooKeeper. Read the [design notes](http://scriptogr.am/mhausenblas/post/rdf-store-in-zookeeper-part-1 "A simple RDF store in ZooKeeper - Part 1") first to get an idea.
-## Dependencies
+## Dependencies and configuration
-This software has been developed and tested under MacOS Lion. I have Python 2.7.1 and I'm using [ZooKeeper 3.3.5](http://ftp.heanet.ie/mirrors/www.apache.org/dist/zookeeper/zookeeper-3.3.5/zookeeper-3.3.5.tar.gz) as well as the following `conf/zoo.cfg`:
+This software has been developed and tested under MacOS Lion. I'm using [ZooKeeper 3.3.5](http://ftp.heanet.ie/mirrors/www.apache.org/dist/zookeeper/zookeeper-3.3.5/zookeeper-3.3.5.tar.gz) with [Python bindings](http://pypi.python.org/pypi/zc-zookeeper-static/3.3.5 "zc-zookeeper-static 3.3.5 : Python Package Index") in an Python 2.7.1 environment. I have the following content in `conf/zoo.cfg` in the ZooKeeper home dir:
tickTime=2000
initLimit=10
syncLimit=5
dataDir=tmp
clientPort=2181
+## Usage
+
To launch GraphKeeper you have to initially `chmod 755 gk-launch.sh` once and set the path to your ZooKeeper installation. Then you can `./gk-launch.sh` to fire up ZooKeeper and after which you should see something like:
JMX enabled by default
@@ -22,12 +24,11 @@ To launch GraphKeeper you have to initially `chmod 755 gk-launch.sh` once and se
Then you can try out GraphKeeper and you should see:
$ python graphkeeper.py
- Set up of Simple RDF Store ...
+ Set up of GraphKeeper ...
<http://data.example.org/person/tim> dc:publisher "Tim" .
To shut down GraphKeeper you do `chmod 755 gk-shutdown.sh` once and then you can `./gk-shutdown.sh` it.
-
## Todo
* Payload codec
View
28 graphkeeper.py
@@ -11,51 +11,33 @@ def __init__(self):
self.connected = False
self.handle = -1
try:
- f = open('simple-rdf-store.log','w')
+ f = open('gk.log','w')
zookeeper.set_log_stream(f)
except IOError:
print "Couldn't open logfile for writing"
+
def set_up(self):
- self.callback_flag = False
self.cv = threading.Condition()
self.connected = False
def connection_watcher(handle, type, state, path):
self.cv.acquire()
self.connected = True
self.cv.notify()
self.cv.release()
-
self.cv.acquire()
self.handle = zookeeper.init(self.host, connection_watcher)
self.cv.wait(10.0)
self.cv.release()
-
if not self.connected:
raise Exception("Couldn't connect to host -", self.host)
- def new_con(self):
- cv = threading.Condition()
- self.pending_connection = False
- def connection_watcher(handle, type, state, path):
- cv.acquire()
- self.pending_connection = True
- cv.notify()
- cv.release()
-
- cv.acquire()
- handle = zookeeper.init(self.host, connection_watcher)
- cv.wait(15.0)
- cv.release()
-
- if not self.pending_connection:
- raise Exception("Couldn't connect to host -", self.host)
- return handle
-
+
def shut_down(self):
if self.connected:
zookeeper.close(self.handle)
+
def exists_ng(self, ng):
return zookeeper.exists(self.handle, ng, None)
@@ -69,7 +51,7 @@ def put_ng(self, ng, val):
if __name__ == '__main__':
gk = GraphKeeper()
- print 'Set up of Simple RDF Store ...'
+ print 'Set up of GraphKeeper ...'
gk.set_up()
gk.put_ng('/ng', '<http://data.example.org/person/tim> dc:publisher "Tim" .')

No commit comments for this range

Something went wrong with that request. Please try again.