Mercurial > libervia-pubsub
comparison idavoll/tap.py @ 204:b4bf0a5ce50d
Implement storage facilities for the HTTP gateway.
Author: ralphm.
Fixes #12.
One of the storage facilities is PostgreSQL based, providing persistence.
author | Ralph Meijer <ralphm@ik.nu> |
---|---|
date | Wed, 16 Jul 2008 06:38:32 +0000 |
parents | 8ab16e319bb8 |
children | 43a4d0d6c076 |
comparison
equal
deleted
inserted
replaced
203:2c46e6664680 | 204:b4bf0a5ce50d |
---|---|
43 s = service.MultiService() | 43 s = service.MultiService() |
44 | 44 |
45 # Create backend service with storage | 45 # Create backend service with storage |
46 | 46 |
47 if config['backend'] == 'pgsql': | 47 if config['backend'] == 'pgsql': |
48 from twisted.enterprise import adbapi | |
48 from idavoll.pgsql_storage import Storage | 49 from idavoll.pgsql_storage import Storage |
49 st = Storage(user=config['dbuser'], | 50 dbpool = adbapi.ConnectionPool('pyPgSQL.PgSQL', |
50 database=config['dbname'], | 51 user=config['dbuser'], |
51 password=config['dbpass'], | 52 password=config['dbuser'], |
52 host=config['dbhost'], | 53 database=config['dbname'], |
53 port=config['dbport']) | 54 host=config['dbpass'], |
55 port=config['dbport'], | |
56 cp_reconnect=True, | |
57 client_encoding='utf-8', | |
58 ) | |
59 st = Storage(dbpool) | |
54 elif config['backend'] == 'memory': | 60 elif config['backend'] == 'memory': |
55 from idavoll.memory_storage import Storage | 61 from idavoll.memory_storage import Storage |
56 st = Storage() | 62 st = Storage() |
57 | 63 |
58 bs = BackendService(st) | 64 bs = BackendService(st) |