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

chore(refactor): move node logic to the node package #533

Merged
merged 5 commits into from
Sep 27, 2024
Merged

chore(refactor): move node logic to the node package #533

merged 5 commits into from
Sep 27, 2024

Conversation

mudler
Copy link
Contributor

@mudler mudler commented Aug 26, 2024

Description

This PR contains some small refactoring. My objective is to run tests for the blockchain, and in order to do this, I need to move from the main the handler registration such as can be re-used when starting the node inside the tests.

Changes breakdown:

  • I'm moving the code currently in pkg/ into it's own node/ package (the masa oracle node).
  • Introduces few setters to AppOption for injecting generic "handlers" and "services" - in order to force the future code to use that structure instead of being loosely handled.
  • Move blockchain implementation to its own single file to start segregating components
  • Reduce usage of config as singleton in favor of AppOptions
  • Move AppOptions to Node
  • Consistently use AppOptions to set services and handlers

This is still WIP, however could be merged as-is for now. The only drawback is that I haven't had the time to migrate yet current handlers and services to the new structure, and didn't moved things out of main yet.

Notes for Reviewers

Signed commits

  • Yes, I signed my commits.

@mudler mudler requested a review from teslashibe August 26, 2024 18:15
@Luka-Loncar
Copy link

Is this supposed to be part of v0.8 or some other release?

@mudler
Copy link
Contributor Author

mudler commented Sep 17, 2024

Is this supposed to be part of v0.8 or some other release?

the earlier the better!

restevens402
restevens402 previously approved these changes Sep 18, 2024
Copy link
Contributor

@restevens402 restevens402 left a comment

Choose a reason for hiding this comment

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

moving to the "node" package makes good sense. The update is straightforward. Everything looks good. I see plans for improving the organization of Protocol handlers. I love it!

commit 4940215
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Wed Sep 18 19:47:58 2024 +0200

    build(deps): bump github.com/ollama/ollama from 0.3.9 to 0.3.11 (#558)

    Bumps [github.com/ollama/ollama](https://github.com/ollama/ollama) from 0.3.9 to 0.3.11.
    - [Release notes](https://github.com/ollama/ollama/releases)
    - [Commits](ollama/ollama@v0.3.9...v0.3.11)

    ---
    updated-dependencies:
    - dependency-name: github.com/ollama/ollama
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

commit b3022cc
Author: Ettore Di Giacinto <[email protected]>
Date:   Wed Sep 18 16:16:09 2024 +0200

    chore(ci): rename gosec workflow

    Signed-off-by: Ettore Di Giacinto <[email protected]>

commit 7afe67f
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Tue Sep 17 17:46:35 2024 +0200

    build(deps): bump github.com/gotd/td from 0.108.0 to 0.110.0 (#555)

    Bumps [github.com/gotd/td](https://github.com/gotd/td) from 0.108.0 to 0.110.0.
    - [Release notes](https://github.com/gotd/td/releases)
    - [Commits](gotd/td@v0.108.0...v0.110.0)

    ---
    updated-dependencies:
    - dependency-name: github.com/gotd/td
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...

    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

commit d2a7aef
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Tue Sep 17 17:46:16 2024 +0200

    build(deps): bump github.com/sashabaranov/go-openai from 1.29.1 to 1.29.2 (#554)

    build(deps): bump github.com/sashabaranov/go-openai

    Bumps [github.com/sashabaranov/go-openai](https://github.com/sashabaranov/go-openai) from 1.29.1 to 1.29.2.
    - [Release notes](https://github.com/sashabaranov/go-openai/releases)
    - [Commits](sashabaranov/go-openai@v1.29.1...v1.29.2)

    ---
    updated-dependencies:
    - dependency-name: github.com/sashabaranov/go-openai
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
mudler and others added 3 commits September 19, 2024 12:48
- Untie blockchain as a singleton, make it possible to create more
  instances
- Allow to add protocols from the MasaOracle
- Untie worker manager and avoid singleton

Signed-off-by: mudler <[email protected]>
- Untie config from viper business logics
- Now options are consistently used inside the node rather the config
  singletons
- Reduce usage of config's singleton
- Generate options from Viper configuration
- Attach services to main node business logic to start up services

Signed-off-by: mudler <[email protected]>
@mudler mudler merged commit 5b54ff2 into main Sep 27, 2024
13 checks passed
@mudler mudler deleted the refactor branch September 27, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants