-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(postgres): integration of postgres in wakunode2 #1808
feat(postgres): integration of postgres in wakunode2 #1808
Conversation
5ac6dee
to
9f88bcf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess before I could review, I'd need to understand why it was necessary to move all the archive setup, migration and maintenance logic into the archive module itself? This was specifically removed from the node modules before as the node should be unaware of which archive drivers the application choose to set up and how it manages these. According to me this all belongs to the application. Of course, if it becomes too large a part of the app module, it could be split into a separate module specifically aimed at how the application sets up its archive drivers. I'd still not extend the node's archive driver modules, though, as it's designed to be agnostic.
Architecturally there's are thing I like and other not so much. I like that Archive drivers seams to be DB interfaces and Store is the protocol. Maybe we should talk about refactoring in general at some meeting? I got some words. Nitpick: I don't like when lines are added or removed outside of scope. I am myself guilty of this. Otherwise looks good so far! |
Thanks for the comments @jm-clius ! Now, in the
Those procs refer to SQLite, which is very specific, so it needs to be moved into a "common/databases" folder. And I'm not keen on just adding other procs for Postgres in IMO, the only places that should refer to "SQLite" are the
We currently have the next in the App object (master:)
Looking at it, we have an archive/store-protocol concept,
I absolutely agree about that. Within the feature branch, the
IMO, there should be only one place where the drivers are considered. The only module that has interest on drivers is the IMHO, the app module itself should be as simple as possible and it should be just the root of the "tree of responsibility". I hope that justifies the changes :) Thanks again for the comment and let's have a quick call if there is sth I'm missing. |
As per our recent meeting. I'll set this on standby and I will submit a separate PR's in order to suggest the refactoring that is being suggested in this. So ignore this PR for now :) |
9f88bcf
to
282d12d
Compare
The original PR that I raised was too generic. Now, this is simpler as we already could make a proper refactor in previous PRs. Thanks for your patience! |
|
||
let driver = res.get() | ||
# The table should exist beforehand. | ||
discard driver.createMessageTable() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the table should exist but perhaps its still valuable to check isErr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that was not important but now that you mention I'll check it :)
Thanks !
Summary
This PR is a combination of:
Details
First, apologies for that big PR:S. I started the integration of Postgres into wakinode2 but during the process, I ended up doing a more generic refactoring, sorry about that. I can explain everything until we are all happy with it.
The main purpose of this PR is to allow a Nwaku to mount the Waku Archive protocol by using Postgres as the underlying database. For that, run the WakuNode with:
./build/wakunode2 --store-message-db-url="postgres://postgres:test123@localhost:5432/postgres" ...
How to test
As usual, we can run two Nwaku nodes,
a
, andb
.b
will act as the store node and will connect to the Postgres database.Start local Postgres database. Go to the repo's root folder and run the next:
where the
postgres-docker-compose.yml
contains:Start a node that will act as a client
cfg_node_a.txt
cfg_node_b.txt
Send a couple of requests to store two messages.
The next command sends requests to node b (started in 3.)
Finally, send a "get_waku_v2_store_v1_messages" request to node
a
(started in 2.)And this should bring the two messages stored in point 4.
Issue
#1604