mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-09 14:26:27 +00:00
f54ba10bc7
* queue driver refactor (#2753) * chore(archive): archive refactor (#2752) * chore(archive): sqlite driver refactor (#2754) * chore(archive): postgres driver refactor (#2755) * chore(archive): renaming & copies (#2751) * posgres legacy: stop using the storedAt field * migration script 6: we still need the id column The id column is needed because it contains the message digest which is used in store v2, and we need to keep support to store v2 for a while * legacy archive: set target migration version to 6 * waku_node: try to use wakuLegacyArchive if wakuArchive is nil * node_factory, waku_node: mount legacy and future store simultaneously We want the nwaku node to simultaneously support store-v2 requests and store-v3 requests. Only the legacy archive is in charge of archiving messages, and the archived information is suitable to fulfill both store-v2 and store-v3 needs. * postgres_driver: adding temporary code until store-v2 is removed --------- Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com> Co-authored-by: gabrielmer <101006718+gabrielmer@users.noreply.github.com> Co-authored-by: Ivan Folgueira Bande <ivansete@status.im>
28 lines
804 B
Nim
28 lines
804 B
Nim
import chronicles, chronos
|
|
import
|
|
waku/waku_archive_legacy,
|
|
waku/waku_archive_legacy/driver as driver_module,
|
|
waku/waku_archive_legacy/driver/builder,
|
|
waku/waku_archive_legacy/driver/postgres_driver
|
|
|
|
const storeMessageDbUrl = "postgres://postgres:test123@localhost:5432/postgres"
|
|
|
|
proc newTestPostgresDriver*(): Future[Result[ArchiveDriver, string]] {.
|
|
async, deprecated
|
|
.} =
|
|
proc onErr(errMsg: string) {.gcsafe, closure.} =
|
|
error "error creating ArchiveDriver", error = errMsg
|
|
quit(QuitFailure)
|
|
|
|
let
|
|
vacuum = false
|
|
migrate = true
|
|
maxNumConn = 50
|
|
|
|
let driverRes =
|
|
await ArchiveDriver.new(storeMessageDbUrl, vacuum, migrate, maxNumConn, onErr)
|
|
if driverRes.isErr():
|
|
onErr("could not create archive driver: " & driverRes.error)
|
|
|
|
return ok(driverRes.get())
|