-
Notifications
You must be signed in to change notification settings - Fork 4
/
log.pb.go
612 lines (529 loc) · 18 KB
/
log.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
// Code generated by protoc-gen-go.
// source: log.proto
// DO NOT EDIT!
package mesosproto
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
type Action_Type int32
const (
Action_NOP Action_Type = 1
Action_APPEND Action_Type = 2
Action_TRUNCATE Action_Type = 3
)
var Action_Type_name = map[int32]string{
1: "NOP",
2: "APPEND",
3: "TRUNCATE",
}
var Action_Type_value = map[string]int32{
"NOP": 1,
"APPEND": 2,
"TRUNCATE": 3,
}
func (x Action_Type) Enum() *Action_Type {
p := new(Action_Type)
*p = x
return p
}
func (x Action_Type) String() string {
return proto.EnumName(Action_Type_name, int32(x))
}
func (x *Action_Type) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(Action_Type_value, data, "Action_Type")
if err != nil {
return err
}
*x = Action_Type(value)
return nil
}
type Metadata_Status int32
const (
Metadata_VOTING Metadata_Status = 1
Metadata_RECOVERING Metadata_Status = 2
Metadata_STARTING Metadata_Status = 3
Metadata_EMPTY Metadata_Status = 4
)
var Metadata_Status_name = map[int32]string{
1: "VOTING",
2: "RECOVERING",
3: "STARTING",
4: "EMPTY",
}
var Metadata_Status_value = map[string]int32{
"VOTING": 1,
"RECOVERING": 2,
"STARTING": 3,
"EMPTY": 4,
}
func (x Metadata_Status) Enum() *Metadata_Status {
p := new(Metadata_Status)
*p = x
return p
}
func (x Metadata_Status) String() string {
return proto.EnumName(Metadata_Status_name, int32(x))
}
func (x *Metadata_Status) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(Metadata_Status_value, data, "Metadata_Status")
if err != nil {
return err
}
*x = Metadata_Status(value)
return nil
}
type Record_Type int32
const (
Record_PROMISE Record_Type = 1
Record_ACTION Record_Type = 2
Record_METADATA Record_Type = 3
)
var Record_Type_name = map[int32]string{
1: "PROMISE",
2: "ACTION",
3: "METADATA",
}
var Record_Type_value = map[string]int32{
"PROMISE": 1,
"ACTION": 2,
"METADATA": 3,
}
func (x Record_Type) Enum() *Record_Type {
p := new(Record_Type)
*p = x
return p
}
func (x Record_Type) String() string {
return proto.EnumName(Record_Type_name, int32(x))
}
func (x *Record_Type) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(Record_Type_value, data, "Record_Type")
if err != nil {
return err
}
*x = Record_Type(value)
return nil
}
// Represents a "promise" that a replica has made. A promise is
// *implicitly* valid for _all_ future actions that get performed on
// the replicated log (provided the action comes from the same
// proposer), until a new promise is made to a proposer with a higher
// proposal number. Each replica writes every promise it makes as a
// log record so that it can recover this information after a failure.
// TODO(benh): Does the promise actually need to be written to stable
// storage? Can we get away with looking at the last written action
// and using it's promised value? In this case, what happens if we
// make a promise but don't receive an action from that coordinator?
type Promise struct {
Proposal *uint64 `protobuf:"varint,1,req,name=proposal" json:"proposal,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Promise) Reset() { *m = Promise{} }
func (m *Promise) String() string { return proto.CompactTextString(m) }
func (*Promise) ProtoMessage() {}
func (m *Promise) GetProposal() uint64 {
if m != nil && m.Proposal != nil {
return *m.Proposal
}
return 0
}
// Represents an "action" performed on the log. Each action has an
// associated position in the log. In addition, each action (i.e.,
// position) will have been "promised" to a specific proposer
// (implicitly or explicitly) and may have been "performed" from a
// specific proposer. An action may also be "learned" to have reached
// consensus. There are three types of possible actions that can be
// performed on the log: nop (no action), append, and truncate.
type Action struct {
Position *uint64 `protobuf:"varint,1,req,name=position" json:"position,omitempty"`
Promised *uint64 `protobuf:"varint,2,req,name=promised" json:"promised,omitempty"`
Performed *uint64 `protobuf:"varint,3,opt,name=performed" json:"performed,omitempty"`
Learned *bool `protobuf:"varint,4,opt,name=learned" json:"learned,omitempty"`
Type *Action_Type `protobuf:"varint,5,opt,name=type,enum=mesosproto.Action_Type" json:"type,omitempty"`
Nop *Action_Nop `protobuf:"bytes,6,opt,name=nop" json:"nop,omitempty"`
Append *Action_Append `protobuf:"bytes,7,opt,name=append" json:"append,omitempty"`
Truncate *Action_Truncate `protobuf:"bytes,8,opt,name=truncate" json:"truncate,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Action) Reset() { *m = Action{} }
func (m *Action) String() string { return proto.CompactTextString(m) }
func (*Action) ProtoMessage() {}
func (m *Action) GetPosition() uint64 {
if m != nil && m.Position != nil {
return *m.Position
}
return 0
}
func (m *Action) GetPromised() uint64 {
if m != nil && m.Promised != nil {
return *m.Promised
}
return 0
}
func (m *Action) GetPerformed() uint64 {
if m != nil && m.Performed != nil {
return *m.Performed
}
return 0
}
func (m *Action) GetLearned() bool {
if m != nil && m.Learned != nil {
return *m.Learned
}
return false
}
func (m *Action) GetType() Action_Type {
if m != nil && m.Type != nil {
return *m.Type
}
return Action_NOP
}
func (m *Action) GetNop() *Action_Nop {
if m != nil {
return m.Nop
}
return nil
}
func (m *Action) GetAppend() *Action_Append {
if m != nil {
return m.Append
}
return nil
}
func (m *Action) GetTruncate() *Action_Truncate {
if m != nil {
return m.Truncate
}
return nil
}
type Action_Nop struct {
XXX_unrecognized []byte `json:"-"`
}
func (m *Action_Nop) Reset() { *m = Action_Nop{} }
func (m *Action_Nop) String() string { return proto.CompactTextString(m) }
func (*Action_Nop) ProtoMessage() {}
type Action_Append struct {
Bytes []byte `protobuf:"bytes,1,req,name=bytes" json:"bytes,omitempty"`
Cksum []byte `protobuf:"bytes,2,opt,name=cksum" json:"cksum,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Action_Append) Reset() { *m = Action_Append{} }
func (m *Action_Append) String() string { return proto.CompactTextString(m) }
func (*Action_Append) ProtoMessage() {}
func (m *Action_Append) GetBytes() []byte {
if m != nil {
return m.Bytes
}
return nil
}
func (m *Action_Append) GetCksum() []byte {
if m != nil {
return m.Cksum
}
return nil
}
type Action_Truncate struct {
To *uint64 `protobuf:"varint,1,req,name=to" json:"to,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Action_Truncate) Reset() { *m = Action_Truncate{} }
func (m *Action_Truncate) String() string { return proto.CompactTextString(m) }
func (*Action_Truncate) ProtoMessage() {}
func (m *Action_Truncate) GetTo() uint64 {
if m != nil && m.To != nil {
return *m.To
}
return 0
}
// The metadata of a replica. It has to be persisted on the disk. We
// store the current status of the replica as well as the implicit
// promise that a replica has made. This message is intended to
// replace the old Promise message to support catch-up.
type Metadata struct {
Status *Metadata_Status `protobuf:"varint,1,req,name=status,enum=mesosproto.Metadata_Status,def=4" json:"status,omitempty"`
Promised *uint64 `protobuf:"varint,2,req,name=promised,def=0" json:"promised,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Metadata) Reset() { *m = Metadata{} }
func (m *Metadata) String() string { return proto.CompactTextString(m) }
func (*Metadata) ProtoMessage() {}
const Default_Metadata_Status Metadata_Status = Metadata_EMPTY
const Default_Metadata_Promised uint64 = 0
func (m *Metadata) GetStatus() Metadata_Status {
if m != nil && m.Status != nil {
return *m.Status
}
return Default_Metadata_Status
}
func (m *Metadata) GetPromised() uint64 {
if m != nil && m.Promised != nil {
return *m.Promised
}
return Default_Metadata_Promised
}
// Represents a log record written to the local filesystem by a
// replica. A log record may store a promise (DEPRECATED), an action
// or metadata (defined above).
type Record struct {
Type *Record_Type `protobuf:"varint,1,req,name=type,enum=mesosproto.Record_Type" json:"type,omitempty"`
Promise *Promise `protobuf:"bytes,2,opt,name=promise" json:"promise,omitempty"`
Action *Action `protobuf:"bytes,3,opt,name=action" json:"action,omitempty"`
Metadata *Metadata `protobuf:"bytes,4,opt,name=metadata" json:"metadata,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Record) Reset() { *m = Record{} }
func (m *Record) String() string { return proto.CompactTextString(m) }
func (*Record) ProtoMessage() {}
func (m *Record) GetType() Record_Type {
if m != nil && m.Type != nil {
return *m.Type
}
return Record_PROMISE
}
func (m *Record) GetPromise() *Promise {
if m != nil {
return m.Promise
}
return nil
}
func (m *Record) GetAction() *Action {
if m != nil {
return m.Action
}
return nil
}
func (m *Record) GetMetadata() *Metadata {
if m != nil {
return m.Metadata
}
return nil
}
// Represents a "promise" request from a proposer with the specified
// 'proposal' to a replica. If the proposer is a coordinator, most
// such requests will occur after a coordinator has failed and a new
// coordinator is elected. In such a case, the position that the
// coordinator is asking the replica to promise is implicitly *all*
// positions that the replica has made no promises (thus the position
// field is not be used). In other instances, however, a proposer
// might be explicitly trying to request that a replica promise a
// specific position in the log (such as when trying to fill holes
// discovered during a client read), and then the 'position' field
// will be present.
type PromiseRequest struct {
Proposal *uint64 `protobuf:"varint,1,req,name=proposal" json:"proposal,omitempty"`
Position *uint64 `protobuf:"varint,2,opt,name=position" json:"position,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *PromiseRequest) Reset() { *m = PromiseRequest{} }
func (m *PromiseRequest) String() string { return proto.CompactTextString(m) }
func (*PromiseRequest) ProtoMessage() {}
func (m *PromiseRequest) GetProposal() uint64 {
if m != nil && m.Proposal != nil {
return *m.Proposal
}
return 0
}
func (m *PromiseRequest) GetPosition() uint64 {
if m != nil && m.Position != nil {
return *m.Position
}
return 0
}
// Represents a "promise" response from a replica back to a proposer.
// A replica represents a NACK (because it has promised a proposer
// with a higher proposal number) by setting the okay field to false.
// The 'proposal' is either the aforementioned higher proposal number
// when the response is a NACK, or the corresponding request's
// proposal number if it is an ACK. The replica either sends back the
// highest position it has recorded in the log (using the 'position'
// field) or the specific action (if any) it has at the position
// requested in PromiseRequest (using the 'action' field).
type PromiseResponse struct {
Okay *bool `protobuf:"varint,1,req,name=okay" json:"okay,omitempty"`
Proposal *uint64 `protobuf:"varint,2,req,name=proposal" json:"proposal,omitempty"`
Position *uint64 `protobuf:"varint,4,opt,name=position" json:"position,omitempty"`
Action *Action `protobuf:"bytes,3,opt,name=action" json:"action,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *PromiseResponse) Reset() { *m = PromiseResponse{} }
func (m *PromiseResponse) String() string { return proto.CompactTextString(m) }
func (*PromiseResponse) ProtoMessage() {}
func (m *PromiseResponse) GetOkay() bool {
if m != nil && m.Okay != nil {
return *m.Okay
}
return false
}
func (m *PromiseResponse) GetProposal() uint64 {
if m != nil && m.Proposal != nil {
return *m.Proposal
}
return 0
}
func (m *PromiseResponse) GetPosition() uint64 {
if m != nil && m.Position != nil {
return *m.Position
}
return 0
}
func (m *PromiseResponse) GetAction() *Action {
if m != nil {
return m.Action
}
return nil
}
// Represents a write request for a specific type of action. Note that
// we deliberately do not include the entire Action as it contains
// fields that are not relevant to a write request (e.g., promised,
// performed) and rather than ignore them we exclude them for safety.
type WriteRequest struct {
Proposal *uint64 `protobuf:"varint,1,req,name=proposal" json:"proposal,omitempty"`
Position *uint64 `protobuf:"varint,2,req,name=position" json:"position,omitempty"`
Learned *bool `protobuf:"varint,3,opt,name=learned" json:"learned,omitempty"`
Type *Action_Type `protobuf:"varint,4,req,name=type,enum=mesosproto.Action_Type" json:"type,omitempty"`
Nop *Action_Nop `protobuf:"bytes,5,opt,name=nop" json:"nop,omitempty"`
Append *Action_Append `protobuf:"bytes,6,opt,name=append" json:"append,omitempty"`
Truncate *Action_Truncate `protobuf:"bytes,7,opt,name=truncate" json:"truncate,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *WriteRequest) Reset() { *m = WriteRequest{} }
func (m *WriteRequest) String() string { return proto.CompactTextString(m) }
func (*WriteRequest) ProtoMessage() {}
func (m *WriteRequest) GetProposal() uint64 {
if m != nil && m.Proposal != nil {
return *m.Proposal
}
return 0
}
func (m *WriteRequest) GetPosition() uint64 {
if m != nil && m.Position != nil {
return *m.Position
}
return 0
}
func (m *WriteRequest) GetLearned() bool {
if m != nil && m.Learned != nil {
return *m.Learned
}
return false
}
func (m *WriteRequest) GetType() Action_Type {
if m != nil && m.Type != nil {
return *m.Type
}
return Action_NOP
}
func (m *WriteRequest) GetNop() *Action_Nop {
if m != nil {
return m.Nop
}
return nil
}
func (m *WriteRequest) GetAppend() *Action_Append {
if m != nil {
return m.Append
}
return nil
}
func (m *WriteRequest) GetTruncate() *Action_Truncate {
if m != nil {
return m.Truncate
}
return nil
}
// Represents a write response corresponding to a write request. A
// replica represents a NACK (because it has promised a proposer with
// a higher proposal number) by setting the okay field to false. If
// the proposer is a coordinator, then it has been demoted. The
// 'position' should always correspond to the position set in the
// request. The 'proposal' is either the same proposal number set in
// the request in the case of an ACK, or the higher proposal number
// this position has been promised to in the case of a NACK.
type WriteResponse struct {
Okay *bool `protobuf:"varint,1,req,name=okay" json:"okay,omitempty"`
Proposal *uint64 `protobuf:"varint,2,req,name=proposal" json:"proposal,omitempty"`
Position *uint64 `protobuf:"varint,3,req,name=position" json:"position,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *WriteResponse) Reset() { *m = WriteResponse{} }
func (m *WriteResponse) String() string { return proto.CompactTextString(m) }
func (*WriteResponse) ProtoMessage() {}
func (m *WriteResponse) GetOkay() bool {
if m != nil && m.Okay != nil {
return *m.Okay
}
return false
}
func (m *WriteResponse) GetProposal() uint64 {
if m != nil && m.Proposal != nil {
return *m.Proposal
}
return 0
}
func (m *WriteResponse) GetPosition() uint64 {
if m != nil && m.Position != nil {
return *m.Position
}
return 0
}
// Represents a "learned" event, that is, when a particular action has
// been agreed upon (reached consensus).
type LearnedMessage struct {
Action *Action `protobuf:"bytes,1,req,name=action" json:"action,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *LearnedMessage) Reset() { *m = LearnedMessage{} }
func (m *LearnedMessage) String() string { return proto.CompactTextString(m) }
func (*LearnedMessage) ProtoMessage() {}
func (m *LearnedMessage) GetAction() *Action {
if m != nil {
return m.Action
}
return nil
}
// Represents a recover request. A recover request is used to initiate
// the recovery (by broadcasting it).
type RecoverRequest struct {
XXX_unrecognized []byte `json:"-"`
}
func (m *RecoverRequest) Reset() { *m = RecoverRequest{} }
func (m *RecoverRequest) String() string { return proto.CompactTextString(m) }
func (*RecoverRequest) ProtoMessage() {}
// When a replica receives a RecoverRequest, it will reply with its
// current status, and the begin and the end of its current log.
type RecoverResponse struct {
Status *Metadata_Status `protobuf:"varint,1,req,name=status,enum=mesosproto.Metadata_Status" json:"status,omitempty"`
Begin *uint64 `protobuf:"varint,2,opt,name=begin" json:"begin,omitempty"`
End *uint64 `protobuf:"varint,3,opt,name=end" json:"end,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *RecoverResponse) Reset() { *m = RecoverResponse{} }
func (m *RecoverResponse) String() string { return proto.CompactTextString(m) }
func (*RecoverResponse) ProtoMessage() {}
func (m *RecoverResponse) GetStatus() Metadata_Status {
if m != nil && m.Status != nil {
return *m.Status
}
return Metadata_VOTING
}
func (m *RecoverResponse) GetBegin() uint64 {
if m != nil && m.Begin != nil {
return *m.Begin
}
return 0
}
func (m *RecoverResponse) GetEnd() uint64 {
if m != nil && m.End != nil {
return *m.End
}
return 0
}
func init() {
proto.RegisterEnum("mesosproto.Action_Type", Action_Type_name, Action_Type_value)
proto.RegisterEnum("mesosproto.Metadata_Status", Metadata_Status_name, Metadata_Status_value)
proto.RegisterEnum("mesosproto.Record_Type", Record_Type_name, Record_Type_value)
}