package v3lockpb

import "go.etcd.io/etcd/server/v3/etcdserver/api/v3lock/v3lockpb"

Index

Constants

const (
	Lock_Lock_FullMethodName   = "/v3lockpb.Lock/Lock"
	Lock_Unlock_FullMethodName = "/v3lockpb.Lock/Unlock"
)

Variables

var File_v3lock_proto protoreflect.FileDescriptor
var Lock_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "v3lockpb.Lock",
	HandlerType: (*LockServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Lock",
			Handler:    _Lock_Lock_Handler,
		},
		{
			MethodName: "Unlock",
			Handler:    _Lock_Unlock_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "v3lock.proto",
}

Lock_ServiceDesc is the grpc.ServiceDesc for Lock service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterLockServer

func RegisterLockServer(s grpc.ServiceRegistrar, srv LockServer)

Types

type LockClient

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)
}

LockClient is the client API for Lock service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

The lock service exposes client-side locking facilities as a gRPC interface.

func NewLockClient

func NewLockClient(cc grpc.ClientConnInterface) LockClient

type LockRequest

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"`
	// contains filtered or unexported fields
}

func (*LockRequest) Descriptor

func (*LockRequest) Descriptor() ([]byte, []int)

Deprecated: Use LockRequest.ProtoReflect.Descriptor instead.

func (*LockRequest) GetLease

func (x *LockRequest) GetLease() int64

func (*LockRequest) GetName

func (x *LockRequest) GetName() []byte

func (*LockRequest) ProtoMessage

func (*LockRequest) ProtoMessage()

func (*LockRequest) ProtoReflect

func (x *LockRequest) ProtoReflect() protoreflect.Message

func (*LockRequest) Reset

func (x *LockRequest) Reset()

func (*LockRequest) String

func (x *LockRequest) String() string

type LockResponse

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"`
	// contains filtered or unexported fields
}

func (*LockResponse) Descriptor

func (*LockResponse) Descriptor() ([]byte, []int)

Deprecated: Use LockResponse.ProtoReflect.Descriptor instead.

func (*LockResponse) GetHeader

func (x *LockResponse) GetHeader() *etcdserverpb.ResponseHeader

func (*LockResponse) GetKey

func (x *LockResponse) GetKey() []byte

func (*LockResponse) ProtoMessage

func (*LockResponse) ProtoMessage()

func (*LockResponse) ProtoReflect

func (x *LockResponse) ProtoReflect() protoreflect.Message

func (*LockResponse) Reset

func (x *LockResponse) Reset()

func (*LockResponse) String

func (x *LockResponse) String() string

type LockServer

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)
	// contains filtered or unexported methods
}

LockServer is the server API for Lock service. All implementations must embed UnimplementedLockServer for forward compatibility.

The lock service exposes client-side locking facilities as a gRPC interface.

type UnimplementedLockServer

type UnimplementedLockServer struct{}

UnimplementedLockServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedLockServer) Lock

func (UnimplementedLockServer) Lock(context.Context, *LockRequest) (*LockResponse, error)

func (UnimplementedLockServer) Unlock

func (UnimplementedLockServer) Unlock(context.Context, *UnlockRequest) (*UnlockResponse, error)

type UnlockRequest

type UnlockRequest struct {

	// key is the lock ownership key granted by Lock.
	Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// contains filtered or unexported fields
}

func (*UnlockRequest) Descriptor

func (*UnlockRequest) Descriptor() ([]byte, []int)

Deprecated: Use UnlockRequest.ProtoReflect.Descriptor instead.

func (*UnlockRequest) GetKey

func (x *UnlockRequest) GetKey() []byte

func (*UnlockRequest) ProtoMessage

func (*UnlockRequest) ProtoMessage()

func (*UnlockRequest) ProtoReflect

func (x *UnlockRequest) ProtoReflect() protoreflect.Message

func (*UnlockRequest) Reset

func (x *UnlockRequest) Reset()

func (*UnlockRequest) String

func (x *UnlockRequest) String() string

type UnlockResponse

type UnlockResponse struct {
	Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
	// contains filtered or unexported fields
}

func (*UnlockResponse) Descriptor

func (*UnlockResponse) Descriptor() ([]byte, []int)

Deprecated: Use UnlockResponse.ProtoReflect.Descriptor instead.

func (*UnlockResponse) GetHeader

func (x *UnlockResponse) GetHeader() *etcdserverpb.ResponseHeader

func (*UnlockResponse) ProtoMessage

func (*UnlockResponse) ProtoMessage()

func (*UnlockResponse) ProtoReflect

func (x *UnlockResponse) ProtoReflect() protoreflect.Message

func (*UnlockResponse) Reset

func (x *UnlockResponse) Reset()

func (*UnlockResponse) String

func (x *UnlockResponse) String() string

type UnsafeLockServer

type UnsafeLockServer interface {
	// contains filtered or unexported methods
}

UnsafeLockServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to LockServer will result in compilation errors.

Source Files

v3lock.pb.go v3lock_grpc.pb.go

Directories

PathSynopsis
etcdserver/api/v3lock/v3lockpb/gwPackage v3lockpb is a reverse proxy.
Version
v3.7.1 (latest)
Published
Jul 23, 2026
Platform
linux/amd64
Imports
11 packages
Last checked
4 hours ago

Tools for package owners.