-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Labels
bugSomething isn't workingSomething isn't working
Description
It seems the current API based on channels is not very comfortable to use. A better design would probably be to expose a blocking API with a callback, for example:
func (c *Client) Run(ctx context.Context, fn func(m *spec.Measurement)) (summary Summary, err error) {
var ch chan spec.Measurement
ch, err = c.StartDownload(ctx)
if err != nil {
return
}
for m := range ch {
// TODO: fill the summary
fn(m)
}
ch, err = c.StartUpload(ctx)
if err != nil {
return
}
for m := range ch {
// TODO: fill the summary
fn(m)
}
return
}This may or may not be combined with a summary. Note that this API does not cause data races because the callback is called in the same thread context of the blocking Run call.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working