Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SimpleSend ¶
func SimpleSend(ctx context.Context, sc asyncclient.Interface, t serverutil.TaskCode, r io.Reader) error
SimpleSend attempts to send the task code t and message data r to the server sc. This is suitable for use if no response data is expected.
Types ¶
type Task ¶
type Task struct {
// contains filtered or unexported fields
}
Task represents a task submitted to the server. A Task should not be used when receiving large amounts of response data from the server, since the data is cached in the Task.
func Send ¶
func Send(sc asyncclient.Interface, t serverutil.TaskCode, r io.Reader) (*Task, error)
Send submits the indicated task, with given data r, to the server sc. If no data needs to be sent, you may set r equal to nil.
func (*Task) Done ¶
func (ts *Task) Done() <-chan struct{}
Done returns the done channel for this task. The channel will be closed when a response has been returned by the server.
func (*Task) Metadata ¶
func (ts *Task) Metadata() *async.TaskMetadata
Metadata returns the metadata for the task.
func (*Task) Response ¶
func (ts *Task) Response() (*asyncclient.Response, error)
Response returns the response received from the server. This will block until the ts.Done() channel is closed.
func (*Task) ResponseData ¶
func (ts *Task) ResponseData() (binaryutil.BinaryReader, error)
ResponseData returns a binaryutil.BinaryReader containing any response data received from the server. This data is cached on the task, so each call to ResponseData returns a new reader. This will block until the ts.Done() channel is closed.