diff options
Diffstat (limited to 'lang/python/src/server.py')
-rw-r--r-- | lang/python/src/server.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lang/python/src/server.py b/lang/python/src/server.py new file mode 100644 index 00000000000..6ec75ef8a24 --- /dev/null +++ b/lang/python/src/server.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# +# Copyright (c) 2008-2012 WiredTiger, Inc. +# All rights reserved. +# +# See the file LICENSE for redistribution information. +# +# WiredTiger Python RPC server for testing and tutorials. + +import sys + +from wiredtiger.service import WiredTiger +from wiredtiger.service.ttypes import * + +from wiredtiger.impl import * + +from thrift.transport import TSocket +from thrift.transport import TTransport +from thrift.protocol import TBinaryProtocol +from thrift.server import TServer + +class WiredTigerHandler: + +handler = WiredTigerHandler() +processor = WiredTiger.Processor(handler) +transport = TSocket.TServerSocket(9090) +tfactory = TTransport.TBufferedTransportFactory() +pfactory = TBinaryProtocol.TBinaryProtocolFactory() + +server = TServer.TSimpleServer(processor, transport, tfactory, pfactory) + +# We could do one of these for a multithreaded server +#server = TServer.TThreadedServer(processor, transport, tfactory, pfactory) +#server = TServer.TThreadPoolServer(processor, transport, tfactory, pfactory) + +print 'Starting the server...' +server.serve() +print 'done.' |