-
Notifications
You must be signed in to change notification settings - Fork 180
/
jobs.micro.go
513 lines (431 loc) · 14.3 KB
/
jobs.micro.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: jobs.proto
/*
Package jobs is a generated protocol buffer package.
It is generated from these files:
jobs.proto
It has these top-level messages:
NodesSelector
IdmSelector
UsersSelector
ActionOutputFilter
ContextMetaFilter
ContextMetaSingleQuery
Schedule
Action
Job
JobParameter
JobChangeEvent
TaskChangeEvent
PutJobRequest
PutJobResponse
GetJobRequest
GetJobResponse
DeleteJobRequest
DeleteJobResponse
ListJobsRequest
ListJobsResponse
ListTasksRequest
ListTasksResponse
PutTaskRequest
PutTaskResponse
DeleteTasksRequest
DeleteTasksResponse
DetectStuckTasksRequest
DetectStuckTasksResponse
Task
CtrlCommand
CtrlCommandResponse
ActionLog
JobTriggerEvent
ActionOutput
ActionOutputSingleQuery
ActionMessage
*/
package jobs
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/golang/protobuf/ptypes/any"
import _ "github.com/pydio/cells/common/service/proto"
import _ "github.com/pydio/cells/common/proto/tree"
import _ "github.com/pydio/cells/common/proto/idm"
import _ "github.com/pydio/cells/common/proto/activity"
import (
client "github.com/micro/go-micro/client"
server "github.com/micro/go-micro/server"
context "context"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ client.Option
var _ server.Option
// Client API for JobService service
type JobServiceClient interface {
PutJob(ctx context.Context, in *PutJobRequest, opts ...client.CallOption) (*PutJobResponse, error)
GetJob(ctx context.Context, in *GetJobRequest, opts ...client.CallOption) (*GetJobResponse, error)
DeleteJob(ctx context.Context, in *DeleteJobRequest, opts ...client.CallOption) (*DeleteJobResponse, error)
ListJobs(ctx context.Context, in *ListJobsRequest, opts ...client.CallOption) (JobService_ListJobsClient, error)
PutTask(ctx context.Context, in *PutTaskRequest, opts ...client.CallOption) (*PutTaskResponse, error)
PutTaskStream(ctx context.Context, opts ...client.CallOption) (JobService_PutTaskStreamClient, error)
ListTasks(ctx context.Context, in *ListTasksRequest, opts ...client.CallOption) (JobService_ListTasksClient, error)
DeleteTasks(ctx context.Context, in *DeleteTasksRequest, opts ...client.CallOption) (*DeleteTasksResponse, error)
DetectStuckTasks(ctx context.Context, in *DetectStuckTasksRequest, opts ...client.CallOption) (*DetectStuckTasksResponse, error)
}
type jobServiceClient struct {
c client.Client
serviceName string
}
func NewJobServiceClient(serviceName string, c client.Client) JobServiceClient {
if c == nil {
c = client.NewClient()
}
if len(serviceName) == 0 {
serviceName = "jobs"
}
return &jobServiceClient{
c: c,
serviceName: serviceName,
}
}
func (c *jobServiceClient) PutJob(ctx context.Context, in *PutJobRequest, opts ...client.CallOption) (*PutJobResponse, error) {
req := c.c.NewRequest(c.serviceName, "JobService.PutJob", in)
out := new(PutJobResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *jobServiceClient) GetJob(ctx context.Context, in *GetJobRequest, opts ...client.CallOption) (*GetJobResponse, error) {
req := c.c.NewRequest(c.serviceName, "JobService.GetJob", in)
out := new(GetJobResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *jobServiceClient) DeleteJob(ctx context.Context, in *DeleteJobRequest, opts ...client.CallOption) (*DeleteJobResponse, error) {
req := c.c.NewRequest(c.serviceName, "JobService.DeleteJob", in)
out := new(DeleteJobResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *jobServiceClient) ListJobs(ctx context.Context, in *ListJobsRequest, opts ...client.CallOption) (JobService_ListJobsClient, error) {
req := c.c.NewRequest(c.serviceName, "JobService.ListJobs", &ListJobsRequest{})
stream, err := c.c.Stream(ctx, req, opts...)
if err != nil {
return nil, err
}
if err := stream.Send(in); err != nil {
return nil, err
}
return &jobServiceListJobsClient{stream}, nil
}
type JobService_ListJobsClient interface {
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Recv() (*ListJobsResponse, error)
}
type jobServiceListJobsClient struct {
stream client.Streamer
}
func (x *jobServiceListJobsClient) Close() error {
return x.stream.Close()
}
func (x *jobServiceListJobsClient) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *jobServiceListJobsClient) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *jobServiceListJobsClient) Recv() (*ListJobsResponse, error) {
m := new(ListJobsResponse)
err := x.stream.Recv(m)
if err != nil {
return nil, err
}
return m, nil
}
func (c *jobServiceClient) PutTask(ctx context.Context, in *PutTaskRequest, opts ...client.CallOption) (*PutTaskResponse, error) {
req := c.c.NewRequest(c.serviceName, "JobService.PutTask", in)
out := new(PutTaskResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *jobServiceClient) PutTaskStream(ctx context.Context, opts ...client.CallOption) (JobService_PutTaskStreamClient, error) {
req := c.c.NewRequest(c.serviceName, "JobService.PutTaskStream", &PutTaskRequest{})
stream, err := c.c.Stream(ctx, req, opts...)
if err != nil {
return nil, err
}
return &jobServicePutTaskStreamClient{stream}, nil
}
type JobService_PutTaskStreamClient interface {
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Send(*PutTaskRequest) error
Recv() (*PutTaskResponse, error)
}
type jobServicePutTaskStreamClient struct {
stream client.Streamer
}
func (x *jobServicePutTaskStreamClient) Close() error {
return x.stream.Close()
}
func (x *jobServicePutTaskStreamClient) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *jobServicePutTaskStreamClient) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *jobServicePutTaskStreamClient) Send(m *PutTaskRequest) error {
return x.stream.Send(m)
}
func (x *jobServicePutTaskStreamClient) Recv() (*PutTaskResponse, error) {
m := new(PutTaskResponse)
err := x.stream.Recv(m)
if err != nil {
return nil, err
}
return m, nil
}
func (c *jobServiceClient) ListTasks(ctx context.Context, in *ListTasksRequest, opts ...client.CallOption) (JobService_ListTasksClient, error) {
req := c.c.NewRequest(c.serviceName, "JobService.ListTasks", &ListTasksRequest{})
stream, err := c.c.Stream(ctx, req, opts...)
if err != nil {
return nil, err
}
if err := stream.Send(in); err != nil {
return nil, err
}
return &jobServiceListTasksClient{stream}, nil
}
type JobService_ListTasksClient interface {
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Recv() (*ListTasksResponse, error)
}
type jobServiceListTasksClient struct {
stream client.Streamer
}
func (x *jobServiceListTasksClient) Close() error {
return x.stream.Close()
}
func (x *jobServiceListTasksClient) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *jobServiceListTasksClient) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *jobServiceListTasksClient) Recv() (*ListTasksResponse, error) {
m := new(ListTasksResponse)
err := x.stream.Recv(m)
if err != nil {
return nil, err
}
return m, nil
}
func (c *jobServiceClient) DeleteTasks(ctx context.Context, in *DeleteTasksRequest, opts ...client.CallOption) (*DeleteTasksResponse, error) {
req := c.c.NewRequest(c.serviceName, "JobService.DeleteTasks", in)
out := new(DeleteTasksResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *jobServiceClient) DetectStuckTasks(ctx context.Context, in *DetectStuckTasksRequest, opts ...client.CallOption) (*DetectStuckTasksResponse, error) {
req := c.c.NewRequest(c.serviceName, "JobService.DetectStuckTasks", in)
out := new(DetectStuckTasksResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for JobService service
type JobServiceHandler interface {
PutJob(context.Context, *PutJobRequest, *PutJobResponse) error
GetJob(context.Context, *GetJobRequest, *GetJobResponse) error
DeleteJob(context.Context, *DeleteJobRequest, *DeleteJobResponse) error
ListJobs(context.Context, *ListJobsRequest, JobService_ListJobsStream) error
PutTask(context.Context, *PutTaskRequest, *PutTaskResponse) error
PutTaskStream(context.Context, JobService_PutTaskStreamStream) error
ListTasks(context.Context, *ListTasksRequest, JobService_ListTasksStream) error
DeleteTasks(context.Context, *DeleteTasksRequest, *DeleteTasksResponse) error
DetectStuckTasks(context.Context, *DetectStuckTasksRequest, *DetectStuckTasksResponse) error
}
func RegisterJobServiceHandler(s server.Server, hdlr JobServiceHandler, opts ...server.HandlerOption) {
s.Handle(s.NewHandler(&JobService{hdlr}, opts...))
}
type JobService struct {
JobServiceHandler
}
func (h *JobService) PutJob(ctx context.Context, in *PutJobRequest, out *PutJobResponse) error {
return h.JobServiceHandler.PutJob(ctx, in, out)
}
func (h *JobService) GetJob(ctx context.Context, in *GetJobRequest, out *GetJobResponse) error {
return h.JobServiceHandler.GetJob(ctx, in, out)
}
func (h *JobService) DeleteJob(ctx context.Context, in *DeleteJobRequest, out *DeleteJobResponse) error {
return h.JobServiceHandler.DeleteJob(ctx, in, out)
}
func (h *JobService) ListJobs(ctx context.Context, stream server.Streamer) error {
m := new(ListJobsRequest)
if err := stream.Recv(m); err != nil {
return err
}
return h.JobServiceHandler.ListJobs(ctx, m, &jobServiceListJobsStream{stream})
}
type JobService_ListJobsStream interface {
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Send(*ListJobsResponse) error
}
type jobServiceListJobsStream struct {
stream server.Streamer
}
func (x *jobServiceListJobsStream) Close() error {
return x.stream.Close()
}
func (x *jobServiceListJobsStream) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *jobServiceListJobsStream) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *jobServiceListJobsStream) Send(m *ListJobsResponse) error {
return x.stream.Send(m)
}
func (h *JobService) PutTask(ctx context.Context, in *PutTaskRequest, out *PutTaskResponse) error {
return h.JobServiceHandler.PutTask(ctx, in, out)
}
func (h *JobService) PutTaskStream(ctx context.Context, stream server.Streamer) error {
return h.JobServiceHandler.PutTaskStream(ctx, &jobServicePutTaskStreamStream{stream})
}
type JobService_PutTaskStreamStream interface {
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Send(*PutTaskResponse) error
Recv() (*PutTaskRequest, error)
}
type jobServicePutTaskStreamStream struct {
stream server.Streamer
}
func (x *jobServicePutTaskStreamStream) Close() error {
return x.stream.Close()
}
func (x *jobServicePutTaskStreamStream) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *jobServicePutTaskStreamStream) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *jobServicePutTaskStreamStream) Send(m *PutTaskResponse) error {
return x.stream.Send(m)
}
func (x *jobServicePutTaskStreamStream) Recv() (*PutTaskRequest, error) {
m := new(PutTaskRequest)
if err := x.stream.Recv(m); err != nil {
return nil, err
}
return m, nil
}
func (h *JobService) ListTasks(ctx context.Context, stream server.Streamer) error {
m := new(ListTasksRequest)
if err := stream.Recv(m); err != nil {
return err
}
return h.JobServiceHandler.ListTasks(ctx, m, &jobServiceListTasksStream{stream})
}
type JobService_ListTasksStream interface {
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Send(*ListTasksResponse) error
}
type jobServiceListTasksStream struct {
stream server.Streamer
}
func (x *jobServiceListTasksStream) Close() error {
return x.stream.Close()
}
func (x *jobServiceListTasksStream) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *jobServiceListTasksStream) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *jobServiceListTasksStream) Send(m *ListTasksResponse) error {
return x.stream.Send(m)
}
func (h *JobService) DeleteTasks(ctx context.Context, in *DeleteTasksRequest, out *DeleteTasksResponse) error {
return h.JobServiceHandler.DeleteTasks(ctx, in, out)
}
func (h *JobService) DetectStuckTasks(ctx context.Context, in *DetectStuckTasksRequest, out *DetectStuckTasksResponse) error {
return h.JobServiceHandler.DetectStuckTasks(ctx, in, out)
}
// Client API for TaskService service
type TaskServiceClient interface {
Control(ctx context.Context, in *CtrlCommand, opts ...client.CallOption) (*CtrlCommandResponse, error)
}
type taskServiceClient struct {
c client.Client
serviceName string
}
func NewTaskServiceClient(serviceName string, c client.Client) TaskServiceClient {
if c == nil {
c = client.NewClient()
}
if len(serviceName) == 0 {
serviceName = "jobs"
}
return &taskServiceClient{
c: c,
serviceName: serviceName,
}
}
func (c *taskServiceClient) Control(ctx context.Context, in *CtrlCommand, opts ...client.CallOption) (*CtrlCommandResponse, error) {
req := c.c.NewRequest(c.serviceName, "TaskService.Control", in)
out := new(CtrlCommandResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for TaskService service
type TaskServiceHandler interface {
Control(context.Context, *CtrlCommand, *CtrlCommandResponse) error
}
func RegisterTaskServiceHandler(s server.Server, hdlr TaskServiceHandler, opts ...server.HandlerOption) {
s.Handle(s.NewHandler(&TaskService{hdlr}, opts...))
}
type TaskService struct {
TaskServiceHandler
}
func (h *TaskService) Control(ctx context.Context, in *CtrlCommand, out *CtrlCommandResponse) error {
return h.TaskServiceHandler.Control(ctx, in, out)
}