You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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, fnfunc(m*spec.Measurement)) (summarySummary, errerror) {
varchchan spec.Measurementch, err=c.StartDownload(ctx)
iferr!=nil {
return
}
form:=rangech {
// TODO: fill the summaryfn(m)
}
ch, err=c.StartUpload(ctx)
iferr!=nil {
return
}
form:=rangech {
// TODO: fill the summaryfn(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.
The text was updated successfully, but these errors were encountered:
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:
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.
The text was updated successfully, but these errors were encountered: