Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Conversation

@jbenet
Copy link
Member

@jbenet jbenet commented Jul 7, 2018

I needed a couple commands, so i implemented them:

  • swarm peers
  • stats bw

I wanted a general way to issue commands to be exported,
so i added that. As described in #92

@ghost ghost assigned jbenet Jul 7, 2018
@ghost ghost added the status/in-progress In progress label Jul 7, 2018
// the stats of the requested Object or an error.
func (s *Shell) StatsBW() (*p2pmetrics.Stats, error) {
v := &p2pmetrics.Stats{}
err := s.RequestDecode(context.TODO(), &v, "stats/bw")
Copy link
Member

Choose a reason for hiding this comment

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

Other functions use..Background

Copy link
Member

Choose a reason for hiding this comment

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

Even better, let's just take a context (it's a new command).

}

func (s *Shell) Request(ctx context.Context, command string, args ...string) (*Request, *Response, error) {
req := s.newRequest(ctx, command, args...)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe allow passing option map here too?

Copy link
Member

Choose a reason for hiding this comment

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

good point

@Stebalien Stebalien mentioned this pull request Jul 16, 2018
@Stebalien Stebalien merged commit 2960bf9 into master Jul 16, 2018
@ghost ghost removed the status/in-progress In progress label Jul 16, 2018
@Stebalien Stebalien deleted the feat/request branch July 16, 2018 19:05
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.

4 participants