Skip to content
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

Multi module configuration #494

Merged

Conversation

torkelrogstad
Copy link
Contributor

In this PR we:

  1. Introduce new database settings for all submodules,
    and at the same time remove the singular datbase setting
    for the entire project
  2. Introduce a new method .initialize() on all configs
    that is responsible for creating needed directories,
    databases and files
  3. Introduce a new class BitcoinSAppConfig that wraps
    configs for all three other subproject config. We
    also provide implicit conversions that enable this
    super-config to be passed in wherever a specialized
    config is required.
  4. Add more tests for our configuration setup.

@torkelrogstad torkelrogstad added chain work on the chain project database database related work for our various projects node work for the node project wallet work for the wallet project labels Jun 5, 2019
In this commit we:

1) Introduce new database settings for all submodules,
and at the same time remove the singular datbase setting
for the entire project
2) Introduce a new method .initialize on all configs
that is responsible for creating needed directories,
databases and files
3) Introduce a new class BitcoinSAppConfig that wraps
configs for all three other subproject config. We
also provide implicit conversions that enable this
super-config to be passed in wherever a specialized
config is required.
4) Add more tests for our configuration setup.
@@ -53,9 +58,14 @@ case class ChainAppConfig(val confs: Config*) extends AppConfig {
BlockHeaderDbHelper.fromBlockHeader(height = 0,
bh =
chain.genesisBlock.blockHeader)
val blockHeaderDAO =
BlockHeaderDAO()(ec = implicitly[ExecutionContext], appConfig = this)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why use implicitly? Can't we just use ec = ec?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just because I wasn't sure what the current execution context in scope was called. implictly works at compile level, so shoudln't make a difference. You could also argue that it's more readable, because it operates on the type level, and not on the "whatever I've called my constants"-level. If you disagree I can change it, not a big deal for me.

* of this class can be passed in anywhere a wallet,
* chain or node config is required.
*/
case class BitcoinSAppConfig(confs: Config*) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what is the implication here if you are only using a portion of bitcoin-s (i.e. wallet with no node, or chain with no node etc)?

Maybe it doesn't matter and can be safely ignored?

I guess looking at this closer this is occurring in the testkit, so maybe it doesn't matter. But i would be nice to have something in src as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very valid objection, but that's also why I placed it in testkit. Once we get some things going that are not just tests I think we can come back and revisit this point, and then we hopefully know more about what requirements and project layout looks like

@Christewart
Copy link
Contributor

Christewart commented Jun 5, 2019

It also looks like there are two bitcoind instances that are not being killed when tests run in this PR.

EDIT: This is wrong, it is happening in master

@Christewart Christewart merged commit ceec55d into bitcoin-s:master Jun 5, 2019
Christewart pushed a commit that referenced this pull request May 1, 2021
* Replace AppConfig with more specific types

* Rework database configuration

In this commit we:

1) Introduce new database settings for all submodules,
and at the same time remove the singular datbase setting
for the entire project
2) Introduce a new method .initialize on all configs
that is responsible for creating needed directories,
databases and files
3) Introduce a new class BitcoinSAppConfig that wraps
configs for all three other subproject config. We
also provide implicit conversions that enable this
super-config to be passed in wherever a specialized
config is required.
4) Add more tests for our configuration setup.

* Add Ammonite to Docs deps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chain work on the chain project database database related work for our various projects node work for the node project wallet work for the wallet project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants