...

Source file src/go.etcd.io/etcd/server/v3/etcdserver/api/v3lock/v3lockpb/v3lock.pb.go

Documentation: go.etcd.io/etcd/server/v3/etcdserver/api/v3lock/v3lockpb

     1  // Code generated by protoc-gen-gogo. DO NOT EDIT.
     2  // source: v3lock.proto
     3  
     4  package v3lockpb
     5  
     6  import (
     7  	context "context"
     8  	fmt "fmt"
     9  	io "io"
    10  	math "math"
    11  	math_bits "math/bits"
    12  
    13  	_ "github.com/gogo/protobuf/gogoproto"
    14  	proto "github.com/golang/protobuf/proto"
    15  	etcdserverpb "go.etcd.io/etcd/api/v3/etcdserverpb"
    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.
    23  var _ = proto.Marshal
    24  var _ = fmt.Errorf
    25  var _ = 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.
    31  const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
    32  
    33  type 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 acquisition; 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  
    47  func (m *LockRequest) Reset()         { *m = LockRequest{} }
    48  func (m *LockRequest) String() string { return proto.CompactTextString(m) }
    49  func (*LockRequest) ProtoMessage()    {}
    50  func (*LockRequest) Descriptor() ([]byte, []int) {
    51  	return fileDescriptor_52389b3e2f253201, []int{0}
    52  }
    53  func (m *LockRequest) XXX_Unmarshal(b []byte) error {
    54  	return m.Unmarshal(b)
    55  }
    56  func (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  }
    68  func (m *LockRequest) XXX_Merge(src proto.Message) {
    69  	xxx_messageInfo_LockRequest.Merge(m, src)
    70  }
    71  func (m *LockRequest) XXX_Size() int {
    72  	return m.Size()
    73  }
    74  func (m *LockRequest) XXX_DiscardUnknown() {
    75  	xxx_messageInfo_LockRequest.DiscardUnknown(m)
    76  }
    77  
    78  var xxx_messageInfo_LockRequest proto.InternalMessageInfo
    79  
    80  func (m *LockRequest) GetName() []byte {
    81  	if m != nil {
    82  		return m.Name
    83  	}
    84  	return nil
    85  }
    86  
    87  func (m *LockRequest) GetLease() int64 {
    88  	if m != nil {
    89  		return m.Lease
    90  	}
    91  	return 0
    92  }
    93  
    94  type 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  
   105  func (m *LockResponse) Reset()         { *m = LockResponse{} }
   106  func (m *LockResponse) String() string { return proto.CompactTextString(m) }
   107  func (*LockResponse) ProtoMessage()    {}
   108  func (*LockResponse) Descriptor() ([]byte, []int) {
   109  	return fileDescriptor_52389b3e2f253201, []int{1}
   110  }
   111  func (m *LockResponse) XXX_Unmarshal(b []byte) error {
   112  	return m.Unmarshal(b)
   113  }
   114  func (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  }
   126  func (m *LockResponse) XXX_Merge(src proto.Message) {
   127  	xxx_messageInfo_LockResponse.Merge(m, src)
   128  }
   129  func (m *LockResponse) XXX_Size() int {
   130  	return m.Size()
   131  }
   132  func (m *LockResponse) XXX_DiscardUnknown() {
   133  	xxx_messageInfo_LockResponse.DiscardUnknown(m)
   134  }
   135  
   136  var xxx_messageInfo_LockResponse proto.InternalMessageInfo
   137  
   138  func (m *LockResponse) GetHeader() *etcdserverpb.ResponseHeader {
   139  	if m != nil {
   140  		return m.Header
   141  	}
   142  	return nil
   143  }
   144  
   145  func (m *LockResponse) GetKey() []byte {
   146  	if m != nil {
   147  		return m.Key
   148  	}
   149  	return nil
   150  }
   151  
   152  type 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  
   160  func (m *UnlockRequest) Reset()         { *m = UnlockRequest{} }
   161  func (m *UnlockRequest) String() string { return proto.CompactTextString(m) }
   162  func (*UnlockRequest) ProtoMessage()    {}
   163  func (*UnlockRequest) Descriptor() ([]byte, []int) {
   164  	return fileDescriptor_52389b3e2f253201, []int{2}
   165  }
   166  func (m *UnlockRequest) XXX_Unmarshal(b []byte) error {
   167  	return m.Unmarshal(b)
   168  }
   169  func (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  }
   181  func (m *UnlockRequest) XXX_Merge(src proto.Message) {
   182  	xxx_messageInfo_UnlockRequest.Merge(m, src)
   183  }
   184  func (m *UnlockRequest) XXX_Size() int {
   185  	return m.Size()
   186  }
   187  func (m *UnlockRequest) XXX_DiscardUnknown() {
   188  	xxx_messageInfo_UnlockRequest.DiscardUnknown(m)
   189  }
   190  
   191  var xxx_messageInfo_UnlockRequest proto.InternalMessageInfo
   192  
   193  func (m *UnlockRequest) GetKey() []byte {
   194  	if m != nil {
   195  		return m.Key
   196  	}
   197  	return nil
   198  }
   199  
   200  type 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  
   207  func (m *UnlockResponse) Reset()         { *m = UnlockResponse{} }
   208  func (m *UnlockResponse) String() string { return proto.CompactTextString(m) }
   209  func (*UnlockResponse) ProtoMessage()    {}
   210  func (*UnlockResponse) Descriptor() ([]byte, []int) {
   211  	return fileDescriptor_52389b3e2f253201, []int{3}
   212  }
   213  func (m *UnlockResponse) XXX_Unmarshal(b []byte) error {
   214  	return m.Unmarshal(b)
   215  }
   216  func (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  }
   228  func (m *UnlockResponse) XXX_Merge(src proto.Message) {
   229  	xxx_messageInfo_UnlockResponse.Merge(m, src)
   230  }
   231  func (m *UnlockResponse) XXX_Size() int {
   232  	return m.Size()
   233  }
   234  func (m *UnlockResponse) XXX_DiscardUnknown() {
   235  	xxx_messageInfo_UnlockResponse.DiscardUnknown(m)
   236  }
   237  
   238  var xxx_messageInfo_UnlockResponse proto.InternalMessageInfo
   239  
   240  func (m *UnlockResponse) GetHeader() *etcdserverpb.ResponseHeader {
   241  	if m != nil {
   242  		return m.Header
   243  	}
   244  	return nil
   245  }
   246  
   247  func 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  
   254  func init() { proto.RegisterFile("v3lock.proto", fileDescriptor_52389b3e2f253201) }
   255  
   256  var fileDescriptor_52389b3e2f253201 = []byte{
   257  	// 330 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, 0x3e, 0xb5, 0x24, 0x39,
   261  	0x45, 0x3f, 0xb1, 0x20, 0x53, 0x1f, 0xc4, 0x28, 0x4e, 0x2d, 0x2a, 0x4b, 0x2d, 0x2a, 0x48, 0xd2,
   262  	0x2f, 0x2a, 0x48, 0x86, 0x2a, 0x90, 0x49, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0x05, 0x2b, 0x49, 0xcc,
   263  	0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0x86, 0xc8, 0x2a, 0x99, 0x73, 0x71, 0xfb,
   264  	0xe4, 0x27, 0x67, 0x07, 0xa5, 0x16, 0x96, 0xa6, 0x16, 0x97, 0x08, 0x09, 0x71, 0xb1, 0xe4, 0x25,
   265  	0xe6, 0xa6, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x04, 0x81, 0xd9, 0x42, 0x22, 0x5c, 0xac, 0x39,
   266  	0xa9, 0x89, 0xc5, 0xa9, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xcc, 0x41, 0x10, 0x8e, 0x52, 0x18, 0x17,
   267  	0x0f, 0x44, 0x63, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0x90, 0x09, 0x17, 0x5b, 0x46, 0x6a, 0x62,
   268  	0x4a, 0x6a, 0x11, 0x58, 0x2f, 0xb7, 0x91, 0x8c, 0x1e, 0xb2, 0x7b, 0xf4, 0x60, 0xea, 0x3c, 0xc0,
   269  	0x6a, 0x82, 0xa0, 0x6a, 0x85, 0x04, 0xb8, 0x98, 0xb3, 0x53, 0x2b, 0xc1, 0x26, 0xf3, 0x04, 0x81,
   270  	0x98, 0x4a, 0x8a, 0x5c, 0xbc, 0xa1, 0x79, 0x39, 0x48, 0x4e, 0x82, 0x2a, 0x61, 0x44, 0x28, 0x71,
   271  	0xe3, 0xe2, 0x83, 0x29, 0xa1, 0xc4, 0x72, 0xa3, 0x0d, 0x8c, 0x5c, 0x2c, 0x20, 0x3f, 0x08, 0xf9,
   272  	0x43, 0x69, 0x51, 0x3d, 0x58, 0x60, 0xeb, 0x21, 0x05, 0x8a, 0x94, 0x18, 0xba, 0x30, 0xc4, 0x34,
   273  	0x25, 0x89, 0xa6, 0xcb, 0x4f, 0x26, 0x33, 0x09, 0x29, 0xf1, 0xea, 0x97, 0x19, 0xeb, 0x83, 0x14,
   274  	0x80, 0x09, 0x2b, 0x46, 0x2d, 0xa1, 0x70, 0x2e, 0x36, 0x88, 0x0b, 0x85, 0xc4, 0x11, 0x7a, 0x51,
   275  	0xbc, 0x25, 0x25, 0x81, 0x29, 0x01, 0x35, 0x56, 0x0a, 0x6c, 0xac, 0x88, 0x12, 0x3f, 0xdc, 0xd8,
   276  	0xd2, 0x3c, 0xa8, 0xc1, 0x4e, 0x02, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0,
   277  	0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x49, 0x6c, 0xe0, 0x78, 0x34, 0x06, 0x04, 0x00, 0x00,
   278  	0xff, 0xff, 0x4a, 0x4d, 0xca, 0xbb, 0x36, 0x02, 0x00, 0x00,
   279  }
   280  
   281  // Reference imports to suppress errors if they are not otherwise used.
   282  var _ context.Context
   283  var _ 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.
   287  const _ = 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.
   292  type 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  
   306  type lockClient struct {
   307  	cc *grpc.ClientConn
   308  }
   309  
   310  func NewLockClient(cc *grpc.ClientConn) LockClient {
   311  	return &lockClient{cc}
   312  }
   313  
   314  func (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  
   323  func (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.
   333  type 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.
   348  type UnimplementedLockServer struct {
   349  }
   350  
   351  func (*UnimplementedLockServer) Lock(ctx context.Context, req *LockRequest) (*LockResponse, error) {
   352  	return nil, status.Errorf(codes.Unimplemented, "method Lock not implemented")
   353  }
   354  func (*UnimplementedLockServer) Unlock(ctx context.Context, req *UnlockRequest) (*UnlockResponse, error) {
   355  	return nil, status.Errorf(codes.Unimplemented, "method Unlock not implemented")
   356  }
   357  
   358  func RegisterLockServer(s *grpc.Server, srv LockServer) {
   359  	s.RegisterService(&_Lock_serviceDesc, srv)
   360  }
   361  
   362  func _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  
   380  func _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  
   398  var _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  
   415  func (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  
   425  func (m *LockRequest) MarshalTo(dAtA []byte) (int, error) {
   426  	size := m.Size()
   427  	return m.MarshalToSizedBuffer(dAtA[:size])
   428  }
   429  
   430  func (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  
   454  func (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  
   464  func (m *LockResponse) MarshalTo(dAtA []byte) (int, error) {
   465  	size := m.Size()
   466  	return m.MarshalToSizedBuffer(dAtA[:size])
   467  }
   468  
   469  func (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  
   500  func (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  
   510  func (m *UnlockRequest) MarshalTo(dAtA []byte) (int, error) {
   511  	size := m.Size()
   512  	return m.MarshalToSizedBuffer(dAtA[:size])
   513  }
   514  
   515  func (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  
   534  func (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  
   544  func (m *UnlockResponse) MarshalTo(dAtA []byte) (int, error) {
   545  	size := m.Size()
   546  	return m.MarshalToSizedBuffer(dAtA[:size])
   547  }
   548  
   549  func (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  
   573  func 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  }
   584  func (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  
   603  func (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  
   623  func (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  
   639  func (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  
   655  func sovV3Lock(x uint64) (n int) {
   656  	return (math_bits.Len64(x|1) + 6) / 7
   657  }
   658  func sozV3Lock(x uint64) (n int) {
   659  	return sovV3Lock(uint64((x << 1) ^ uint64((int64(x) >> 63))))
   660  }
   661  func (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) || (iNdEx+skippy) < 0 {
   750  				return ErrInvalidLengthV3Lock
   751  			}
   752  			if (iNdEx + skippy) > l {
   753  				return io.ErrUnexpectedEOF
   754  			}
   755  			m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
   756  			iNdEx += skippy
   757  		}
   758  	}
   759  
   760  	if iNdEx > l {
   761  		return io.ErrUnexpectedEOF
   762  	}
   763  	return nil
   764  }
   765  func (m *LockResponse) Unmarshal(dAtA []byte) error {
   766  	l := len(dAtA)
   767  	iNdEx := 0
   768  	for iNdEx < l {
   769  		preIndex := iNdEx
   770  		var wire uint64
   771  		for shift := uint(0); ; shift += 7 {
   772  			if shift >= 64 {
   773  				return ErrIntOverflowV3Lock
   774  			}
   775  			if iNdEx >= l {
   776  				return io.ErrUnexpectedEOF
   777  			}
   778  			b := dAtA[iNdEx]
   779  			iNdEx++
   780  			wire |= uint64(b&0x7F) << shift
   781  			if b < 0x80 {
   782  				break
   783  			}
   784  		}
   785  		fieldNum := int32(wire >> 3)
   786  		wireType := int(wire & 0x7)
   787  		if wireType == 4 {
   788  			return fmt.Errorf("proto: LockResponse: wiretype end group for non-group")
   789  		}
   790  		if fieldNum <= 0 {
   791  			return fmt.Errorf("proto: LockResponse: illegal tag %d (wire type %d)", fieldNum, wire)
   792  		}
   793  		switch fieldNum {
   794  		case 1:
   795  			if wireType != 2 {
   796  				return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
   797  			}
   798  			var msglen int
   799  			for shift := uint(0); ; shift += 7 {
   800  				if shift >= 64 {
   801  					return ErrIntOverflowV3Lock
   802  				}
   803  				if iNdEx >= l {
   804  					return io.ErrUnexpectedEOF
   805  				}
   806  				b := dAtA[iNdEx]
   807  				iNdEx++
   808  				msglen |= int(b&0x7F) << shift
   809  				if b < 0x80 {
   810  					break
   811  				}
   812  			}
   813  			if msglen < 0 {
   814  				return ErrInvalidLengthV3Lock
   815  			}
   816  			postIndex := iNdEx + msglen
   817  			if postIndex < 0 {
   818  				return ErrInvalidLengthV3Lock
   819  			}
   820  			if postIndex > l {
   821  				return io.ErrUnexpectedEOF
   822  			}
   823  			if m.Header == nil {
   824  				m.Header = &etcdserverpb.ResponseHeader{}
   825  			}
   826  			if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
   827  				return err
   828  			}
   829  			iNdEx = postIndex
   830  		case 2:
   831  			if wireType != 2 {
   832  				return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
   833  			}
   834  			var byteLen int
   835  			for shift := uint(0); ; shift += 7 {
   836  				if shift >= 64 {
   837  					return ErrIntOverflowV3Lock
   838  				}
   839  				if iNdEx >= l {
   840  					return io.ErrUnexpectedEOF
   841  				}
   842  				b := dAtA[iNdEx]
   843  				iNdEx++
   844  				byteLen |= int(b&0x7F) << shift
   845  				if b < 0x80 {
   846  					break
   847  				}
   848  			}
   849  			if byteLen < 0 {
   850  				return ErrInvalidLengthV3Lock
   851  			}
   852  			postIndex := iNdEx + byteLen
   853  			if postIndex < 0 {
   854  				return ErrInvalidLengthV3Lock
   855  			}
   856  			if postIndex > l {
   857  				return io.ErrUnexpectedEOF
   858  			}
   859  			m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...)
   860  			if m.Key == nil {
   861  				m.Key = []byte{}
   862  			}
   863  			iNdEx = postIndex
   864  		default:
   865  			iNdEx = preIndex
   866  			skippy, err := skipV3Lock(dAtA[iNdEx:])
   867  			if err != nil {
   868  				return err
   869  			}
   870  			if (skippy < 0) || (iNdEx+skippy) < 0 {
   871  				return ErrInvalidLengthV3Lock
   872  			}
   873  			if (iNdEx + skippy) > l {
   874  				return io.ErrUnexpectedEOF
   875  			}
   876  			m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
   877  			iNdEx += skippy
   878  		}
   879  	}
   880  
   881  	if iNdEx > l {
   882  		return io.ErrUnexpectedEOF
   883  	}
   884  	return nil
   885  }
   886  func (m *UnlockRequest) Unmarshal(dAtA []byte) error {
   887  	l := len(dAtA)
   888  	iNdEx := 0
   889  	for iNdEx < l {
   890  		preIndex := iNdEx
   891  		var wire uint64
   892  		for shift := uint(0); ; shift += 7 {
   893  			if shift >= 64 {
   894  				return ErrIntOverflowV3Lock
   895  			}
   896  			if iNdEx >= l {
   897  				return io.ErrUnexpectedEOF
   898  			}
   899  			b := dAtA[iNdEx]
   900  			iNdEx++
   901  			wire |= uint64(b&0x7F) << shift
   902  			if b < 0x80 {
   903  				break
   904  			}
   905  		}
   906  		fieldNum := int32(wire >> 3)
   907  		wireType := int(wire & 0x7)
   908  		if wireType == 4 {
   909  			return fmt.Errorf("proto: UnlockRequest: wiretype end group for non-group")
   910  		}
   911  		if fieldNum <= 0 {
   912  			return fmt.Errorf("proto: UnlockRequest: illegal tag %d (wire type %d)", fieldNum, wire)
   913  		}
   914  		switch fieldNum {
   915  		case 1:
   916  			if wireType != 2 {
   917  				return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
   918  			}
   919  			var byteLen int
   920  			for shift := uint(0); ; shift += 7 {
   921  				if shift >= 64 {
   922  					return ErrIntOverflowV3Lock
   923  				}
   924  				if iNdEx >= l {
   925  					return io.ErrUnexpectedEOF
   926  				}
   927  				b := dAtA[iNdEx]
   928  				iNdEx++
   929  				byteLen |= int(b&0x7F) << shift
   930  				if b < 0x80 {
   931  					break
   932  				}
   933  			}
   934  			if byteLen < 0 {
   935  				return ErrInvalidLengthV3Lock
   936  			}
   937  			postIndex := iNdEx + byteLen
   938  			if postIndex < 0 {
   939  				return ErrInvalidLengthV3Lock
   940  			}
   941  			if postIndex > l {
   942  				return io.ErrUnexpectedEOF
   943  			}
   944  			m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...)
   945  			if m.Key == nil {
   946  				m.Key = []byte{}
   947  			}
   948  			iNdEx = postIndex
   949  		default:
   950  			iNdEx = preIndex
   951  			skippy, err := skipV3Lock(dAtA[iNdEx:])
   952  			if err != nil {
   953  				return err
   954  			}
   955  			if (skippy < 0) || (iNdEx+skippy) < 0 {
   956  				return ErrInvalidLengthV3Lock
   957  			}
   958  			if (iNdEx + skippy) > l {
   959  				return io.ErrUnexpectedEOF
   960  			}
   961  			m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
   962  			iNdEx += skippy
   963  		}
   964  	}
   965  
   966  	if iNdEx > l {
   967  		return io.ErrUnexpectedEOF
   968  	}
   969  	return nil
   970  }
   971  func (m *UnlockResponse) Unmarshal(dAtA []byte) error {
   972  	l := len(dAtA)
   973  	iNdEx := 0
   974  	for iNdEx < l {
   975  		preIndex := iNdEx
   976  		var wire uint64
   977  		for shift := uint(0); ; shift += 7 {
   978  			if shift >= 64 {
   979  				return ErrIntOverflowV3Lock
   980  			}
   981  			if iNdEx >= l {
   982  				return io.ErrUnexpectedEOF
   983  			}
   984  			b := dAtA[iNdEx]
   985  			iNdEx++
   986  			wire |= uint64(b&0x7F) << shift
   987  			if b < 0x80 {
   988  				break
   989  			}
   990  		}
   991  		fieldNum := int32(wire >> 3)
   992  		wireType := int(wire & 0x7)
   993  		if wireType == 4 {
   994  			return fmt.Errorf("proto: UnlockResponse: wiretype end group for non-group")
   995  		}
   996  		if fieldNum <= 0 {
   997  			return fmt.Errorf("proto: UnlockResponse: illegal tag %d (wire type %d)", fieldNum, wire)
   998  		}
   999  		switch fieldNum {
  1000  		case 1:
  1001  			if wireType != 2 {
  1002  				return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
  1003  			}
  1004  			var msglen int
  1005  			for shift := uint(0); ; shift += 7 {
  1006  				if shift >= 64 {
  1007  					return ErrIntOverflowV3Lock
  1008  				}
  1009  				if iNdEx >= l {
  1010  					return io.ErrUnexpectedEOF
  1011  				}
  1012  				b := dAtA[iNdEx]
  1013  				iNdEx++
  1014  				msglen |= int(b&0x7F) << shift
  1015  				if b < 0x80 {
  1016  					break
  1017  				}
  1018  			}
  1019  			if msglen < 0 {
  1020  				return ErrInvalidLengthV3Lock
  1021  			}
  1022  			postIndex := iNdEx + msglen
  1023  			if postIndex < 0 {
  1024  				return ErrInvalidLengthV3Lock
  1025  			}
  1026  			if postIndex > l {
  1027  				return io.ErrUnexpectedEOF
  1028  			}
  1029  			if m.Header == nil {
  1030  				m.Header = &etcdserverpb.ResponseHeader{}
  1031  			}
  1032  			if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  1033  				return err
  1034  			}
  1035  			iNdEx = postIndex
  1036  		default:
  1037  			iNdEx = preIndex
  1038  			skippy, err := skipV3Lock(dAtA[iNdEx:])
  1039  			if err != nil {
  1040  				return err
  1041  			}
  1042  			if (skippy < 0) || (iNdEx+skippy) < 0 {
  1043  				return ErrInvalidLengthV3Lock
  1044  			}
  1045  			if (iNdEx + skippy) > l {
  1046  				return io.ErrUnexpectedEOF
  1047  			}
  1048  			m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
  1049  			iNdEx += skippy
  1050  		}
  1051  	}
  1052  
  1053  	if iNdEx > l {
  1054  		return io.ErrUnexpectedEOF
  1055  	}
  1056  	return nil
  1057  }
  1058  func skipV3Lock(dAtA []byte) (n int, err error) {
  1059  	l := len(dAtA)
  1060  	iNdEx := 0
  1061  	depth := 0
  1062  	for iNdEx < l {
  1063  		var wire uint64
  1064  		for shift := uint(0); ; shift += 7 {
  1065  			if shift >= 64 {
  1066  				return 0, ErrIntOverflowV3Lock
  1067  			}
  1068  			if iNdEx >= l {
  1069  				return 0, io.ErrUnexpectedEOF
  1070  			}
  1071  			b := dAtA[iNdEx]
  1072  			iNdEx++
  1073  			wire |= (uint64(b) & 0x7F) << shift
  1074  			if b < 0x80 {
  1075  				break
  1076  			}
  1077  		}
  1078  		wireType := int(wire & 0x7)
  1079  		switch wireType {
  1080  		case 0:
  1081  			for shift := uint(0); ; shift += 7 {
  1082  				if shift >= 64 {
  1083  					return 0, ErrIntOverflowV3Lock
  1084  				}
  1085  				if iNdEx >= l {
  1086  					return 0, io.ErrUnexpectedEOF
  1087  				}
  1088  				iNdEx++
  1089  				if dAtA[iNdEx-1] < 0x80 {
  1090  					break
  1091  				}
  1092  			}
  1093  		case 1:
  1094  			iNdEx += 8
  1095  		case 2:
  1096  			var length int
  1097  			for shift := uint(0); ; shift += 7 {
  1098  				if shift >= 64 {
  1099  					return 0, ErrIntOverflowV3Lock
  1100  				}
  1101  				if iNdEx >= l {
  1102  					return 0, io.ErrUnexpectedEOF
  1103  				}
  1104  				b := dAtA[iNdEx]
  1105  				iNdEx++
  1106  				length |= (int(b) & 0x7F) << shift
  1107  				if b < 0x80 {
  1108  					break
  1109  				}
  1110  			}
  1111  			if length < 0 {
  1112  				return 0, ErrInvalidLengthV3Lock
  1113  			}
  1114  			iNdEx += length
  1115  		case 3:
  1116  			depth++
  1117  		case 4:
  1118  			if depth == 0 {
  1119  				return 0, ErrUnexpectedEndOfGroupV3Lock
  1120  			}
  1121  			depth--
  1122  		case 5:
  1123  			iNdEx += 4
  1124  		default:
  1125  			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  1126  		}
  1127  		if iNdEx < 0 {
  1128  			return 0, ErrInvalidLengthV3Lock
  1129  		}
  1130  		if depth == 0 {
  1131  			return iNdEx, nil
  1132  		}
  1133  	}
  1134  	return 0, io.ErrUnexpectedEOF
  1135  }
  1136  
  1137  var (
  1138  	ErrInvalidLengthV3Lock        = fmt.Errorf("proto: negative length found during unmarshaling")
  1139  	ErrIntOverflowV3Lock          = fmt.Errorf("proto: integer overflow")
  1140  	ErrUnexpectedEndOfGroupV3Lock = fmt.Errorf("proto: unexpected end of group")
  1141  )
  1142  

View as plain text