diff options
author | Valery Piashchynski <[email protected]> | 2021-07-18 11:32:44 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-07-18 11:32:44 +0300 |
commit | 9c51360f9119a4114bdcc21c8e61f0908a3c876d (patch) | |
tree | ea63a051931bbd8282d64478bbefa2f970fcc955 /plugins/jobs/rpc.go | |
parent | f4feb30197843d05eb308081ee579d3a9e3d6206 (diff) |
Started beanstalk driver. Add new Queue impl (not finished yet).
Fix bugs in the AMQP, update proto-api
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/jobs/rpc.go')
-rw-r--r-- | plugins/jobs/rpc.go | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/plugins/jobs/rpc.go b/plugins/jobs/rpc.go index a2bd9c6d..4333c587 100644 --- a/plugins/jobs/rpc.go +++ b/plugins/jobs/rpc.go @@ -3,6 +3,7 @@ package jobs import ( "github.com/spiral/errors" "github.com/spiral/roadrunner/v2/plugins/jobs/job" + "github.com/spiral/roadrunner/v2/plugins/jobs/pipeline" "github.com/spiral/roadrunner/v2/plugins/logger" jobsv1beta "github.com/spiral/roadrunner/v2/proto/jobs/v1beta" ) @@ -65,7 +66,7 @@ func (r *rpc) PushBatch(j *jobsv1beta.PushBatchRequest, _ *jobsv1beta.Empty) err return nil } -func (r *rpc) Pause(req *jobsv1beta.MaintenanceRequest, _ *jobsv1beta.Empty) error { +func (r *rpc) Pause(req *jobsv1beta.Maintenance, _ *jobsv1beta.Empty) error { pipelines := make([]string, len(req.GetPipelines())) for i := 0; i < len(pipelines); i++ { @@ -76,7 +77,7 @@ func (r *rpc) Pause(req *jobsv1beta.MaintenanceRequest, _ *jobsv1beta.Empty) err return nil } -func (r *rpc) Resume(req *jobsv1beta.MaintenanceRequest, _ *jobsv1beta.Empty) error { +func (r *rpc) Resume(req *jobsv1beta.Maintenance, _ *jobsv1beta.Empty) error { pipelines := make([]string, len(req.GetPipelines())) for i := 0; i < len(pipelines); i++ { @@ -87,11 +88,32 @@ func (r *rpc) Resume(req *jobsv1beta.MaintenanceRequest, _ *jobsv1beta.Empty) er return nil } -func (r *rpc) List(_ *jobsv1beta.Empty, resp *jobsv1beta.List) error { +func (r *rpc) List(_ *jobsv1beta.Empty, resp *jobsv1beta.Maintenance) error { resp.Pipelines = r.p.List() return nil } +// Declare pipeline used to dynamically declare any type of the pipeline +// Mandatory fields: +// 1. Driver +// 2. Pipeline name +// 3. Options related to the particular pipeline +func (r *rpc) Declare(req *jobsv1beta.DeclareRequest, _ *jobsv1beta.Empty) error { + const op = errors.Op("rcp_declare_pipeline") + pipe := &pipeline.Pipeline{} + + for i := range req.GetPipeline() { + (*pipe)[i] = req.GetPipeline()[i] + } + + err := r.p.Declare(pipe) + if err != nil { + return errors.E(op, err) + } + + return nil +} + // from converts from transport entity to domain func (r *rpc) from(j *jobsv1beta.Job) *job.Job { headers := map[string][]string{} |