|
|
|
@@ -48,7 +48,7 @@ type HubWorkerClient struct { |
|
|
|
|
|
|
|
func (c *HubWorkerClient) ExecutePlan(ctx context.Context, plan exec.Plan) error { |
|
|
|
_, err := c.cli.ExecuteIOPlan(ctx, &hubrpc.ExecuteIOPlan{Plan: plan}) |
|
|
|
return err |
|
|
|
return err.ToError() |
|
|
|
} |
|
|
|
func (c *HubWorkerClient) SendStream(ctx context.Context, planID exec.PlanID, id exec.VarID, stream io.ReadCloser) error { |
|
|
|
_, err := c.cli.SendIOStream(ctx, &hubrpc.SendIOStream{ |
|
|
|
@@ -60,20 +60,20 @@ func (c *HubWorkerClient) SendStream(ctx context.Context, planID exec.PlanID, id |
|
|
|
} |
|
|
|
}), |
|
|
|
}) |
|
|
|
return err |
|
|
|
return err.ToError() |
|
|
|
} |
|
|
|
func (c *HubWorkerClient) SendVar(ctx context.Context, planID exec.PlanID, id exec.VarID, value exec.VarValue) error { |
|
|
|
_, err := c.cli.SendIOVar(ctx, &hubrpc.SendIOVar{ |
|
|
|
PlanID: planID, VarID: id, Value: value, |
|
|
|
}) |
|
|
|
return err |
|
|
|
return err.ToError() |
|
|
|
} |
|
|
|
func (c *HubWorkerClient) GetStream(ctx context.Context, planID exec.PlanID, streamID exec.VarID, signalID exec.VarID, signal exec.VarValue) (io.ReadCloser, error) { |
|
|
|
resp, err := c.cli.GetIOStream(ctx, &hubrpc.GetIOStream{ |
|
|
|
PlanID: planID, VarID: streamID, SignalID: signalID, Signal: signal, |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
return nil, err.ToError() |
|
|
|
} |
|
|
|
|
|
|
|
return io2.CounterCloser(resp.Stream, func(cnt int64, err error) { |
|
|
|
@@ -87,7 +87,7 @@ func (c *HubWorkerClient) GetVar(ctx context.Context, planID exec.PlanID, varID |
|
|
|
PlanID: planID, VarID: varID, SignalID: signalID, Signal: signal, |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
return nil, err.ToError() |
|
|
|
} |
|
|
|
return resp.Value, nil |
|
|
|
} |
|
|
|
|