More work on code samples, Python implementation of the API using Berkeley DB.

--HG--
branch : mjc
rename : examples/c/ex_hello.c => examples/c/ex_cursor.c
rename : examples/c/ex_hello.c => examples/c/ex_extending.c
rename : examples/c/ex_hello.c => examples/c/ex_pack.c
rename : examples/c/ex_hello.c => examples/c/ex_process.c
rename : examples/c/ex_hello.c => examples/c/ex_transaction.c
This commit is contained in:
Michael Cahill
2011-01-06 10:57:13 +11:00
parent e51557e46f
commit c823027e57
27 changed files with 623 additions and 52 deletions

34
lang/python/src/server.py Normal file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/env python
# WiredTiger Python RPC server for testing and tutorials.
# Copyright (c) 2011 WiredTiger, Inc. All rights reserved.
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.'