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

introducing systemservices #535

Merged
merged 58 commits into from
Nov 7, 2018
Merged

introducing systemservices #535

merged 58 commits into from
Nov 7, 2018

Conversation

ilgooz
Copy link
Contributor

@ilgooz ilgooz commented Oct 10, 2018

No description provided.

@ilgooz ilgooz added enhancement New feature or request refactoring labels Oct 10, 2018
api/execute_and_listen.go Show resolved Hide resolved
systemservices/systemservices.go Outdated Show resolved Hide resolved
case "notFound":
return "", fmt.Errorf("address for service id %s not found", serviceID)
case "error":
return "", errors.New(e.OutputData["error"].(string))
Copy link
Member

Choose a reason for hiding this comment

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

What about creating one error type that can contains the error message but also the outputKey?
So we don't have a 1000s different error type but we can access the outputKey returned by the task.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For this one, I don't quite understand what do you mean? The line you highlighted is about error output key and it's only returned from the service when there is an internal error. Output key is always the same but error message can be different depending on the internal error happened in the service.

But I think we need a custom error type for notFound output and here is the implementation.


switch e.Output {
case "found":
return e.OutputData["address"].(string), nil
Copy link
Member

@NicolasMahe NicolasMahe Oct 11, 2018

Choose a reason for hiding this comment

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

Just as a note for possible more complicated type conversion that are done one multiple variable: We can create structs and json.Unmarshal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I chose to do type conversion and added some notes about that. We should improve the api package to accept any types otherwise using json.Unmarshal for serialization can decrease the performance that can be prevented by having a better api.

systemservices/service.go Outdated Show resolved Hide resolved
@ilgooz ilgooz requested review from a team and removed request for a team October 23, 2018 15:14
Copy link
Contributor

@krhubert krhubert left a comment

Choose a reason for hiding this comment

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

We still can't use it in api package, we need to resolve this issue first (https://forum.mesg.com/t/the-import-cycle-between-api-systemservices-packages/105/7)

@ilgooz
Copy link
Contributor Author

ilgooz commented Oct 24, 2018

@krhubert I think we can solve that issue within another PR and we don't have a decision on that one yet. I need this PR to be merged for my upcoming PRs.

@ilgooz
Copy link
Contributor Author

ilgooz commented Oct 31, 2018

https://forum.mesg.com/t/the-import-cycle-between-api-systemservices-packages/105/9 needs to be resolved before merging this PR

@ilgooz
Copy link
Contributor Author

ilgooz commented Nov 1, 2018

@mesg-foundation/core please review

Copy link
Contributor Author

@ilgooz ilgooz left a comment

Choose a reason for hiding this comment

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

I would like to keep sources under -source.

@ilgooz
Copy link
Contributor Author

ilgooz commented Nov 7, 2018

manual tests are ok

@antho1404
Copy link
Member

I played with it and it's great, i was able to do some monitoring of the core with the influxdb service really easily so for me it's good to go.

Few feedbacks:

  • Blocking System services installation doesn't work: the dev-core script is not installing the source folder. We need to be consistent on that, @ilgooz was saying that -source would be easier for him so I would recommend using that.

  • The system services are still not runnable in the API, we still deploy and start services from the systemservices package that make it not runnable from the api package but we can fix this later and merge this one when 1 is fixed.

I didn't rename the source folder but I can do that, I just want to have confirmation that it will not break other of @ilgooz's development

@ilgooz
Copy link
Contributor Author

ilgooz commented Nov 7, 2018

@antho1404 I fixed the some missing -source to source path changes with my last commit, it's working now. I've manually tested everything with the resolver service on my machine.

But I personally like to have some kind of prefix for sources like -sources because otherwise it'll look like just an another system service wrapper if we don't explicitly group wrappers under a folder like wrappers.

-source to source change breaks my next PRs as well as the change on APIs of the systemservices/* but it's ok, I can do the necessary updates while rebasing next PR's to this one.

@krhubert krhubert merged commit 3f76f8b into dev Nov 7, 2018
@ilgooz ilgooz deleted the feature/system-services branch November 7, 2018 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants