var ( ErrInvalidLengthV3Lock = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowV3Lock = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupV3Lock = fmt.Errorf("proto: unexpected end of group") )
func RegisterLockServer(s *grpc.Server, srv LockServer)
LockClient is the client API for Lock service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type LockClient interface { // Lock acquires a distributed shared lock on a given named lock. // On success, it will return a unique key that exists so long as the // lock is held by the caller. This key can be used in conjunction with // transactions to safely ensure updates to etcd only occur while holding // lock ownership. The lock is held until Unlock is called on the key or the // lease associate with the owner expires. Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error) // Unlock takes a key returned by Lock and releases the hold on lock. The // next Lock caller waiting for the lock will then be woken up and given // ownership of the lock. Unlock(ctx context.Context, in *UnlockRequest, opts ...grpc.CallOption) (*UnlockResponse, error) }
func NewLockClient(cc *grpc.ClientConn) LockClient
type LockRequest struct { // name is the identifier for the distributed shared lock to be acquired. Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // lease is the ID of the lease that will be attached to ownership of the // lock. If the lease expires or is revoked and currently holds the lock, // the lock is automatically released. Calls to Lock with the same lease will // be treated as a single acquisition; locking twice with the same lease is a // no-op. Lease int64 `protobuf:"varint,2,opt,name=lease,proto3" json:"lease,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*LockRequest) Descriptor() ([]byte, []int)
func (m *LockRequest) GetLease() int64
func (m *LockRequest) GetName() []byte
func (m *LockRequest) Marshal() (dAtA []byte, err error)
func (m *LockRequest) MarshalTo(dAtA []byte) (int, error)
func (m *LockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*LockRequest) ProtoMessage()
func (m *LockRequest) Reset()
func (m *LockRequest) Size() (n int)
func (m *LockRequest) String() string
func (m *LockRequest) Unmarshal(dAtA []byte) error
func (m *LockRequest) XXX_DiscardUnknown()
func (m *LockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (m *LockRequest) XXX_Merge(src proto.Message)
func (m *LockRequest) XXX_Size() int
func (m *LockRequest) XXX_Unmarshal(b []byte) error
type LockResponse struct { Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // key is a key that will exist on etcd for the duration that the Lock caller // owns the lock. Users should not modify this key or the lock may exhibit // undefined behavior. Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*LockResponse) Descriptor() ([]byte, []int)
func (m *LockResponse) GetHeader() *etcdserverpb.ResponseHeader
func (m *LockResponse) GetKey() []byte
func (m *LockResponse) Marshal() (dAtA []byte, err error)
func (m *LockResponse) MarshalTo(dAtA []byte) (int, error)
func (m *LockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*LockResponse) ProtoMessage()
func (m *LockResponse) Reset()
func (m *LockResponse) Size() (n int)
func (m *LockResponse) String() string
func (m *LockResponse) Unmarshal(dAtA []byte) error
func (m *LockResponse) XXX_DiscardUnknown()
func (m *LockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (m *LockResponse) XXX_Merge(src proto.Message)
func (m *LockResponse) XXX_Size() int
func (m *LockResponse) XXX_Unmarshal(b []byte) error
LockServer is the server API for Lock service.
type LockServer interface { // Lock acquires a distributed shared lock on a given named lock. // On success, it will return a unique key that exists so long as the // lock is held by the caller. This key can be used in conjunction with // transactions to safely ensure updates to etcd only occur while holding // lock ownership. The lock is held until Unlock is called on the key or the // lease associate with the owner expires. Lock(context.Context, *LockRequest) (*LockResponse, error) // Unlock takes a key returned by Lock and releases the hold on lock. The // next Lock caller waiting for the lock will then be woken up and given // ownership of the lock. Unlock(context.Context, *UnlockRequest) (*UnlockResponse, error) }
UnimplementedLockServer can be embedded to have forward compatible implementations.
type UnimplementedLockServer struct { }
func (*UnimplementedLockServer) Lock(ctx context.Context, req *LockRequest) (*LockResponse, error)
func (*UnimplementedLockServer) Unlock(ctx context.Context, req *UnlockRequest) (*UnlockResponse, error)
type UnlockRequest struct { // key is the lock ownership key granted by Lock. Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*UnlockRequest) Descriptor() ([]byte, []int)
func (m *UnlockRequest) GetKey() []byte
func (m *UnlockRequest) Marshal() (dAtA []byte, err error)
func (m *UnlockRequest) MarshalTo(dAtA []byte) (int, error)
func (m *UnlockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*UnlockRequest) ProtoMessage()
func (m *UnlockRequest) Reset()
func (m *UnlockRequest) Size() (n int)
func (m *UnlockRequest) String() string
func (m *UnlockRequest) Unmarshal(dAtA []byte) error
func (m *UnlockRequest) XXX_DiscardUnknown()
func (m *UnlockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (m *UnlockRequest) XXX_Merge(src proto.Message)
func (m *UnlockRequest) XXX_Size() int
func (m *UnlockRequest) XXX_Unmarshal(b []byte) error
type UnlockResponse struct { Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*UnlockResponse) Descriptor() ([]byte, []int)
func (m *UnlockResponse) GetHeader() *etcdserverpb.ResponseHeader
func (m *UnlockResponse) Marshal() (dAtA []byte, err error)
func (m *UnlockResponse) MarshalTo(dAtA []byte) (int, error)
func (m *UnlockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*UnlockResponse) ProtoMessage()
func (m *UnlockResponse) Reset()
func (m *UnlockResponse) Size() (n int)
func (m *UnlockResponse) String() string
func (m *UnlockResponse) Unmarshal(dAtA []byte) error
func (m *UnlockResponse) XXX_DiscardUnknown()
func (m *UnlockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (m *UnlockResponse) XXX_Merge(src proto.Message)
func (m *UnlockResponse) XXX_Size() int
func (m *UnlockResponse) XXX_Unmarshal(b []byte) error