Skip to content

159 node information #163

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

Merged
merged 21 commits into from
Aug 20, 2019
Merged

159 node information #163

merged 21 commits into from
Aug 20, 2019

Conversation

andy-shi88
Copy link
Contributor

@andy-shi88 andy-shi88 commented Aug 19, 2019

Description

Open endpoint to fetch node information such as cpu, ram, and storage usages.

Breakdown

  • Open get node information bidirectional stream endpoint handler
  • Create simple authentication method
  • Open proxy endpoint and initiate minimal postman.collection
  • Move every interceptor from /common/util to common/interceptor
  • Authenticate user using authorization header (which is a hex string representation of signed data [requestType+timestamp] *will explain more in wiki later)

Reference Issue

Close #159

Step to Test (optional)

  • go test ./...
  • run the server
  • run client script in GetNodeHardware/client.go
    http proxy : POSTMAN
  • run server
  • import the postman collection, adjust your environment host value to match the port in your resource/config.toml:apiHTTPPort

note:

  • some part of the code can't be mocked (the gopsutil library usage), sorry bout that.

@andy-shi88 andy-shi88 marked this pull request as ready for review August 19, 2019 06:24
@andy-shi88
Copy link
Contributor Author

The only thing is whether we need to add this endpoint as stream or normal rpc endpoint, if it's stream then every request in the stream, they'll need to generate the Auth object.

// memory
vmStat, err := mem.VirtualMemory()
if err != nil {
return nil, err
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to use blocker package?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, will do

@capt4ce
Copy link
Contributor

capt4ce commented Aug 19, 2019

How do we treat the functionality when the owner of a node is changed? do we need to restart the node? @andy-shi88

@andy-shi88
Copy link
Contributor Author

How do we treat the functionality when the owner of a node is changed? do we need to restart the node? @andy-shi88

true right now we'll need to restart the whole application, since it only read the owner from config file in the start up. This should follow however the claim node transaction type work. I'll add some todo comment for this.

@andy-shi88
Copy link
Contributor Author

WIP: moving auth checking to interceptor as suggested by @astaphobia

@andy-shi88 andy-shi88 added the WIP label Aug 20, 2019
@andy-shi88 andy-shi88 removed the WIP label Aug 20, 2019
@andy-shi88
Copy link
Contributor Author

ready for re-review

@astaphobia astaphobia merged commit 52a9f6e into zoobc:develop Aug 20, 2019
@astaphobia astaphobia deleted the 159-node-information branch August 20, 2019 09:20
@andy-shi88 andy-shi88 removed their assignment Dec 10, 2020
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.

Tech: Node Information RPC Endpoint
4 participants