// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.6.2 // - protoc v7.34.1 // source: waymaker_locks.proto package waymaker import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.64.0 or later. const _ = grpc.SupportPackageIsVersion9 const ( WaymakerService_Lock_FullMethodName = "/waymaker.WaymakerService/Lock" WaymakerService_ReadLock_FullMethodName = "/waymaker.WaymakerService/ReadLock" WaymakerService_UnLock_FullMethodName = "/waymaker.WaymakerService/UnLock" WaymakerService_LeaseStatus_FullMethodName = "/waymaker.WaymakerService/LeaseStatus" WaymakerService_ExtendLease_FullMethodName = "/waymaker.WaymakerService/ExtendLease" WaymakerService_MultiLock_FullMethodName = "/waymaker.WaymakerService/MultiLock" WaymakerService_ListAcquiredLocks_FullMethodName = "/waymaker.WaymakerService/ListAcquiredLocks" ) // WaymakerServiceClient is the client API for WaymakerService 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. // // WaymakerService defines a gRPC service for managing distributed locks. type WaymakerServiceClient interface { // Lock attempts to acquire a lock based on the provided LockRequest. // The response is a stream of LockEvent messages that provide updates // on the status of the lock acquisition. Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[LockEvent], error) // ReadLock attempts to acquire a read lock, which allows multiple readers // but no writers to hold the lock simultaneously. The response is a stream // of LockEvent messages that provide updates on the status of the lock acquisition. ReadLock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[LockEvent], error) // UnLock releases a previously acquired lock based on the provided UnLockRequest. // The response is an UnLockResponse indicating the success or failure of the operation. UnLock(ctx context.Context, in *UnLockRequest, opts ...grpc.CallOption) (*UnLockResponse, error) // LeaseStatus retrieves the current status of a lock lease based on the provided // LeaseStatusRequest. The response is a LeaseStatusResponse containing details // about the lease. LeaseStatus(ctx context.Context, in *LeaseStatusRequest, opts ...grpc.CallOption) (*LeaseStatusResponse, error) // ExtendLease extends the lease of an already acquired lock based on the provided // ExtendLeaseRequest. The response is an ExtendLeaseResponse indicating the success // or failure of the operation and the updated lease information. ExtendLease(ctx context.Context, in *ExtendLeaseRequest, opts ...grpc.CallOption) (*ExtendLeaseResponse, error) // MultiLock acquires N locks atomically — all keys are granted or none are. // The server sorts keys lexicographically to guarantee deadlock-free // ordering between any two MultiLock callers (without this, callers asking // for (k1,k2) and (k2,k1) could deadlock under contention). `max_wait_period` // applies to the whole batch as a single deadline, not per key. On any // failure the server releases every key it already acquired in this batch // before returning. Returns a unary response — no streaming. MultiLock(ctx context.Context, in *MultiLockRequest, opts ...grpc.CallOption) (*MultiLockResponse, error) // ListAcquiredLocks returns every lock CURRENTLY HELD on the node serving the // request (the node that owns each key via the consistent-hash ring). It is a // read-only operator/introspection surface (waymaker-ctl `locks list`); it does // NOT include waiters. An optional `key_prefix` filters the result server-side. // In a multi-node cluster, call it on each node to see the full picture, since // each node only holds the locks for the keys it owns. ListAcquiredLocks(ctx context.Context, in *ListAcquiredLocksRequest, opts ...grpc.CallOption) (*ListAcquiredLocksResponse, error) } type waymakerServiceClient struct { cc grpc.ClientConnInterface } func NewWaymakerServiceClient(cc grpc.ClientConnInterface) WaymakerServiceClient { return &waymakerServiceClient{cc} } func (c *waymakerServiceClient) Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[LockEvent], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &WaymakerService_ServiceDesc.Streams[0], WaymakerService_Lock_FullMethodName, cOpts...) if err != nil { return nil, err } x := &grpc.GenericClientStream[LockRequest, LockEvent]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } if err := x.ClientStream.CloseSend(); err != nil { return nil, err } return x, nil } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type WaymakerService_LockClient = grpc.ServerStreamingClient[LockEvent] func (c *waymakerServiceClient) ReadLock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[LockEvent], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &WaymakerService_ServiceDesc.Streams[1], WaymakerService_ReadLock_FullMethodName, cOpts...) if err != nil { return nil, err } x := &grpc.GenericClientStream[LockRequest, LockEvent]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } if err := x.ClientStream.CloseSend(); err != nil { return nil, err } return x, nil } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type WaymakerService_ReadLockClient = grpc.ServerStreamingClient[LockEvent] func (c *waymakerServiceClient) UnLock(ctx context.Context, in *UnLockRequest, opts ...grpc.CallOption) (*UnLockResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(UnLockResponse) err := c.cc.Invoke(ctx, WaymakerService_UnLock_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *waymakerServiceClient) LeaseStatus(ctx context.Context, in *LeaseStatusRequest, opts ...grpc.CallOption) (*LeaseStatusResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(LeaseStatusResponse) err := c.cc.Invoke(ctx, WaymakerService_LeaseStatus_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *waymakerServiceClient) ExtendLease(ctx context.Context, in *ExtendLeaseRequest, opts ...grpc.CallOption) (*ExtendLeaseResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ExtendLeaseResponse) err := c.cc.Invoke(ctx, WaymakerService_ExtendLease_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *waymakerServiceClient) MultiLock(ctx context.Context, in *MultiLockRequest, opts ...grpc.CallOption) (*MultiLockResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(MultiLockResponse) err := c.cc.Invoke(ctx, WaymakerService_MultiLock_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *waymakerServiceClient) ListAcquiredLocks(ctx context.Context, in *ListAcquiredLocksRequest, opts ...grpc.CallOption) (*ListAcquiredLocksResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ListAcquiredLocksResponse) err := c.cc.Invoke(ctx, WaymakerService_ListAcquiredLocks_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } // WaymakerServiceServer is the server API for WaymakerService service. // All implementations must embed UnimplementedWaymakerServiceServer // for forward compatibility. // // WaymakerService defines a gRPC service for managing distributed locks. type WaymakerServiceServer interface { // Lock attempts to acquire a lock based on the provided LockRequest. // The response is a stream of LockEvent messages that provide updates // on the status of the lock acquisition. Lock(*LockRequest, grpc.ServerStreamingServer[LockEvent]) error // ReadLock attempts to acquire a read lock, which allows multiple readers // but no writers to hold the lock simultaneously. The response is a stream // of LockEvent messages that provide updates on the status of the lock acquisition. ReadLock(*LockRequest, grpc.ServerStreamingServer[LockEvent]) error // UnLock releases a previously acquired lock based on the provided UnLockRequest. // The response is an UnLockResponse indicating the success or failure of the operation. UnLock(context.Context, *UnLockRequest) (*UnLockResponse, error) // LeaseStatus retrieves the current status of a lock lease based on the provided // LeaseStatusRequest. The response is a LeaseStatusResponse containing details // about the lease. LeaseStatus(context.Context, *LeaseStatusRequest) (*LeaseStatusResponse, error) // ExtendLease extends the lease of an already acquired lock based on the provided // ExtendLeaseRequest. The response is an ExtendLeaseResponse indicating the success // or failure of the operation and the updated lease information. ExtendLease(context.Context, *ExtendLeaseRequest) (*ExtendLeaseResponse, error) // MultiLock acquires N locks atomically — all keys are granted or none are. // The server sorts keys lexicographically to guarantee deadlock-free // ordering between any two MultiLock callers (without this, callers asking // for (k1,k2) and (k2,k1) could deadlock under contention). `max_wait_period` // applies to the whole batch as a single deadline, not per key. On any // failure the server releases every key it already acquired in this batch // before returning. Returns a unary response — no streaming. MultiLock(context.Context, *MultiLockRequest) (*MultiLockResponse, error) // ListAcquiredLocks returns every lock CURRENTLY HELD on the node serving the // request (the node that owns each key via the consistent-hash ring). It is a // read-only operator/introspection surface (waymaker-ctl `locks list`); it does // NOT include waiters. An optional `key_prefix` filters the result server-side. // In a multi-node cluster, call it on each node to see the full picture, since // each node only holds the locks for the keys it owns. ListAcquiredLocks(context.Context, *ListAcquiredLocksRequest) (*ListAcquiredLocksResponse, error) mustEmbedUnimplementedWaymakerServiceServer() } // UnimplementedWaymakerServiceServer 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. type UnimplementedWaymakerServiceServer struct{} func (UnimplementedWaymakerServiceServer) Lock(*LockRequest, grpc.ServerStreamingServer[LockEvent]) error { return status.Error(codes.Unimplemented, "method Lock not implemented") } func (UnimplementedWaymakerServiceServer) ReadLock(*LockRequest, grpc.ServerStreamingServer[LockEvent]) error { return status.Error(codes.Unimplemented, "method ReadLock not implemented") } func (UnimplementedWaymakerServiceServer) UnLock(context.Context, *UnLockRequest) (*UnLockResponse, error) { return nil, status.Error(codes.Unimplemented, "method UnLock not implemented") } func (UnimplementedWaymakerServiceServer) LeaseStatus(context.Context, *LeaseStatusRequest) (*LeaseStatusResponse, error) { return nil, status.Error(codes.Unimplemented, "method LeaseStatus not implemented") } func (UnimplementedWaymakerServiceServer) ExtendLease(context.Context, *ExtendLeaseRequest) (*ExtendLeaseResponse, error) { return nil, status.Error(codes.Unimplemented, "method ExtendLease not implemented") } func (UnimplementedWaymakerServiceServer) MultiLock(context.Context, *MultiLockRequest) (*MultiLockResponse, error) { return nil, status.Error(codes.Unimplemented, "method MultiLock not implemented") } func (UnimplementedWaymakerServiceServer) ListAcquiredLocks(context.Context, *ListAcquiredLocksRequest) (*ListAcquiredLocksResponse, error) { return nil, status.Error(codes.Unimplemented, "method ListAcquiredLocks not implemented") } func (UnimplementedWaymakerServiceServer) mustEmbedUnimplementedWaymakerServiceServer() {} func (UnimplementedWaymakerServiceServer) testEmbeddedByValue() {} // UnsafeWaymakerServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to WaymakerServiceServer will // result in compilation errors. type UnsafeWaymakerServiceServer interface { mustEmbedUnimplementedWaymakerServiceServer() } func RegisterWaymakerServiceServer(s grpc.ServiceRegistrar, srv WaymakerServiceServer) { // If the following call panics, it indicates UnimplementedWaymakerServiceServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { t.testEmbeddedByValue() } s.RegisterService(&WaymakerService_ServiceDesc, srv) } func _WaymakerService_Lock_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(LockRequest) if err := stream.RecvMsg(m); err != nil { return err } return srv.(WaymakerServiceServer).Lock(m, &grpc.GenericServerStream[LockRequest, LockEvent]{ServerStream: stream}) } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type WaymakerService_LockServer = grpc.ServerStreamingServer[LockEvent] func _WaymakerService_ReadLock_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(LockRequest) if err := stream.RecvMsg(m); err != nil { return err } return srv.(WaymakerServiceServer).ReadLock(m, &grpc.GenericServerStream[LockRequest, LockEvent]{ServerStream: stream}) } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type WaymakerService_ReadLockServer = grpc.ServerStreamingServer[LockEvent] func _WaymakerService_UnLock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(UnLockRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(WaymakerServiceServer).UnLock(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: WaymakerService_UnLock_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WaymakerServiceServer).UnLock(ctx, req.(*UnLockRequest)) } return interceptor(ctx, in, info, handler) } func _WaymakerService_LeaseStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(LeaseStatusRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(WaymakerServiceServer).LeaseStatus(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: WaymakerService_LeaseStatus_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WaymakerServiceServer).LeaseStatus(ctx, req.(*LeaseStatusRequest)) } return interceptor(ctx, in, info, handler) } func _WaymakerService_ExtendLease_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ExtendLeaseRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(WaymakerServiceServer).ExtendLease(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: WaymakerService_ExtendLease_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WaymakerServiceServer).ExtendLease(ctx, req.(*ExtendLeaseRequest)) } return interceptor(ctx, in, info, handler) } func _WaymakerService_MultiLock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MultiLockRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(WaymakerServiceServer).MultiLock(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: WaymakerService_MultiLock_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WaymakerServiceServer).MultiLock(ctx, req.(*MultiLockRequest)) } return interceptor(ctx, in, info, handler) } func _WaymakerService_ListAcquiredLocks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListAcquiredLocksRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(WaymakerServiceServer).ListAcquiredLocks(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: WaymakerService_ListAcquiredLocks_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WaymakerServiceServer).ListAcquiredLocks(ctx, req.(*ListAcquiredLocksRequest)) } return interceptor(ctx, in, info, handler) } // WaymakerService_ServiceDesc is the grpc.ServiceDesc for WaymakerService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var WaymakerService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "waymaker.WaymakerService", HandlerType: (*WaymakerServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "UnLock", Handler: _WaymakerService_UnLock_Handler, }, { MethodName: "LeaseStatus", Handler: _WaymakerService_LeaseStatus_Handler, }, { MethodName: "ExtendLease", Handler: _WaymakerService_ExtendLease_Handler, }, { MethodName: "MultiLock", Handler: _WaymakerService_MultiLock_Handler, }, { MethodName: "ListAcquiredLocks", Handler: _WaymakerService_ListAcquiredLocks_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "Lock", Handler: _WaymakerService_Lock_Handler, ServerStreams: true, }, { StreamName: "ReadLock", Handler: _WaymakerService_ReadLock_Handler, ServerStreams: true, }, }, Metadata: "waymaker_locks.proto", }