Open mariocynicys opened 1 year ago
To test the tower with postgresql DB, this docker compose script might be handy:
version: '3.1'
services:
db:
image: postgres
restart: always
ports:
- 5432:5432
environment:
POSTGRES_PASSWORD: pass
POSTGRES_USER: user
POSTGRES_DB: teos
This PR replaces the
rusqlite
SQLite engine withsqlx
.sqlx
is an asynchronous versatile sql engine that supports both SQLite & PostgreSQL.Due to the asynchronous-only nature of
sqlx
, every method that interacted with the DB had to be asynchronous as well. This ripple effect propagated to nearly all the methods of the tower components. Also to thelightning::chain::Listen
trait, thus a newAsyncListen
trait was introduced to replace it.The sqlite driver is enabled with the
sqlite
feature, and the postgresql driver with thepostgres
feature. By default, both of them are enabled, meaning that the tower program can run on top of either a sqlite or postgresql db.To enable postgres-only driver:
cargo build --no-default-features --features postgres
(replacepostgres
withsqlite
for sqlite-only build)Fixes #32