blob: 1ece90bef0a3ea2c0ec990546b3091968bf01d01 [file] [log] [blame]
khenaidood948f772021-08-11 17:49:24 -04001// Code generated by protoc-gen-gogo. DO NOT EDIT.
2// source: v3lock.proto
3
4package v3lockpb
5
6import (
7 context "context"
8 fmt "fmt"
9 io "io"
10 math "math"
11 math_bits "math/bits"
12
13 etcdserverpb "github.com/coreos/etcd/etcdserver/etcdserverpb"
14 _ "github.com/gogo/protobuf/gogoproto"
15 proto "github.com/golang/protobuf/proto"
16 _ "google.golang.org/genproto/googleapis/api/annotations"
17 grpc "google.golang.org/grpc"
18 codes "google.golang.org/grpc/codes"
19 status "google.golang.org/grpc/status"
20)
21
22// Reference imports to suppress errors if they are not otherwise used.
23var _ = proto.Marshal
24var _ = fmt.Errorf
25var _ = math.Inf
26
27// This is a compile-time assertion to ensure that this generated file
28// is compatible with the proto package it is being compiled against.
29// A compilation error at this line likely means your copy of the
30// proto package needs to be updated.
31const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
32
33type LockRequest struct {
34 // name is the identifier for the distributed shared lock to be acquired.
35 Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
36 // lease is the ID of the lease that will be attached to ownership of the
37 // lock. If the lease expires or is revoked and currently holds the lock,
38 // the lock is automatically released. Calls to Lock with the same lease will
39 // be treated as a single acquistion; locking twice with the same lease is a
40 // no-op.
41 Lease int64 `protobuf:"varint,2,opt,name=lease,proto3" json:"lease,omitempty"`
42 XXX_NoUnkeyedLiteral struct{} `json:"-"`
43 XXX_unrecognized []byte `json:"-"`
44 XXX_sizecache int32 `json:"-"`
45}
46
47func (m *LockRequest) Reset() { *m = LockRequest{} }
48func (m *LockRequest) String() string { return proto.CompactTextString(m) }
49func (*LockRequest) ProtoMessage() {}
50func (*LockRequest) Descriptor() ([]byte, []int) {
51 return fileDescriptor_52389b3e2f253201, []int{0}
52}
53func (m *LockRequest) XXX_Unmarshal(b []byte) error {
54 return m.Unmarshal(b)
55}
56func (m *LockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
57 if deterministic {
58 return xxx_messageInfo_LockRequest.Marshal(b, m, deterministic)
59 } else {
60 b = b[:cap(b)]
61 n, err := m.MarshalToSizedBuffer(b)
62 if err != nil {
63 return nil, err
64 }
65 return b[:n], nil
66 }
67}
68func (m *LockRequest) XXX_Merge(src proto.Message) {
69 xxx_messageInfo_LockRequest.Merge(m, src)
70}
71func (m *LockRequest) XXX_Size() int {
72 return m.Size()
73}
74func (m *LockRequest) XXX_DiscardUnknown() {
75 xxx_messageInfo_LockRequest.DiscardUnknown(m)
76}
77
78var xxx_messageInfo_LockRequest proto.InternalMessageInfo
79
80func (m *LockRequest) GetName() []byte {
81 if m != nil {
82 return m.Name
83 }
84 return nil
85}
86
87func (m *LockRequest) GetLease() int64 {
88 if m != nil {
89 return m.Lease
90 }
91 return 0
92}
93
94type LockResponse struct {
95 Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
96 // key is a key that will exist on etcd for the duration that the Lock caller
97 // owns the lock. Users should not modify this key or the lock may exhibit
98 // undefined behavior.
99 Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
100 XXX_NoUnkeyedLiteral struct{} `json:"-"`
101 XXX_unrecognized []byte `json:"-"`
102 XXX_sizecache int32 `json:"-"`
103}
104
105func (m *LockResponse) Reset() { *m = LockResponse{} }
106func (m *LockResponse) String() string { return proto.CompactTextString(m) }
107func (*LockResponse) ProtoMessage() {}
108func (*LockResponse) Descriptor() ([]byte, []int) {
109 return fileDescriptor_52389b3e2f253201, []int{1}
110}
111func (m *LockResponse) XXX_Unmarshal(b []byte) error {
112 return m.Unmarshal(b)
113}
114func (m *LockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
115 if deterministic {
116 return xxx_messageInfo_LockResponse.Marshal(b, m, deterministic)
117 } else {
118 b = b[:cap(b)]
119 n, err := m.MarshalToSizedBuffer(b)
120 if err != nil {
121 return nil, err
122 }
123 return b[:n], nil
124 }
125}
126func (m *LockResponse) XXX_Merge(src proto.Message) {
127 xxx_messageInfo_LockResponse.Merge(m, src)
128}
129func (m *LockResponse) XXX_Size() int {
130 return m.Size()
131}
132func (m *LockResponse) XXX_DiscardUnknown() {
133 xxx_messageInfo_LockResponse.DiscardUnknown(m)
134}
135
136var xxx_messageInfo_LockResponse proto.InternalMessageInfo
137
138func (m *LockResponse) GetHeader() *etcdserverpb.ResponseHeader {
139 if m != nil {
140 return m.Header
141 }
142 return nil
143}
144
145func (m *LockResponse) GetKey() []byte {
146 if m != nil {
147 return m.Key
148 }
149 return nil
150}
151
152type UnlockRequest struct {
153 // key is the lock ownership key granted by Lock.
154 Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
155 XXX_NoUnkeyedLiteral struct{} `json:"-"`
156 XXX_unrecognized []byte `json:"-"`
157 XXX_sizecache int32 `json:"-"`
158}
159
160func (m *UnlockRequest) Reset() { *m = UnlockRequest{} }
161func (m *UnlockRequest) String() string { return proto.CompactTextString(m) }
162func (*UnlockRequest) ProtoMessage() {}
163func (*UnlockRequest) Descriptor() ([]byte, []int) {
164 return fileDescriptor_52389b3e2f253201, []int{2}
165}
166func (m *UnlockRequest) XXX_Unmarshal(b []byte) error {
167 return m.Unmarshal(b)
168}
169func (m *UnlockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
170 if deterministic {
171 return xxx_messageInfo_UnlockRequest.Marshal(b, m, deterministic)
172 } else {
173 b = b[:cap(b)]
174 n, err := m.MarshalToSizedBuffer(b)
175 if err != nil {
176 return nil, err
177 }
178 return b[:n], nil
179 }
180}
181func (m *UnlockRequest) XXX_Merge(src proto.Message) {
182 xxx_messageInfo_UnlockRequest.Merge(m, src)
183}
184func (m *UnlockRequest) XXX_Size() int {
185 return m.Size()
186}
187func (m *UnlockRequest) XXX_DiscardUnknown() {
188 xxx_messageInfo_UnlockRequest.DiscardUnknown(m)
189}
190
191var xxx_messageInfo_UnlockRequest proto.InternalMessageInfo
192
193func (m *UnlockRequest) GetKey() []byte {
194 if m != nil {
195 return m.Key
196 }
197 return nil
198}
199
200type UnlockResponse struct {
201 Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
202 XXX_NoUnkeyedLiteral struct{} `json:"-"`
203 XXX_unrecognized []byte `json:"-"`
204 XXX_sizecache int32 `json:"-"`
205}
206
207func (m *UnlockResponse) Reset() { *m = UnlockResponse{} }
208func (m *UnlockResponse) String() string { return proto.CompactTextString(m) }
209func (*UnlockResponse) ProtoMessage() {}
210func (*UnlockResponse) Descriptor() ([]byte, []int) {
211 return fileDescriptor_52389b3e2f253201, []int{3}
212}
213func (m *UnlockResponse) XXX_Unmarshal(b []byte) error {
214 return m.Unmarshal(b)
215}
216func (m *UnlockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
217 if deterministic {
218 return xxx_messageInfo_UnlockResponse.Marshal(b, m, deterministic)
219 } else {
220 b = b[:cap(b)]
221 n, err := m.MarshalToSizedBuffer(b)
222 if err != nil {
223 return nil, err
224 }
225 return b[:n], nil
226 }
227}
228func (m *UnlockResponse) XXX_Merge(src proto.Message) {
229 xxx_messageInfo_UnlockResponse.Merge(m, src)
230}
231func (m *UnlockResponse) XXX_Size() int {
232 return m.Size()
233}
234func (m *UnlockResponse) XXX_DiscardUnknown() {
235 xxx_messageInfo_UnlockResponse.DiscardUnknown(m)
236}
237
238var xxx_messageInfo_UnlockResponse proto.InternalMessageInfo
239
240func (m *UnlockResponse) GetHeader() *etcdserverpb.ResponseHeader {
241 if m != nil {
242 return m.Header
243 }
244 return nil
245}
246
247func init() {
248 proto.RegisterType((*LockRequest)(nil), "v3lockpb.LockRequest")
249 proto.RegisterType((*LockResponse)(nil), "v3lockpb.LockResponse")
250 proto.RegisterType((*UnlockRequest)(nil), "v3lockpb.UnlockRequest")
251 proto.RegisterType((*UnlockResponse)(nil), "v3lockpb.UnlockResponse")
252}
253
254func init() { proto.RegisterFile("v3lock.proto", fileDescriptor_52389b3e2f253201) }
255
256var fileDescriptor_52389b3e2f253201 = []byte{
257 // 335 bytes of a gzipped FileDescriptorProto
258 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x33, 0xce, 0xc9,
259 0x4f, 0xce, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x80, 0xf0, 0x0a, 0x92, 0xa4, 0x44,
260 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x82, 0xfa, 0x20, 0x16, 0x44, 0x5e, 0x4a, 0x2d, 0xb5, 0x24, 0x39,
261 0x45, 0x1f, 0x44, 0x14, 0xa7, 0x16, 0x95, 0xa5, 0x16, 0x21, 0x31, 0x0b, 0x92, 0xf4, 0x8b, 0x0a,
262 0x92, 0xa1, 0xea, 0x64, 0xd2, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13,
263 0xf3, 0xf2, 0xf2, 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0xb2, 0x4a, 0xe6, 0x5c, 0xdc,
264 0x3e, 0xf9, 0xc9, 0xd9, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x42, 0x42, 0x5c, 0x2c, 0x79,
265 0x89, 0xb9, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0x60, 0xb6, 0x90, 0x08, 0x17, 0x6b,
266 0x4e, 0x6a, 0x62, 0x71, 0xaa, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x73, 0x10, 0x84, 0xa3, 0x14, 0xc6,
267 0xc5, 0x03, 0xd1, 0x58, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0x2a, 0x64, 0xc2, 0xc5, 0x96, 0x91, 0x9a,
268 0x98, 0x92, 0x5a, 0x04, 0xd6, 0xcb, 0x6d, 0x24, 0xa3, 0x87, 0xec, 0x1e, 0x3d, 0x98, 0x3a, 0x0f,
269 0xb0, 0x9a, 0x20, 0xa8, 0x5a, 0x21, 0x01, 0x2e, 0xe6, 0xec, 0xd4, 0x4a, 0xb0, 0xc9, 0x3c, 0x41,
270 0x20, 0xa6, 0x92, 0x22, 0x17, 0x6f, 0x68, 0x5e, 0x0e, 0x92, 0x93, 0xa0, 0x4a, 0x18, 0x11, 0x4a,
271 0xdc, 0xb8, 0xf8, 0x60, 0x4a, 0x28, 0xb1, 0xdc, 0x68, 0x07, 0x23, 0x17, 0x0b, 0xc8, 0x0f, 0x42,
272 0xc1, 0x50, 0x5a, 0x54, 0x0f, 0x16, 0xe6, 0x7a, 0x48, 0x81, 0x22, 0x25, 0x86, 0x2e, 0x0c, 0x31,
273 0x4d, 0x49, 0xa6, 0xe9, 0xf2, 0x93, 0xc9, 0x4c, 0x62, 0x4a, 0x82, 0xfa, 0x65, 0xc6, 0x49, 0xa9,
274 0x25, 0x89, 0xfa, 0x20, 0x45, 0x60, 0xc2, 0x8a, 0x51, 0x4b, 0x28, 0x9a, 0x8b, 0x0d, 0xe2, 0x4a,
275 0x21, 0x71, 0x84, 0x7e, 0x14, 0xaf, 0x49, 0x49, 0x60, 0x4a, 0x40, 0x8d, 0x96, 0x03, 0x1b, 0x2d,
276 0xa1, 0x24, 0x8c, 0x62, 0x74, 0x69, 0x1e, 0xd4, 0x70, 0x27, 0x81, 0x13, 0x8f, 0xe4, 0x18, 0x2f,
277 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x24, 0x36, 0x70, 0x7c,
278 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x10, 0x82, 0x89, 0xf0, 0x45, 0x02, 0x00, 0x00,
279}
280
281// Reference imports to suppress errors if they are not otherwise used.
282var _ context.Context
283var _ grpc.ClientConn
284
285// This is a compile-time assertion to ensure that this generated file
286// is compatible with the grpc package it is being compiled against.
287const _ = grpc.SupportPackageIsVersion4
288
289// LockClient is the client API for Lock service.
290//
291// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
292type LockClient interface {
293 // Lock acquires a distributed shared lock on a given named lock.
294 // On success, it will return a unique key that exists so long as the
295 // lock is held by the caller. This key can be used in conjunction with
296 // transactions to safely ensure updates to etcd only occur while holding
297 // lock ownership. The lock is held until Unlock is called on the key or the
298 // lease associate with the owner expires.
299 Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error)
300 // Unlock takes a key returned by Lock and releases the hold on lock. The
301 // next Lock caller waiting for the lock will then be woken up and given
302 // ownership of the lock.
303 Unlock(ctx context.Context, in *UnlockRequest, opts ...grpc.CallOption) (*UnlockResponse, error)
304}
305
306type lockClient struct {
307 cc *grpc.ClientConn
308}
309
310func NewLockClient(cc *grpc.ClientConn) LockClient {
311 return &lockClient{cc}
312}
313
314func (c *lockClient) Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error) {
315 out := new(LockResponse)
316 err := c.cc.Invoke(ctx, "/v3lockpb.Lock/Lock", in, out, opts...)
317 if err != nil {
318 return nil, err
319 }
320 return out, nil
321}
322
323func (c *lockClient) Unlock(ctx context.Context, in *UnlockRequest, opts ...grpc.CallOption) (*UnlockResponse, error) {
324 out := new(UnlockResponse)
325 err := c.cc.Invoke(ctx, "/v3lockpb.Lock/Unlock", in, out, opts...)
326 if err != nil {
327 return nil, err
328 }
329 return out, nil
330}
331
332// LockServer is the server API for Lock service.
333type LockServer interface {
334 // Lock acquires a distributed shared lock on a given named lock.
335 // On success, it will return a unique key that exists so long as the
336 // lock is held by the caller. This key can be used in conjunction with
337 // transactions to safely ensure updates to etcd only occur while holding
338 // lock ownership. The lock is held until Unlock is called on the key or the
339 // lease associate with the owner expires.
340 Lock(context.Context, *LockRequest) (*LockResponse, error)
341 // Unlock takes a key returned by Lock and releases the hold on lock. The
342 // next Lock caller waiting for the lock will then be woken up and given
343 // ownership of the lock.
344 Unlock(context.Context, *UnlockRequest) (*UnlockResponse, error)
345}
346
347// UnimplementedLockServer can be embedded to have forward compatible implementations.
348type UnimplementedLockServer struct {
349}
350
351func (*UnimplementedLockServer) Lock(ctx context.Context, req *LockRequest) (*LockResponse, error) {
352 return nil, status.Errorf(codes.Unimplemented, "method Lock not implemented")
353}
354func (*UnimplementedLockServer) Unlock(ctx context.Context, req *UnlockRequest) (*UnlockResponse, error) {
355 return nil, status.Errorf(codes.Unimplemented, "method Unlock not implemented")
356}
357
358func RegisterLockServer(s *grpc.Server, srv LockServer) {
359 s.RegisterService(&_Lock_serviceDesc, srv)
360}
361
362func _Lock_Lock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
363 in := new(LockRequest)
364 if err := dec(in); err != nil {
365 return nil, err
366 }
367 if interceptor == nil {
368 return srv.(LockServer).Lock(ctx, in)
369 }
370 info := &grpc.UnaryServerInfo{
371 Server: srv,
372 FullMethod: "/v3lockpb.Lock/Lock",
373 }
374 handler := func(ctx context.Context, req interface{}) (interface{}, error) {
375 return srv.(LockServer).Lock(ctx, req.(*LockRequest))
376 }
377 return interceptor(ctx, in, info, handler)
378}
379
380func _Lock_Unlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
381 in := new(UnlockRequest)
382 if err := dec(in); err != nil {
383 return nil, err
384 }
385 if interceptor == nil {
386 return srv.(LockServer).Unlock(ctx, in)
387 }
388 info := &grpc.UnaryServerInfo{
389 Server: srv,
390 FullMethod: "/v3lockpb.Lock/Unlock",
391 }
392 handler := func(ctx context.Context, req interface{}) (interface{}, error) {
393 return srv.(LockServer).Unlock(ctx, req.(*UnlockRequest))
394 }
395 return interceptor(ctx, in, info, handler)
396}
397
398var _Lock_serviceDesc = grpc.ServiceDesc{
399 ServiceName: "v3lockpb.Lock",
400 HandlerType: (*LockServer)(nil),
401 Methods: []grpc.MethodDesc{
402 {
403 MethodName: "Lock",
404 Handler: _Lock_Lock_Handler,
405 },
406 {
407 MethodName: "Unlock",
408 Handler: _Lock_Unlock_Handler,
409 },
410 },
411 Streams: []grpc.StreamDesc{},
412 Metadata: "v3lock.proto",
413}
414
415func (m *LockRequest) Marshal() (dAtA []byte, err error) {
416 size := m.Size()
417 dAtA = make([]byte, size)
418 n, err := m.MarshalToSizedBuffer(dAtA[:size])
419 if err != nil {
420 return nil, err
421 }
422 return dAtA[:n], nil
423}
424
425func (m *LockRequest) MarshalTo(dAtA []byte) (int, error) {
426 size := m.Size()
427 return m.MarshalToSizedBuffer(dAtA[:size])
428}
429
430func (m *LockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
431 i := len(dAtA)
432 _ = i
433 var l int
434 _ = l
435 if m.XXX_unrecognized != nil {
436 i -= len(m.XXX_unrecognized)
437 copy(dAtA[i:], m.XXX_unrecognized)
438 }
439 if m.Lease != 0 {
440 i = encodeVarintV3Lock(dAtA, i, uint64(m.Lease))
441 i--
442 dAtA[i] = 0x10
443 }
444 if len(m.Name) > 0 {
445 i -= len(m.Name)
446 copy(dAtA[i:], m.Name)
447 i = encodeVarintV3Lock(dAtA, i, uint64(len(m.Name)))
448 i--
449 dAtA[i] = 0xa
450 }
451 return len(dAtA) - i, nil
452}
453
454func (m *LockResponse) Marshal() (dAtA []byte, err error) {
455 size := m.Size()
456 dAtA = make([]byte, size)
457 n, err := m.MarshalToSizedBuffer(dAtA[:size])
458 if err != nil {
459 return nil, err
460 }
461 return dAtA[:n], nil
462}
463
464func (m *LockResponse) MarshalTo(dAtA []byte) (int, error) {
465 size := m.Size()
466 return m.MarshalToSizedBuffer(dAtA[:size])
467}
468
469func (m *LockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
470 i := len(dAtA)
471 _ = i
472 var l int
473 _ = l
474 if m.XXX_unrecognized != nil {
475 i -= len(m.XXX_unrecognized)
476 copy(dAtA[i:], m.XXX_unrecognized)
477 }
478 if len(m.Key) > 0 {
479 i -= len(m.Key)
480 copy(dAtA[i:], m.Key)
481 i = encodeVarintV3Lock(dAtA, i, uint64(len(m.Key)))
482 i--
483 dAtA[i] = 0x12
484 }
485 if m.Header != nil {
486 {
487 size, err := m.Header.MarshalToSizedBuffer(dAtA[:i])
488 if err != nil {
489 return 0, err
490 }
491 i -= size
492 i = encodeVarintV3Lock(dAtA, i, uint64(size))
493 }
494 i--
495 dAtA[i] = 0xa
496 }
497 return len(dAtA) - i, nil
498}
499
500func (m *UnlockRequest) Marshal() (dAtA []byte, err error) {
501 size := m.Size()
502 dAtA = make([]byte, size)
503 n, err := m.MarshalToSizedBuffer(dAtA[:size])
504 if err != nil {
505 return nil, err
506 }
507 return dAtA[:n], nil
508}
509
510func (m *UnlockRequest) MarshalTo(dAtA []byte) (int, error) {
511 size := m.Size()
512 return m.MarshalToSizedBuffer(dAtA[:size])
513}
514
515func (m *UnlockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
516 i := len(dAtA)
517 _ = i
518 var l int
519 _ = l
520 if m.XXX_unrecognized != nil {
521 i -= len(m.XXX_unrecognized)
522 copy(dAtA[i:], m.XXX_unrecognized)
523 }
524 if len(m.Key) > 0 {
525 i -= len(m.Key)
526 copy(dAtA[i:], m.Key)
527 i = encodeVarintV3Lock(dAtA, i, uint64(len(m.Key)))
528 i--
529 dAtA[i] = 0xa
530 }
531 return len(dAtA) - i, nil
532}
533
534func (m *UnlockResponse) Marshal() (dAtA []byte, err error) {
535 size := m.Size()
536 dAtA = make([]byte, size)
537 n, err := m.MarshalToSizedBuffer(dAtA[:size])
538 if err != nil {
539 return nil, err
540 }
541 return dAtA[:n], nil
542}
543
544func (m *UnlockResponse) MarshalTo(dAtA []byte) (int, error) {
545 size := m.Size()
546 return m.MarshalToSizedBuffer(dAtA[:size])
547}
548
549func (m *UnlockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
550 i := len(dAtA)
551 _ = i
552 var l int
553 _ = l
554 if m.XXX_unrecognized != nil {
555 i -= len(m.XXX_unrecognized)
556 copy(dAtA[i:], m.XXX_unrecognized)
557 }
558 if m.Header != nil {
559 {
560 size, err := m.Header.MarshalToSizedBuffer(dAtA[:i])
561 if err != nil {
562 return 0, err
563 }
564 i -= size
565 i = encodeVarintV3Lock(dAtA, i, uint64(size))
566 }
567 i--
568 dAtA[i] = 0xa
569 }
570 return len(dAtA) - i, nil
571}
572
573func encodeVarintV3Lock(dAtA []byte, offset int, v uint64) int {
574 offset -= sovV3Lock(v)
575 base := offset
576 for v >= 1<<7 {
577 dAtA[offset] = uint8(v&0x7f | 0x80)
578 v >>= 7
579 offset++
580 }
581 dAtA[offset] = uint8(v)
582 return base
583}
584func (m *LockRequest) Size() (n int) {
585 if m == nil {
586 return 0
587 }
588 var l int
589 _ = l
590 l = len(m.Name)
591 if l > 0 {
592 n += 1 + l + sovV3Lock(uint64(l))
593 }
594 if m.Lease != 0 {
595 n += 1 + sovV3Lock(uint64(m.Lease))
596 }
597 if m.XXX_unrecognized != nil {
598 n += len(m.XXX_unrecognized)
599 }
600 return n
601}
602
603func (m *LockResponse) Size() (n int) {
604 if m == nil {
605 return 0
606 }
607 var l int
608 _ = l
609 if m.Header != nil {
610 l = m.Header.Size()
611 n += 1 + l + sovV3Lock(uint64(l))
612 }
613 l = len(m.Key)
614 if l > 0 {
615 n += 1 + l + sovV3Lock(uint64(l))
616 }
617 if m.XXX_unrecognized != nil {
618 n += len(m.XXX_unrecognized)
619 }
620 return n
621}
622
623func (m *UnlockRequest) Size() (n int) {
624 if m == nil {
625 return 0
626 }
627 var l int
628 _ = l
629 l = len(m.Key)
630 if l > 0 {
631 n += 1 + l + sovV3Lock(uint64(l))
632 }
633 if m.XXX_unrecognized != nil {
634 n += len(m.XXX_unrecognized)
635 }
636 return n
637}
638
639func (m *UnlockResponse) Size() (n int) {
640 if m == nil {
641 return 0
642 }
643 var l int
644 _ = l
645 if m.Header != nil {
646 l = m.Header.Size()
647 n += 1 + l + sovV3Lock(uint64(l))
648 }
649 if m.XXX_unrecognized != nil {
650 n += len(m.XXX_unrecognized)
651 }
652 return n
653}
654
655func sovV3Lock(x uint64) (n int) {
656 return (math_bits.Len64(x|1) + 6) / 7
657}
658func sozV3Lock(x uint64) (n int) {
659 return sovV3Lock(uint64((x << 1) ^ uint64((int64(x) >> 63))))
660}
661func (m *LockRequest) Unmarshal(dAtA []byte) error {
662 l := len(dAtA)
663 iNdEx := 0
664 for iNdEx < l {
665 preIndex := iNdEx
666 var wire uint64
667 for shift := uint(0); ; shift += 7 {
668 if shift >= 64 {
669 return ErrIntOverflowV3Lock
670 }
671 if iNdEx >= l {
672 return io.ErrUnexpectedEOF
673 }
674 b := dAtA[iNdEx]
675 iNdEx++
676 wire |= uint64(b&0x7F) << shift
677 if b < 0x80 {
678 break
679 }
680 }
681 fieldNum := int32(wire >> 3)
682 wireType := int(wire & 0x7)
683 if wireType == 4 {
684 return fmt.Errorf("proto: LockRequest: wiretype end group for non-group")
685 }
686 if fieldNum <= 0 {
687 return fmt.Errorf("proto: LockRequest: illegal tag %d (wire type %d)", fieldNum, wire)
688 }
689 switch fieldNum {
690 case 1:
691 if wireType != 2 {
692 return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
693 }
694 var byteLen int
695 for shift := uint(0); ; shift += 7 {
696 if shift >= 64 {
697 return ErrIntOverflowV3Lock
698 }
699 if iNdEx >= l {
700 return io.ErrUnexpectedEOF
701 }
702 b := dAtA[iNdEx]
703 iNdEx++
704 byteLen |= int(b&0x7F) << shift
705 if b < 0x80 {
706 break
707 }
708 }
709 if byteLen < 0 {
710 return ErrInvalidLengthV3Lock
711 }
712 postIndex := iNdEx + byteLen
713 if postIndex < 0 {
714 return ErrInvalidLengthV3Lock
715 }
716 if postIndex > l {
717 return io.ErrUnexpectedEOF
718 }
719 m.Name = append(m.Name[:0], dAtA[iNdEx:postIndex]...)
720 if m.Name == nil {
721 m.Name = []byte{}
722 }
723 iNdEx = postIndex
724 case 2:
725 if wireType != 0 {
726 return fmt.Errorf("proto: wrong wireType = %d for field Lease", wireType)
727 }
728 m.Lease = 0
729 for shift := uint(0); ; shift += 7 {
730 if shift >= 64 {
731 return ErrIntOverflowV3Lock
732 }
733 if iNdEx >= l {
734 return io.ErrUnexpectedEOF
735 }
736 b := dAtA[iNdEx]
737 iNdEx++
738 m.Lease |= int64(b&0x7F) << shift
739 if b < 0x80 {
740 break
741 }
742 }
743 default:
744 iNdEx = preIndex
745 skippy, err := skipV3Lock(dAtA[iNdEx:])
746 if err != nil {
747 return err
748 }
749 if skippy < 0 {
750 return ErrInvalidLengthV3Lock
751 }
752 if (iNdEx + skippy) < 0 {
753 return ErrInvalidLengthV3Lock
754 }
755 if (iNdEx + skippy) > l {
756 return io.ErrUnexpectedEOF
757 }
758 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
759 iNdEx += skippy
760 }
761 }
762
763 if iNdEx > l {
764 return io.ErrUnexpectedEOF
765 }
766 return nil
767}
768func (m *LockResponse) Unmarshal(dAtA []byte) error {
769 l := len(dAtA)
770 iNdEx := 0
771 for iNdEx < l {
772 preIndex := iNdEx
773 var wire uint64
774 for shift := uint(0); ; shift += 7 {
775 if shift >= 64 {
776 return ErrIntOverflowV3Lock
777 }
778 if iNdEx >= l {
779 return io.ErrUnexpectedEOF
780 }
781 b := dAtA[iNdEx]
782 iNdEx++
783 wire |= uint64(b&0x7F) << shift
784 if b < 0x80 {
785 break
786 }
787 }
788 fieldNum := int32(wire >> 3)
789 wireType := int(wire & 0x7)
790 if wireType == 4 {
791 return fmt.Errorf("proto: LockResponse: wiretype end group for non-group")
792 }
793 if fieldNum <= 0 {
794 return fmt.Errorf("proto: LockResponse: illegal tag %d (wire type %d)", fieldNum, wire)
795 }
796 switch fieldNum {
797 case 1:
798 if wireType != 2 {
799 return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
800 }
801 var msglen int
802 for shift := uint(0); ; shift += 7 {
803 if shift >= 64 {
804 return ErrIntOverflowV3Lock
805 }
806 if iNdEx >= l {
807 return io.ErrUnexpectedEOF
808 }
809 b := dAtA[iNdEx]
810 iNdEx++
811 msglen |= int(b&0x7F) << shift
812 if b < 0x80 {
813 break
814 }
815 }
816 if msglen < 0 {
817 return ErrInvalidLengthV3Lock
818 }
819 postIndex := iNdEx + msglen
820 if postIndex < 0 {
821 return ErrInvalidLengthV3Lock
822 }
823 if postIndex > l {
824 return io.ErrUnexpectedEOF
825 }
826 if m.Header == nil {
827 m.Header = &etcdserverpb.ResponseHeader{}
828 }
829 if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
830 return err
831 }
832 iNdEx = postIndex
833 case 2:
834 if wireType != 2 {
835 return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
836 }
837 var byteLen int
838 for shift := uint(0); ; shift += 7 {
839 if shift >= 64 {
840 return ErrIntOverflowV3Lock
841 }
842 if iNdEx >= l {
843 return io.ErrUnexpectedEOF
844 }
845 b := dAtA[iNdEx]
846 iNdEx++
847 byteLen |= int(b&0x7F) << shift
848 if b < 0x80 {
849 break
850 }
851 }
852 if byteLen < 0 {
853 return ErrInvalidLengthV3Lock
854 }
855 postIndex := iNdEx + byteLen
856 if postIndex < 0 {
857 return ErrInvalidLengthV3Lock
858 }
859 if postIndex > l {
860 return io.ErrUnexpectedEOF
861 }
862 m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...)
863 if m.Key == nil {
864 m.Key = []byte{}
865 }
866 iNdEx = postIndex
867 default:
868 iNdEx = preIndex
869 skippy, err := skipV3Lock(dAtA[iNdEx:])
870 if err != nil {
871 return err
872 }
873 if skippy < 0 {
874 return ErrInvalidLengthV3Lock
875 }
876 if (iNdEx + skippy) < 0 {
877 return ErrInvalidLengthV3Lock
878 }
879 if (iNdEx + skippy) > l {
880 return io.ErrUnexpectedEOF
881 }
882 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
883 iNdEx += skippy
884 }
885 }
886
887 if iNdEx > l {
888 return io.ErrUnexpectedEOF
889 }
890 return nil
891}
892func (m *UnlockRequest) Unmarshal(dAtA []byte) error {
893 l := len(dAtA)
894 iNdEx := 0
895 for iNdEx < l {
896 preIndex := iNdEx
897 var wire uint64
898 for shift := uint(0); ; shift += 7 {
899 if shift >= 64 {
900 return ErrIntOverflowV3Lock
901 }
902 if iNdEx >= l {
903 return io.ErrUnexpectedEOF
904 }
905 b := dAtA[iNdEx]
906 iNdEx++
907 wire |= uint64(b&0x7F) << shift
908 if b < 0x80 {
909 break
910 }
911 }
912 fieldNum := int32(wire >> 3)
913 wireType := int(wire & 0x7)
914 if wireType == 4 {
915 return fmt.Errorf("proto: UnlockRequest: wiretype end group for non-group")
916 }
917 if fieldNum <= 0 {
918 return fmt.Errorf("proto: UnlockRequest: illegal tag %d (wire type %d)", fieldNum, wire)
919 }
920 switch fieldNum {
921 case 1:
922 if wireType != 2 {
923 return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
924 }
925 var byteLen int
926 for shift := uint(0); ; shift += 7 {
927 if shift >= 64 {
928 return ErrIntOverflowV3Lock
929 }
930 if iNdEx >= l {
931 return io.ErrUnexpectedEOF
932 }
933 b := dAtA[iNdEx]
934 iNdEx++
935 byteLen |= int(b&0x7F) << shift
936 if b < 0x80 {
937 break
938 }
939 }
940 if byteLen < 0 {
941 return ErrInvalidLengthV3Lock
942 }
943 postIndex := iNdEx + byteLen
944 if postIndex < 0 {
945 return ErrInvalidLengthV3Lock
946 }
947 if postIndex > l {
948 return io.ErrUnexpectedEOF
949 }
950 m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...)
951 if m.Key == nil {
952 m.Key = []byte{}
953 }
954 iNdEx = postIndex
955 default:
956 iNdEx = preIndex
957 skippy, err := skipV3Lock(dAtA[iNdEx:])
958 if err != nil {
959 return err
960 }
961 if skippy < 0 {
962 return ErrInvalidLengthV3Lock
963 }
964 if (iNdEx + skippy) < 0 {
965 return ErrInvalidLengthV3Lock
966 }
967 if (iNdEx + skippy) > l {
968 return io.ErrUnexpectedEOF
969 }
970 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
971 iNdEx += skippy
972 }
973 }
974
975 if iNdEx > l {
976 return io.ErrUnexpectedEOF
977 }
978 return nil
979}
980func (m *UnlockResponse) Unmarshal(dAtA []byte) error {
981 l := len(dAtA)
982 iNdEx := 0
983 for iNdEx < l {
984 preIndex := iNdEx
985 var wire uint64
986 for shift := uint(0); ; shift += 7 {
987 if shift >= 64 {
988 return ErrIntOverflowV3Lock
989 }
990 if iNdEx >= l {
991 return io.ErrUnexpectedEOF
992 }
993 b := dAtA[iNdEx]
994 iNdEx++
995 wire |= uint64(b&0x7F) << shift
996 if b < 0x80 {
997 break
998 }
999 }
1000 fieldNum := int32(wire >> 3)
1001 wireType := int(wire & 0x7)
1002 if wireType == 4 {
1003 return fmt.Errorf("proto: UnlockResponse: wiretype end group for non-group")
1004 }
1005 if fieldNum <= 0 {
1006 return fmt.Errorf("proto: UnlockResponse: illegal tag %d (wire type %d)", fieldNum, wire)
1007 }
1008 switch fieldNum {
1009 case 1:
1010 if wireType != 2 {
1011 return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
1012 }
1013 var msglen int
1014 for shift := uint(0); ; shift += 7 {
1015 if shift >= 64 {
1016 return ErrIntOverflowV3Lock
1017 }
1018 if iNdEx >= l {
1019 return io.ErrUnexpectedEOF
1020 }
1021 b := dAtA[iNdEx]
1022 iNdEx++
1023 msglen |= int(b&0x7F) << shift
1024 if b < 0x80 {
1025 break
1026 }
1027 }
1028 if msglen < 0 {
1029 return ErrInvalidLengthV3Lock
1030 }
1031 postIndex := iNdEx + msglen
1032 if postIndex < 0 {
1033 return ErrInvalidLengthV3Lock
1034 }
1035 if postIndex > l {
1036 return io.ErrUnexpectedEOF
1037 }
1038 if m.Header == nil {
1039 m.Header = &etcdserverpb.ResponseHeader{}
1040 }
1041 if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
1042 return err
1043 }
1044 iNdEx = postIndex
1045 default:
1046 iNdEx = preIndex
1047 skippy, err := skipV3Lock(dAtA[iNdEx:])
1048 if err != nil {
1049 return err
1050 }
1051 if skippy < 0 {
1052 return ErrInvalidLengthV3Lock
1053 }
1054 if (iNdEx + skippy) < 0 {
1055 return ErrInvalidLengthV3Lock
1056 }
1057 if (iNdEx + skippy) > l {
1058 return io.ErrUnexpectedEOF
1059 }
1060 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
1061 iNdEx += skippy
1062 }
1063 }
1064
1065 if iNdEx > l {
1066 return io.ErrUnexpectedEOF
1067 }
1068 return nil
1069}
1070func skipV3Lock(dAtA []byte) (n int, err error) {
1071 l := len(dAtA)
1072 iNdEx := 0
1073 for iNdEx < l {
1074 var wire uint64
1075 for shift := uint(0); ; shift += 7 {
1076 if shift >= 64 {
1077 return 0, ErrIntOverflowV3Lock
1078 }
1079 if iNdEx >= l {
1080 return 0, io.ErrUnexpectedEOF
1081 }
1082 b := dAtA[iNdEx]
1083 iNdEx++
1084 wire |= (uint64(b) & 0x7F) << shift
1085 if b < 0x80 {
1086 break
1087 }
1088 }
1089 wireType := int(wire & 0x7)
1090 switch wireType {
1091 case 0:
1092 for shift := uint(0); ; shift += 7 {
1093 if shift >= 64 {
1094 return 0, ErrIntOverflowV3Lock
1095 }
1096 if iNdEx >= l {
1097 return 0, io.ErrUnexpectedEOF
1098 }
1099 iNdEx++
1100 if dAtA[iNdEx-1] < 0x80 {
1101 break
1102 }
1103 }
1104 return iNdEx, nil
1105 case 1:
1106 iNdEx += 8
1107 return iNdEx, nil
1108 case 2:
1109 var length int
1110 for shift := uint(0); ; shift += 7 {
1111 if shift >= 64 {
1112 return 0, ErrIntOverflowV3Lock
1113 }
1114 if iNdEx >= l {
1115 return 0, io.ErrUnexpectedEOF
1116 }
1117 b := dAtA[iNdEx]
1118 iNdEx++
1119 length |= (int(b) & 0x7F) << shift
1120 if b < 0x80 {
1121 break
1122 }
1123 }
1124 if length < 0 {
1125 return 0, ErrInvalidLengthV3Lock
1126 }
1127 iNdEx += length
1128 if iNdEx < 0 {
1129 return 0, ErrInvalidLengthV3Lock
1130 }
1131 return iNdEx, nil
1132 case 3:
1133 for {
1134 var innerWire uint64
1135 var start int = iNdEx
1136 for shift := uint(0); ; shift += 7 {
1137 if shift >= 64 {
1138 return 0, ErrIntOverflowV3Lock
1139 }
1140 if iNdEx >= l {
1141 return 0, io.ErrUnexpectedEOF
1142 }
1143 b := dAtA[iNdEx]
1144 iNdEx++
1145 innerWire |= (uint64(b) & 0x7F) << shift
1146 if b < 0x80 {
1147 break
1148 }
1149 }
1150 innerWireType := int(innerWire & 0x7)
1151 if innerWireType == 4 {
1152 break
1153 }
1154 next, err := skipV3Lock(dAtA[start:])
1155 if err != nil {
1156 return 0, err
1157 }
1158 iNdEx = start + next
1159 if iNdEx < 0 {
1160 return 0, ErrInvalidLengthV3Lock
1161 }
1162 }
1163 return iNdEx, nil
1164 case 4:
1165 return iNdEx, nil
1166 case 5:
1167 iNdEx += 4
1168 return iNdEx, nil
1169 default:
1170 return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
1171 }
1172 }
1173 panic("unreachable")
1174}
1175
1176var (
1177 ErrInvalidLengthV3Lock = fmt.Errorf("proto: negative length found during unmarshaling")
1178 ErrIntOverflowV3Lock = fmt.Errorf("proto: integer overflow")
1179)