interledger-rs icon indicating copy to clipboard operation
interledger-rs copied to clipboard

PostGres store backend

Open bstrie opened this issue 5 years ago • 7 comments

Breaking down this task into more manageable goals:

  • [x] configuration option for selecting redis or sqlite (possibly via parsing the scheme of the given store URL?)
  • [x] crate features for enabling/disabling redis and sqlite backends (both enabled by default?)
  • [x] logic in ilp-node to select appropriate backend crate
  • [ ] dynamically determine whether to instantiate a prior existing node or a new node based on whether the sqlite file already exists (or configuration parameter, for use with redis as well?)
  • [x] "hello world" demo for a node that answers the / (status) endpoint without having the redis crate enabled at all
  • [ ] one-by-one implement the store traits for SQLite (TODO: prioritize)
    • [ ] api::NodeStore
    • [ ] btp::BtpStore
    • [ ] ccp::RouteManagerStore
    • [ ] http::IdempotentStore
    • [ ] http::HttpStore
    • [ ] router::RouterStore
    • [ ] service::AccountStore
    • [ ] service::AddressStore
    • [ ] service_util::BalanceStore
    • [ ] service_util::ExchangeRateStore
    • [ ] service_util::RateLimitStore
    • [ ] settlement::LeftoversStore
    • [ ] settlement::SettlementStore
    • [ ] stream::StreamNotificationsStore

bstrie avatar Oct 28 '19 19:10 bstrie

abstract redis-specific logic out of ilp-node

I wouldn't work on much abstraction here. Instead, I would replace these lines with a method on the node called connect_to_store or something like that. That method would parse the database_url parameter to see whether it's a redis, redis+unix, or sqlite URL and use the appropriate builder to create and connect to the store. That method would return an impl Future<Item = ..., Error = ()> where ... is a thing that implements all the store traits.

dynamically determine whether to instantiate a prior existing node or a new node based on whether the sqlite file already exists (or configuration parameter, for use with redis as well?)

This should only be necessary if the SQLite store does anything to create the tables on startup. If the tables are created dynamically when they're used, its behavior would be the same whether you gave it a path to a file that didn't yet exist or one a path to a previously used database.

emschwartz avatar Oct 28 '19 19:10 emschwartz

Is this happening on a branch somewhere? I'm curious to watch these changes take shape.

KevinWMatthews avatar Oct 30 '19 16:10 KevinWMatthews

@KevinWMatthews I haven't pushed any of my WIP commits yet, but I'll try to get something up today that people can look at.

bstrie avatar Oct 30 '19 19:10 bstrie

@KevinWMatthews I've got the initial groundwork laid in https://github.com/interledger-rs/interledger-rs/issues/474.

bstrie avatar Nov 06 '19 00:11 bstrie

@bstrie Any updates here?

sappenin avatar Jan 22 '20 15:01 sappenin

Given that we haven't had any progress on this, we decided with @sappenin to move forward with PostGRes and tokio-postgres for this task

gakonst avatar Jan 24 '20 16:01 gakonst

In Java we have all account-related data stored in Postgres (only balance tracking is still persisted in Redis). I suggest we replicate the DDL that we have in the Java project here. See here for the table structure used by the Java Connector.

sappenin avatar Jan 24 '20 16:01 sappenin