Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

[CO-371] Refactor launchers #3605

Merged
merged 3 commits into from
Sep 16, 2018
Merged

[CO-371] Refactor launchers #3605

merged 3 commits into from
Sep 16, 2018

Conversation

KtorZ
Copy link
Contributor

@KtorZ KtorZ commented Sep 16, 2018

Description

Working towards acceptance criteria CO-356.1 & CO-356.5, this task would make it easy to start-up a node without much knowledge or manipulation of the internals. Starting a node should be as easy as providing a bunch of configuration parameters coming from a CLI.
Also, these bits of code are currently duplicated between the lib@node/Main.hs code and wallet-new@server/Main.hs, and similar things are needed in the incoming integration tests and demo.

This PR removes this duplication and unify the way nodes are launched 👍
Starting a node becomes as simple as:

SimpleNodeArgs cArgs nArgs <- getSimpleNodeOptions
let lArgs = loggingParams "node" cArgs

launchNode nArgs cArgs lArgs $ \genesisConfig _ txpConfig _ _ _ nodeRes -> do
    let plugins = [ updateTriggerWorker ]
    let action  = runNode genesisConfig txpConfig nodeRes plugins
    runRealMode genesisConfig txpConfig nodeRes action

Linked issue

[CO-371]

Type of change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • 🛠 New feature (non-breaking change which adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)
  • 🏭 Refactoring that does not change existing functionality but does improve things like code readability, structure etc
  • 🔨 New or improved tests for existing code
  • ⛑ git-flow chore (backport, hotfix, etc)

Developer checklist

  • I have read the style guide document, and my code follows the code style of this project.
  • If my code deals with exceptions, it follows the guidelines.
  • I have updated any documentation accordingly, if needed. Documentation changes can be reflected in opening a PR on cardanodocs.com, amending the inline Haddock comments, any relevant README file or one of the document listed in the docs directory.
  • [ ] CHANGELOG entry has been added and is linked to the correct PR on GitHub.

Testing checklist

  • [ ] I have added tests to cover my changes.
  • All new and existing tests passed.

QA Steps

Screenshots (if available)

Also giving the launching function a bit more power to actually be
self-sufficient. This way, it becomes really a function that help us
parse the CLI arguments and start-up a node, passing it resources
acquired or allocated along the way.

This is especially useful to reduce duplications which occurs in the
wallet launchers and, that will soon otherwise occur in the integration
tests and demo code.
@KtorZ KtorZ requested a review from erikd September 16, 2018 03:42
Copy link
Member

@erikd erikd left a comment

Choose a reason for hiding this comment

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

LGTM!

@KtorZ KtorZ merged commit 6c358dc into develop Sep 16, 2018
@KtorZ KtorZ deleted the KtorZ/CO-371/refactor-launchers branch September 16, 2018 07:38
@KtorZ
Copy link
Contributor Author

KtorZ commented Sep 16, 2018

Thanks @erikd. I wasn't expecting a review before Monday ^^

@adinapoli-iohk
Copy link
Contributor

adinapoli-iohk commented Sep 16, 2018

..and I wasn't expecting my PR to go into conflict due to changes over the weekend :trollface:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants