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

go/common/node: Add custom text (un)marshaler for RolesMask type #4243

Merged
merged 1 commit into from
Sep 3, 2021

Conversation

tjanez
Copy link
Member

@tjanez tjanez commented Sep 2, 2021

This will result in easy to understand "roles" fields in various CLI commands that output JSON.

For example, instead of oasis-node control status showing:

{
  ... trimmed ...
 
  "registration": {
    "last_registration": "2021-09-02T13:25:53+02:00",
    "descriptor": {

      ... trimmed ...

      "roles": 24
    },

  ... trimmed ...
}

it will show:

{
  ... trimmed ...
 
  "registration": {
    "last_registration": "2021-09-02T13:25:53+02:00",
    "descriptor": {

      ... trimmed ...

      "roles": "validator,consensus-rpc"
    },

  ... trimmed ...
}

@tjanez tjanez added c:common Category: common libraries c:cli Category: command line interface labels Sep 2, 2021
Copy link
Member

@kostko kostko left a comment

Choose a reason for hiding this comment

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

Should we reject duplicate roles when parsing?

go/common/node/node.go Outdated Show resolved Hide resolved
go/common/node/node.go Show resolved Hide resolved
@tjanez tjanez force-pushed the tjanez/rolesmask-custom-marshaler branch from 5024c58 to f90c842 Compare September 3, 2021 08:56
@tjanez
Copy link
Member Author

tjanez commented Sep 3, 2021

Should we reject duplicate roles when parsing?

Agreed. Done.

@tjanez tjanez force-pushed the tjanez/rolesmask-custom-marshaler branch from f90c842 to b1af087 Compare September 3, 2021 08:59
This will result in easy to understand "roles" fields in various CLI
commands that output JSON.
@tjanez tjanez force-pushed the tjanez/rolesmask-custom-marshaler branch from b1af087 to 3731894 Compare September 3, 2021 09:21
@tjanez tjanez merged commit 76e0c8d into master Sep 3, 2021
@tjanez tjanez deleted the tjanez/rolesmask-custom-marshaler branch September 3, 2021 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c:cli Category: command line interface c:common Category: common libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants