forked from moby/swarmkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dispatcher.pb.go
3694 lines (3462 loc) · 95.5 KB
/
dispatcher.pb.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
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by protoc-gen-gogo.
// source: dispatcher.proto
// DO NOT EDIT!
package api
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
import _ "github.com/docker/swarmkit/protobuf/plugin"
import _ "github.com/gogo/protobuf/types"
import time "time"
import github_com_docker_swarmkit_api_deepcopy "github.com/docker/swarmkit/api/deepcopy"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
import raftselector "github.com/docker/swarmkit/manager/raftselector"
import codes "google.golang.org/grpc/codes"
import metadata "google.golang.org/grpc/metadata"
import transport "google.golang.org/grpc/transport"
import rafttime "time"
import strings "strings"
import reflect "reflect"
import io "io"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
type AssignmentChange_AssignmentAction int32
const (
AssignmentChange_AssignmentActionUpdate AssignmentChange_AssignmentAction = 0
AssignmentChange_AssignmentActionRemove AssignmentChange_AssignmentAction = 1
)
var AssignmentChange_AssignmentAction_name = map[int32]string{
0: "UPDATE",
1: "REMOVE",
}
var AssignmentChange_AssignmentAction_value = map[string]int32{
"UPDATE": 0,
"REMOVE": 1,
}
func (x AssignmentChange_AssignmentAction) String() string {
return proto.EnumName(AssignmentChange_AssignmentAction_name, int32(x))
}
func (AssignmentChange_AssignmentAction) EnumDescriptor() ([]byte, []int) {
return fileDescriptorDispatcher, []int{10, 0}
}
// AssignmentType specifies whether this assignment message carries
// the full state, or is an update to an existing state.
type AssignmentsMessage_Type int32
const (
AssignmentsMessage_COMPLETE AssignmentsMessage_Type = 0
AssignmentsMessage_INCREMENTAL AssignmentsMessage_Type = 1
)
var AssignmentsMessage_Type_name = map[int32]string{
0: "COMPLETE",
1: "INCREMENTAL",
}
var AssignmentsMessage_Type_value = map[string]int32{
"COMPLETE": 0,
"INCREMENTAL": 1,
}
func (x AssignmentsMessage_Type) String() string {
return proto.EnumName(AssignmentsMessage_Type_name, int32(x))
}
func (AssignmentsMessage_Type) EnumDescriptor() ([]byte, []int) {
return fileDescriptorDispatcher, []int{11, 0}
}
// SessionRequest starts a session.
type SessionRequest struct {
Description *NodeDescription `protobuf:"bytes,1,opt,name=description" json:"description,omitempty"`
// SessionID can be provided to attempt resuming an existing session. If the
// SessionID is empty or invalid, a new SessionID will be assigned.
//
// See SessionMessage.SessionID for details.
SessionID string `protobuf:"bytes,2,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
}
func (m *SessionRequest) Reset() { *m = SessionRequest{} }
func (*SessionRequest) ProtoMessage() {}
func (*SessionRequest) Descriptor() ([]byte, []int) { return fileDescriptorDispatcher, []int{0} }
// SessionMessage instructs an agent on various actions as part of the current
// session. An agent should act immediately on the contents.
type SessionMessage struct {
// SessionID is allocated after a successful registration. It should be
// used on all RPC calls after registration. A dispatcher may choose to
// change the SessionID, at which time an agent must re-register and obtain
// a new one.
//
// All Dispatcher calls after register should include the SessionID. If the
// Dispatcher so chooses, it may reject the call with an InvalidArgument
// error code, at which time the agent should call Register to start a new
// session.
//
// As a rule, once an agent has a SessionID, it should never save it to
// disk or try to otherwise reuse. If the agent loses its SessionID, it
// must start a new session through a call to Register. A Dispatcher may
// choose to reuse the SessionID, if it sees fit, but it is not advised.
//
// The actual implementation of the SessionID is Dispatcher specific and
// should be treated as opaque by agents.
//
// From a Dispatcher perspective, there are many ways to use the SessionID
// to ensure uniqueness of a set of client RPC calls. One method is to keep
// the SessionID unique to every call to Register in a single Dispatcher
// instance. This ensures that the SessionID represents the unique
// session from a single Agent to Manager. If the Agent restarts, we
// allocate a new session, since the restarted Agent is not aware of the
// new SessionID.
//
// The most compelling use case is to support duplicate node detection. If
// one clones a virtual machine, including certificate material, two nodes
// may end up with the same identity. This can also happen if two identical
// agent processes are coming from the same node. If the SessionID is
// replicated through the cluster, we can immediately detect the condition
// and address it.
//
// Extending from the case above, we can actually detect a compromised
// identity. Coupled with provisions to rebuild node identity, we can ban
// the compromised node identity and have the nodes re-authenticate and
// build a new identity. At this time, an administrator can then
// re-authorize the compromised nodes, if it was a mistake or ensure that a
// misbehaved node can no longer connect to the cluster.
//
// We considered placing this field in a GRPC header. Because this is a
// critical feature of the protocol, we thought it should be represented
// directly in the RPC message set.
SessionID string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
// Node identifies the registering node.
Node *Node `protobuf:"bytes,2,opt,name=node" json:"node,omitempty"`
// Managers provides a weight list of alternative dispatchers
Managers []*WeightedPeer `protobuf:"bytes,3,rep,name=managers" json:"managers,omitempty"`
// Symmetric encryption key distributed by the lead manager. Used by agents
// for securing network bootstrapping and communication.
NetworkBootstrapKeys []*EncryptionKey `protobuf:"bytes,4,rep,name=network_bootstrap_keys,json=networkBootstrapKeys" json:"network_bootstrap_keys,omitempty"`
}
func (m *SessionMessage) Reset() { *m = SessionMessage{} }
func (*SessionMessage) ProtoMessage() {}
func (*SessionMessage) Descriptor() ([]byte, []int) { return fileDescriptorDispatcher, []int{1} }
// HeartbeatRequest provides identifying properties for a single heartbeat.
type HeartbeatRequest struct {
SessionID string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
}
func (m *HeartbeatRequest) Reset() { *m = HeartbeatRequest{} }
func (*HeartbeatRequest) ProtoMessage() {}
func (*HeartbeatRequest) Descriptor() ([]byte, []int) { return fileDescriptorDispatcher, []int{2} }
type HeartbeatResponse struct {
// Period is the duration to wait before sending the next heartbeat.
// Well-behaved agents should update this on every heartbeat round trip.
Period time.Duration `protobuf:"bytes,1,opt,name=period,stdduration" json:"period"`
}
func (m *HeartbeatResponse) Reset() { *m = HeartbeatResponse{} }
func (*HeartbeatResponse) ProtoMessage() {}
func (*HeartbeatResponse) Descriptor() ([]byte, []int) { return fileDescriptorDispatcher, []int{3} }
type UpdateTaskStatusRequest struct {
// Tasks should contain all statuses for running tasks. Only the status
// field must be set. The spec is not required.
SessionID string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
Updates []*UpdateTaskStatusRequest_TaskStatusUpdate `protobuf:"bytes,3,rep,name=updates" json:"updates,omitempty"`
}
func (m *UpdateTaskStatusRequest) Reset() { *m = UpdateTaskStatusRequest{} }
func (*UpdateTaskStatusRequest) ProtoMessage() {}
func (*UpdateTaskStatusRequest) Descriptor() ([]byte, []int) {
return fileDescriptorDispatcher, []int{4}
}
type UpdateTaskStatusRequest_TaskStatusUpdate struct {
TaskID string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"`
Status *TaskStatus `protobuf:"bytes,2,opt,name=status" json:"status,omitempty"`
}
func (m *UpdateTaskStatusRequest_TaskStatusUpdate) Reset() {
*m = UpdateTaskStatusRequest_TaskStatusUpdate{}
}
func (*UpdateTaskStatusRequest_TaskStatusUpdate) ProtoMessage() {}
func (*UpdateTaskStatusRequest_TaskStatusUpdate) Descriptor() ([]byte, []int) {
return fileDescriptorDispatcher, []int{4, 0}
}
type UpdateTaskStatusResponse struct {
}
func (m *UpdateTaskStatusResponse) Reset() { *m = UpdateTaskStatusResponse{} }
func (*UpdateTaskStatusResponse) ProtoMessage() {}
func (*UpdateTaskStatusResponse) Descriptor() ([]byte, []int) {
return fileDescriptorDispatcher, []int{5}
}
type TasksRequest struct {
SessionID string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
}
func (m *TasksRequest) Reset() { *m = TasksRequest{} }
func (*TasksRequest) ProtoMessage() {}
func (*TasksRequest) Descriptor() ([]byte, []int) { return fileDescriptorDispatcher, []int{6} }
type TasksMessage struct {
// Tasks is the set of tasks that should be running on the node.
// Tasks outside of this set running on the node should be terminated.
Tasks []*Task `protobuf:"bytes,1,rep,name=tasks" json:"tasks,omitempty"`
}
func (m *TasksMessage) Reset() { *m = TasksMessage{} }
func (*TasksMessage) ProtoMessage() {}
func (*TasksMessage) Descriptor() ([]byte, []int) { return fileDescriptorDispatcher, []int{7} }
type AssignmentsRequest struct {
SessionID string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
}
func (m *AssignmentsRequest) Reset() { *m = AssignmentsRequest{} }
func (*AssignmentsRequest) ProtoMessage() {}
func (*AssignmentsRequest) Descriptor() ([]byte, []int) { return fileDescriptorDispatcher, []int{8} }
type Assignment struct {
// Types that are valid to be assigned to Item:
// *Assignment_Task
// *Assignment_Secret
Item isAssignment_Item `protobuf_oneof:"item"`
}
func (m *Assignment) Reset() { *m = Assignment{} }
func (*Assignment) ProtoMessage() {}
func (*Assignment) Descriptor() ([]byte, []int) { return fileDescriptorDispatcher, []int{9} }
type isAssignment_Item interface {
isAssignment_Item()
MarshalTo([]byte) (int, error)
Size() int
}
type Assignment_Task struct {
Task *Task `protobuf:"bytes,1,opt,name=task,oneof"`
}
type Assignment_Secret struct {
Secret *Secret `protobuf:"bytes,2,opt,name=secret,oneof"`
}
func (*Assignment_Task) isAssignment_Item() {}
func (*Assignment_Secret) isAssignment_Item() {}
func (m *Assignment) GetItem() isAssignment_Item {
if m != nil {
return m.Item
}
return nil
}
func (m *Assignment) GetTask() *Task {
if x, ok := m.GetItem().(*Assignment_Task); ok {
return x.Task
}
return nil
}
func (m *Assignment) GetSecret() *Secret {
if x, ok := m.GetItem().(*Assignment_Secret); ok {
return x.Secret
}
return nil
}
// XXX_OneofFuncs is for the internal use of the proto package.
func (*Assignment) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _Assignment_OneofMarshaler, _Assignment_OneofUnmarshaler, _Assignment_OneofSizer, []interface{}{
(*Assignment_Task)(nil),
(*Assignment_Secret)(nil),
}
}
func _Assignment_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
m := msg.(*Assignment)
// item
switch x := m.Item.(type) {
case *Assignment_Task:
_ = b.EncodeVarint(1<<3 | proto.WireBytes)
if err := b.EncodeMessage(x.Task); err != nil {
return err
}
case *Assignment_Secret:
_ = b.EncodeVarint(2<<3 | proto.WireBytes)
if err := b.EncodeMessage(x.Secret); err != nil {
return err
}
case nil:
default:
return fmt.Errorf("Assignment.Item has unexpected type %T", x)
}
return nil
}
func _Assignment_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
m := msg.(*Assignment)
switch tag {
case 1: // item.task
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
msg := new(Task)
err := b.DecodeMessage(msg)
m.Item = &Assignment_Task{msg}
return true, err
case 2: // item.secret
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
msg := new(Secret)
err := b.DecodeMessage(msg)
m.Item = &Assignment_Secret{msg}
return true, err
default:
return false, nil
}
}
func _Assignment_OneofSizer(msg proto.Message) (n int) {
m := msg.(*Assignment)
// item
switch x := m.Item.(type) {
case *Assignment_Task:
s := proto.Size(x.Task)
n += proto.SizeVarint(1<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(s))
n += s
case *Assignment_Secret:
s := proto.Size(x.Secret)
n += proto.SizeVarint(2<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(s))
n += s
case nil:
default:
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
}
return n
}
type AssignmentChange struct {
Assignment *Assignment `protobuf:"bytes,1,opt,name=assignment" json:"assignment,omitempty"`
Action AssignmentChange_AssignmentAction `protobuf:"varint,2,opt,name=action,proto3,enum=docker.swarmkit.v1.AssignmentChange_AssignmentAction" json:"action,omitempty"`
}
func (m *AssignmentChange) Reset() { *m = AssignmentChange{} }
func (*AssignmentChange) ProtoMessage() {}
func (*AssignmentChange) Descriptor() ([]byte, []int) { return fileDescriptorDispatcher, []int{10} }
type AssignmentsMessage struct {
Type AssignmentsMessage_Type `protobuf:"varint,1,opt,name=type,proto3,enum=docker.swarmkit.v1.AssignmentsMessage_Type" json:"type,omitempty"`
// AppliesTo references the previous ResultsIn value, to chain
// incremental updates together. For the first update in a stream,
// AppliesTo is empty. If AppliesTo does not match the previously
// received ResultsIn, the consumer of the stream should start a new
// Assignments stream to re-sync.
AppliesTo string `protobuf:"bytes,2,opt,name=applies_to,json=appliesTo,proto3" json:"applies_to,omitempty"`
// ResultsIn identifies the result of this assignments message, to
// match against the next message's AppliesTo value and protect
// against missed messages.
ResultsIn string `protobuf:"bytes,3,opt,name=results_in,json=resultsIn,proto3" json:"results_in,omitempty"`
// AssignmentChange is a set of changes to apply on this node.
Changes []*AssignmentChange `protobuf:"bytes,4,rep,name=changes" json:"changes,omitempty"`
}
func (m *AssignmentsMessage) Reset() { *m = AssignmentsMessage{} }
func (*AssignmentsMessage) ProtoMessage() {}
func (*AssignmentsMessage) Descriptor() ([]byte, []int) { return fileDescriptorDispatcher, []int{11} }
func init() {
proto.RegisterType((*SessionRequest)(nil), "docker.swarmkit.v1.SessionRequest")
proto.RegisterType((*SessionMessage)(nil), "docker.swarmkit.v1.SessionMessage")
proto.RegisterType((*HeartbeatRequest)(nil), "docker.swarmkit.v1.HeartbeatRequest")
proto.RegisterType((*HeartbeatResponse)(nil), "docker.swarmkit.v1.HeartbeatResponse")
proto.RegisterType((*UpdateTaskStatusRequest)(nil), "docker.swarmkit.v1.UpdateTaskStatusRequest")
proto.RegisterType((*UpdateTaskStatusRequest_TaskStatusUpdate)(nil), "docker.swarmkit.v1.UpdateTaskStatusRequest.TaskStatusUpdate")
proto.RegisterType((*UpdateTaskStatusResponse)(nil), "docker.swarmkit.v1.UpdateTaskStatusResponse")
proto.RegisterType((*TasksRequest)(nil), "docker.swarmkit.v1.TasksRequest")
proto.RegisterType((*TasksMessage)(nil), "docker.swarmkit.v1.TasksMessage")
proto.RegisterType((*AssignmentsRequest)(nil), "docker.swarmkit.v1.AssignmentsRequest")
proto.RegisterType((*Assignment)(nil), "docker.swarmkit.v1.Assignment")
proto.RegisterType((*AssignmentChange)(nil), "docker.swarmkit.v1.AssignmentChange")
proto.RegisterType((*AssignmentsMessage)(nil), "docker.swarmkit.v1.AssignmentsMessage")
proto.RegisterEnum("docker.swarmkit.v1.AssignmentChange_AssignmentAction", AssignmentChange_AssignmentAction_name, AssignmentChange_AssignmentAction_value)
proto.RegisterEnum("docker.swarmkit.v1.AssignmentsMessage_Type", AssignmentsMessage_Type_name, AssignmentsMessage_Type_value)
}
type authenticatedWrapperDispatcherServer struct {
local DispatcherServer
authorize func(context.Context, []string) error
}
func NewAuthenticatedWrapperDispatcherServer(local DispatcherServer, authorize func(context.Context, []string) error) DispatcherServer {
return &authenticatedWrapperDispatcherServer{
local: local,
authorize: authorize,
}
}
func (p *authenticatedWrapperDispatcherServer) Session(r *SessionRequest, stream Dispatcher_SessionServer) error {
if err := p.authorize(stream.Context(), []string{"swarm-worker", "swarm-manager"}); err != nil {
return err
}
return p.local.Session(r, stream)
}
func (p *authenticatedWrapperDispatcherServer) Heartbeat(ctx context.Context, r *HeartbeatRequest) (*HeartbeatResponse, error) {
if err := p.authorize(ctx, []string{"swarm-worker", "swarm-manager"}); err != nil {
return nil, err
}
return p.local.Heartbeat(ctx, r)
}
func (p *authenticatedWrapperDispatcherServer) UpdateTaskStatus(ctx context.Context, r *UpdateTaskStatusRequest) (*UpdateTaskStatusResponse, error) {
if err := p.authorize(ctx, []string{"swarm-worker", "swarm-manager"}); err != nil {
return nil, err
}
return p.local.UpdateTaskStatus(ctx, r)
}
func (p *authenticatedWrapperDispatcherServer) Tasks(r *TasksRequest, stream Dispatcher_TasksServer) error {
if err := p.authorize(stream.Context(), []string{"swarm-worker", "swarm-manager"}); err != nil {
return err
}
return p.local.Tasks(r, stream)
}
func (p *authenticatedWrapperDispatcherServer) Assignments(r *AssignmentsRequest, stream Dispatcher_AssignmentsServer) error {
if err := p.authorize(stream.Context(), []string{"swarm-worker", "swarm-manager"}); err != nil {
return err
}
return p.local.Assignments(r, stream)
}
func (m *SessionRequest) Copy() *SessionRequest {
if m == nil {
return nil
}
o := &SessionRequest{}
o.CopyFrom(m)
return o
}
func (m *SessionRequest) CopyFrom(src interface{}) {
o := src.(*SessionRequest)
*m = *o
if o.Description != nil {
m.Description = &NodeDescription{}
github_com_docker_swarmkit_api_deepcopy.Copy(m.Description, o.Description)
}
}
func (m *SessionMessage) Copy() *SessionMessage {
if m == nil {
return nil
}
o := &SessionMessage{}
o.CopyFrom(m)
return o
}
func (m *SessionMessage) CopyFrom(src interface{}) {
o := src.(*SessionMessage)
*m = *o
if o.Node != nil {
m.Node = &Node{}
github_com_docker_swarmkit_api_deepcopy.Copy(m.Node, o.Node)
}
if o.Managers != nil {
m.Managers = make([]*WeightedPeer, len(o.Managers))
for i := range m.Managers {
m.Managers[i] = &WeightedPeer{}
github_com_docker_swarmkit_api_deepcopy.Copy(m.Managers[i], o.Managers[i])
}
}
if o.NetworkBootstrapKeys != nil {
m.NetworkBootstrapKeys = make([]*EncryptionKey, len(o.NetworkBootstrapKeys))
for i := range m.NetworkBootstrapKeys {
m.NetworkBootstrapKeys[i] = &EncryptionKey{}
github_com_docker_swarmkit_api_deepcopy.Copy(m.NetworkBootstrapKeys[i], o.NetworkBootstrapKeys[i])
}
}
}
func (m *HeartbeatRequest) Copy() *HeartbeatRequest {
if m == nil {
return nil
}
o := &HeartbeatRequest{}
o.CopyFrom(m)
return o
}
func (m *HeartbeatRequest) CopyFrom(src interface{}) {
o := src.(*HeartbeatRequest)
*m = *o
}
func (m *HeartbeatResponse) Copy() *HeartbeatResponse {
if m == nil {
return nil
}
o := &HeartbeatResponse{}
o.CopyFrom(m)
return o
}
func (m *HeartbeatResponse) CopyFrom(src interface{}) {
o := src.(*HeartbeatResponse)
*m = *o
github_com_docker_swarmkit_api_deepcopy.Copy(&m.Period, &o.Period)
}
func (m *UpdateTaskStatusRequest) Copy() *UpdateTaskStatusRequest {
if m == nil {
return nil
}
o := &UpdateTaskStatusRequest{}
o.CopyFrom(m)
return o
}
func (m *UpdateTaskStatusRequest) CopyFrom(src interface{}) {
o := src.(*UpdateTaskStatusRequest)
*m = *o
if o.Updates != nil {
m.Updates = make([]*UpdateTaskStatusRequest_TaskStatusUpdate, len(o.Updates))
for i := range m.Updates {
m.Updates[i] = &UpdateTaskStatusRequest_TaskStatusUpdate{}
github_com_docker_swarmkit_api_deepcopy.Copy(m.Updates[i], o.Updates[i])
}
}
}
func (m *UpdateTaskStatusRequest_TaskStatusUpdate) Copy() *UpdateTaskStatusRequest_TaskStatusUpdate {
if m == nil {
return nil
}
o := &UpdateTaskStatusRequest_TaskStatusUpdate{}
o.CopyFrom(m)
return o
}
func (m *UpdateTaskStatusRequest_TaskStatusUpdate) CopyFrom(src interface{}) {
o := src.(*UpdateTaskStatusRequest_TaskStatusUpdate)
*m = *o
if o.Status != nil {
m.Status = &TaskStatus{}
github_com_docker_swarmkit_api_deepcopy.Copy(m.Status, o.Status)
}
}
func (m *UpdateTaskStatusResponse) Copy() *UpdateTaskStatusResponse {
if m == nil {
return nil
}
o := &UpdateTaskStatusResponse{}
o.CopyFrom(m)
return o
}
func (m *UpdateTaskStatusResponse) CopyFrom(src interface{}) {}
func (m *TasksRequest) Copy() *TasksRequest {
if m == nil {
return nil
}
o := &TasksRequest{}
o.CopyFrom(m)
return o
}
func (m *TasksRequest) CopyFrom(src interface{}) {
o := src.(*TasksRequest)
*m = *o
}
func (m *TasksMessage) Copy() *TasksMessage {
if m == nil {
return nil
}
o := &TasksMessage{}
o.CopyFrom(m)
return o
}
func (m *TasksMessage) CopyFrom(src interface{}) {
o := src.(*TasksMessage)
*m = *o
if o.Tasks != nil {
m.Tasks = make([]*Task, len(o.Tasks))
for i := range m.Tasks {
m.Tasks[i] = &Task{}
github_com_docker_swarmkit_api_deepcopy.Copy(m.Tasks[i], o.Tasks[i])
}
}
}
func (m *AssignmentsRequest) Copy() *AssignmentsRequest {
if m == nil {
return nil
}
o := &AssignmentsRequest{}
o.CopyFrom(m)
return o
}
func (m *AssignmentsRequest) CopyFrom(src interface{}) {
o := src.(*AssignmentsRequest)
*m = *o
}
func (m *Assignment) Copy() *Assignment {
if m == nil {
return nil
}
o := &Assignment{}
o.CopyFrom(m)
return o
}
func (m *Assignment) CopyFrom(src interface{}) {
o := src.(*Assignment)
*m = *o
if o.Item != nil {
switch o.Item.(type) {
case *Assignment_Task:
v := Assignment_Task{
Task: &Task{},
}
github_com_docker_swarmkit_api_deepcopy.Copy(v.Task, o.GetTask())
m.Item = &v
case *Assignment_Secret:
v := Assignment_Secret{
Secret: &Secret{},
}
github_com_docker_swarmkit_api_deepcopy.Copy(v.Secret, o.GetSecret())
m.Item = &v
}
}
}
func (m *AssignmentChange) Copy() *AssignmentChange {
if m == nil {
return nil
}
o := &AssignmentChange{}
o.CopyFrom(m)
return o
}
func (m *AssignmentChange) CopyFrom(src interface{}) {
o := src.(*AssignmentChange)
*m = *o
if o.Assignment != nil {
m.Assignment = &Assignment{}
github_com_docker_swarmkit_api_deepcopy.Copy(m.Assignment, o.Assignment)
}
}
func (m *AssignmentsMessage) Copy() *AssignmentsMessage {
if m == nil {
return nil
}
o := &AssignmentsMessage{}
o.CopyFrom(m)
return o
}
func (m *AssignmentsMessage) CopyFrom(src interface{}) {
o := src.(*AssignmentsMessage)
*m = *o
if o.Changes != nil {
m.Changes = make([]*AssignmentChange, len(o.Changes))
for i := range m.Changes {
m.Changes[i] = &AssignmentChange{}
github_com_docker_swarmkit_api_deepcopy.Copy(m.Changes[i], o.Changes[i])
}
}
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// Client API for Dispatcher service
type DispatcherClient interface {
// Session starts an agent session with the dispatcher. The session is
// started after the first SessionMessage is received.
//
// Once started, the agent is controlled with a stream of SessionMessage.
// Agents should list on the stream at all times for instructions.
Session(ctx context.Context, in *SessionRequest, opts ...grpc.CallOption) (Dispatcher_SessionClient, error)
// Heartbeat is heartbeat method for nodes. It returns new TTL in response.
// Node should send new heartbeat earlier than now + TTL, otherwise it will
// be deregistered from dispatcher and its status will be updated to NodeStatus_DOWN
Heartbeat(ctx context.Context, in *HeartbeatRequest, opts ...grpc.CallOption) (*HeartbeatResponse, error)
// UpdateTaskStatus updates status of task. Node should send such updates
// on every status change of its tasks.
//
// Whether receiving batch updates or single status updates, this method
// should be accepting. Errors should only be returned if the entire update
// should be retried, due to data loss or other problems.
//
// If a task is unknown the dispatcher, the status update should be
// accepted regardless.
UpdateTaskStatus(ctx context.Context, in *UpdateTaskStatusRequest, opts ...grpc.CallOption) (*UpdateTaskStatusResponse, error)
// Tasks is a stream of tasks state for node. Each message contains full list
// of tasks which should be run on node, if task is not present in that list,
// it should be terminated.
Tasks(ctx context.Context, in *TasksRequest, opts ...grpc.CallOption) (Dispatcher_TasksClient, error)
// Assignments is a stream of assignments such as tasks and secrets for node.
// The first message in the stream contains all of the tasks and secrets
// that are relevant to the node. Future messages in the stream are updates to
// the set of assignments.
Assignments(ctx context.Context, in *AssignmentsRequest, opts ...grpc.CallOption) (Dispatcher_AssignmentsClient, error)
}
type dispatcherClient struct {
cc *grpc.ClientConn
}
func NewDispatcherClient(cc *grpc.ClientConn) DispatcherClient {
return &dispatcherClient{cc}
}
func (c *dispatcherClient) Session(ctx context.Context, in *SessionRequest, opts ...grpc.CallOption) (Dispatcher_SessionClient, error) {
stream, err := grpc.NewClientStream(ctx, &_Dispatcher_serviceDesc.Streams[0], c.cc, "/docker.swarmkit.v1.Dispatcher/Session", opts...)
if err != nil {
return nil, err
}
x := &dispatcherSessionClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type Dispatcher_SessionClient interface {
Recv() (*SessionMessage, error)
grpc.ClientStream
}
type dispatcherSessionClient struct {
grpc.ClientStream
}
func (x *dispatcherSessionClient) Recv() (*SessionMessage, error) {
m := new(SessionMessage)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *dispatcherClient) Heartbeat(ctx context.Context, in *HeartbeatRequest, opts ...grpc.CallOption) (*HeartbeatResponse, error) {
out := new(HeartbeatResponse)
err := grpc.Invoke(ctx, "/docker.swarmkit.v1.Dispatcher/Heartbeat", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *dispatcherClient) UpdateTaskStatus(ctx context.Context, in *UpdateTaskStatusRequest, opts ...grpc.CallOption) (*UpdateTaskStatusResponse, error) {
out := new(UpdateTaskStatusResponse)
err := grpc.Invoke(ctx, "/docker.swarmkit.v1.Dispatcher/UpdateTaskStatus", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *dispatcherClient) Tasks(ctx context.Context, in *TasksRequest, opts ...grpc.CallOption) (Dispatcher_TasksClient, error) {
stream, err := grpc.NewClientStream(ctx, &_Dispatcher_serviceDesc.Streams[1], c.cc, "/docker.swarmkit.v1.Dispatcher/Tasks", opts...)
if err != nil {
return nil, err
}
x := &dispatcherTasksClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type Dispatcher_TasksClient interface {
Recv() (*TasksMessage, error)
grpc.ClientStream
}
type dispatcherTasksClient struct {
grpc.ClientStream
}
func (x *dispatcherTasksClient) Recv() (*TasksMessage, error) {
m := new(TasksMessage)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *dispatcherClient) Assignments(ctx context.Context, in *AssignmentsRequest, opts ...grpc.CallOption) (Dispatcher_AssignmentsClient, error) {
stream, err := grpc.NewClientStream(ctx, &_Dispatcher_serviceDesc.Streams[2], c.cc, "/docker.swarmkit.v1.Dispatcher/Assignments", opts...)
if err != nil {
return nil, err
}
x := &dispatcherAssignmentsClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type Dispatcher_AssignmentsClient interface {
Recv() (*AssignmentsMessage, error)
grpc.ClientStream
}
type dispatcherAssignmentsClient struct {
grpc.ClientStream
}
func (x *dispatcherAssignmentsClient) Recv() (*AssignmentsMessage, error) {
m := new(AssignmentsMessage)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// Server API for Dispatcher service
type DispatcherServer interface {
// Session starts an agent session with the dispatcher. The session is
// started after the first SessionMessage is received.
//
// Once started, the agent is controlled with a stream of SessionMessage.
// Agents should list on the stream at all times for instructions.
Session(*SessionRequest, Dispatcher_SessionServer) error
// Heartbeat is heartbeat method for nodes. It returns new TTL in response.
// Node should send new heartbeat earlier than now + TTL, otherwise it will
// be deregistered from dispatcher and its status will be updated to NodeStatus_DOWN
Heartbeat(context.Context, *HeartbeatRequest) (*HeartbeatResponse, error)
// UpdateTaskStatus updates status of task. Node should send such updates
// on every status change of its tasks.
//
// Whether receiving batch updates or single status updates, this method
// should be accepting. Errors should only be returned if the entire update
// should be retried, due to data loss or other problems.
//
// If a task is unknown the dispatcher, the status update should be
// accepted regardless.
UpdateTaskStatus(context.Context, *UpdateTaskStatusRequest) (*UpdateTaskStatusResponse, error)
// Tasks is a stream of tasks state for node. Each message contains full list
// of tasks which should be run on node, if task is not present in that list,
// it should be terminated.
Tasks(*TasksRequest, Dispatcher_TasksServer) error
// Assignments is a stream of assignments such as tasks and secrets for node.
// The first message in the stream contains all of the tasks and secrets
// that are relevant to the node. Future messages in the stream are updates to
// the set of assignments.
Assignments(*AssignmentsRequest, Dispatcher_AssignmentsServer) error
}
func RegisterDispatcherServer(s *grpc.Server, srv DispatcherServer) {
s.RegisterService(&_Dispatcher_serviceDesc, srv)
}
func _Dispatcher_Session_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(SessionRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(DispatcherServer).Session(m, &dispatcherSessionServer{stream})
}
type Dispatcher_SessionServer interface {
Send(*SessionMessage) error
grpc.ServerStream
}
type dispatcherSessionServer struct {
grpc.ServerStream
}
func (x *dispatcherSessionServer) Send(m *SessionMessage) error {
return x.ServerStream.SendMsg(m)
}
func _Dispatcher_Heartbeat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(HeartbeatRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DispatcherServer).Heartbeat(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/docker.swarmkit.v1.Dispatcher/Heartbeat",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DispatcherServer).Heartbeat(ctx, req.(*HeartbeatRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Dispatcher_UpdateTaskStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateTaskStatusRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DispatcherServer).UpdateTaskStatus(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/docker.swarmkit.v1.Dispatcher/UpdateTaskStatus",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DispatcherServer).UpdateTaskStatus(ctx, req.(*UpdateTaskStatusRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Dispatcher_Tasks_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(TasksRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(DispatcherServer).Tasks(m, &dispatcherTasksServer{stream})
}
type Dispatcher_TasksServer interface {
Send(*TasksMessage) error
grpc.ServerStream
}
type dispatcherTasksServer struct {