AmbireTech / adex-validator-stack-rust

The Ambire AdEx Validator Stack implemented in Rust: sentry, validator worker, adapter, adview manager
https://adex.network
GNU Affero General Public License v3.0
11 stars 10 forks source link

Postgres connection #2

Closed elpiel closed 4 years ago

elpiel commented 5 years ago

Create a Postgres async client to be used in Sentry with tokio_postgres

elpiel commented 5 years ago

The problems I've encountered here were that:

Current workaround was to implement it with the synchronous client and basically on each request make a new connection.

elpiel commented 5 years ago

PRs #5 and #6 both tackle this problem using bb8. It still looks quite ugly for the repository, but for now it's a start and it's using a Pool and it's async.

Further investigation should go into it, to see how we can make it easy for the Repositories to look and be more developer friendly.

elpiel commented 5 years ago

Some improvements, i.e. separation of concern, were done in PR #42 for implementing the ToSql & FromSql for Domain Structs, since this cannot be done outside of domain crate, we've created a wrapper tuple structs that will handle the conversion in the Postgres***Repository implementations

elpiel commented 4 years ago

closing in favour of #151