From d7d6f7421dc71ecd7e2336ed0da8be2eb7d2d46b Mon Sep 17 00:00:00 2001 From: Brandon Roberson Date: Fri, 13 Sep 2024 20:52:02 +0000 Subject: [PATCH 01/15] Remove gogo/protobuf in favor of golang/protobuf; Regenerate protos --- models/locket.pb.go | 2963 ++++++++------------------------------ models/locket.proto | 1 + models/locket_grpc.pb.go | 236 +++ 3 files changed, 827 insertions(+), 2373 deletions(-) create mode 100644 models/locket_grpc.pb.go diff --git a/models/locket.pb.go b/models/locket.pb.go index 557d078..5741001 100644 --- a/models/locket.pb.go +++ b/models/locket.pb.go @@ -1,2560 +1,777 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc v5.28.0 // source: locket.proto package models import ( - context "context" - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" - strconv "strconv" - strings "strings" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type TypeCode int32 const ( - UNKNOWN TypeCode = 0 - LOCK TypeCode = 1 - PRESENCE TypeCode = 2 + TypeCode_UNKNOWN TypeCode = 0 + TypeCode_LOCK TypeCode = 1 + TypeCode_PRESENCE TypeCode = 2 +) + +// Enum value maps for TypeCode. +var ( + TypeCode_name = map[int32]string{ + 0: "UNKNOWN", + 1: "LOCK", + 2: "PRESENCE", + } + TypeCode_value = map[string]int32{ + "UNKNOWN": 0, + "LOCK": 1, + "PRESENCE": 2, + } ) -var TypeCode_name = map[int32]string{ - 0: "UNKNOWN", - 1: "LOCK", - 2: "PRESENCE", +func (x TypeCode) Enum() *TypeCode { + p := new(TypeCode) + *p = x + return p } -var TypeCode_value = map[string]int32{ - "UNKNOWN": 0, - "LOCK": 1, - "PRESENCE": 2, +func (x TypeCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TypeCode) Descriptor() protoreflect.EnumDescriptor { + return file_locket_proto_enumTypes[0].Descriptor() +} + +func (TypeCode) Type() protoreflect.EnumType { + return &file_locket_proto_enumTypes[0] +} + +func (x TypeCode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } +// Deprecated: Use TypeCode.Descriptor instead. func (TypeCode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_5f2d92f834ce8fa9, []int{0} + return file_locket_proto_rawDescGZIP(), []int{0} } type Resource struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` - Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"` // Deprecated: Do not use. + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + // Deprecated: Marked as deprecated in locket.proto. + Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"` TypeCode TypeCode `protobuf:"varint,5,opt,name=type_code,json=typeCode,proto3,enum=models.TypeCode" json:"type_code,omitempty"` } -func (m *Resource) Reset() { *m = Resource{} } -func (*Resource) ProtoMessage() {} -func (*Resource) Descriptor() ([]byte, []int) { - return fileDescriptor_5f2d92f834ce8fa9, []int{0} -} -func (m *Resource) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Resource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Resource.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *Resource) Reset() { + *x = Resource{} + if protoimpl.UnsafeEnabled { + mi := &file_locket_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *Resource) XXX_Merge(src proto.Message) { - xxx_messageInfo_Resource.Merge(m, src) -} -func (m *Resource) XXX_Size() int { - return m.Size() + +func (x *Resource) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Resource) XXX_DiscardUnknown() { - xxx_messageInfo_Resource.DiscardUnknown(m) + +func (*Resource) ProtoMessage() {} + +func (x *Resource) ProtoReflect() protoreflect.Message { + mi := &file_locket_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_Resource proto.InternalMessageInfo +// Deprecated: Use Resource.ProtoReflect.Descriptor instead. +func (*Resource) Descriptor() ([]byte, []int) { + return file_locket_proto_rawDescGZIP(), []int{0} +} -func (m *Resource) GetKey() string { - if m != nil { - return m.Key +func (x *Resource) GetKey() string { + if x != nil { + return x.Key } return "" } -func (m *Resource) GetOwner() string { - if m != nil { - return m.Owner +func (x *Resource) GetOwner() string { + if x != nil { + return x.Owner } return "" } -func (m *Resource) GetValue() string { - if m != nil { - return m.Value +func (x *Resource) GetValue() string { + if x != nil { + return x.Value } return "" } -// Deprecated: Do not use. -func (m *Resource) GetType() string { - if m != nil { - return m.Type +// Deprecated: Marked as deprecated in locket.proto. +func (x *Resource) GetType() string { + if x != nil { + return x.Type } return "" } -func (m *Resource) GetTypeCode() TypeCode { - if m != nil { - return m.TypeCode +func (x *Resource) GetTypeCode() TypeCode { + if x != nil { + return x.TypeCode } - return UNKNOWN + return TypeCode_UNKNOWN } type LockRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` TtlInSeconds int64 `protobuf:"varint,2,opt,name=ttl_in_seconds,json=ttlInSeconds,proto3" json:"ttl_in_seconds,omitempty"` } -func (m *LockRequest) Reset() { *m = LockRequest{} } -func (*LockRequest) ProtoMessage() {} -func (*LockRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5f2d92f834ce8fa9, []int{1} -} -func (m *LockRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LockRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *LockRequest) Reset() { + *x = LockRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_locket_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *LockRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_LockRequest.Merge(m, src) -} -func (m *LockRequest) XXX_Size() int { - return m.Size() -} -func (m *LockRequest) XXX_DiscardUnknown() { - xxx_messageInfo_LockRequest.DiscardUnknown(m) + +func (x *LockRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_LockRequest proto.InternalMessageInfo +func (*LockRequest) ProtoMessage() {} -func (m *LockRequest) GetResource() *Resource { - if m != nil { - return m.Resource +func (x *LockRequest) ProtoReflect() protoreflect.Message { + mi := &file_locket_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return nil + return mi.MessageOf(x) } -func (m *LockRequest) GetTtlInSeconds() int64 { - if m != nil { - return m.TtlInSeconds - } - return 0 +// Deprecated: Use LockRequest.ProtoReflect.Descriptor instead. +func (*LockRequest) Descriptor() ([]byte, []int) { + return file_locket_proto_rawDescGZIP(), []int{1} } -type LockResponse struct { +func (x *LockRequest) GetResource() *Resource { + if x != nil { + return x.Resource + } + return nil } -func (m *LockResponse) Reset() { *m = LockResponse{} } -func (*LockResponse) ProtoMessage() {} -func (*LockResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5f2d92f834ce8fa9, []int{2} -} -func (m *LockResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LockResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *LockRequest) GetTtlInSeconds() int64 { + if x != nil { + return x.TtlInSeconds } -} -func (m *LockResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_LockResponse.Merge(m, src) -} -func (m *LockResponse) XXX_Size() int { - return m.Size() -} -func (m *LockResponse) XXX_DiscardUnknown() { - xxx_messageInfo_LockResponse.DiscardUnknown(m) + return 0 } -var xxx_messageInfo_LockResponse proto.InternalMessageInfo - -type ReleaseRequest struct { - Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` +type LockResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -func (m *ReleaseRequest) Reset() { *m = ReleaseRequest{} } -func (*ReleaseRequest) ProtoMessage() {} -func (*ReleaseRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5f2d92f834ce8fa9, []int{3} -} -func (m *ReleaseRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ReleaseRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ReleaseRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *LockResponse) Reset() { + *x = LockResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_locket_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *ReleaseRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReleaseRequest.Merge(m, src) -} -func (m *ReleaseRequest) XXX_Size() int { - return m.Size() -} -func (m *ReleaseRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ReleaseRequest.DiscardUnknown(m) -} -var xxx_messageInfo_ReleaseRequest proto.InternalMessageInfo - -func (m *ReleaseRequest) GetResource() *Resource { - if m != nil { - return m.Resource - } - return nil +func (x *LockResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -type ReleaseResponse struct { -} +func (*LockResponse) ProtoMessage() {} -func (m *ReleaseResponse) Reset() { *m = ReleaseResponse{} } -func (*ReleaseResponse) ProtoMessage() {} -func (*ReleaseResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5f2d92f834ce8fa9, []int{4} -} -func (m *ReleaseResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ReleaseResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ReleaseResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (x *LockResponse) ProtoReflect() protoreflect.Message { + mi := &file_locket_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } + return mi.MessageOf(x) } -func (m *ReleaseResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReleaseResponse.Merge(m, src) -} -func (m *ReleaseResponse) XXX_Size() int { - return m.Size() -} -func (m *ReleaseResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ReleaseResponse.DiscardUnknown(m) + +// Deprecated: Use LockResponse.ProtoReflect.Descriptor instead. +func (*LockResponse) Descriptor() ([]byte, []int) { + return file_locket_proto_rawDescGZIP(), []int{2} } -var xxx_messageInfo_ReleaseResponse proto.InternalMessageInfo +type ReleaseRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -type FetchRequest struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` } -func (m *FetchRequest) Reset() { *m = FetchRequest{} } -func (*FetchRequest) ProtoMessage() {} -func (*FetchRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5f2d92f834ce8fa9, []int{5} -} -func (m *FetchRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *FetchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_FetchRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *ReleaseRequest) Reset() { + *x = ReleaseRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_locket_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *FetchRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_FetchRequest.Merge(m, src) -} -func (m *FetchRequest) XXX_Size() int { - return m.Size() -} -func (m *FetchRequest) XXX_DiscardUnknown() { - xxx_messageInfo_FetchRequest.DiscardUnknown(m) -} -var xxx_messageInfo_FetchRequest proto.InternalMessageInfo - -func (m *FetchRequest) GetKey() string { - if m != nil { - return m.Key - } - return "" +func (x *ReleaseRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -type FetchResponse struct { - Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` -} +func (*ReleaseRequest) ProtoMessage() {} -func (m *FetchResponse) Reset() { *m = FetchResponse{} } -func (*FetchResponse) ProtoMessage() {} -func (*FetchResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5f2d92f834ce8fa9, []int{6} -} -func (m *FetchResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *FetchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_FetchResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (x *ReleaseRequest) ProtoReflect() protoreflect.Message { + mi := &file_locket_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *FetchResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_FetchResponse.Merge(m, src) -} -func (m *FetchResponse) XXX_Size() int { - return m.Size() -} -func (m *FetchResponse) XXX_DiscardUnknown() { - xxx_messageInfo_FetchResponse.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_FetchResponse proto.InternalMessageInfo +// Deprecated: Use ReleaseRequest.ProtoReflect.Descriptor instead. +func (*ReleaseRequest) Descriptor() ([]byte, []int) { + return file_locket_proto_rawDescGZIP(), []int{3} +} -func (m *FetchResponse) GetResource() *Resource { - if m != nil { - return m.Resource +func (x *ReleaseRequest) GetResource() *Resource { + if x != nil { + return x.Resource } return nil } -type FetchAllRequest struct { - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` // Deprecated: Do not use. - TypeCode TypeCode `protobuf:"varint,2,opt,name=type_code,json=typeCode,proto3,enum=models.TypeCode" json:"type_code,omitempty"` +type ReleaseResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -func (m *FetchAllRequest) Reset() { *m = FetchAllRequest{} } -func (*FetchAllRequest) ProtoMessage() {} -func (*FetchAllRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5f2d92f834ce8fa9, []int{7} -} -func (m *FetchAllRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *FetchAllRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_FetchAllRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *ReleaseResponse) Reset() { + *x = ReleaseResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_locket_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *FetchAllRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_FetchAllRequest.Merge(m, src) -} -func (m *FetchAllRequest) XXX_Size() int { - return m.Size() -} -func (m *FetchAllRequest) XXX_DiscardUnknown() { - xxx_messageInfo_FetchAllRequest.DiscardUnknown(m) + +func (x *ReleaseResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_FetchAllRequest proto.InternalMessageInfo +func (*ReleaseResponse) ProtoMessage() {} -// Deprecated: Do not use. -func (m *FetchAllRequest) GetType() string { - if m != nil { - return m.Type +func (x *ReleaseResponse) ProtoReflect() protoreflect.Message { + mi := &file_locket_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return "" + return mi.MessageOf(x) } -func (m *FetchAllRequest) GetTypeCode() TypeCode { - if m != nil { - return m.TypeCode - } - return UNKNOWN +// Deprecated: Use ReleaseResponse.ProtoReflect.Descriptor instead. +func (*ReleaseResponse) Descriptor() ([]byte, []int) { + return file_locket_proto_rawDescGZIP(), []int{4} } -type FetchAllResponse struct { - Resources []*Resource `protobuf:"bytes,1,rep,name=resources,proto3" json:"resources,omitempty"` -} +type FetchRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *FetchAllResponse) Reset() { *m = FetchAllResponse{} } -func (*FetchAllResponse) ProtoMessage() {} -func (*FetchAllResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5f2d92f834ce8fa9, []int{8} -} -func (m *FetchAllResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *FetchAllResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_FetchAllResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *FetchAllResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_FetchAllResponse.Merge(m, src) -} -func (m *FetchAllResponse) XXX_Size() int { - return m.Size() -} -func (m *FetchAllResponse) XXX_DiscardUnknown() { - xxx_messageInfo_FetchAllResponse.DiscardUnknown(m) + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` } -var xxx_messageInfo_FetchAllResponse proto.InternalMessageInfo - -func (m *FetchAllResponse) GetResources() []*Resource { - if m != nil { - return m.Resources +func (x *FetchRequest) Reset() { + *x = FetchRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_locket_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return nil } -func init() { - proto.RegisterEnum("models.TypeCode", TypeCode_name, TypeCode_value) - proto.RegisterType((*Resource)(nil), "models.Resource") - proto.RegisterType((*LockRequest)(nil), "models.LockRequest") - proto.RegisterType((*LockResponse)(nil), "models.LockResponse") - proto.RegisterType((*ReleaseRequest)(nil), "models.ReleaseRequest") - proto.RegisterType((*ReleaseResponse)(nil), "models.ReleaseResponse") - proto.RegisterType((*FetchRequest)(nil), "models.FetchRequest") - proto.RegisterType((*FetchResponse)(nil), "models.FetchResponse") - proto.RegisterType((*FetchAllRequest)(nil), "models.FetchAllRequest") - proto.RegisterType((*FetchAllResponse)(nil), "models.FetchAllResponse") -} - -func init() { proto.RegisterFile("locket.proto", fileDescriptor_5f2d92f834ce8fa9) } - -var fileDescriptor_5f2d92f834ce8fa9 = []byte{ - // 490 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xf6, 0xe6, 0xaf, 0xce, 0xc4, 0xa4, 0x66, 0x29, 0xad, 0x95, 0xc3, 0x2a, 0xb2, 0x38, 0x54, - 0x08, 0x82, 0xd4, 0x22, 0x4e, 0xfc, 0x88, 0x44, 0x41, 0x42, 0x8d, 0x52, 0xe4, 0x82, 0xe0, 0x16, - 0x05, 0x67, 0x24, 0x50, 0x8c, 0x37, 0x64, 0x37, 0xa0, 0xdc, 0x78, 0x03, 0x78, 0x0c, 0x1e, 0x85, - 0x63, 0x8e, 0x3d, 0x12, 0xe7, 0xc2, 0xb1, 0x07, 0x1e, 0x00, 0x79, 0xed, 0xb5, 0x13, 0x82, 0x40, - 0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c8, 0xb7, 0x88, - 0x91, 0x45, 0xc4, 0xc8, 0xf7, 0x88, 0x91, 0x1f, 0x11, 0x33, 0x2e, 0x22, 0x46, 0xbe, 0xac, 0x98, - 0xb1, 0x58, 0x31, 0xe3, 0x7c, 0xc5, 0x8c, 0xd7, 0x15, 0xf5, 0x0f, 0x1f, 0xff, 0x0a, 0x00, 0x00, - 0xff, 0xff, 0x40, 0xe5, 0x0d, 0xd7, 0xd3, 0x03, 0x00, 0x00, +func (x *FetchRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (x TypeCode) String() string { - s, ok := TypeCode_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (this *Resource) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (*FetchRequest) ProtoMessage() {} - that1, ok := that.(*Resource) - if !ok { - that2, ok := that.(Resource) - if ok { - that1 = &that2 - } else { - return false +func (x *FetchRequest) ProtoReflect() protoreflect.Message { + mi := &file_locket_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } + return ms } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Key != that1.Key { - return false - } - if this.Owner != that1.Owner { - return false - } - if this.Value != that1.Value { - return false - } - if this.Type != that1.Type { - return false - } - if this.TypeCode != that1.TypeCode { - return false - } - return true + return mi.MessageOf(x) } -func (this *LockRequest) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*LockRequest) - if !ok { - that2, ok := that.(LockRequest) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Resource.Equal(that1.Resource) { - return false - } - if this.TtlInSeconds != that1.TtlInSeconds { - return false - } - return true +// Deprecated: Use FetchRequest.ProtoReflect.Descriptor instead. +func (*FetchRequest) Descriptor() ([]byte, []int) { + return file_locket_proto_rawDescGZIP(), []int{5} } -func (this *LockResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*LockResponse) - if !ok { - that2, ok := that.(LockResponse) - if ok { - that1 = &that2 - } else { - return false - } +func (x *FetchRequest) GetKey() string { + if x != nil { + return x.Key } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - return true + return "" } -func (this *ReleaseRequest) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*ReleaseRequest) - if !ok { - that2, ok := that.(ReleaseRequest) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Resource.Equal(that1.Resource) { - return false - } - return true -} -func (this *ReleaseResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +type FetchResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields - that1, ok := that.(*ReleaseResponse) - if !ok { - that2, ok := that.(ReleaseResponse) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - return true + Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` } -func (this *FetchRequest) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*FetchRequest) - if !ok { - that2, ok := that.(FetchRequest) - if ok { - that1 = &that2 - } else { - return false - } +func (x *FetchResponse) Reset() { + *x = FetchResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_locket_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Key != that1.Key { - return false - } - return true } -func (this *FetchResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*FetchResponse) - if !ok { - that2, ok := that.(FetchResponse) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Resource.Equal(that1.Resource) { - return false - } - return true +func (x *FetchResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (this *FetchAllRequest) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*FetchAllRequest) - if !ok { - that2, ok := that.(FetchAllRequest) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Type != that1.Type { - return false - } - if this.TypeCode != that1.TypeCode { - return false - } - return true -} -func (this *FetchAllResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (*FetchResponse) ProtoMessage() {} - that1, ok := that.(*FetchAllResponse) - if !ok { - that2, ok := that.(FetchAllResponse) - if ok { - that1 = &that2 - } else { - return false +func (x *FetchResponse) ProtoReflect() protoreflect.Message { + mi := &file_locket_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } + return ms } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.Resources) != len(that1.Resources) { - return false - } - for i := range this.Resources { - if !this.Resources[i].Equal(that1.Resources[i]) { - return false - } - } - return true -} -func (this *Resource) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 9) - s = append(s, "&models.Resource{") - s = append(s, "Key: "+fmt.Sprintf("%#v", this.Key)+",\n") - s = append(s, "Owner: "+fmt.Sprintf("%#v", this.Owner)+",\n") - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - s = append(s, "Type: "+fmt.Sprintf("%#v", this.Type)+",\n") - s = append(s, "TypeCode: "+fmt.Sprintf("%#v", this.TypeCode)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *LockRequest) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&models.LockRequest{") - if this.Resource != nil { - s = append(s, "Resource: "+fmt.Sprintf("%#v", this.Resource)+",\n") - } - s = append(s, "TtlInSeconds: "+fmt.Sprintf("%#v", this.TtlInSeconds)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *LockResponse) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 4) - s = append(s, "&models.LockResponse{") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *ReleaseRequest) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&models.ReleaseRequest{") - if this.Resource != nil { - s = append(s, "Resource: "+fmt.Sprintf("%#v", this.Resource)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *ReleaseResponse) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 4) - s = append(s, "&models.ReleaseResponse{") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FetchRequest) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&models.FetchRequest{") - s = append(s, "Key: "+fmt.Sprintf("%#v", this.Key)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FetchResponse) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&models.FetchResponse{") - if this.Resource != nil { - s = append(s, "Resource: "+fmt.Sprintf("%#v", this.Resource)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FetchAllRequest) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&models.FetchAllRequest{") - s = append(s, "Type: "+fmt.Sprintf("%#v", this.Type)+",\n") - s = append(s, "TypeCode: "+fmt.Sprintf("%#v", this.TypeCode)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FetchAllResponse) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&models.FetchAllResponse{") - if this.Resources != nil { - s = append(s, "Resources: "+fmt.Sprintf("%#v", this.Resources)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringLocket(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// LocketClient is the client API for Locket service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type LocketClient interface { - Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error) - Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchResponse, error) - Release(ctx context.Context, in *ReleaseRequest, opts ...grpc.CallOption) (*ReleaseResponse, error) - FetchAll(ctx context.Context, in *FetchAllRequest, opts ...grpc.CallOption) (*FetchAllResponse, error) -} - -type locketClient struct { - cc *grpc.ClientConn + return mi.MessageOf(x) } -func NewLocketClient(cc *grpc.ClientConn) LocketClient { - return &locketClient{cc} +// Deprecated: Use FetchResponse.ProtoReflect.Descriptor instead. +func (*FetchResponse) Descriptor() ([]byte, []int) { + return file_locket_proto_rawDescGZIP(), []int{6} } -func (c *locketClient) Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error) { - out := new(LockResponse) - err := c.cc.Invoke(ctx, "/models.Locket/Lock", in, out, opts...) - if err != nil { - return nil, err +func (x *FetchResponse) GetResource() *Resource { + if x != nil { + return x.Resource } - return out, nil + return nil } -func (c *locketClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchResponse, error) { - out := new(FetchResponse) - err := c.cc.Invoke(ctx, "/models.Locket/Fetch", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} +type FetchAllRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (c *locketClient) Release(ctx context.Context, in *ReleaseRequest, opts ...grpc.CallOption) (*ReleaseResponse, error) { - out := new(ReleaseResponse) - err := c.cc.Invoke(ctx, "/models.Locket/Release", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil + // Deprecated: Marked as deprecated in locket.proto. + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + TypeCode TypeCode `protobuf:"varint,2,opt,name=type_code,json=typeCode,proto3,enum=models.TypeCode" json:"type_code,omitempty"` } -func (c *locketClient) FetchAll(ctx context.Context, in *FetchAllRequest, opts ...grpc.CallOption) (*FetchAllResponse, error) { - out := new(FetchAllResponse) - err := c.cc.Invoke(ctx, "/models.Locket/FetchAll", in, out, opts...) - if err != nil { - return nil, err +func (x *FetchAllRequest) Reset() { + *x = FetchAllRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_locket_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return out, nil } -// LocketServer is the server API for Locket service. -type LocketServer interface { - Lock(context.Context, *LockRequest) (*LockResponse, error) - Fetch(context.Context, *FetchRequest) (*FetchResponse, error) - Release(context.Context, *ReleaseRequest) (*ReleaseResponse, error) - FetchAll(context.Context, *FetchAllRequest) (*FetchAllResponse, error) +func (x *FetchAllRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -// UnimplementedLocketServer can be embedded to have forward compatible implementations. -type UnimplementedLocketServer struct { -} +func (*FetchAllRequest) ProtoMessage() {} -func (*UnimplementedLocketServer) Lock(ctx context.Context, req *LockRequest) (*LockResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Lock not implemented") -} -func (*UnimplementedLocketServer) Fetch(ctx context.Context, req *FetchRequest) (*FetchResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Fetch not implemented") -} -func (*UnimplementedLocketServer) Release(ctx context.Context, req *ReleaseRequest) (*ReleaseResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Release not implemented") -} -func (*UnimplementedLocketServer) FetchAll(ctx context.Context, req *FetchAllRequest) (*FetchAllResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FetchAll not implemented") +func (x *FetchAllRequest) ProtoReflect() protoreflect.Message { + mi := &file_locket_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func RegisterLocketServer(s *grpc.Server, srv LocketServer) { - s.RegisterService(&_Locket_serviceDesc, srv) +// Deprecated: Use FetchAllRequest.ProtoReflect.Descriptor instead. +func (*FetchAllRequest) Descriptor() ([]byte, []int) { + return file_locket_proto_rawDescGZIP(), []int{7} } -func _Locket_Lock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LockRequest) - if err := dec(in); err != nil { - return nil, err +// Deprecated: Marked as deprecated in locket.proto. +func (x *FetchAllRequest) GetType() string { + if x != nil { + return x.Type } - if interceptor == nil { - return srv.(LocketServer).Lock(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/models.Locket/Lock", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LocketServer).Lock(ctx, req.(*LockRequest)) - } - return interceptor(ctx, in, info, handler) + return "" } -func _Locket_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FetchRequest) - if err := dec(in); err != nil { - return nil, err +func (x *FetchAllRequest) GetTypeCode() TypeCode { + if x != nil { + return x.TypeCode } - if interceptor == nil { - return srv.(LocketServer).Fetch(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/models.Locket/Fetch", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LocketServer).Fetch(ctx, req.(*FetchRequest)) - } - return interceptor(ctx, in, info, handler) + return TypeCode_UNKNOWN } -func _Locket_Release_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ReleaseRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LocketServer).Release(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/models.Locket/Release", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LocketServer).Release(ctx, req.(*ReleaseRequest)) - } - return interceptor(ctx, in, info, handler) +type FetchAllResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Resources []*Resource `protobuf:"bytes,1,rep,name=resources,proto3" json:"resources,omitempty"` } -func _Locket_FetchAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FetchAllRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LocketServer).FetchAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/models.Locket/FetchAll", +func (x *FetchAllResponse) Reset() { + *x = FetchAllResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_locket_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LocketServer).FetchAll(ctx, req.(*FetchAllRequest)) - } - return interceptor(ctx, in, info, handler) } -var _Locket_serviceDesc = grpc.ServiceDesc{ - ServiceName: "models.Locket", - HandlerType: (*LocketServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Lock", - Handler: _Locket_Lock_Handler, - }, - { - MethodName: "Fetch", - Handler: _Locket_Fetch_Handler, - }, - { - MethodName: "Release", - Handler: _Locket_Release_Handler, - }, - { - MethodName: "FetchAll", - Handler: _Locket_FetchAll_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "locket.proto", +func (x *FetchAllResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Resource) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (*FetchAllResponse) ProtoMessage() {} + +func (x *FetchAllResponse) ProtoReflect() protoreflect.Message { + mi := &file_locket_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return dAtA[:n], nil + return mi.MessageOf(x) } -func (m *Resource) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +// Deprecated: Use FetchAllResponse.ProtoReflect.Descriptor instead. +func (*FetchAllResponse) Descriptor() ([]byte, []int) { + return file_locket_proto_rawDescGZIP(), []int{8} } -func (m *Resource) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.TypeCode != 0 { - i = encodeVarintLocket(dAtA, i, uint64(m.TypeCode)) - i-- - dAtA[i] = 0x28 - } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintLocket(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0x22 - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintLocket(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x1a - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintLocket(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x12 +func (x *FetchAllResponse) GetResources() []*Resource { + if x != nil { + return x.Resources } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintLocket(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil + return nil } -func (m *LockRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +var File_locket_proto protoreflect.FileDescriptor + +var file_locket_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x22, 0x8f, 0x01, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x12, 0x16, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x02, 0x18, 0x01, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2d, 0x0a, 0x09, 0x74, 0x79, 0x70, + 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x08, + 0x74, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x61, 0x0a, 0x0b, 0x4c, 0x6f, 0x63, 0x6b, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x74, 0x74, 0x6c, 0x5f, 0x69, 0x6e, 0x5f, + 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x74, + 0x74, 0x6c, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x0e, 0x0a, 0x0c, 0x4c, + 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3e, 0x0a, 0x0e, 0x52, + 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, + 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x11, 0x0a, 0x0f, 0x52, + 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, + 0x0a, 0x0c, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x22, 0x3d, 0x0a, 0x0d, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, + 0x58, 0x0a, 0x0f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x16, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x02, 0x18, 0x01, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2d, 0x0a, 0x09, 0x74, 0x79, + 0x70, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, + 0x08, 0x74, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x42, 0x0a, 0x10, 0x46, 0x65, 0x74, + 0x63, 0x68, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, + 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2a, 0x2f, 0x0a, + 0x08, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, + 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x01, + 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x43, 0x45, 0x10, 0x02, 0x32, 0xf4, + 0x01, 0x0a, 0x06, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x33, 0x0a, 0x04, 0x4c, 0x6f, 0x63, + 0x6b, 0x12, 0x13, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x4c, 0x6f, 0x63, 0x6b, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, + 0x4c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x36, + 0x0a, 0x05, 0x46, 0x65, 0x74, 0x63, 0x68, 0x12, 0x14, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, + 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3c, 0x0a, 0x07, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, + 0x65, 0x12, 0x16, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, + 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x08, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x6c, 0x6c, + 0x12, 0x17, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, + 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x73, 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x25, 0x5a, 0x23, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x6c, + 0x6f, 0x75, 0x64, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x72, 0x79, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6c, + 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } -func (m *LockRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} +var ( + file_locket_proto_rawDescOnce sync.Once + file_locket_proto_rawDescData = file_locket_proto_rawDesc +) -func (m *LockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.TtlInSeconds != 0 { - i = encodeVarintLocket(dAtA, i, uint64(m.TtlInSeconds)) - i-- - dAtA[i] = 0x10 - } - if m.Resource != nil { - { - size, err := m.Resource.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintLocket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *LockResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LockResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *ReleaseRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ReleaseRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ReleaseRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Resource != nil { - { - size, err := m.Resource.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintLocket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ReleaseResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ReleaseResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ReleaseResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *FetchRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FetchRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FetchRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintLocket(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *FetchResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FetchResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FetchResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Resource != nil { - { - size, err := m.Resource.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintLocket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *FetchAllRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FetchAllRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FetchAllRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.TypeCode != 0 { - i = encodeVarintLocket(dAtA, i, uint64(m.TypeCode)) - i-- - dAtA[i] = 0x10 - } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintLocket(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *FetchAllResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FetchAllResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FetchAllResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Resources) > 0 { - for iNdEx := len(m.Resources) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Resources[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintLocket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintLocket(dAtA []byte, offset int, v uint64) int { - offset -= sovLocket(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Resource) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovLocket(uint64(l)) - } - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovLocket(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovLocket(uint64(l)) - } - l = len(m.Type) - if l > 0 { - n += 1 + l + sovLocket(uint64(l)) - } - if m.TypeCode != 0 { - n += 1 + sovLocket(uint64(m.TypeCode)) - } - return n -} - -func (m *LockRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Resource != nil { - l = m.Resource.Size() - n += 1 + l + sovLocket(uint64(l)) - } - if m.TtlInSeconds != 0 { - n += 1 + sovLocket(uint64(m.TtlInSeconds)) - } - return n -} - -func (m *LockResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *ReleaseRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Resource != nil { - l = m.Resource.Size() - n += 1 + l + sovLocket(uint64(l)) - } - return n -} - -func (m *ReleaseResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *FetchRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovLocket(uint64(l)) - } - return n -} - -func (m *FetchResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Resource != nil { - l = m.Resource.Size() - n += 1 + l + sovLocket(uint64(l)) - } - return n -} - -func (m *FetchAllRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - if l > 0 { - n += 1 + l + sovLocket(uint64(l)) - } - if m.TypeCode != 0 { - n += 1 + sovLocket(uint64(m.TypeCode)) - } - return n -} - -func (m *FetchAllResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Resources) > 0 { - for _, e := range m.Resources { - l = e.Size() - n += 1 + l + sovLocket(uint64(l)) - } - } - return n -} - -func sovLocket(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozLocket(x uint64) (n int) { - return sovLocket(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *Resource) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Resource{`, - `Key:` + fmt.Sprintf("%v", this.Key) + `,`, - `Owner:` + fmt.Sprintf("%v", this.Owner) + `,`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `TypeCode:` + fmt.Sprintf("%v", this.TypeCode) + `,`, - `}`, - }, "") - return s -} -func (this *LockRequest) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&LockRequest{`, - `Resource:` + strings.Replace(this.Resource.String(), "Resource", "Resource", 1) + `,`, - `TtlInSeconds:` + fmt.Sprintf("%v", this.TtlInSeconds) + `,`, - `}`, - }, "") - return s -} -func (this *LockResponse) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&LockResponse{`, - `}`, - }, "") - return s -} -func (this *ReleaseRequest) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ReleaseRequest{`, - `Resource:` + strings.Replace(this.Resource.String(), "Resource", "Resource", 1) + `,`, - `}`, - }, "") - return s -} -func (this *ReleaseResponse) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ReleaseResponse{`, - `}`, - }, "") - return s -} -func (this *FetchRequest) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&FetchRequest{`, - `Key:` + fmt.Sprintf("%v", this.Key) + `,`, - `}`, - }, "") - return s -} -func (this *FetchResponse) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&FetchResponse{`, - `Resource:` + strings.Replace(this.Resource.String(), "Resource", "Resource", 1) + `,`, - `}`, - }, "") - return s -} -func (this *FetchAllRequest) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&FetchAllRequest{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `TypeCode:` + fmt.Sprintf("%v", this.TypeCode) + `,`, - `}`, - }, "") - return s -} -func (this *FetchAllResponse) String() string { - if this == nil { - return "nil" - } - repeatedStringForResources := "[]*Resource{" - for _, f := range this.Resources { - repeatedStringForResources += strings.Replace(f.String(), "Resource", "Resource", 1) + "," - } - repeatedStringForResources += "}" - s := strings.Join([]string{`&FetchAllResponse{`, - `Resources:` + repeatedStringForResources + `,`, - `}`, - }, "") - return s -} -func valueToStringLocket(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *Resource) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Resource: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Resource: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthLocket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthLocket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthLocket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthLocket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthLocket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthLocket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthLocket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthLocket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TypeCode", wireType) - } - m.TypeCode = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TypeCode |= TypeCode(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipLocket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthLocket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LockRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LockRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LockRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Resource", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthLocket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthLocket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Resource == nil { - m.Resource = &Resource{} - } - if err := m.Resource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TtlInSeconds", wireType) - } - m.TtlInSeconds = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TtlInSeconds |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipLocket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthLocket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LockResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LockResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LockResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipLocket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthLocket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ReleaseRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ReleaseRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ReleaseRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Resource", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthLocket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthLocket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Resource == nil { - m.Resource = &Resource{} - } - if err := m.Resource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipLocket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthLocket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ReleaseResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ReleaseResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ReleaseResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipLocket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthLocket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FetchRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FetchRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FetchRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthLocket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthLocket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipLocket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthLocket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FetchResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FetchResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FetchResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Resource", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthLocket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthLocket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Resource == nil { - m.Resource = &Resource{} - } - if err := m.Resource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipLocket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthLocket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FetchAllRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FetchAllRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FetchAllRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthLocket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthLocket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TypeCode", wireType) - } - m.TypeCode = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TypeCode |= TypeCode(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipLocket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthLocket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FetchAllResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FetchAllResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FetchAllResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowLocket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthLocket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthLocket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Resources = append(m.Resources, &Resource{}) - if err := m.Resources[len(m.Resources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipLocket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthLocket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipLocket(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowLocket - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowLocket - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowLocket - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthLocket - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupLocket - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthLocket - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF +func file_locket_proto_rawDescGZIP() []byte { + file_locket_proto_rawDescOnce.Do(func() { + file_locket_proto_rawDescData = protoimpl.X.CompressGZIP(file_locket_proto_rawDescData) + }) + return file_locket_proto_rawDescData +} + +var file_locket_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_locket_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_locket_proto_goTypes = []any{ + (TypeCode)(0), // 0: models.TypeCode + (*Resource)(nil), // 1: models.Resource + (*LockRequest)(nil), // 2: models.LockRequest + (*LockResponse)(nil), // 3: models.LockResponse + (*ReleaseRequest)(nil), // 4: models.ReleaseRequest + (*ReleaseResponse)(nil), // 5: models.ReleaseResponse + (*FetchRequest)(nil), // 6: models.FetchRequest + (*FetchResponse)(nil), // 7: models.FetchResponse + (*FetchAllRequest)(nil), // 8: models.FetchAllRequest + (*FetchAllResponse)(nil), // 9: models.FetchAllResponse +} +var file_locket_proto_depIdxs = []int32{ + 0, // 0: models.Resource.type_code:type_name -> models.TypeCode + 1, // 1: models.LockRequest.resource:type_name -> models.Resource + 1, // 2: models.ReleaseRequest.resource:type_name -> models.Resource + 1, // 3: models.FetchResponse.resource:type_name -> models.Resource + 0, // 4: models.FetchAllRequest.type_code:type_name -> models.TypeCode + 1, // 5: models.FetchAllResponse.resources:type_name -> models.Resource + 2, // 6: models.Locket.Lock:input_type -> models.LockRequest + 6, // 7: models.Locket.Fetch:input_type -> models.FetchRequest + 4, // 8: models.Locket.Release:input_type -> models.ReleaseRequest + 8, // 9: models.Locket.FetchAll:input_type -> models.FetchAllRequest + 3, // 10: models.Locket.Lock:output_type -> models.LockResponse + 7, // 11: models.Locket.Fetch:output_type -> models.FetchResponse + 5, // 12: models.Locket.Release:output_type -> models.ReleaseResponse + 9, // 13: models.Locket.FetchAll:output_type -> models.FetchAllResponse + 10, // [10:14] is the sub-list for method output_type + 6, // [6:10] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_locket_proto_init() } +func file_locket_proto_init() { + if File_locket_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_locket_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*Resource); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_locket_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*LockRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_locket_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*LockResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_locket_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*ReleaseRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_locket_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*ReleaseResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_locket_proto_msgTypes[5].Exporter = func(v any, i int) any { + switch v := v.(*FetchRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_locket_proto_msgTypes[6].Exporter = func(v any, i int) any { + switch v := v.(*FetchResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_locket_proto_msgTypes[7].Exporter = func(v any, i int) any { + switch v := v.(*FetchAllRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_locket_proto_msgTypes[8].Exporter = func(v any, i int) any { + switch v := v.(*FetchAllResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_locket_proto_rawDesc, + NumEnums: 1, + NumMessages: 9, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_locket_proto_goTypes, + DependencyIndexes: file_locket_proto_depIdxs, + EnumInfos: file_locket_proto_enumTypes, + MessageInfos: file_locket_proto_msgTypes, + }.Build() + File_locket_proto = out.File + file_locket_proto_rawDesc = nil + file_locket_proto_goTypes = nil + file_locket_proto_depIdxs = nil } - -var ( - ErrInvalidLengthLocket = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowLocket = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupLocket = fmt.Errorf("proto: unexpected end of group") -) diff --git a/models/locket.proto b/models/locket.proto index 122cd8a..04da4c8 100644 --- a/models/locket.proto +++ b/models/locket.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package models; +option go_package="code.cloudfoundry.org/locket/models"; service Locket { rpc Lock(LockRequest) returns (LockResponse) {} diff --git a/models/locket_grpc.pb.go b/models/locket_grpc.pb.go new file mode 100644 index 0000000..1a19ca5 --- /dev/null +++ b/models/locket_grpc.pb.go @@ -0,0 +1,236 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.28.0 +// source: locket.proto + +package models + +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 ( + Locket_Lock_FullMethodName = "/models.Locket/Lock" + Locket_Fetch_FullMethodName = "/models.Locket/Fetch" + Locket_Release_FullMethodName = "/models.Locket/Release" + Locket_FetchAll_FullMethodName = "/models.Locket/FetchAll" +) + +// LocketClient is the client API for Locket 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. +type LocketClient interface { + Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error) + Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchResponse, error) + Release(ctx context.Context, in *ReleaseRequest, opts ...grpc.CallOption) (*ReleaseResponse, error) + FetchAll(ctx context.Context, in *FetchAllRequest, opts ...grpc.CallOption) (*FetchAllResponse, error) +} + +type locketClient struct { + cc grpc.ClientConnInterface +} + +func NewLocketClient(cc grpc.ClientConnInterface) LocketClient { + return &locketClient{cc} +} + +func (c *locketClient) Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LockResponse) + err := c.cc.Invoke(ctx, Locket_Lock_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *locketClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(FetchResponse) + err := c.cc.Invoke(ctx, Locket_Fetch_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *locketClient) Release(ctx context.Context, in *ReleaseRequest, opts ...grpc.CallOption) (*ReleaseResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReleaseResponse) + err := c.cc.Invoke(ctx, Locket_Release_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *locketClient) FetchAll(ctx context.Context, in *FetchAllRequest, opts ...grpc.CallOption) (*FetchAllResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(FetchAllResponse) + err := c.cc.Invoke(ctx, Locket_FetchAll_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// LocketServer is the server API for Locket service. +// All implementations must embed UnimplementedLocketServer +// for forward compatibility. +type LocketServer interface { + Lock(context.Context, *LockRequest) (*LockResponse, error) + Fetch(context.Context, *FetchRequest) (*FetchResponse, error) + Release(context.Context, *ReleaseRequest) (*ReleaseResponse, error) + FetchAll(context.Context, *FetchAllRequest) (*FetchAllResponse, error) + mustEmbedUnimplementedLocketServer() +} + +// UnimplementedLocketServer 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 UnimplementedLocketServer struct{} + +func (UnimplementedLocketServer) Lock(context.Context, *LockRequest) (*LockResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Lock not implemented") +} +func (UnimplementedLocketServer) Fetch(context.Context, *FetchRequest) (*FetchResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Fetch not implemented") +} +func (UnimplementedLocketServer) Release(context.Context, *ReleaseRequest) (*ReleaseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Release not implemented") +} +func (UnimplementedLocketServer) FetchAll(context.Context, *FetchAllRequest) (*FetchAllResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FetchAll not implemented") +} +func (UnimplementedLocketServer) mustEmbedUnimplementedLocketServer() {} +func (UnimplementedLocketServer) testEmbeddedByValue() {} + +// UnsafeLocketServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to LocketServer will +// result in compilation errors. +type UnsafeLocketServer interface { + mustEmbedUnimplementedLocketServer() +} + +func RegisterLocketServer(s grpc.ServiceRegistrar, srv LocketServer) { + // If the following call pancis, it indicates UnimplementedLocketServer 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(&Locket_ServiceDesc, srv) +} + +func _Locket_Lock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LocketServer).Lock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Locket_Lock_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LocketServer).Lock(ctx, req.(*LockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Locket_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FetchRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LocketServer).Fetch(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Locket_Fetch_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LocketServer).Fetch(ctx, req.(*FetchRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Locket_Release_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReleaseRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LocketServer).Release(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Locket_Release_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LocketServer).Release(ctx, req.(*ReleaseRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Locket_FetchAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FetchAllRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LocketServer).FetchAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Locket_FetchAll_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LocketServer).FetchAll(ctx, req.(*FetchAllRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Locket_ServiceDesc is the grpc.ServiceDesc for Locket service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Locket_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "models.Locket", + HandlerType: (*LocketServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Lock", + Handler: _Locket_Lock_Handler, + }, + { + MethodName: "Fetch", + Handler: _Locket_Fetch_Handler, + }, + { + MethodName: "Release", + Handler: _Locket_Release_Handler, + }, + { + MethodName: "FetchAll", + Handler: _Locket_FetchAll_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "locket.proto", +} From dca4b5216a856668f2b64b066d87ccda6ae24448 Mon Sep 17 00:00:00 2001 From: Brandon Roberson Date: Fri, 13 Sep 2024 20:52:23 +0000 Subject: [PATCH 02/15] Update references to new protos --- cmd/locket/main_test.go | 58 ++-- db/dbfakes/fake_lock_db.go | 2 +- db/lock_db.go | 12 +- db/lock_db_test.go | 30 +- expiration/burglar_test.go | 4 +- expiration/expirationfakes/fake_lock_pick.go | 2 +- expiration/lock_pick.go | 2 + grpcserver/server_test.go | 4 +- handlers/context_test.go | 2 +- handlers/handler.go | 3 +- handlers/handler_test.go | 25 +- models/helpers.go | 12 +- models/helpers_test.go | 28 +- models/locket.pb.go | 289 +++++-------------- models/locket_grpc.pb.go | 3 +- scripts/generate_protos.sh | 5 +- 16 files changed, 183 insertions(+), 298 deletions(-) diff --git a/cmd/locket/main_test.go b/cmd/locket/main_test.go index cb908b9..6696cc6 100644 --- a/cmd/locket/main_test.go +++ b/cmd/locket/main_test.go @@ -172,7 +172,7 @@ var _ = Describe("Locket", func() { Context("when a lock is acquired", func() { JustBeforeEach(func() { - requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} + requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} _, err := locketClient.Lock(context.Background(), &models.LockRequest{ Resource: requestedResource, TtlInSeconds: 10, @@ -218,7 +218,7 @@ var _ = Describe("Locket", func() { wg.Add(10) for i := 0; i < 10; i++ { key := fmt.Sprintf("test%d", i) - requestedResource := &models.Resource{Key: key, Value: "test-data", Owner: key, TypeCode: models.LOCK} + requestedResource := &models.Resource{Key: key, Value: "test-data", Owner: key, TypeCode: models.TypeCode_LOCK} go func() { defer GinkgoRecover() defer wg.Done() @@ -332,7 +332,7 @@ var _ = Describe("Locket", func() { JustBeforeEach(func() { _, err := sqlRunner.DB().Exec("DROP TABLE locks") Expect(err).NotTo(HaveOccurred()) - requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} + requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} _, err = locketClient.Lock(context.Background(), &models.LockRequest{ Resource: requestedResource, TtlInSeconds: 10, @@ -347,8 +347,8 @@ var _ = Describe("Locket", func() { }) It("locks the key with the corresponding value", func() { - requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} - expectedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", Type: "lock", TypeCode: models.LOCK} + requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} + expectedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", Type: "lock", TypeCode: models.TypeCode_LOCK} _, err := locketClient.Lock(context.Background(), &models.LockRequest{ Resource: requestedResource, TtlInSeconds: 10, @@ -359,7 +359,7 @@ var _ = Describe("Locket", func() { Expect(err).NotTo(HaveOccurred()) Expect(resp.Resource).To(BeEquivalentTo(expectedResource)) - requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "nima", TypeCode: models.LOCK} + requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "nima", TypeCode: models.TypeCode_LOCK} _, err = locketClient.Lock(context.Background(), &models.LockRequest{ Resource: requestedResource, TtlInSeconds: 10, @@ -368,7 +368,7 @@ var _ = Describe("Locket", func() { }) It("logs the uuid of the request", func() { - requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} + requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs("uuid", "some-uuid")) _, err := locketClient.Lock(ctx, &models.LockRequest{ Resource: requestedResource, @@ -380,7 +380,7 @@ var _ = Describe("Locket", func() { }) It("expires after a ttl", func() { - requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} + requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} _, err := locketClient.Lock(context.Background(), &models.LockRequest{ Resource: requestedResource, TtlInSeconds: 6, @@ -395,7 +395,7 @@ var _ = Describe("Locket", func() { Context("when the lock server disappears unexpectedly", func() { It("still disappears after ~ the ttl", func() { - requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} + requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} _, err := locketClient.Lock(context.Background(), &models.LockRequest{ Resource: requestedResource, TtlInSeconds: 3, @@ -421,7 +421,7 @@ var _ = Describe("Locket", func() { Context("when the lock does not exist", func() { It("does not throw an error releasing the lock", func() { - requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} + requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} _, err := locketClient.Release(context.Background(), &models.ReleaseRequest{Resource: requestedResource}) Expect(err).NotTo(HaveOccurred()) }) @@ -429,8 +429,8 @@ var _ = Describe("Locket", func() { Context("when the lock exists", func() { JustBeforeEach(func() { - requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} - expectedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", Type: "lock", TypeCode: models.LOCK} + requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} + expectedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", Type: "lock", TypeCode: models.TypeCode_LOCK} _, err := locketClient.Lock(context.Background(), &models.LockRequest{Resource: requestedResource, TtlInSeconds: 10}) Expect(err).NotTo(HaveOccurred()) @@ -449,7 +449,7 @@ var _ = Describe("Locket", func() { Context("when another process is the lock owner", func() { It("throws an error", func() { - requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "nima", TypeCode: models.LOCK} + requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "nima", TypeCode: models.TypeCode_LOCK} _, err := locketClient.Release(context.Background(), &models.ReleaseRequest{Resource: requestedResource}) Expect(err).To(HaveOccurred()) }) @@ -492,25 +492,25 @@ var _ = Describe("Locket", func() { var expectedResource1, expectedResource2, expectedResource3, expectedResource4 *models.Resource BeforeEach(func() { - resource1 = &models.Resource{Key: "test-lock1", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} - resource2 = &models.Resource{Key: "test-lock2", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} - resource3 = &models.Resource{Key: "test-presence1", Value: "test-data", Owner: "jim", TypeCode: models.PRESENCE} - resource4 = &models.Resource{Key: "test-presence2", Value: "test-data", Owner: "jim", TypeCode: models.PRESENCE} - - expectedResource1 = &models.Resource{Key: "test-lock1", Value: "test-data", Owner: "jim", TypeCode: models.LOCK, Type: models.LockType} - expectedResource2 = &models.Resource{Key: "test-lock2", Value: "test-data", Owner: "jim", TypeCode: models.LOCK, Type: models.LockType} - expectedResource3 = &models.Resource{Key: "test-presence1", Value: "test-data", Owner: "jim", TypeCode: models.PRESENCE, Type: models.PresenceType} - expectedResource4 = &models.Resource{Key: "test-presence2", Value: "test-data", Owner: "jim", TypeCode: models.PRESENCE, Type: models.PresenceType} + resource1 = &models.Resource{Key: "test-lock1", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} + resource2 = &models.Resource{Key: "test-lock2", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} + resource3 = &models.Resource{Key: "test-presence1", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_PRESENCE} + resource4 = &models.Resource{Key: "test-presence2", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_PRESENCE} + + expectedResource1 = &models.Resource{Key: "test-lock1", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK, Type: models.LockType} + expectedResource2 = &models.Resource{Key: "test-lock2", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK, Type: models.LockType} + expectedResource3 = &models.Resource{Key: "test-presence1", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_PRESENCE, Type: models.PresenceType} + expectedResource4 = &models.Resource{Key: "test-presence2", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_PRESENCE, Type: models.PresenceType} }) It("fetches all the locks corresponding to type code", func() { - response, err := locketClient.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.LOCK}) + response, err := locketClient.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_LOCK}) Expect(err).NotTo(HaveOccurred()) Expect(response.Resources).To(ConsistOf(expectedResource1, expectedResource2)) }) It("fetches all the presences corresponding to type", func() { - response, err := locketClient.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.PRESENCE}) + response, err := locketClient.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_PRESENCE}) Expect(err).NotTo(HaveOccurred()) Expect(response.Resources).To(ConsistOf(expectedResource3, expectedResource4)) }) @@ -518,16 +518,16 @@ var _ = Describe("Locket", func() { Context("if the table disappears", func() { BeforeEach(func() { - resource1 = &models.Resource{Key: "test-lock1", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} - resource2 = &models.Resource{Key: "test-lock2", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} - resource3 = &models.Resource{Key: "test-presence1", Value: "test-data", Owner: "jim", TypeCode: models.PRESENCE} - resource4 = &models.Resource{Key: "test-presence2", Value: "test-data", Owner: "jim", TypeCode: models.PRESENCE} + resource1 = &models.Resource{Key: "test-lock1", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} + resource2 = &models.Resource{Key: "test-lock2", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} + resource3 = &models.Resource{Key: "test-presence1", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_PRESENCE} + resource4 = &models.Resource{Key: "test-presence2", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_PRESENCE} }) JustBeforeEach(func() { _, err := sqlRunner.DB().Exec("DROP TABLE locks") Expect(err).NotTo(HaveOccurred()) - _, err = locketClient.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.LOCK}) + _, err = locketClient.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_LOCK}) Expect(err).To(HaveOccurred()) }) diff --git a/db/dbfakes/fake_lock_db.go b/db/dbfakes/fake_lock_db.go index 58c5207..a34a6ad 100644 --- a/db/dbfakes/fake_lock_db.go +++ b/db/dbfakes/fake_lock_db.go @@ -5,7 +5,7 @@ import ( "context" "sync" - "code.cloudfoundry.org/lager/v3" + lager "code.cloudfoundry.org/lager/v3" "code.cloudfoundry.org/locket/db" "code.cloudfoundry.org/locket/models" ) diff --git a/db/lock_db.go b/db/lock_db.go index 1bac088..8beed5f 100644 --- a/db/lock_db.go +++ b/db/lock_db.go @@ -58,9 +58,10 @@ func (db *SQLDB) Lock(ctx context.Context, logger lager.Logger, resource *models if newLock { _, err = db.helper.Insert(ctx, logger, tx, "locks", helpers.SQLAttributes{ - "path": lock.Key, - "owner": lock.Owner, - "value": lock.Value, + "path": lock.Key, + "owner": lock.Owner, + "value": lock.Value, + //lint:ignore SA1019 - backwards compatibility "type": lock.Type, "modified_index": lock.ModifiedIndex, "modified_id": lock.ModifiedId, @@ -70,8 +71,9 @@ func (db *SQLDB) Lock(ctx context.Context, logger lager.Logger, resource *models } else { _, err = db.helper.Update(ctx, logger, tx, "locks", helpers.SQLAttributes{ - "owner": lock.Owner, - "value": lock.Value, + "owner": lock.Owner, + "value": lock.Value, + //lint:ignore SA1019 - backwards compatibility "type": lock.Type, "modified_index": lock.ModifiedIndex, "modified_id": lock.ModifiedId, diff --git a/db/lock_db_test.go b/db/lock_db_test.go index 8e806da..022776a 100644 --- a/db/lock_db_test.go +++ b/db/lock_db_test.go @@ -33,7 +33,9 @@ func validateLockInDB(rawDB *sql.DB, res *models.Resource, expectedIndex, expect if res.Value != value { errMsg += fmt.Sprintf("mismatch value (%s, %s),", res.Value, value) } + //lint:ignore SA1019 - testing deprecated functionality if res.Type != lockType { + //lint:ignore SA1019 - testing deprecated functionality errMsg += fmt.Sprintf("mismatch value (%s, %s),", res.Type, lockType) } if expectedIndex != index { @@ -83,11 +85,12 @@ var _ = Describe("Lock", func() { Type: "lock", } expectedResource = &models.Resource{ - Key: resource.Key, - Owner: resource.Owner, - Value: resource.Value, + Key: resource.Key, + Owner: resource.Owner, + Value: resource.Value, + //lint:ignore SA1019 - testing deprecated functionality Type: resource.Type, - TypeCode: models.LOCK, + TypeCode: models.TypeCode_LOCK, } fakeGUIDProvider.NextGUIDReturns("new-guid", nil) @@ -102,7 +105,7 @@ var _ = Describe("Lock", func() { Key: "quack", Owner: "iamthelizardking", Value: "i can do anything", - TypeCode: models.LOCK, + TypeCode: models.TypeCode_LOCK, } lock, err := sqlDB.Lock(ctx, logger, typeCodeResource, 10) Expect(err).NotTo(HaveOccurred()) @@ -290,6 +293,7 @@ var _ = Describe("Lock", func() { `INSERT INTO locks (path, owner, value, type, modified_index, modified_id, ttl) VALUES (?, ?, ?, ?, ?, ?, ?);`, dbFlavor, ) + //lint:ignore SA1019 - testing deprecated functionality result, err := rawDB.Exec(query, lock.Key, lock.Owner, lock.Value, lock.Type, 434, "modified-id", 5) Expect(err).NotTo(HaveOccurred()) Expect(result.RowsAffected()).To(BeEquivalentTo(1)) @@ -329,7 +333,7 @@ var _ = Describe("Lock", func() { Type: "lock", } expectedLock = lock - expectedLock.TypeCode = models.LOCK + expectedLock.TypeCode = models.TypeCode_LOCK }) It("returns the lock from the database", func() { @@ -353,7 +357,7 @@ var _ = Describe("Lock", func() { Type: "presence", } expectedLock = lock - expectedLock.TypeCode = models.PRESENCE + expectedLock.TypeCode = models.TypeCode_PRESENCE }) It("returns the lock from the database", func() { @@ -374,9 +378,10 @@ var _ = Describe("Lock", func() { Key: "test", Owner: "jim", Value: "locks stuff for days", - TypeCode: models.LOCK, + TypeCode: models.TypeCode_LOCK, } expectedLock = lock + //lint:ignore SA1019 - testing deprecated functionality expectedLock.Type = models.LockType }) @@ -398,9 +403,10 @@ var _ = Describe("Lock", func() { Key: "test", Owner: "jim", Value: "locks stuff for days", - TypeCode: models.PRESENCE, + TypeCode: models.TypeCode_PRESENCE, } expectedLock = lock + //lint:ignore SA1019 - testing deprecated functionality expectedLock.Type = models.PresenceType }) @@ -499,7 +505,7 @@ var _ = Describe("Lock", func() { Owner: "finn", Value: "thehuman", Type: "presence", - TypeCode: models.PRESENCE, + TypeCode: models.TypeCode_PRESENCE, }, ModifiedIndex: 10, ModifiedId: "hello", @@ -554,6 +560,7 @@ var _ = Describe("Lock", func() { dbFlavor, ) + //lint:ignore SA1019 - testing deprecated functionality result, err := rawDB.Exec(query, resource.Key, resource.Owner, resource.Value, currentIndex, currentTTL, modifiedId, resource.Type) Expect(err).NotTo(HaveOccurred()) Expect(result.RowsAffected()).To(BeEquivalentTo(1)) @@ -643,7 +650,8 @@ var _ = Describe("Lock", func() { Key: resource.Key, Owner: "danny", Value: resource.Value, - Type: resource.Type, + //lint:ignore SA1019 - testing deprecated functionality + Type: resource.Type, } released, err := sqlDB.FetchAndRelease(ctx, logger, oldLock) diff --git a/expiration/burglar_test.go b/expiration/burglar_test.go index e2d206a..4cd5f96 100644 --- a/expiration/burglar_test.go +++ b/expiration/burglar_test.go @@ -46,7 +46,7 @@ var _ = Describe("Burglar", func() { Owner: "town", Value: "won't you take me to", Type: "lock", - TypeCode: models.LOCK, + TypeCode: models.TypeCode_LOCK, }, TtlInSeconds: 25, ModifiedIndex: 3587584357348, @@ -58,7 +58,7 @@ var _ = Describe("Burglar", func() { Owner: "bar", Value: "chocolate chip", Type: "presence", - TypeCode: models.PRESENCE, + TypeCode: models.TypeCode_PRESENCE, }, TtlInSeconds: 437, ModifiedIndex: 2346, diff --git a/expiration/expirationfakes/fake_lock_pick.go b/expiration/expirationfakes/fake_lock_pick.go index 08bfe17..1faa379 100644 --- a/expiration/expirationfakes/fake_lock_pick.go +++ b/expiration/expirationfakes/fake_lock_pick.go @@ -4,7 +4,7 @@ package expirationfakes import ( "sync" - "code.cloudfoundry.org/lager/v3" + lager "code.cloudfoundry.org/lager/v3" "code.cloudfoundry.org/locket/db" "code.cloudfoundry.org/locket/expiration" ) diff --git a/expiration/lock_pick.go b/expiration/lock_pick.go index 62c5844..f117937 100644 --- a/expiration/lock_pick.go +++ b/expiration/lock_pick.go @@ -56,6 +56,7 @@ func (l lockPick) ExpirationCounts() (uint32, uint32) { } func (l lockPick) RegisterTTL(logger lager.Logger, lock *db.Lock) { + //lint:ignore SA1019 - backwards compatibility logger = logger.Session("register-ttl", lager.Data{"key": lock.Key, "modified-index": lock.ModifiedIndex, "type": lock.Type}) logger.Debug("starting") logger.Debug("completed") @@ -107,6 +108,7 @@ func (l lockPick) checkExpiration(logger lager.Logger, lock *db.Lock, closeChan if expired { logger.Info("lock-expired") counter := l.locksExpiredCount + //lint:ignore SA1019 - backwards compatibility if lock.Type == models.PresenceType { counter = l.presencesExpiredCount } diff --git a/grpcserver/server_test.go b/grpcserver/server_test.go index 9c34ace..d1e3a6b 100644 --- a/grpcserver/server_test.go +++ b/grpcserver/server_test.go @@ -98,7 +98,9 @@ var _ = Describe("GRPCServer", func() { }) }) -type testHandler struct{} +type testHandler struct { + models.UnimplementedLocketServer +} func (h *testHandler) Lock(ctx context.Context, req *models.LockRequest) (*models.LockResponse, error) { return &models.LockResponse{}, nil diff --git a/handlers/context_test.go b/handlers/context_test.go index c14949c..ad72805 100644 --- a/handlers/context_test.go +++ b/handlers/context_test.go @@ -69,7 +69,7 @@ var _ = Describe("LocketHandler", func() { Key: "test", Value: "test-value", Owner: "myself", - TypeCode: models.LOCK, + TypeCode: models.TypeCode_LOCK, } locketHandler = handlers.NewLocketHandler( diff --git a/handlers/handler.go b/handlers/handler.go index 05af6ae..1b62198 100644 --- a/handlers/handler.go +++ b/handlers/handler.go @@ -20,6 +20,7 @@ type locketHandler struct { exitCh chan<- struct{} lockPick expiration.LockPick metrics metrics_helpers.RequestMetrics + models.UnimplementedLocketServer } func NewLocketHandler(logger lager.Logger, db db.LockDB, lockPick expiration.LockPick, requestMetrics metrics_helpers.RequestMetrics, exitCh chan<- struct{}) *locketHandler { @@ -259,7 +260,7 @@ func validate(req interface{}) error { return models.ErrInvalidType } - if reqTypeCode == models.UNKNOWN { + if reqTypeCode == models.TypeCode_UNKNOWN { return models.ErrInvalidType } diff --git a/handlers/handler_test.go b/handlers/handler_test.go index 43d87ad..d5a370c 100644 --- a/handlers/handler_test.go +++ b/handlers/handler_test.go @@ -43,7 +43,7 @@ var _ = Describe("LocketHandler", func() { Key: "test", Value: "test-value", Owner: "myself", - TypeCode: models.LOCK, + TypeCode: models.TypeCode_LOCK, } locketHandler = handlers.NewLocketHandler( @@ -115,8 +115,9 @@ var _ = Describe("LocketHandler", func() { Context("validate lock type", func() { Context("when type_code is set", func() { It("should be valid on a valid type code and empty type", func() { + //lint:ignore SA1019 - testing deprecated functionality request.Resource.Type = "" - request.Resource.TypeCode = models.LOCK + request.Resource.TypeCode = models.TypeCode_LOCK _, err := locketHandler.Lock(context.Background(), request) Expect(err).NotTo(HaveOccurred()) @@ -125,8 +126,9 @@ var _ = Describe("LocketHandler", func() { }) It("should be invalid on an UNKNOWN type code and empty type", func() { + //lint:ignore SA1019 - testing deprecated functionality request.Resource.Type = "" - request.Resource.TypeCode = models.UNKNOWN + request.Resource.TypeCode = models.TypeCode_UNKNOWN _, err := locketHandler.Lock(context.Background(), request) Expect(err).To(HaveOccurred()) @@ -135,6 +137,7 @@ var _ = Describe("LocketHandler", func() { }) It("should be invalid on an non-existent type code", func() { + //lint:ignore SA1019 - testing deprecated functionality request.Resource.Type = "" request.Resource.TypeCode = 4 _, err := locketHandler.Lock(context.Background(), request) @@ -568,13 +571,13 @@ var _ = Describe("LocketHandler", func() { Context("validate lock type", func() { Context("when type_code is set", func() { It("should be valid on a valid type code and empty type", func() { - _, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.LOCK}) + _, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_LOCK}) Expect(err).NotTo(HaveOccurred()) metricsRecordSuccess(fakeRequestMetrics) metricsUseCorrectCallTags(fakeRequestMetrics, "FetchAll") - _, err = locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.PRESENCE}) + _, err = locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_PRESENCE}) Expect(err).NotTo(HaveOccurred()) }) @@ -590,7 +593,7 @@ var _ = Describe("LocketHandler", func() { Context("when the type is valid", func() { It("fetches all the presence locks in the database by type", func() { - fetchResp, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.PRESENCE}) + fetchResp, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_PRESENCE}) Expect(err).NotTo(HaveOccurred()) metricsRecordSuccess(fakeRequestMetrics) @@ -603,7 +606,7 @@ var _ = Describe("LocketHandler", func() { }) It("fetches all the lock locks in the database by type", func() { - fetchResp, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.LOCK}) + fetchResp, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_LOCK}) Expect(err).NotTo(HaveOccurred()) metricsRecordSuccess(fakeRequestMetrics) @@ -616,7 +619,7 @@ var _ = Describe("LocketHandler", func() { }) It("fetches all the presence locks in the database by type code", func() { - fetchResp, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.PRESENCE}) + fetchResp, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_PRESENCE}) Expect(err).NotTo(HaveOccurred()) metricsRecordSuccess(fakeRequestMetrics) @@ -629,7 +632,7 @@ var _ = Describe("LocketHandler", func() { }) It("fetches all the lock locks in the database by type code", func() { - fetchResp, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.LOCK}) + fetchResp, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_LOCK}) Expect(err).NotTo(HaveOccurred()) metricsRecordSuccess(fakeRequestMetrics) @@ -654,7 +657,7 @@ var _ = Describe("LocketHandler", func() { Context("when the type code is UNKNOWN", func() { It("returns an invalid type error", func() { - _, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.UNKNOWN}) + _, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_UNKNOWN}) Expect(err).To(HaveOccurred()) metricsRecordFailure(fakeRequestMetrics) @@ -682,7 +685,7 @@ var _ = Describe("LocketHandler", func() { }) It("logs and writes to the exit channel", func() { - locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.PRESENCE}) + locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_PRESENCE}) Expect(logger).To(gbytes.Say("unrecoverable-error")) metricsRecordFailure(fakeRequestMetrics) diff --git a/models/helpers.go b/models/helpers.go index 6928b72..0f8b865 100644 --- a/models/helpers.go +++ b/models/helpers.go @@ -2,7 +2,7 @@ package models func GetResource(resource *Resource) *Resource { r := &Resource{Key: resource.Key, Owner: resource.Owner, Value: resource.Value} - if resource.TypeCode == UNKNOWN { + if resource.TypeCode == TypeCode_UNKNOWN { r.TypeCode = GetTypeCode(resource.Type) r.Type = resource.Type } else { @@ -15,19 +15,19 @@ func GetResource(resource *Resource) *Resource { func GetTypeCode(lockType string) TypeCode { switch lockType { case LockType: - return LOCK + return TypeCode_LOCK case PresenceType: - return PRESENCE + return TypeCode_PRESENCE default: - return UNKNOWN + return TypeCode_UNKNOWN } } func GetType(resource *Resource) string { switch resource.TypeCode { - case LOCK: + case TypeCode_LOCK: return LockType - case PRESENCE: + case TypeCode_PRESENCE: return PresenceType default: return resource.Type diff --git a/models/helpers_test.go b/models/helpers_test.go index 8c95bc7..3cc1853 100644 --- a/models/helpers_test.go +++ b/models/helpers_test.go @@ -9,17 +9,17 @@ import ( var _ = Describe("helpers", func() { Describe("GetType", func() { It("matches the correct type to the type code", func() { - Expect(models.GetType(&models.Resource{TypeCode: models.PRESENCE})).To(Equal("presence")) - Expect(models.GetType(&models.Resource{TypeCode: models.LOCK})).To(Equal("lock")) - Expect(models.GetType(&models.Resource{Type: "sandwich", TypeCode: models.UNKNOWN})).To(Equal("sandwich")) + Expect(models.GetType(&models.Resource{TypeCode: models.TypeCode_PRESENCE})).To(Equal("presence")) + Expect(models.GetType(&models.Resource{TypeCode: models.TypeCode_LOCK})).To(Equal("lock")) + Expect(models.GetType(&models.Resource{Type: "sandwich", TypeCode: models.TypeCode_UNKNOWN})).To(Equal("sandwich")) }) }) Describe("GetTypeCode", func() { It("matches the correct type code to the type", func() { - Expect(models.GetTypeCode("presence")).To(Equal(models.PRESENCE)) - Expect(models.GetTypeCode("lock")).To(Equal(models.LOCK)) - Expect(models.GetTypeCode("sandwich")).To(Equal(models.UNKNOWN)) + Expect(models.GetTypeCode("presence")).To(Equal(models.TypeCode_PRESENCE)) + Expect(models.GetTypeCode("lock")).To(Equal(models.TypeCode_LOCK)) + Expect(models.GetTypeCode("sandwich")).To(Equal(models.TypeCode_UNKNOWN)) }) }) @@ -29,7 +29,7 @@ var _ = Describe("helpers", func() { Owner: "thelizardking", Value: "candoanything", Key: "sandwich", - TypeCode: models.UNKNOWN, + TypeCode: models.TypeCode_UNKNOWN, Type: "lock", } @@ -37,14 +37,14 @@ var _ = Describe("helpers", func() { Owner: "thelizardking", Value: "candoanything", Key: "sandwich", - TypeCode: models.UNKNOWN, + TypeCode: models.TypeCode_UNKNOWN, Type: "whut", } - Expect(models.GetResource(resource1).TypeCode).To(Equal(models.LOCK)) + Expect(models.GetResource(resource1).TypeCode).To(Equal(models.TypeCode_LOCK)) Expect(models.GetResource(resource1).Type).To(Equal("lock")) - Expect(models.GetResource(resource2).TypeCode).To(Equal(models.UNKNOWN)) + Expect(models.GetResource(resource2).TypeCode).To(Equal(models.TypeCode_UNKNOWN)) Expect(models.GetResource(resource2).Type).To(Equal("whut")) }) @@ -53,7 +53,7 @@ var _ = Describe("helpers", func() { Owner: "thelizardking", Value: "candoanything", Key: "sandwich", - TypeCode: models.LOCK, + TypeCode: models.TypeCode_LOCK, Type: "whut", } @@ -61,14 +61,14 @@ var _ = Describe("helpers", func() { Owner: "thelizardking", Value: "candoanything", Key: "sandwich", - TypeCode: models.PRESENCE, + TypeCode: models.TypeCode_PRESENCE, Type: "whut", } - Expect(models.GetResource(resource1).TypeCode).To(Equal(models.LOCK)) + Expect(models.GetResource(resource1).TypeCode).To(Equal(models.TypeCode_LOCK)) Expect(models.GetResource(resource1).Type).To(Equal("lock")) - Expect(models.GetResource(resource2).TypeCode).To(Equal(models.PRESENCE)) + Expect(models.GetResource(resource2).TypeCode).To(Equal(models.TypeCode_PRESENCE)) Expect(models.GetResource(resource2).Type).To(Equal("presence")) }) }) diff --git a/models/locket.pb.go b/models/locket.pb.go index 5741001..658fbc9 100644 --- a/models/locket.pb.go +++ b/models/locket.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 -// protoc v5.28.0 +// protoc-gen-go v1.36.5 +// protoc v4.25.6 // source: locket.proto package models @@ -11,6 +11,7 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -70,25 +71,22 @@ func (TypeCode) EnumDescriptor() ([]byte, []int) { } type Resource struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` - Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` // Deprecated: Marked as deprecated in locket.proto. - Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"` - TypeCode TypeCode `protobuf:"varint,5,opt,name=type_code,json=typeCode,proto3,enum=models.TypeCode" json:"type_code,omitempty"` + Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"` + TypeCode TypeCode `protobuf:"varint,5,opt,name=type_code,json=typeCode,proto3,enum=models.TypeCode" json:"type_code,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Resource) Reset() { *x = Resource{} - if protoimpl.UnsafeEnabled { - mi := &file_locket_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_locket_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Resource) String() string { @@ -99,7 +97,7 @@ func (*Resource) ProtoMessage() {} func (x *Resource) ProtoReflect() protoreflect.Message { mi := &file_locket_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -151,21 +149,18 @@ func (x *Resource) GetTypeCode() TypeCode { } type LockRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` + TtlInSeconds int64 `protobuf:"varint,2,opt,name=ttl_in_seconds,json=ttlInSeconds,proto3" json:"ttl_in_seconds,omitempty"` unknownFields protoimpl.UnknownFields - - Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` - TtlInSeconds int64 `protobuf:"varint,2,opt,name=ttl_in_seconds,json=ttlInSeconds,proto3" json:"ttl_in_seconds,omitempty"` + sizeCache protoimpl.SizeCache } func (x *LockRequest) Reset() { *x = LockRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_locket_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_locket_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *LockRequest) String() string { @@ -176,7 +171,7 @@ func (*LockRequest) ProtoMessage() {} func (x *LockRequest) ProtoReflect() protoreflect.Message { mi := &file_locket_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -206,18 +201,16 @@ func (x *LockRequest) GetTtlInSeconds() int64 { } type LockResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *LockResponse) Reset() { *x = LockResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_locket_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_locket_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *LockResponse) String() string { @@ -228,7 +221,7 @@ func (*LockResponse) ProtoMessage() {} func (x *LockResponse) ProtoReflect() protoreflect.Message { mi := &file_locket_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -244,20 +237,17 @@ func (*LockResponse) Descriptor() ([]byte, []int) { } type ReleaseRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` unknownFields protoimpl.UnknownFields - - Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ReleaseRequest) Reset() { *x = ReleaseRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_locket_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_locket_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReleaseRequest) String() string { @@ -268,7 +258,7 @@ func (*ReleaseRequest) ProtoMessage() {} func (x *ReleaseRequest) ProtoReflect() protoreflect.Message { mi := &file_locket_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -291,18 +281,16 @@ func (x *ReleaseRequest) GetResource() *Resource { } type ReleaseResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReleaseResponse) Reset() { *x = ReleaseResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_locket_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_locket_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReleaseResponse) String() string { @@ -313,7 +301,7 @@ func (*ReleaseResponse) ProtoMessage() {} func (x *ReleaseResponse) ProtoReflect() protoreflect.Message { mi := &file_locket_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -329,20 +317,17 @@ func (*ReleaseResponse) Descriptor() ([]byte, []int) { } type FetchRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` unknownFields protoimpl.UnknownFields - - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + sizeCache protoimpl.SizeCache } func (x *FetchRequest) Reset() { *x = FetchRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_locket_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_locket_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FetchRequest) String() string { @@ -353,7 +338,7 @@ func (*FetchRequest) ProtoMessage() {} func (x *FetchRequest) ProtoReflect() protoreflect.Message { mi := &file_locket_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -376,20 +361,17 @@ func (x *FetchRequest) GetKey() string { } type FetchResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` unknownFields protoimpl.UnknownFields - - Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` + sizeCache protoimpl.SizeCache } func (x *FetchResponse) Reset() { *x = FetchResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_locket_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_locket_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FetchResponse) String() string { @@ -400,7 +382,7 @@ func (*FetchResponse) ProtoMessage() {} func (x *FetchResponse) ProtoReflect() protoreflect.Message { mi := &file_locket_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -423,22 +405,19 @@ func (x *FetchResponse) GetResource() *Resource { } type FetchAllRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` // Deprecated: Marked as deprecated in locket.proto. - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - TypeCode TypeCode `protobuf:"varint,2,opt,name=type_code,json=typeCode,proto3,enum=models.TypeCode" json:"type_code,omitempty"` + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + TypeCode TypeCode `protobuf:"varint,2,opt,name=type_code,json=typeCode,proto3,enum=models.TypeCode" json:"type_code,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *FetchAllRequest) Reset() { *x = FetchAllRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_locket_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_locket_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FetchAllRequest) String() string { @@ -449,7 +428,7 @@ func (*FetchAllRequest) ProtoMessage() {} func (x *FetchAllRequest) ProtoReflect() protoreflect.Message { mi := &file_locket_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -480,20 +459,17 @@ func (x *FetchAllRequest) GetTypeCode() TypeCode { } type FetchAllResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Resources []*Resource `protobuf:"bytes,1,rep,name=resources,proto3" json:"resources,omitempty"` unknownFields protoimpl.UnknownFields - - Resources []*Resource `protobuf:"bytes,1,rep,name=resources,proto3" json:"resources,omitempty"` + sizeCache protoimpl.SizeCache } func (x *FetchAllResponse) Reset() { *x = FetchAllResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_locket_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_locket_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FetchAllResponse) String() string { @@ -504,7 +480,7 @@ func (*FetchAllResponse) ProtoMessage() {} func (x *FetchAllResponse) ProtoReflect() protoreflect.Message { mi := &file_locket_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -528,7 +504,7 @@ func (x *FetchAllResponse) GetResources() []*Resource { var File_locket_proto protoreflect.FileDescriptor -var file_locket_proto_rawDesc = []byte{ +var file_locket_proto_rawDesc = string([]byte{ 0x0a, 0x0c, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x22, 0x8f, 0x01, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, @@ -590,16 +566,16 @@ var file_locket_proto_rawDesc = []byte{ 0x6f, 0x75, 0x64, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x72, 0x79, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} +}) var ( file_locket_proto_rawDescOnce sync.Once - file_locket_proto_rawDescData = file_locket_proto_rawDesc + file_locket_proto_rawDescData []byte ) func file_locket_proto_rawDescGZIP() []byte { file_locket_proto_rawDescOnce.Do(func() { - file_locket_proto_rawDescData = protoimpl.X.CompressGZIP(file_locket_proto_rawDescData) + file_locket_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_locket_proto_rawDesc), len(file_locket_proto_rawDesc))) }) return file_locket_proto_rawDescData } @@ -645,121 +621,11 @@ func file_locket_proto_init() { if File_locket_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_locket_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*Resource); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_locket_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*LockRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_locket_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*LockResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_locket_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*ReleaseRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_locket_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*ReleaseResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_locket_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*FetchRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_locket_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*FetchResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_locket_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*FetchAllRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_locket_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*FetchAllResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_locket_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_locket_proto_rawDesc), len(file_locket_proto_rawDesc)), NumEnums: 1, NumMessages: 9, NumExtensions: 0, @@ -771,7 +637,6 @@ func file_locket_proto_init() { MessageInfos: file_locket_proto_msgTypes, }.Build() File_locket_proto = out.File - file_locket_proto_rawDesc = nil file_locket_proto_goTypes = nil file_locket_proto_depIdxs = nil } diff --git a/models/locket_grpc.pb.go b/models/locket_grpc.pb.go index 1a19ca5..a92998e 100644 --- a/models/locket_grpc.pb.go +++ b/models/locket_grpc.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v5.28.0 +// - protoc v4.25.6 // source: locket.proto package models import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/scripts/generate_protos.sh b/scripts/generate_protos.sh index 5e0f7e0..c3d44ed 100755 --- a/scripts/generate_protos.sh +++ b/scripts/generate_protos.sh @@ -1,5 +1,8 @@ set -e DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" pushd "$DIR/../models" -protoc --proto_path=../../vendor:../../vendor/github.com/golang/protobuf/ptypes/duration/:. --gogoslick_out=plugins=grpc:. *.proto +protoc --proto_path=../../vendor:../../vendor/github.com/golang/protobuf/ptypes/duration/:. \ + --go_out=. --go_opt=paths=source_relative \ + --go-grpc_out=. --go-grpc_opt=paths=source_relative \ + ./*.proto popd From aea6ad3c192f1a9d1e6590f71964e3d5813c6a9a Mon Sep 17 00:00:00 2001 From: Brandon Roberson Date: Fri, 14 Feb 2025 16:14:35 +0000 Subject: [PATCH 03/15] Change github.com/golang/protobuf (deprecated) to google.golang.org/protobuf --- scripts/generate_protos.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate_protos.sh b/scripts/generate_protos.sh index c3d44ed..518e54a 100755 --- a/scripts/generate_protos.sh +++ b/scripts/generate_protos.sh @@ -1,7 +1,7 @@ set -e DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" pushd "$DIR/../models" -protoc --proto_path=../../vendor:../../vendor/github.com/golang/protobuf/ptypes/duration/:. \ +protoc --proto_path=../../vendor:../../vendor/google.golang.org/protobuf/types/known/durationpb/:. \ --go_out=. --go_opt=paths=source_relative \ --go-grpc_out=. --go-grpc_opt=paths=source_relative \ ./*.proto From eb2b569f10c4fed00ad442b4f4d52f8cb8f48e08 Mon Sep 17 00:00:00 2001 From: Brandon Roberson Date: Wed, 26 Feb 2025 01:27:50 +0000 Subject: [PATCH 04/15] Convert to use new backwards-compatible protobufs --- cmd/locket/main_test.go | 149 ++-- db/lock_db_test.go | 14 +- expiration/burglar_test.go | 4 +- grpcserver/server_test.go | 24 +- handlers/context_test.go | 7 +- handlers/handler.go | 46 +- handlers/handler_test.go | 91 ++- lock/lock.go | 12 +- lock/lock_test.go | 13 +- models/helpers.go | 12 +- models/helpers_test.go | 28 +- models/locket.pb.go | 391 +++++----- models/locket.proto | 48 +- models/locket_bbs.pb.go | 937 +++++++++++++++++++++++ models/locket_grpc.pb.go | 58 +- models/modelsfakes/fake_locket_client.go | 104 +-- scripts/generate_protos.sh | 5 +- 17 files changed, 1474 insertions(+), 469 deletions(-) create mode 100644 models/locket_bbs.pb.go diff --git a/cmd/locket/main_test.go b/cmd/locket/main_test.go index 6696cc6..7b5a66b 100644 --- a/cmd/locket/main_test.go +++ b/cmd/locket/main_test.go @@ -172,11 +172,12 @@ var _ = Describe("Locket", func() { Context("when a lock is acquired", func() { JustBeforeEach(func() { - requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} - _, err := locketClient.Lock(context.Background(), &models.LockRequest{ + requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} + lockRequest := &models.LockRequest{ Resource: requestedResource, TtlInSeconds: 10, - }) + } + _, err := locketClient.Lock(context.Background(), lockRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) }) @@ -218,16 +219,17 @@ var _ = Describe("Locket", func() { wg.Add(10) for i := 0; i < 10; i++ { key := fmt.Sprintf("test%d", i) - requestedResource := &models.Resource{Key: key, Value: "test-data", Owner: key, TypeCode: models.TypeCode_LOCK} + requestedResource := &models.Resource{Key: key, Value: "test-data", Owner: key, TypeCode: models.LOCK} go func() { defer GinkgoRecover() defer wg.Done() var err error for j := 0; j < 3; j++ { - _, err := locketClient.Lock(context.Background(), &models.LockRequest{ + lockRequest := &models.LockRequest{ Resource: requestedResource, TtlInSeconds: 10, - }) + } + _, err := locketClient.Lock(context.Background(), lockRequest.ToProto()) if err == nil { break } @@ -332,11 +334,12 @@ var _ = Describe("Locket", func() { JustBeforeEach(func() { _, err := sqlRunner.DB().Exec("DROP TABLE locks") Expect(err).NotTo(HaveOccurred()) - requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} - _, err = locketClient.Lock(context.Background(), &models.LockRequest{ + requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} + lockRequest := &models.LockRequest{ Resource: requestedResource, TtlInSeconds: 10, - }) + } + _, err = locketClient.Lock(context.Background(), lockRequest.ToProto()) Expect(err).To(HaveOccurred()) }) @@ -347,59 +350,66 @@ var _ = Describe("Locket", func() { }) It("locks the key with the corresponding value", func() { - requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} - expectedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", Type: "lock", TypeCode: models.TypeCode_LOCK} - _, err := locketClient.Lock(context.Background(), &models.LockRequest{ + requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} + expectedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", Type: "lock", TypeCode: models.LOCK} + lockRequest := &models.LockRequest{ Resource: requestedResource, TtlInSeconds: 10, - }) + } + _, err := locketClient.Lock(context.Background(), lockRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) - resp, err := locketClient.Fetch(context.Background(), &models.FetchRequest{Key: "test"}) + fetchRequest := &models.FetchRequest{Key: "test"} + resp, err := locketClient.Fetch(context.Background(), fetchRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) Expect(resp.Resource).To(BeEquivalentTo(expectedResource)) - requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "nima", TypeCode: models.TypeCode_LOCK} - _, err = locketClient.Lock(context.Background(), &models.LockRequest{ + requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "nima", TypeCode: models.LOCK} + lockRequest = &models.LockRequest{ Resource: requestedResource, TtlInSeconds: 10, - }) + } + _, err = locketClient.Lock(context.Background(), lockRequest.ToProto()) Expect(err).To(HaveOccurred()) }) It("logs the uuid of the request", func() { - requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} + requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs("uuid", "some-uuid")) - _, err := locketClient.Lock(ctx, &models.LockRequest{ + lockRequest := &models.LockRequest{ Resource: requestedResource, TtlInSeconds: 10, - }) + } + _, err := locketClient.Lock(ctx, lockRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) Eventually(locketRunner).Should(gbytes.Say("some-uuid")) }) It("expires after a ttl", func() { - requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} - _, err := locketClient.Lock(context.Background(), &models.LockRequest{ + requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} + lockRequest := &models.LockRequest{ Resource: requestedResource, TtlInSeconds: 6, - }) + } + _, err := locketClient.Lock(context.Background(), lockRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) Eventually(func() error { - _, err := locketClient.Fetch(context.Background(), &models.FetchRequest{Key: "test"}) + fetchRequest := &models.FetchRequest{Key: "test"} + _, err := locketClient.Fetch(context.Background(), fetchRequest.ToProto()) return err }, 10*time.Second).Should(HaveOccurred()) }) Context("when the lock server disappears unexpectedly", func() { It("still disappears after ~ the ttl", func() { - requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} - _, err := locketClient.Lock(context.Background(), &models.LockRequest{ + requestedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} + lockRequest := &models.LockRequest{ Resource: requestedResource, TtlInSeconds: 3, - }) + } + _, err := locketClient.Lock(context.Background(), lockRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) ginkgomon.Kill(locketProcess) @@ -409,7 +419,8 @@ var _ = Describe("Locket", func() { locketProcess = ginkgomon.Invoke(locketRunner) Eventually(func() error { - _, err := locketClient.Fetch(context.Background(), &models.FetchRequest{Key: "test"}) + fetchRequest := &models.FetchRequest{Key: "test"} + _, err := locketClient.Fetch(context.Background(), fetchRequest.ToProto()) return err }, 6*time.Second).Should(HaveOccurred()) }) @@ -421,36 +432,42 @@ var _ = Describe("Locket", func() { Context("when the lock does not exist", func() { It("does not throw an error releasing the lock", func() { - requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} - _, err := locketClient.Release(context.Background(), &models.ReleaseRequest{Resource: requestedResource}) + requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} + releaseRequest := &models.ReleaseRequest{Resource: requestedResource} + _, err := locketClient.Release(context.Background(), releaseRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) }) }) Context("when the lock exists", func() { JustBeforeEach(func() { - requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} - expectedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", Type: "lock", TypeCode: models.TypeCode_LOCK} - _, err := locketClient.Lock(context.Background(), &models.LockRequest{Resource: requestedResource, TtlInSeconds: 10}) + requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} + expectedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", Type: "lock", TypeCode: models.LOCK} + lockRequest := &models.LockRequest{Resource: requestedResource, TtlInSeconds: 10} + _, err := locketClient.Lock(context.Background(), lockRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) - resp, err := locketClient.Fetch(context.Background(), &models.FetchRequest{Key: "test"}) + fetchRequest := &models.FetchRequest{Key: "test"} + resp, err := locketClient.Fetch(context.Background(), fetchRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) Expect(resp.Resource).To(BeEquivalentTo(expectedResource)) }) It("releases the lock", func() { - _, err := locketClient.Release(context.Background(), &models.ReleaseRequest{Resource: requestedResource}) + releaseRequest := &models.ReleaseRequest{Resource: requestedResource} + _, err := locketClient.Release(context.Background(), releaseRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) - _, err = locketClient.Fetch(context.Background(), &models.FetchRequest{Key: "test"}) + fetchRequest := &models.FetchRequest{Key: "test"} + _, err = locketClient.Fetch(context.Background(), fetchRequest.ToProto()) Expect(err).To(HaveOccurred()) }) Context("when another process is the lock owner", func() { It("throws an error", func() { - requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "nima", TypeCode: models.TypeCode_LOCK} - _, err := locketClient.Release(context.Background(), &models.ReleaseRequest{Resource: requestedResource}) + requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "nima", TypeCode: models.LOCK} + releaseRequest := &models.ReleaseRequest{Resource: requestedResource} + _, err := locketClient.Release(context.Background(), releaseRequest.ToProto()) Expect(err).To(HaveOccurred()) }) }) @@ -463,28 +480,33 @@ var _ = Describe("Locket", func() { ) JustBeforeEach(func() { - _, err := locketClient.Lock(context.Background(), &models.LockRequest{ + + lock1Request := &models.LockRequest{ Resource: resource1, TtlInSeconds: 10, - }) + } + _, err := locketClient.Lock(context.Background(), lock1Request.ToProto()) Expect(err).NotTo(HaveOccurred()) - _, err = locketClient.Lock(context.Background(), &models.LockRequest{ + lock2Request := &models.LockRequest{ Resource: resource2, TtlInSeconds: 10, - }) + } + _, err = locketClient.Lock(context.Background(), lock2Request.ToProto()) Expect(err).NotTo(HaveOccurred()) - _, err = locketClient.Lock(context.Background(), &models.LockRequest{ + lock3Request := &models.LockRequest{ Resource: resource3, TtlInSeconds: 10, - }) + } + _, err = locketClient.Lock(context.Background(), lock3Request.ToProto()) Expect(err).NotTo(HaveOccurred()) - _, err = locketClient.Lock(context.Background(), &models.LockRequest{ + lock4Request := &models.LockRequest{ Resource: resource4, TtlInSeconds: 10, - }) + } + _, err = locketClient.Lock(context.Background(), lock4Request.ToProto()) Expect(err).NotTo(HaveOccurred()) }) @@ -492,25 +514,27 @@ var _ = Describe("Locket", func() { var expectedResource1, expectedResource2, expectedResource3, expectedResource4 *models.Resource BeforeEach(func() { - resource1 = &models.Resource{Key: "test-lock1", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} - resource2 = &models.Resource{Key: "test-lock2", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} - resource3 = &models.Resource{Key: "test-presence1", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_PRESENCE} - resource4 = &models.Resource{Key: "test-presence2", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_PRESENCE} - - expectedResource1 = &models.Resource{Key: "test-lock1", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK, Type: models.LockType} - expectedResource2 = &models.Resource{Key: "test-lock2", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK, Type: models.LockType} - expectedResource3 = &models.Resource{Key: "test-presence1", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_PRESENCE, Type: models.PresenceType} - expectedResource4 = &models.Resource{Key: "test-presence2", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_PRESENCE, Type: models.PresenceType} + resource1 = &models.Resource{Key: "test-lock1", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} + resource2 = &models.Resource{Key: "test-lock2", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} + resource3 = &models.Resource{Key: "test-presence1", Value: "test-data", Owner: "jim", TypeCode: models.PRESENCE} + resource4 = &models.Resource{Key: "test-presence2", Value: "test-data", Owner: "jim", TypeCode: models.PRESENCE} + + expectedResource1 = &models.Resource{Key: "test-lock1", Value: "test-data", Owner: "jim", TypeCode: models.LOCK, Type: models.LockType} + expectedResource2 = &models.Resource{Key: "test-lock2", Value: "test-data", Owner: "jim", TypeCode: models.LOCK, Type: models.LockType} + expectedResource3 = &models.Resource{Key: "test-presence1", Value: "test-data", Owner: "jim", TypeCode: models.PRESENCE, Type: models.PresenceType} + expectedResource4 = &models.Resource{Key: "test-presence2", Value: "test-data", Owner: "jim", TypeCode: models.PRESENCE, Type: models.PresenceType} }) It("fetches all the locks corresponding to type code", func() { - response, err := locketClient.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_LOCK}) + fetchAllRequest := &models.FetchAllRequest{TypeCode: models.LOCK} + response, err := locketClient.FetchAll(context.Background(), fetchAllRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) Expect(response.Resources).To(ConsistOf(expectedResource1, expectedResource2)) }) It("fetches all the presences corresponding to type", func() { - response, err := locketClient.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_PRESENCE}) + fetchAllRequest := &models.FetchAllRequest{TypeCode: models.PRESENCE} + response, err := locketClient.FetchAll(context.Background(), fetchAllRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) Expect(response.Resources).To(ConsistOf(expectedResource3, expectedResource4)) }) @@ -518,16 +542,17 @@ var _ = Describe("Locket", func() { Context("if the table disappears", func() { BeforeEach(func() { - resource1 = &models.Resource{Key: "test-lock1", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} - resource2 = &models.Resource{Key: "test-lock2", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_LOCK} - resource3 = &models.Resource{Key: "test-presence1", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_PRESENCE} - resource4 = &models.Resource{Key: "test-presence2", Value: "test-data", Owner: "jim", TypeCode: models.TypeCode_PRESENCE} + resource1 = &models.Resource{Key: "test-lock1", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} + resource2 = &models.Resource{Key: "test-lock2", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} + resource3 = &models.Resource{Key: "test-presence1", Value: "test-data", Owner: "jim", TypeCode: models.PRESENCE} + resource4 = &models.Resource{Key: "test-presence2", Value: "test-data", Owner: "jim", TypeCode: models.PRESENCE} }) JustBeforeEach(func() { _, err := sqlRunner.DB().Exec("DROP TABLE locks") Expect(err).NotTo(HaveOccurred()) - _, err = locketClient.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_LOCK}) + fetchAllRequest := &models.FetchAllRequest{TypeCode: models.LOCK} + _, err = locketClient.FetchAll(context.Background(), fetchAllRequest.ToProto()) Expect(err).To(HaveOccurred()) }) diff --git a/db/lock_db_test.go b/db/lock_db_test.go index 022776a..27393ba 100644 --- a/db/lock_db_test.go +++ b/db/lock_db_test.go @@ -90,7 +90,7 @@ var _ = Describe("Lock", func() { Value: resource.Value, //lint:ignore SA1019 - testing deprecated functionality Type: resource.Type, - TypeCode: models.TypeCode_LOCK, + TypeCode: models.LOCK, } fakeGUIDProvider.NextGUIDReturns("new-guid", nil) @@ -105,7 +105,7 @@ var _ = Describe("Lock", func() { Key: "quack", Owner: "iamthelizardking", Value: "i can do anything", - TypeCode: models.TypeCode_LOCK, + TypeCode: models.LOCK, } lock, err := sqlDB.Lock(ctx, logger, typeCodeResource, 10) Expect(err).NotTo(HaveOccurred()) @@ -333,7 +333,7 @@ var _ = Describe("Lock", func() { Type: "lock", } expectedLock = lock - expectedLock.TypeCode = models.TypeCode_LOCK + expectedLock.TypeCode = models.LOCK }) It("returns the lock from the database", func() { @@ -357,7 +357,7 @@ var _ = Describe("Lock", func() { Type: "presence", } expectedLock = lock - expectedLock.TypeCode = models.TypeCode_PRESENCE + expectedLock.TypeCode = models.PRESENCE }) It("returns the lock from the database", func() { @@ -378,7 +378,7 @@ var _ = Describe("Lock", func() { Key: "test", Owner: "jim", Value: "locks stuff for days", - TypeCode: models.TypeCode_LOCK, + TypeCode: models.LOCK, } expectedLock = lock //lint:ignore SA1019 - testing deprecated functionality @@ -403,7 +403,7 @@ var _ = Describe("Lock", func() { Key: "test", Owner: "jim", Value: "locks stuff for days", - TypeCode: models.TypeCode_PRESENCE, + TypeCode: models.PRESENCE, } expectedLock = lock //lint:ignore SA1019 - testing deprecated functionality @@ -505,7 +505,7 @@ var _ = Describe("Lock", func() { Owner: "finn", Value: "thehuman", Type: "presence", - TypeCode: models.TypeCode_PRESENCE, + TypeCode: models.PRESENCE, }, ModifiedIndex: 10, ModifiedId: "hello", diff --git a/expiration/burglar_test.go b/expiration/burglar_test.go index 4cd5f96..e2d206a 100644 --- a/expiration/burglar_test.go +++ b/expiration/burglar_test.go @@ -46,7 +46,7 @@ var _ = Describe("Burglar", func() { Owner: "town", Value: "won't you take me to", Type: "lock", - TypeCode: models.TypeCode_LOCK, + TypeCode: models.LOCK, }, TtlInSeconds: 25, ModifiedIndex: 3587584357348, @@ -58,7 +58,7 @@ var _ = Describe("Burglar", func() { Owner: "bar", Value: "chocolate chip", Type: "presence", - TypeCode: models.TypeCode_PRESENCE, + TypeCode: models.PRESENCE, }, TtlInSeconds: 437, ModifiedIndex: 2346, diff --git a/grpcserver/server_test.go b/grpcserver/server_test.go index d1e3a6b..b2a7a92 100644 --- a/grpcserver/server_test.go +++ b/grpcserver/server_test.go @@ -69,16 +69,16 @@ var _ = Describe("GRPCServer", func() { Expect(err).NotTo(HaveOccurred()) locketClient := models.NewLocketClient(conn) - _, err = locketClient.Lock(context.Background(), &models.LockRequest{}) + _, err = locketClient.Lock(context.Background(), &models.ProtoLockRequest{}) Expect(err).NotTo(HaveOccurred()) - _, err = locketClient.Release(context.Background(), &models.ReleaseRequest{}) + _, err = locketClient.Release(context.Background(), &models.ProtoReleaseRequest{}) Expect(err).NotTo(HaveOccurred()) - _, err = locketClient.Fetch(context.Background(), &models.FetchRequest{}) + _, err = locketClient.Fetch(context.Background(), &models.ProtoFetchRequest{}) Expect(err).NotTo(HaveOccurred()) - _, err = locketClient.FetchAll(context.Background(), &models.FetchAllRequest{}) + _, err = locketClient.FetchAll(context.Background(), &models.ProtoFetchAllRequest{}) Expect(err).NotTo(HaveOccurred()) }) @@ -102,15 +102,15 @@ type testHandler struct { models.UnimplementedLocketServer } -func (h *testHandler) Lock(ctx context.Context, req *models.LockRequest) (*models.LockResponse, error) { - return &models.LockResponse{}, nil +func (h *testHandler) Lock(ctx context.Context, req *models.ProtoLockRequest) (*models.ProtoLockResponse, error) { + return &models.ProtoLockResponse{}, nil } -func (h *testHandler) Release(ctx context.Context, req *models.ReleaseRequest) (*models.ReleaseResponse, error) { - return &models.ReleaseResponse{}, nil +func (h *testHandler) Release(ctx context.Context, req *models.ProtoReleaseRequest) (*models.ProtoReleaseResponse, error) { + return &models.ProtoReleaseResponse{}, nil } -func (h *testHandler) Fetch(ctx context.Context, req *models.FetchRequest) (*models.FetchResponse, error) { - return &models.FetchResponse{}, nil +func (h *testHandler) Fetch(ctx context.Context, req *models.ProtoFetchRequest) (*models.ProtoFetchResponse, error) { + return &models.ProtoFetchResponse{}, nil } -func (h *testHandler) FetchAll(ctx context.Context, req *models.FetchAllRequest) (*models.FetchAllResponse, error) { - return &models.FetchAllResponse{}, nil +func (h *testHandler) FetchAll(ctx context.Context, req *models.ProtoFetchAllRequest) (*models.ProtoFetchAllResponse, error) { + return &models.ProtoFetchAllResponse{}, nil } diff --git a/handlers/context_test.go b/handlers/context_test.go index ad72805..74cf64e 100644 --- a/handlers/context_test.go +++ b/handlers/context_test.go @@ -69,7 +69,7 @@ var _ = Describe("LocketHandler", func() { Key: "test", Value: "test-value", Owner: "myself", - TypeCode: models.TypeCode_LOCK, + TypeCode: models.LOCK, } locketHandler = handlers.NewLocketHandler( @@ -122,10 +122,11 @@ var _ = Describe("LocketHandler", func() { finishedRequest := make(chan struct{}, 1) go func() { defer GinkgoRecover() - _, err := locketHandler.Lock(ctxWithCancel, &models.LockRequest{ + lockRequest := &models.LockRequest{ Resource: resource, TtlInSeconds: 10, - }) + } + _, err := locketHandler.Lock(ctxWithCancel, lockRequest.ToProto()) Expect(err).To(HaveOccurred()) Expect(err).To(MatchError(context.Canceled)) close(finishedRequest) diff --git a/handlers/handler.go b/handlers/handler.go index 1b62198..af6712b 100644 --- a/handlers/handler.go +++ b/handlers/handler.go @@ -84,9 +84,9 @@ func (h *locketHandler) monitorRequest(requestType string, ctx context.Context, return err } -func (h *locketHandler) Lock(ctx context.Context, req *models.LockRequest) (*models.LockResponse, error) { +func (h *locketHandler) Lock(ctx context.Context, req *models.ProtoLockRequest) (*models.ProtoLockResponse, error) { var ( - response *models.LockResponse + response *models.ProtoLockResponse err error ) @@ -98,9 +98,9 @@ func (h *locketHandler) Lock(ctx context.Context, req *models.LockRequest) (*mod return response, err } -func (h *locketHandler) Release(ctx context.Context, req *models.ReleaseRequest) (*models.ReleaseResponse, error) { +func (h *locketHandler) Release(ctx context.Context, req *models.ProtoReleaseRequest) (*models.ProtoReleaseResponse, error) { var ( - response *models.ReleaseResponse + response *models.ProtoReleaseResponse err error ) @@ -112,9 +112,9 @@ func (h *locketHandler) Release(ctx context.Context, req *models.ReleaseRequest) return response, err } -func (h *locketHandler) Fetch(ctx context.Context, req *models.FetchRequest) (*models.FetchResponse, error) { +func (h *locketHandler) Fetch(ctx context.Context, req *models.ProtoFetchRequest) (*models.ProtoFetchResponse, error) { var ( - response *models.FetchResponse + response *models.ProtoFetchResponse err error ) @@ -126,9 +126,9 @@ func (h *locketHandler) Fetch(ctx context.Context, req *models.FetchRequest) (*m return response, err } -func (h *locketHandler) FetchAll(ctx context.Context, req *models.FetchAllRequest) (*models.FetchAllResponse, error) { +func (h *locketHandler) FetchAll(ctx context.Context, req *models.ProtoFetchAllRequest) (*models.ProtoFetchAllResponse, error) { var ( - response *models.FetchAllResponse + response *models.ProtoFetchAllResponse err error ) @@ -140,7 +140,7 @@ func (h *locketHandler) FetchAll(ctx context.Context, req *models.FetchAllReques return response, err } -func (h *locketHandler) lock(ctx context.Context, req *models.LockRequest) (*models.LockResponse, error) { +func (h *locketHandler) lock(ctx context.Context, req *models.ProtoLockRequest) (*models.ProtoLockResponse, error) { logger := h.logger.Session("lock") logger.Debug("started") defer logger.Debug("complete") @@ -174,7 +174,7 @@ func (h *locketHandler) lock(ctx context.Context, req *models.LockRequest) (*mod logger = logger.WithData(lager.Data{"request-uuid": requestUUID[0]}) } - lock, err := h.db.Lock(ctx, logger, req.Resource, req.TtlInSeconds) + lock, err := h.db.Lock(ctx, logger, req.Resource.FromProto(), req.TtlInSeconds) if err != nil { if err != models.ErrLockCollision { logger.Error("failed-locking-lock", err, lager.Data{ @@ -187,23 +187,23 @@ func (h *locketHandler) lock(ctx context.Context, req *models.LockRequest) (*mod h.lockPick.RegisterTTL(logger, lock) - return &models.LockResponse{}, nil + return &models.ProtoLockResponse{}, nil } -func (h *locketHandler) release(ctx context.Context, req *models.ReleaseRequest) (*models.ReleaseResponse, error) { +func (h *locketHandler) release(ctx context.Context, req *models.ProtoReleaseRequest) (*models.ProtoReleaseResponse, error) { logger := h.logger.Session("release") logger.Debug("started") defer logger.Debug("complete") - err := h.db.Release(ctx, logger, req.Resource) + err := h.db.Release(ctx, logger, req.Resource.FromProto()) if err != nil { return nil, err } - return &models.ReleaseResponse{}, nil + return &models.ProtoReleaseResponse{}, nil } -func (h *locketHandler) fetch(ctx context.Context, req *models.FetchRequest) (*models.FetchResponse, error) { +func (h *locketHandler) fetch(ctx context.Context, req *models.ProtoFetchRequest) (*models.ProtoFetchResponse, error) { logger := h.logger.Session("fetch") logger.Debug("started") defer logger.Debug("complete") @@ -213,12 +213,12 @@ func (h *locketHandler) fetch(ctx context.Context, req *models.FetchRequest) (*m return nil, err } - return &models.FetchResponse{ - Resource: lock.Resource, + return &models.ProtoFetchResponse{ + Resource: lock.Resource.ToProto(), }, nil } -func (h *locketHandler) fetchAll(ctx context.Context, req *models.FetchAllRequest) (*models.FetchAllResponse, error) { +func (h *locketHandler) fetchAll(ctx context.Context, req *models.ProtoFetchAllRequest) (*models.ProtoFetchAllResponse, error) { logger := h.logger.Session("fetch-all") logger.Debug("started") defer logger.Debug("complete") @@ -229,7 +229,8 @@ func (h *locketHandler) fetchAll(ctx context.Context, req *models.FetchAllReques return nil, err } - locks, err := h.db.FetchAll(ctx, logger, models.GetType(&models.Resource{TypeCode: req.TypeCode})) + resource := &models.ProtoResource{TypeCode: req.TypeCode} + locks, err := h.db.FetchAll(ctx, logger, models.GetType(resource.FromProto())) if err != nil { return nil, err } @@ -239,9 +240,10 @@ func (h *locketHandler) fetchAll(ctx context.Context, req *models.FetchAllReques responses = append(responses, lock.Resource) } - return &models.FetchAllResponse{ + response := &models.FetchAllResponse{ Resources: responses, - }, nil + } + return response.ToProto(), nil } func validate(req interface{}) error { @@ -260,7 +262,7 @@ func validate(req interface{}) error { return models.ErrInvalidType } - if reqTypeCode == models.TypeCode_UNKNOWN { + if reqTypeCode == models.UNKNOWN { return models.ErrInvalidType } diff --git a/handlers/handler_test.go b/handlers/handler_test.go index d5a370c..cab7948 100644 --- a/handlers/handler_test.go +++ b/handlers/handler_test.go @@ -43,7 +43,7 @@ var _ = Describe("LocketHandler", func() { Key: "test", Value: "test-value", Owner: "myself", - TypeCode: models.TypeCode_LOCK, + TypeCode: models.LOCK, } locketHandler = handlers.NewLocketHandler( @@ -77,7 +77,7 @@ var _ = Describe("LocketHandler", func() { }) It("reserves the lock in the database", func() { - _, err := locketHandler.Lock(context.Background(), request) + _, err := locketHandler.Lock(context.Background(), request.ToProto()) Expect(err).NotTo(HaveOccurred()) Expect(fakeLockDB.LockCallCount()).To(Equal(1)) @@ -90,7 +90,7 @@ var _ = Describe("LocketHandler", func() { }) It("increments the in-flight counter and then decrements it when done", func() { - _, err := locketHandler.Lock(context.Background(), request) + _, err := locketHandler.Lock(context.Background(), request.ToProto()) Expect(err).NotTo(HaveOccurred()) Expect(fakeLockDB.LockCallCount()).To(Equal(1)) @@ -101,7 +101,7 @@ var _ = Describe("LocketHandler", func() { }) It("registers the lock and ttl with the lock pick", func() { - _, err := locketHandler.Lock(context.Background(), request) + _, err := locketHandler.Lock(context.Background(), request.ToProto()) Expect(err).NotTo(HaveOccurred()) Expect(fakeLockPick.RegisterTTLCallCount()).To(Equal(1)) @@ -117,8 +117,8 @@ var _ = Describe("LocketHandler", func() { It("should be valid on a valid type code and empty type", func() { //lint:ignore SA1019 - testing deprecated functionality request.Resource.Type = "" - request.Resource.TypeCode = models.TypeCode_LOCK - _, err := locketHandler.Lock(context.Background(), request) + request.Resource.TypeCode = models.LOCK + _, err := locketHandler.Lock(context.Background(), request.ToProto()) Expect(err).NotTo(HaveOccurred()) metricsRecordSuccess(fakeRequestMetrics) @@ -128,8 +128,8 @@ var _ = Describe("LocketHandler", func() { It("should be invalid on an UNKNOWN type code and empty type", func() { //lint:ignore SA1019 - testing deprecated functionality request.Resource.Type = "" - request.Resource.TypeCode = models.TypeCode_UNKNOWN - _, err := locketHandler.Lock(context.Background(), request) + request.Resource.TypeCode = models.UNKNOWN + _, err := locketHandler.Lock(context.Background(), request.ToProto()) Expect(err).To(HaveOccurred()) metricsRecordFailure(fakeRequestMetrics) @@ -140,7 +140,7 @@ var _ = Describe("LocketHandler", func() { //lint:ignore SA1019 - testing deprecated functionality request.Resource.Type = "" request.Resource.TypeCode = 4 - _, err := locketHandler.Lock(context.Background(), request) + _, err := locketHandler.Lock(context.Background(), request.ToProto()) Expect(err).To(HaveOccurred()) metricsRecordFailure(fakeRequestMetrics) @@ -157,7 +157,7 @@ var _ = Describe("LocketHandler", func() { }) It("returns a validation error", func() { - _, err := locketHandler.Lock(context.Background(), request) + _, err := locketHandler.Lock(context.Background(), request.ToProto()) Expect(err).To(HaveOccurred()) Expect(err).To(Equal(models.ErrInvalidTTL)) Expect(logger).To(gbytes.Say(models.ErrInvalidTTL.Error())) @@ -175,7 +175,7 @@ var _ = Describe("LocketHandler", func() { }) It("returns a validation error", func() { - _, err := locketHandler.Lock(context.Background(), request) + _, err := locketHandler.Lock(context.Background(), request.ToProto()) Expect(err).To(HaveOccurred()) Expect(err).To(Equal(models.ErrInvalidOwner)) Expect(logger).To(gbytes.Say(models.ErrInvalidOwner.Error())) @@ -197,7 +197,7 @@ var _ = Describe("LocketHandler", func() { }) JustBeforeEach(func() { - _, err = locketHandler.Lock(context.Background(), request) + _, err = locketHandler.Lock(context.Background(), request.ToProto()) }) It("returns the error", func() { @@ -234,7 +234,7 @@ var _ = Describe("LocketHandler", func() { }) It("logs and writes to the exit channel", func() { - locketHandler.Lock(context.Background(), request) + locketHandler.Lock(context.Background(), request.ToProto()) Expect(logger).To(gbytes.Say("unrecoverable-error")) metricsRecordFailure(fakeRequestMetrics) @@ -253,7 +253,7 @@ var _ = Describe("LocketHandler", func() { JustBeforeEach(func() { fakeLockDB.LockReturns(nil, errors.New("Boom.")) - locketHandler.Lock(ctx, request) + locketHandler.Lock(ctx, request.ToProto()) }) Context("when the context was closed due to a client cancellation", func() { @@ -324,7 +324,8 @@ var _ = Describe("LocketHandler", func() { JustBeforeEach(func() { go func() { - _, err := locketHandler.Release(context.Background(), &models.ReleaseRequest{Resource: resource}) + releaseRequest := &models.ReleaseRequest{Resource: resource} + _, err := locketHandler.Release(context.Background(), releaseRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) }() }) @@ -356,7 +357,8 @@ var _ = Describe("LocketHandler", func() { }) It("releases the lock in the database", func() { - _, err := locketHandler.Release(context.Background(), &models.ReleaseRequest{Resource: resource}) + releaseRequest := &models.ReleaseRequest{Resource: resource} + _, err := locketHandler.Release(context.Background(), releaseRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) Expect(fakeLockDB.ReleaseCallCount()).Should(Equal(1)) @@ -373,7 +375,8 @@ var _ = Describe("LocketHandler", func() { }) It("returns the error", func() { - _, err := locketHandler.Release(context.Background(), &models.ReleaseRequest{Resource: resource}) + releaseRequest := &models.ReleaseRequest{Resource: resource} + _, err := locketHandler.Release(context.Background(), releaseRequest.ToProto()) Expect(err).To(HaveOccurred()) metricsRecordFailure(fakeRequestMetrics) @@ -387,7 +390,8 @@ var _ = Describe("LocketHandler", func() { }) It("logs and writes to the exit channel", func() { - locketHandler.Release(context.Background(), &models.ReleaseRequest{Resource: resource}) + releaseRequest := &models.ReleaseRequest{Resource: resource} + locketHandler.Release(context.Background(), releaseRequest.ToProto()) Expect(logger).To(gbytes.Say("unrecoverable-error")) metricsRecordFailure(fakeRequestMetrics) @@ -405,7 +409,8 @@ var _ = Describe("LocketHandler", func() { JustBeforeEach(func() { fakeLockDB.ReleaseReturns(errors.New("Boom.")) - locketHandler.Release(ctx, &models.ReleaseRequest{Resource: resource}) + releaseRequest := &models.ReleaseRequest{Resource: resource} + locketHandler.Release(ctx, releaseRequest.ToProto()) }) Context("when the context was closed due to a client cancellation", func() { @@ -458,7 +463,8 @@ var _ = Describe("LocketHandler", func() { }) It("fetches the lock in the database", func() { - fetchResp, err := locketHandler.Fetch(context.Background(), &models.FetchRequest{Key: "test-fetch"}) + fetchRequest := &models.FetchRequest{Key: "test-fetch"} + fetchResp, err := locketHandler.Fetch(context.Background(), fetchRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) Expect(fetchResp.Resource).To(Equal(resource)) @@ -476,7 +482,8 @@ var _ = Describe("LocketHandler", func() { }) It("returns the error", func() { - _, err := locketHandler.Fetch(context.Background(), &models.FetchRequest{Key: "test-fetch"}) + fetchRequest := &models.FetchRequest{Key: "test-fetch"} + _, err := locketHandler.Fetch(context.Background(), fetchRequest.ToProto()) Expect(err).To(HaveOccurred()) metricsRecordFailure(fakeRequestMetrics) @@ -490,7 +497,8 @@ var _ = Describe("LocketHandler", func() { }) It("logs and writes to the exit channel", func() { - locketHandler.Fetch(context.Background(), &models.FetchRequest{Key: "test-fetch"}) + fetchRequest := &models.FetchRequest{Key: "test-fetch"} + locketHandler.Fetch(context.Background(), fetchRequest.ToProto()) Expect(logger).To(gbytes.Say("unrecoverable-error")) metricsRecordFailure(fakeRequestMetrics) @@ -508,7 +516,8 @@ var _ = Describe("LocketHandler", func() { JustBeforeEach(func() { fakeLockDB.FetchReturns(nil, errors.New("boom")) - locketHandler.Fetch(ctx, &models.FetchRequest{Key: "test-fetch"}) + fetchRequest := &models.FetchRequest{Key: "test-fetch"} + locketHandler.Fetch(ctx, fetchRequest.ToProto()) }) Context("when the context was closed due to a client cancellation", func() { @@ -571,18 +580,21 @@ var _ = Describe("LocketHandler", func() { Context("validate lock type", func() { Context("when type_code is set", func() { It("should be valid on a valid type code and empty type", func() { - _, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_LOCK}) + fetchAllLockRequest := &models.FetchAllRequest{TypeCode: models.LOCK} + _, err := locketHandler.FetchAll(context.Background(), fetchAllLockRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) metricsRecordSuccess(fakeRequestMetrics) metricsUseCorrectCallTags(fakeRequestMetrics, "FetchAll") - _, err = locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_PRESENCE}) + fetchAllPresenceRequest := &models.FetchAllRequest{TypeCode: models.PRESENCE} + _, err = locketHandler.FetchAll(context.Background(), fetchAllPresenceRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) }) It("should be invalid on an UNKNOWN type code and empty type", func() { - _, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{}) + fetchAllRequest := &models.FetchAllRequest{} + _, err := locketHandler.FetchAll(context.Background(), fetchAllRequest.ToProto()) Expect(err).To(HaveOccurred()) metricsRecordFailure(fakeRequestMetrics) @@ -593,7 +605,8 @@ var _ = Describe("LocketHandler", func() { Context("when the type is valid", func() { It("fetches all the presence locks in the database by type", func() { - fetchResp, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_PRESENCE}) + fetchAllRequest := &models.FetchAllRequest{TypeCode: models.PRESENCE} + fetchResp, err := locketHandler.FetchAll(context.Background(), fetchAllRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) metricsRecordSuccess(fakeRequestMetrics) @@ -606,7 +619,8 @@ var _ = Describe("LocketHandler", func() { }) It("fetches all the lock locks in the database by type", func() { - fetchResp, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_LOCK}) + fetchAllRequest := &models.FetchAllRequest{TypeCode: models.LOCK} + fetchResp, err := locketHandler.FetchAll(context.Background(), fetchAllRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) metricsRecordSuccess(fakeRequestMetrics) @@ -619,7 +633,8 @@ var _ = Describe("LocketHandler", func() { }) It("fetches all the presence locks in the database by type code", func() { - fetchResp, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_PRESENCE}) + fetchAllRequest := &models.FetchAllRequest{TypeCode: models.PRESENCE} + fetchResp, err := locketHandler.FetchAll(context.Background(), fetchAllRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) metricsRecordSuccess(fakeRequestMetrics) @@ -632,7 +647,8 @@ var _ = Describe("LocketHandler", func() { }) It("fetches all the lock locks in the database by type code", func() { - fetchResp, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_LOCK}) + fetchAllRequest := &models.FetchAllRequest{TypeCode: models.LOCK} + fetchResp, err := locketHandler.FetchAll(context.Background(), fetchAllRequest.ToProto()) Expect(err).NotTo(HaveOccurred()) metricsRecordSuccess(fakeRequestMetrics) @@ -647,7 +663,8 @@ var _ = Describe("LocketHandler", func() { Context("when the type is invalid", func() { It("returns an invalid type error", func() { - _, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{Type: "dawg"}) + fetchAllRequest := &models.FetchAllRequest{Type: "dawg"} + _, err := locketHandler.FetchAll(context.Background(), fetchAllRequest.ToProto()) Expect(err).To(HaveOccurred()) metricsRecordFailure(fakeRequestMetrics) @@ -657,7 +674,8 @@ var _ = Describe("LocketHandler", func() { Context("when the type code is UNKNOWN", func() { It("returns an invalid type error", func() { - _, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_UNKNOWN}) + fetchAllRequest := &models.FetchAllRequest{TypeCode: models.UNKNOWN} + _, err := locketHandler.FetchAll(context.Background(), fetchAllRequest.ToProto()) Expect(err).To(HaveOccurred()) metricsRecordFailure(fakeRequestMetrics) @@ -671,7 +689,8 @@ var _ = Describe("LocketHandler", func() { }) It("returns the error", func() { - _, err := locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{}) + fetchAllRequest := &models.FetchAllRequest{} + _, err := locketHandler.FetchAll(context.Background(), fetchAllRequest.ToProto()) Expect(err).To(HaveOccurred()) metricsRecordFailure(fakeRequestMetrics) @@ -685,7 +704,8 @@ var _ = Describe("LocketHandler", func() { }) It("logs and writes to the exit channel", func() { - locketHandler.FetchAll(context.Background(), &models.FetchAllRequest{TypeCode: models.TypeCode_PRESENCE}) + fetchAllRequest := &models.FetchAllRequest{TypeCode: models.PRESENCE} + locketHandler.FetchAll(context.Background(), fetchAllRequest.ToProto()) Expect(logger).To(gbytes.Say("unrecoverable-error")) metricsRecordFailure(fakeRequestMetrics) @@ -703,7 +723,8 @@ var _ = Describe("LocketHandler", func() { JustBeforeEach(func() { fakeLockDB.FetchAllReturns(nil, errors.New("boom")) - locketHandler.FetchAll(ctx, &models.FetchAllRequest{}) + fetchAllRequest := &models.FetchAllRequest{} + locketHandler.FetchAll(ctx, fetchAllRequest.ToProto()) }) Context("when the context was closed due to a client cancellation", func() { diff --git a/lock/lock.go b/lock/lock.go index 7f32e83..9f846e7 100644 --- a/lock/lock.go +++ b/lock/lock.go @@ -88,10 +88,12 @@ func (l *lockRunner) Run(signals <-chan os.Signal, ready chan<- struct{}) error logger.Error("failed-to-create-context", err) return err } - _, err = l.locker.Lock(ctx, &models.LockRequest{Resource: l.lock, TtlInSeconds: l.ttlInSeconds}) + lockRequest := &models.LockRequest{Resource: l.lock, TtlInSeconds: l.ttlInSeconds} + _, err = l.locker.Lock(ctx, lockRequest.ToProto()) if err != nil { lagerData := lager.Data{"request-uuid": uuid} - resp, fErr := l.locker.Fetch(ctx, &models.FetchRequest{Key: l.lock.Key}) + fetchRequest := &models.FetchRequest{Key: l.lock.Key} + resp, fErr := l.locker.Fetch(ctx, fetchRequest.ToProto()) if fErr != nil { logger.Error("failed-fetching-lock-owner", fErr) } else { @@ -112,7 +114,8 @@ func (l *lockRunner) Run(signals <-chan os.Signal, ready chan<- struct{}) error case sig := <-signals: logger.Info("signalled", lager.Data{"signal": sig}) - _, err := l.locker.Release(context.Background(), &models.ReleaseRequest{Resource: l.lock}) + releaseRequest := &models.ReleaseRequest{Resource: l.lock} + _, err := l.locker.Release(context.Background(), releaseRequest.ToProto()) if err != nil { logger.Error("failed-to-release-lock", err) } else { @@ -129,7 +132,8 @@ func (l *lockRunner) Run(signals <-chan os.Signal, ready chan<- struct{}) error } ctx, cancel := context.WithTimeout(ctx, time.Duration(l.ttlInSeconds)*time.Second) start := time.Now() - _, err = l.locker.Lock(ctx, &models.LockRequest{Resource: l.lock, TtlInSeconds: l.ttlInSeconds}, grpc.WaitForReady(true)) + lockRequest := &models.LockRequest{Resource: l.lock, TtlInSeconds: l.ttlInSeconds} + _, err = l.locker.Lock(ctx, lockRequest.ToProto(), grpc.WaitForReady(true)) cancel() if err != nil { if acquired { diff --git a/lock/lock_test.go b/lock/lock_test.go index 3b1218f..2b32375 100644 --- a/lock/lock_test.go +++ b/lock/lock_test.go @@ -87,7 +87,8 @@ var _ = Describe("Lock", func() { Context("when the lock cannot be acquired", func() { BeforeEach(func() { fakeLocker.LockReturns(nil, errors.New("no-lock-for-you")) - fakeLocker.FetchReturns(&models.FetchResponse{Resource: &models.Resource{Owner: "joe"}}, nil) + fetchResponse := &models.FetchResponse{Resource: &models.Resource{Owner: "joe"}} + fakeLocker.FetchReturns(fetchResponse.ToProto(), nil) }) JustBeforeEach(func() { @@ -146,8 +147,8 @@ var _ = Describe("Lock", func() { // do not use models.ErrLockCollision because in practice from the wire that // variable instance cannot be returned fakeLocker.LockReturns(nil, status.Errorf(codes.AlreadyExists, "lock-collision")) - - fakeLocker.FetchReturns(&models.FetchResponse{Resource: &models.Resource{Owner: "joe"}}, nil) + fetchResponse := &models.FetchResponse{Resource: &models.Resource{Owner: "joe"}} + fakeLocker.FetchReturns(fetchResponse.ToProto(), nil) }) It("logs the initial error", func() { @@ -188,7 +189,7 @@ var _ = Describe("Lock", func() { BeforeEach(func() { done = make(chan struct{}) - fakeLocker.LockStub = func(ctx context.Context, res *models.LockRequest, opts ...grpc.CallOption) (*models.LockResponse, error) { + fakeLocker.LockStub = func(ctx context.Context, res *models.ProtoLockRequest, opts ...grpc.CallOption) (*models.ProtoLockResponse, error) { select { case <-done: return nil, nil @@ -248,7 +249,7 @@ var _ = Describe("Lock", func() { done = make(chan struct{}) lockErr = errors.New("no-lock-for-you") - fakeLocker.LockStub = func(ctx context.Context, res *models.LockRequest, opts ...grpc.CallOption) (*models.LockResponse, error) { + fakeLocker.LockStub = func(ctx context.Context, res *models.ProtoLockRequest, opts ...grpc.CallOption) (*models.ProtoLockResponse, error) { select { case <-done: return nil, lockErr @@ -358,7 +359,7 @@ var _ = Describe("Lock", func() { BeforeEach(func() { lockResult = make(chan bool, 1) - fakeLocker.LockStub = func(ctx context.Context, res *models.LockRequest, opts ...grpc.CallOption) (*models.LockResponse, error) { + fakeLocker.LockStub = func(ctx context.Context, res *models.ProtoLockRequest, opts ...grpc.CallOption) (*models.ProtoLockResponse, error) { defer GinkgoRecover() var shouldError bool Eventually(lockResult).Should(Receive(&shouldError)) diff --git a/models/helpers.go b/models/helpers.go index 0f8b865..6928b72 100644 --- a/models/helpers.go +++ b/models/helpers.go @@ -2,7 +2,7 @@ package models func GetResource(resource *Resource) *Resource { r := &Resource{Key: resource.Key, Owner: resource.Owner, Value: resource.Value} - if resource.TypeCode == TypeCode_UNKNOWN { + if resource.TypeCode == UNKNOWN { r.TypeCode = GetTypeCode(resource.Type) r.Type = resource.Type } else { @@ -15,19 +15,19 @@ func GetResource(resource *Resource) *Resource { func GetTypeCode(lockType string) TypeCode { switch lockType { case LockType: - return TypeCode_LOCK + return LOCK case PresenceType: - return TypeCode_PRESENCE + return PRESENCE default: - return TypeCode_UNKNOWN + return UNKNOWN } } func GetType(resource *Resource) string { switch resource.TypeCode { - case TypeCode_LOCK: + case LOCK: return LockType - case TypeCode_PRESENCE: + case PRESENCE: return PresenceType default: return resource.Type diff --git a/models/helpers_test.go b/models/helpers_test.go index 3cc1853..8c95bc7 100644 --- a/models/helpers_test.go +++ b/models/helpers_test.go @@ -9,17 +9,17 @@ import ( var _ = Describe("helpers", func() { Describe("GetType", func() { It("matches the correct type to the type code", func() { - Expect(models.GetType(&models.Resource{TypeCode: models.TypeCode_PRESENCE})).To(Equal("presence")) - Expect(models.GetType(&models.Resource{TypeCode: models.TypeCode_LOCK})).To(Equal("lock")) - Expect(models.GetType(&models.Resource{Type: "sandwich", TypeCode: models.TypeCode_UNKNOWN})).To(Equal("sandwich")) + Expect(models.GetType(&models.Resource{TypeCode: models.PRESENCE})).To(Equal("presence")) + Expect(models.GetType(&models.Resource{TypeCode: models.LOCK})).To(Equal("lock")) + Expect(models.GetType(&models.Resource{Type: "sandwich", TypeCode: models.UNKNOWN})).To(Equal("sandwich")) }) }) Describe("GetTypeCode", func() { It("matches the correct type code to the type", func() { - Expect(models.GetTypeCode("presence")).To(Equal(models.TypeCode_PRESENCE)) - Expect(models.GetTypeCode("lock")).To(Equal(models.TypeCode_LOCK)) - Expect(models.GetTypeCode("sandwich")).To(Equal(models.TypeCode_UNKNOWN)) + Expect(models.GetTypeCode("presence")).To(Equal(models.PRESENCE)) + Expect(models.GetTypeCode("lock")).To(Equal(models.LOCK)) + Expect(models.GetTypeCode("sandwich")).To(Equal(models.UNKNOWN)) }) }) @@ -29,7 +29,7 @@ var _ = Describe("helpers", func() { Owner: "thelizardking", Value: "candoanything", Key: "sandwich", - TypeCode: models.TypeCode_UNKNOWN, + TypeCode: models.UNKNOWN, Type: "lock", } @@ -37,14 +37,14 @@ var _ = Describe("helpers", func() { Owner: "thelizardking", Value: "candoanything", Key: "sandwich", - TypeCode: models.TypeCode_UNKNOWN, + TypeCode: models.UNKNOWN, Type: "whut", } - Expect(models.GetResource(resource1).TypeCode).To(Equal(models.TypeCode_LOCK)) + Expect(models.GetResource(resource1).TypeCode).To(Equal(models.LOCK)) Expect(models.GetResource(resource1).Type).To(Equal("lock")) - Expect(models.GetResource(resource2).TypeCode).To(Equal(models.TypeCode_UNKNOWN)) + Expect(models.GetResource(resource2).TypeCode).To(Equal(models.UNKNOWN)) Expect(models.GetResource(resource2).Type).To(Equal("whut")) }) @@ -53,7 +53,7 @@ var _ = Describe("helpers", func() { Owner: "thelizardking", Value: "candoanything", Key: "sandwich", - TypeCode: models.TypeCode_LOCK, + TypeCode: models.LOCK, Type: "whut", } @@ -61,14 +61,14 @@ var _ = Describe("helpers", func() { Owner: "thelizardking", Value: "candoanything", Key: "sandwich", - TypeCode: models.TypeCode_PRESENCE, + TypeCode: models.PRESENCE, Type: "whut", } - Expect(models.GetResource(resource1).TypeCode).To(Equal(models.TypeCode_LOCK)) + Expect(models.GetResource(resource1).TypeCode).To(Equal(models.LOCK)) Expect(models.GetResource(resource1).Type).To(Equal("lock")) - Expect(models.GetResource(resource2).TypeCode).To(Equal(models.TypeCode_PRESENCE)) + Expect(models.GetResource(resource2).TypeCode).To(Equal(models.PRESENCE)) Expect(models.GetResource(resource2).Type).To(Equal("presence")) }) }) diff --git a/models/locket.pb.go b/models/locket.pb.go index 658fbc9..a8470ae 100644 --- a/models/locket.pb.go +++ b/models/locket.pb.go @@ -1,12 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.5 -// protoc v4.25.6 +// protoc v6.30.0 // source: locket.proto package models import ( + _ "code.cloudfoundry.org/bbs/models" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -21,81 +22,81 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type TypeCode int32 +type ProtoTypeCode int32 const ( - TypeCode_UNKNOWN TypeCode = 0 - TypeCode_LOCK TypeCode = 1 - TypeCode_PRESENCE TypeCode = 2 + ProtoTypeCode_UNKNOWN ProtoTypeCode = 0 + ProtoTypeCode_LOCK ProtoTypeCode = 1 + ProtoTypeCode_PRESENCE ProtoTypeCode = 2 ) -// Enum value maps for TypeCode. +// Enum value maps for ProtoTypeCode. var ( - TypeCode_name = map[int32]string{ + ProtoTypeCode_name = map[int32]string{ 0: "UNKNOWN", 1: "LOCK", 2: "PRESENCE", } - TypeCode_value = map[string]int32{ + ProtoTypeCode_value = map[string]int32{ "UNKNOWN": 0, "LOCK": 1, "PRESENCE": 2, } ) -func (x TypeCode) Enum() *TypeCode { - p := new(TypeCode) +func (x ProtoTypeCode) Enum() *ProtoTypeCode { + p := new(ProtoTypeCode) *p = x return p } -func (x TypeCode) String() string { +func (x ProtoTypeCode) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (TypeCode) Descriptor() protoreflect.EnumDescriptor { +func (ProtoTypeCode) Descriptor() protoreflect.EnumDescriptor { return file_locket_proto_enumTypes[0].Descriptor() } -func (TypeCode) Type() protoreflect.EnumType { +func (ProtoTypeCode) Type() protoreflect.EnumType { return &file_locket_proto_enumTypes[0] } -func (x TypeCode) Number() protoreflect.EnumNumber { +func (x ProtoTypeCode) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } -// Deprecated: Use TypeCode.Descriptor instead. -func (TypeCode) EnumDescriptor() ([]byte, []int) { +// Deprecated: Use ProtoTypeCode.Descriptor instead. +func (ProtoTypeCode) EnumDescriptor() ([]byte, []int) { return file_locket_proto_rawDescGZIP(), []int{0} } -type Resource struct { +type ProtoResource struct { state protoimpl.MessageState `protogen:"open.v1"` Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` // Deprecated: Marked as deprecated in locket.proto. - Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"` - TypeCode TypeCode `protobuf:"varint,5,opt,name=type_code,json=typeCode,proto3,enum=models.TypeCode" json:"type_code,omitempty"` + Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"` + TypeCode ProtoTypeCode `protobuf:"varint,5,opt,name=type_code,json=typeCode,proto3,enum=models.ProtoTypeCode" json:"type_code,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *Resource) Reset() { - *x = Resource{} +func (x *ProtoResource) Reset() { + *x = ProtoResource{} mi := &file_locket_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *Resource) String() string { +func (x *ProtoResource) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Resource) ProtoMessage() {} +func (*ProtoResource) ProtoMessage() {} -func (x *Resource) ProtoReflect() protoreflect.Message { +func (x *ProtoResource) ProtoReflect() protoreflect.Message { mi := &file_locket_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -107,26 +108,26 @@ func (x *Resource) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Resource.ProtoReflect.Descriptor instead. -func (*Resource) Descriptor() ([]byte, []int) { +// Deprecated: Use ProtoResource.ProtoReflect.Descriptor instead. +func (*ProtoResource) Descriptor() ([]byte, []int) { return file_locket_proto_rawDescGZIP(), []int{0} } -func (x *Resource) GetKey() string { +func (x *ProtoResource) GetKey() string { if x != nil { return x.Key } return "" } -func (x *Resource) GetOwner() string { +func (x *ProtoResource) GetOwner() string { if x != nil { return x.Owner } return "" } -func (x *Resource) GetValue() string { +func (x *ProtoResource) GetValue() string { if x != nil { return x.Value } @@ -134,42 +135,42 @@ func (x *Resource) GetValue() string { } // Deprecated: Marked as deprecated in locket.proto. -func (x *Resource) GetType() string { +func (x *ProtoResource) GetType() string { if x != nil { return x.Type } return "" } -func (x *Resource) GetTypeCode() TypeCode { +func (x *ProtoResource) GetTypeCode() ProtoTypeCode { if x != nil { return x.TypeCode } - return TypeCode_UNKNOWN + return ProtoTypeCode_UNKNOWN } -type LockRequest struct { +type ProtoLockRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` + Resource *ProtoResource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` TtlInSeconds int64 `protobuf:"varint,2,opt,name=ttl_in_seconds,json=ttlInSeconds,proto3" json:"ttl_in_seconds,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *LockRequest) Reset() { - *x = LockRequest{} +func (x *ProtoLockRequest) Reset() { + *x = ProtoLockRequest{} mi := &file_locket_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *LockRequest) String() string { +func (x *ProtoLockRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*LockRequest) ProtoMessage() {} +func (*ProtoLockRequest) ProtoMessage() {} -func (x *LockRequest) ProtoReflect() protoreflect.Message { +func (x *ProtoLockRequest) ProtoReflect() protoreflect.Message { mi := &file_locket_proto_msgTypes[1] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -181,45 +182,45 @@ func (x *LockRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use LockRequest.ProtoReflect.Descriptor instead. -func (*LockRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use ProtoLockRequest.ProtoReflect.Descriptor instead. +func (*ProtoLockRequest) Descriptor() ([]byte, []int) { return file_locket_proto_rawDescGZIP(), []int{1} } -func (x *LockRequest) GetResource() *Resource { +func (x *ProtoLockRequest) GetResource() *ProtoResource { if x != nil { return x.Resource } return nil } -func (x *LockRequest) GetTtlInSeconds() int64 { +func (x *ProtoLockRequest) GetTtlInSeconds() int64 { if x != nil { return x.TtlInSeconds } return 0 } -type LockResponse struct { +type ProtoLockResponse struct { state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *LockResponse) Reset() { - *x = LockResponse{} +func (x *ProtoLockResponse) Reset() { + *x = ProtoLockResponse{} mi := &file_locket_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *LockResponse) String() string { +func (x *ProtoLockResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*LockResponse) ProtoMessage() {} +func (*ProtoLockResponse) ProtoMessage() {} -func (x *LockResponse) ProtoReflect() protoreflect.Message { +func (x *ProtoLockResponse) ProtoReflect() protoreflect.Message { mi := &file_locket_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -231,32 +232,32 @@ func (x *LockResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use LockResponse.ProtoReflect.Descriptor instead. -func (*LockResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use ProtoLockResponse.ProtoReflect.Descriptor instead. +func (*ProtoLockResponse) Descriptor() ([]byte, []int) { return file_locket_proto_rawDescGZIP(), []int{2} } -type ReleaseRequest struct { +type ProtoReleaseRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` + Resource *ProtoResource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *ReleaseRequest) Reset() { - *x = ReleaseRequest{} +func (x *ProtoReleaseRequest) Reset() { + *x = ProtoReleaseRequest{} mi := &file_locket_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ReleaseRequest) String() string { +func (x *ProtoReleaseRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ReleaseRequest) ProtoMessage() {} +func (*ProtoReleaseRequest) ProtoMessage() {} -func (x *ReleaseRequest) ProtoReflect() protoreflect.Message { +func (x *ProtoReleaseRequest) ProtoReflect() protoreflect.Message { mi := &file_locket_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -268,38 +269,38 @@ func (x *ReleaseRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ReleaseRequest.ProtoReflect.Descriptor instead. -func (*ReleaseRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use ProtoReleaseRequest.ProtoReflect.Descriptor instead. +func (*ProtoReleaseRequest) Descriptor() ([]byte, []int) { return file_locket_proto_rawDescGZIP(), []int{3} } -func (x *ReleaseRequest) GetResource() *Resource { +func (x *ProtoReleaseRequest) GetResource() *ProtoResource { if x != nil { return x.Resource } return nil } -type ReleaseResponse struct { +type ProtoReleaseResponse struct { state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *ReleaseResponse) Reset() { - *x = ReleaseResponse{} +func (x *ProtoReleaseResponse) Reset() { + *x = ProtoReleaseResponse{} mi := &file_locket_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ReleaseResponse) String() string { +func (x *ProtoReleaseResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ReleaseResponse) ProtoMessage() {} +func (*ProtoReleaseResponse) ProtoMessage() {} -func (x *ReleaseResponse) ProtoReflect() protoreflect.Message { +func (x *ProtoReleaseResponse) ProtoReflect() protoreflect.Message { mi := &file_locket_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -311,32 +312,32 @@ func (x *ReleaseResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ReleaseResponse.ProtoReflect.Descriptor instead. -func (*ReleaseResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use ProtoReleaseResponse.ProtoReflect.Descriptor instead. +func (*ProtoReleaseResponse) Descriptor() ([]byte, []int) { return file_locket_proto_rawDescGZIP(), []int{4} } -type FetchRequest struct { +type ProtoFetchRequest struct { state protoimpl.MessageState `protogen:"open.v1"` Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *FetchRequest) Reset() { - *x = FetchRequest{} +func (x *ProtoFetchRequest) Reset() { + *x = ProtoFetchRequest{} mi := &file_locket_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *FetchRequest) String() string { +func (x *ProtoFetchRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*FetchRequest) ProtoMessage() {} +func (*ProtoFetchRequest) ProtoMessage() {} -func (x *FetchRequest) ProtoReflect() protoreflect.Message { +func (x *ProtoFetchRequest) ProtoReflect() protoreflect.Message { mi := &file_locket_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -348,39 +349,39 @@ func (x *FetchRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use FetchRequest.ProtoReflect.Descriptor instead. -func (*FetchRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use ProtoFetchRequest.ProtoReflect.Descriptor instead. +func (*ProtoFetchRequest) Descriptor() ([]byte, []int) { return file_locket_proto_rawDescGZIP(), []int{5} } -func (x *FetchRequest) GetKey() string { +func (x *ProtoFetchRequest) GetKey() string { if x != nil { return x.Key } return "" } -type FetchResponse struct { +type ProtoFetchResponse struct { state protoimpl.MessageState `protogen:"open.v1"` - Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` + Resource *ProtoResource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *FetchResponse) Reset() { - *x = FetchResponse{} +func (x *ProtoFetchResponse) Reset() { + *x = ProtoFetchResponse{} mi := &file_locket_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *FetchResponse) String() string { +func (x *ProtoFetchResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*FetchResponse) ProtoMessage() {} +func (*ProtoFetchResponse) ProtoMessage() {} -func (x *FetchResponse) ProtoReflect() protoreflect.Message { +func (x *ProtoFetchResponse) ProtoReflect() protoreflect.Message { mi := &file_locket_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -392,41 +393,41 @@ func (x *FetchResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use FetchResponse.ProtoReflect.Descriptor instead. -func (*FetchResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use ProtoFetchResponse.ProtoReflect.Descriptor instead. +func (*ProtoFetchResponse) Descriptor() ([]byte, []int) { return file_locket_proto_rawDescGZIP(), []int{6} } -func (x *FetchResponse) GetResource() *Resource { +func (x *ProtoFetchResponse) GetResource() *ProtoResource { if x != nil { return x.Resource } return nil } -type FetchAllRequest struct { +type ProtoFetchAllRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Deprecated: Marked as deprecated in locket.proto. - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - TypeCode TypeCode `protobuf:"varint,2,opt,name=type_code,json=typeCode,proto3,enum=models.TypeCode" json:"type_code,omitempty"` + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + TypeCode ProtoTypeCode `protobuf:"varint,2,opt,name=type_code,json=typeCode,proto3,enum=models.ProtoTypeCode" json:"type_code,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *FetchAllRequest) Reset() { - *x = FetchAllRequest{} +func (x *ProtoFetchAllRequest) Reset() { + *x = ProtoFetchAllRequest{} mi := &file_locket_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *FetchAllRequest) String() string { +func (x *ProtoFetchAllRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*FetchAllRequest) ProtoMessage() {} +func (*ProtoFetchAllRequest) ProtoMessage() {} -func (x *FetchAllRequest) ProtoReflect() protoreflect.Message { +func (x *ProtoFetchAllRequest) ProtoReflect() protoreflect.Message { mi := &file_locket_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -438,47 +439,47 @@ func (x *FetchAllRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use FetchAllRequest.ProtoReflect.Descriptor instead. -func (*FetchAllRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use ProtoFetchAllRequest.ProtoReflect.Descriptor instead. +func (*ProtoFetchAllRequest) Descriptor() ([]byte, []int) { return file_locket_proto_rawDescGZIP(), []int{7} } // Deprecated: Marked as deprecated in locket.proto. -func (x *FetchAllRequest) GetType() string { +func (x *ProtoFetchAllRequest) GetType() string { if x != nil { return x.Type } return "" } -func (x *FetchAllRequest) GetTypeCode() TypeCode { +func (x *ProtoFetchAllRequest) GetTypeCode() ProtoTypeCode { if x != nil { return x.TypeCode } - return TypeCode_UNKNOWN + return ProtoTypeCode_UNKNOWN } -type FetchAllResponse struct { +type ProtoFetchAllResponse struct { state protoimpl.MessageState `protogen:"open.v1"` - Resources []*Resource `protobuf:"bytes,1,rep,name=resources,proto3" json:"resources,omitempty"` + Resources []*ProtoResource `protobuf:"bytes,1,rep,name=resources,proto3" json:"resources,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *FetchAllResponse) Reset() { - *x = FetchAllResponse{} +func (x *ProtoFetchAllResponse) Reset() { + *x = ProtoFetchAllResponse{} mi := &file_locket_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *FetchAllResponse) String() string { +func (x *ProtoFetchAllResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*FetchAllResponse) ProtoMessage() {} +func (*ProtoFetchAllResponse) ProtoMessage() {} -func (x *FetchAllResponse) ProtoReflect() protoreflect.Message { +func (x *ProtoFetchAllResponse) ProtoReflect() protoreflect.Message { mi := &file_locket_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -490,12 +491,12 @@ func (x *FetchAllResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use FetchAllResponse.ProtoReflect.Descriptor instead. -func (*FetchAllResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use ProtoFetchAllResponse.ProtoReflect.Descriptor instead. +func (*ProtoFetchAllResponse) Descriptor() ([]byte, []int) { return file_locket_proto_rawDescGZIP(), []int{8} } -func (x *FetchAllResponse) GetResources() []*Resource { +func (x *ProtoFetchAllResponse) GetResources() []*ProtoResource { if x != nil { return x.Resources } @@ -506,66 +507,76 @@ var File_locket_proto protoreflect.FileDescriptor var file_locket_proto_rawDesc = string([]byte{ 0x0a, 0x0c, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x22, 0x8f, 0x01, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x1a, 0x09, 0x62, 0x62, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x99, 0x01, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x16, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x02, 0x18, 0x01, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2d, 0x0a, 0x09, 0x74, 0x79, 0x70, - 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x6d, - 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x08, - 0x74, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x61, 0x0a, 0x0b, 0x4c, 0x6f, 0x63, 0x6b, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, - 0x6c, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x74, 0x74, 0x6c, 0x5f, 0x69, 0x6e, 0x5f, - 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x74, - 0x74, 0x6c, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x0e, 0x0a, 0x0c, 0x4c, - 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3e, 0x0a, 0x0e, 0x52, - 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, - 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x11, 0x0a, 0x0f, 0x52, - 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, - 0x0a, 0x0c, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x22, 0x3d, 0x0a, 0x0d, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, - 0x58, 0x0a, 0x0f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x16, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x02, 0x18, 0x01, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2d, 0x0a, 0x09, 0x74, 0x79, - 0x70, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, - 0x08, 0x74, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x42, 0x0a, 0x10, 0x46, 0x65, 0x74, - 0x63, 0x68, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, - 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2a, 0x2f, 0x0a, - 0x08, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, - 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x01, - 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x43, 0x45, 0x10, 0x02, 0x32, 0xf4, - 0x01, 0x0a, 0x06, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x33, 0x0a, 0x04, 0x4c, 0x6f, 0x63, - 0x6b, 0x12, 0x13, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x4c, 0x6f, 0x63, 0x6b, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, - 0x4c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x36, - 0x0a, 0x05, 0x46, 0x65, 0x74, 0x63, 0x68, 0x12, 0x14, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, - 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3c, 0x0a, 0x07, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, - 0x65, 0x12, 0x16, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, - 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6d, 0x6f, 0x64, 0x65, - 0x6c, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x08, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x6c, 0x6c, - 0x12, 0x17, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, - 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6d, 0x6f, 0x64, 0x65, - 0x6c, 0x73, 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x25, 0x5a, 0x23, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x6c, - 0x6f, 0x75, 0x64, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x72, 0x79, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6c, - 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x02, 0x18, 0x01, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x32, 0x0a, 0x09, 0x74, 0x79, 0x70, + 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x43, + 0x6f, 0x64, 0x65, 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x6b, 0x0a, + 0x10, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x4c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x31, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x74, 0x74, 0x6c, 0x5f, 0x69, 0x6e, 0x5f, 0x73, + 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x74, 0x74, + 0x6c, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x13, 0x0a, 0x11, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x4c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x48, 0x0a, 0x13, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x31, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, + 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, + 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x16, 0x0a, 0x14, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x25, 0x0a, 0x11, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x47, 0x0a, 0x12, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, + 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x15, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x22, 0x62, 0x0a, 0x14, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, + 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x02, 0x18, 0x01, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x32, 0x0a, 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x08, 0x74, 0x79, 0x70, + 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x4c, 0x0a, 0x15, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, + 0x74, 0x63, 0x68, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, + 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x2a, 0x56, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x54, 0x79, 0x70, 0x65, + 0x43, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, + 0x00, 0x1a, 0x0a, 0x82, 0x7d, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x12, 0x11, 0x0a, + 0x04, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x01, 0x1a, 0x07, 0x82, 0x7d, 0x04, 0x4c, 0x4f, 0x43, 0x4b, + 0x12, 0x19, 0x0a, 0x08, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x43, 0x45, 0x10, 0x02, 0x1a, 0x0b, + 0x82, 0x7d, 0x08, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x43, 0x45, 0x32, 0x9c, 0x02, 0x0a, 0x06, + 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x3d, 0x0a, 0x04, 0x4c, 0x6f, 0x63, 0x6b, 0x12, 0x18, + 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x4c, 0x6f, 0x63, + 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, + 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x4c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x05, 0x46, 0x65, 0x74, 0x63, 0x68, 0x12, 0x19, + 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, + 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x07, 0x52, 0x65, 0x6c, 0x65, 0x61, + 0x73, 0x65, 0x12, 0x1b, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x65, + 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x49, 0x0a, 0x08, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x6c, 0x6c, 0x12, 0x1c, 0x2e, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, + 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x6c, 0x6c, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x25, 0x5a, 0x23, 0x63, 0x6f, + 0x64, 0x65, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x72, 0x79, 0x2e, + 0x6f, 0x72, 0x67, 0x2f, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, }) var ( @@ -583,32 +594,32 @@ func file_locket_proto_rawDescGZIP() []byte { var file_locket_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_locket_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_locket_proto_goTypes = []any{ - (TypeCode)(0), // 0: models.TypeCode - (*Resource)(nil), // 1: models.Resource - (*LockRequest)(nil), // 2: models.LockRequest - (*LockResponse)(nil), // 3: models.LockResponse - (*ReleaseRequest)(nil), // 4: models.ReleaseRequest - (*ReleaseResponse)(nil), // 5: models.ReleaseResponse - (*FetchRequest)(nil), // 6: models.FetchRequest - (*FetchResponse)(nil), // 7: models.FetchResponse - (*FetchAllRequest)(nil), // 8: models.FetchAllRequest - (*FetchAllResponse)(nil), // 9: models.FetchAllResponse + (ProtoTypeCode)(0), // 0: models.ProtoTypeCode + (*ProtoResource)(nil), // 1: models.ProtoResource + (*ProtoLockRequest)(nil), // 2: models.ProtoLockRequest + (*ProtoLockResponse)(nil), // 3: models.ProtoLockResponse + (*ProtoReleaseRequest)(nil), // 4: models.ProtoReleaseRequest + (*ProtoReleaseResponse)(nil), // 5: models.ProtoReleaseResponse + (*ProtoFetchRequest)(nil), // 6: models.ProtoFetchRequest + (*ProtoFetchResponse)(nil), // 7: models.ProtoFetchResponse + (*ProtoFetchAllRequest)(nil), // 8: models.ProtoFetchAllRequest + (*ProtoFetchAllResponse)(nil), // 9: models.ProtoFetchAllResponse } var file_locket_proto_depIdxs = []int32{ - 0, // 0: models.Resource.type_code:type_name -> models.TypeCode - 1, // 1: models.LockRequest.resource:type_name -> models.Resource - 1, // 2: models.ReleaseRequest.resource:type_name -> models.Resource - 1, // 3: models.FetchResponse.resource:type_name -> models.Resource - 0, // 4: models.FetchAllRequest.type_code:type_name -> models.TypeCode - 1, // 5: models.FetchAllResponse.resources:type_name -> models.Resource - 2, // 6: models.Locket.Lock:input_type -> models.LockRequest - 6, // 7: models.Locket.Fetch:input_type -> models.FetchRequest - 4, // 8: models.Locket.Release:input_type -> models.ReleaseRequest - 8, // 9: models.Locket.FetchAll:input_type -> models.FetchAllRequest - 3, // 10: models.Locket.Lock:output_type -> models.LockResponse - 7, // 11: models.Locket.Fetch:output_type -> models.FetchResponse - 5, // 12: models.Locket.Release:output_type -> models.ReleaseResponse - 9, // 13: models.Locket.FetchAll:output_type -> models.FetchAllResponse + 0, // 0: models.ProtoResource.type_code:type_name -> models.ProtoTypeCode + 1, // 1: models.ProtoLockRequest.resource:type_name -> models.ProtoResource + 1, // 2: models.ProtoReleaseRequest.resource:type_name -> models.ProtoResource + 1, // 3: models.ProtoFetchResponse.resource:type_name -> models.ProtoResource + 0, // 4: models.ProtoFetchAllRequest.type_code:type_name -> models.ProtoTypeCode + 1, // 5: models.ProtoFetchAllResponse.resources:type_name -> models.ProtoResource + 2, // 6: models.Locket.Lock:input_type -> models.ProtoLockRequest + 6, // 7: models.Locket.Fetch:input_type -> models.ProtoFetchRequest + 4, // 8: models.Locket.Release:input_type -> models.ProtoReleaseRequest + 8, // 9: models.Locket.FetchAll:input_type -> models.ProtoFetchAllRequest + 3, // 10: models.Locket.Lock:output_type -> models.ProtoLockResponse + 7, // 11: models.Locket.Fetch:output_type -> models.ProtoFetchResponse + 5, // 12: models.Locket.Release:output_type -> models.ProtoReleaseResponse + 9, // 13: models.Locket.FetchAll:output_type -> models.ProtoFetchAllResponse 10, // [10:14] is the sub-list for method output_type 6, // [6:10] is the sub-list for method input_type 6, // [6:6] is the sub-list for extension type_name diff --git a/models/locket.proto b/models/locket.proto index 04da4c8..be3aab4 100644 --- a/models/locket.proto +++ b/models/locket.proto @@ -3,53 +3,55 @@ syntax = "proto3"; package models; option go_package="code.cloudfoundry.org/locket/models"; +import "bbs.proto"; + service Locket { - rpc Lock(LockRequest) returns (LockResponse) {} - rpc Fetch(FetchRequest) returns (FetchResponse) {} - rpc Release(ReleaseRequest) returns (ReleaseResponse) {} - rpc FetchAll(FetchAllRequest) returns (FetchAllResponse) {} + rpc Lock(ProtoLockRequest) returns (ProtoLockResponse) {} + rpc Fetch(ProtoFetchRequest) returns (ProtoFetchResponse) {} + rpc Release(ProtoReleaseRequest) returns (ProtoReleaseResponse) {} + rpc FetchAll(ProtoFetchAllRequest) returns (ProtoFetchAllResponse) {} } -enum TypeCode { - UNKNOWN = 0; - LOCK = 1; - PRESENCE = 2; +enum ProtoTypeCode { + UNKNOWN = 0 [(bbs.bbs_enumvalue_customname) = "UNKNOWN"]; + LOCK = 1 [(bbs.bbs_enumvalue_customname) = "LOCK"]; + PRESENCE = 2 [(bbs.bbs_enumvalue_customname) = "PRESENCE"]; } -message Resource { +message ProtoResource { string key = 1; string owner = 2; string value = 3; string type = 4 [deprecated=true]; - TypeCode type_code = 5; + ProtoTypeCode type_code = 5; } -message LockRequest { - Resource resource = 1; +message ProtoLockRequest { + ProtoResource resource = 1; int64 ttl_in_seconds = 2; } -message LockResponse {} +message ProtoLockResponse {} -message ReleaseRequest { - Resource resource = 1; +message ProtoReleaseRequest { + ProtoResource resource = 1; } -message ReleaseResponse {} +message ProtoReleaseResponse {} -message FetchRequest { +message ProtoFetchRequest { string key = 1; } -message FetchResponse { - Resource resource = 1; +message ProtoFetchResponse { + ProtoResource resource = 1; } -message FetchAllRequest { +message ProtoFetchAllRequest { string type = 1 [deprecated=true]; - TypeCode type_code = 2; + ProtoTypeCode type_code = 2; } -message FetchAllResponse { - repeated Resource resources = 1; +message ProtoFetchAllResponse { + repeated ProtoResource resources = 1; } diff --git a/models/locket_bbs.pb.go b/models/locket_bbs.pb.go new file mode 100644 index 0000000..b38a853 --- /dev/null +++ b/models/locket_bbs.pb.go @@ -0,0 +1,937 @@ +// Code generated by protoc-gen-go-bbs. DO NOT EDIT. +// versions: +// - protoc-gen-go-bbs v0.0.1 +// - protoc v6.30.0 +// source: locket.proto + +package models + +import ( + strconv "strconv" +) + +type TypeCode int32 + +const ( + UNKNOWN TypeCode = 0 + LOCK TypeCode = 1 + PRESENCE TypeCode = 2 +) + +// Enum value maps for TypeCode +var ( + TypeCode_name = map[int32]string{ + 0: "UNKNOWN", + 1: "LOCK", + 2: "PRESENCE", + } + TypeCode_value = map[string]int32{ + "UNKNOWN": 0, + "LOCK": 1, + "PRESENCE": 2, + } +) + +func (m TypeCode) String() string { + s, ok := TypeCode_name[int32(m)] + if ok { + return s + } + return strconv.Itoa(int(m)) +} + +// Prevent copylock errors when using ProtoResource directly +type Resource struct { + Key string `json:"key,omitempty"` + Owner string `json:"owner,omitempty"` + Value string `json:"value,omitempty"` + // Deprecated: marked deprecated in locket.proto + Type string `json:"type,omitempty"` + TypeCode TypeCode `json:"typeCode,omitempty"` +} + +func (this *Resource) Equal(that interface{}) bool { + + if that == nil { + return this == nil + } + + that1, ok := that.(*Resource) + if !ok { + that2, ok := that.(Resource) + if ok { + that1 = &that2 + } else { + return false + } + } + + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + + if this.Key != that1.Key { + return false + } + if this.Owner != that1.Owner { + return false + } + if this.Value != that1.Value { + return false + } + if this.Type != that1.Type { + return false + } + if this.TypeCode != that1.TypeCode { + return false + } + return true +} +func (m *Resource) GetKey() string { + if m != nil { + return m.Key + } + var defaultValue string + defaultValue = "" + return defaultValue +} +func (m *Resource) SetKey(value string) { + if m != nil { + m.Key = value + } +} +func (m *Resource) GetOwner() string { + if m != nil { + return m.Owner + } + var defaultValue string + defaultValue = "" + return defaultValue +} +func (m *Resource) SetOwner(value string) { + if m != nil { + m.Owner = value + } +} +func (m *Resource) GetValue() string { + if m != nil { + return m.Value + } + var defaultValue string + defaultValue = "" + return defaultValue +} +func (m *Resource) SetValue(value string) { + if m != nil { + m.Value = value + } +} + +// Deprecated: marked deprecated in locket.proto +func (m *Resource) GetType() string { + if m != nil { + return m.Type + } + var defaultValue string + defaultValue = "" + return defaultValue +} + +// Deprecated: marked deprecated in locket.proto +func (m *Resource) SetType(value string) { + if m != nil { + m.Type = value + } +} +func (m *Resource) GetTypeCode() TypeCode { + if m != nil { + return m.TypeCode + } + var defaultValue TypeCode + defaultValue = 0 + return defaultValue +} +func (m *Resource) SetTypeCode(value TypeCode) { + if m != nil { + m.TypeCode = value + } +} +func (x *Resource) ToProto() *ProtoResource { + if x == nil { + return nil + } + + proto := &ProtoResource{ + Key: x.Key, + Owner: x.Owner, + Value: x.Value, + Type: x.Type, + TypeCode: ProtoTypeCode(x.TypeCode), + } + return proto +} + +func (x *ProtoResource) FromProto() *Resource { + if x == nil { + return nil + } + + copysafe := &Resource{ + Key: x.Key, + Owner: x.Owner, + Value: x.Value, + Type: x.Type, + TypeCode: TypeCode(x.TypeCode), + } + return copysafe +} + +func ResourceToProtoSlice(values []*Resource) []*ProtoResource { + if values == nil { + return nil + } + result := make([]*ProtoResource, len(values)) + for i, val := range values { + result[i] = val.ToProto() + } + return result +} + +func ResourceFromProtoSlice(values []*ProtoResource) []*Resource { + if values == nil { + return nil + } + result := make([]*Resource, len(values)) + for i, val := range values { + result[i] = val.FromProto() + } + return result +} + +// Prevent copylock errors when using ProtoLockRequest directly +type LockRequest struct { + Resource *Resource `json:"resource,omitempty"` + TtlInSeconds int64 `json:"ttlInSeconds,omitempty"` +} + +func (this *LockRequest) Equal(that interface{}) bool { + + if that == nil { + return this == nil + } + + that1, ok := that.(*LockRequest) + if !ok { + that2, ok := that.(LockRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + + if this.Resource == nil { + if that1.Resource != nil { + return false + } + } else if !this.Resource.Equal(*that1.Resource) { + return false + } + if this.TtlInSeconds != that1.TtlInSeconds { + return false + } + return true +} +func (m *LockRequest) GetResource() *Resource { + if m != nil { + return m.Resource + } + return nil +} +func (m *LockRequest) SetResource(value *Resource) { + if m != nil { + m.Resource = value + } +} +func (m *LockRequest) GetTtlInSeconds() int64 { + if m != nil { + return m.TtlInSeconds + } + var defaultValue int64 + defaultValue = 0 + return defaultValue +} +func (m *LockRequest) SetTtlInSeconds(value int64) { + if m != nil { + m.TtlInSeconds = value + } +} +func (x *LockRequest) ToProto() *ProtoLockRequest { + if x == nil { + return nil + } + + proto := &ProtoLockRequest{ + Resource: x.Resource.ToProto(), + TtlInSeconds: x.TtlInSeconds, + } + return proto +} + +func (x *ProtoLockRequest) FromProto() *LockRequest { + if x == nil { + return nil + } + + copysafe := &LockRequest{ + Resource: x.Resource.FromProto(), + TtlInSeconds: x.TtlInSeconds, + } + return copysafe +} + +func LockRequestToProtoSlice(values []*LockRequest) []*ProtoLockRequest { + if values == nil { + return nil + } + result := make([]*ProtoLockRequest, len(values)) + for i, val := range values { + result[i] = val.ToProto() + } + return result +} + +func LockRequestFromProtoSlice(values []*ProtoLockRequest) []*LockRequest { + if values == nil { + return nil + } + result := make([]*LockRequest, len(values)) + for i, val := range values { + result[i] = val.FromProto() + } + return result +} + +// Prevent copylock errors when using ProtoLockResponse directly +type LockResponse struct { +} + +func (this *LockResponse) Equal(that interface{}) bool { + + if that == nil { + return this == nil + } + + that1, ok := that.(*LockResponse) + if !ok { + that2, ok := that.(LockResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + + return true +} +func (x *LockResponse) ToProto() *ProtoLockResponse { + if x == nil { + return nil + } + + proto := &ProtoLockResponse{} + return proto +} + +func (x *ProtoLockResponse) FromProto() *LockResponse { + if x == nil { + return nil + } + + copysafe := &LockResponse{} + return copysafe +} + +func LockResponseToProtoSlice(values []*LockResponse) []*ProtoLockResponse { + if values == nil { + return nil + } + result := make([]*ProtoLockResponse, len(values)) + for i, val := range values { + result[i] = val.ToProto() + } + return result +} + +func LockResponseFromProtoSlice(values []*ProtoLockResponse) []*LockResponse { + if values == nil { + return nil + } + result := make([]*LockResponse, len(values)) + for i, val := range values { + result[i] = val.FromProto() + } + return result +} + +// Prevent copylock errors when using ProtoReleaseRequest directly +type ReleaseRequest struct { + Resource *Resource `json:"resource,omitempty"` +} + +func (this *ReleaseRequest) Equal(that interface{}) bool { + + if that == nil { + return this == nil + } + + that1, ok := that.(*ReleaseRequest) + if !ok { + that2, ok := that.(ReleaseRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + + if this.Resource == nil { + if that1.Resource != nil { + return false + } + } else if !this.Resource.Equal(*that1.Resource) { + return false + } + return true +} +func (m *ReleaseRequest) GetResource() *Resource { + if m != nil { + return m.Resource + } + return nil +} +func (m *ReleaseRequest) SetResource(value *Resource) { + if m != nil { + m.Resource = value + } +} +func (x *ReleaseRequest) ToProto() *ProtoReleaseRequest { + if x == nil { + return nil + } + + proto := &ProtoReleaseRequest{ + Resource: x.Resource.ToProto(), + } + return proto +} + +func (x *ProtoReleaseRequest) FromProto() *ReleaseRequest { + if x == nil { + return nil + } + + copysafe := &ReleaseRequest{ + Resource: x.Resource.FromProto(), + } + return copysafe +} + +func ReleaseRequestToProtoSlice(values []*ReleaseRequest) []*ProtoReleaseRequest { + if values == nil { + return nil + } + result := make([]*ProtoReleaseRequest, len(values)) + for i, val := range values { + result[i] = val.ToProto() + } + return result +} + +func ReleaseRequestFromProtoSlice(values []*ProtoReleaseRequest) []*ReleaseRequest { + if values == nil { + return nil + } + result := make([]*ReleaseRequest, len(values)) + for i, val := range values { + result[i] = val.FromProto() + } + return result +} + +// Prevent copylock errors when using ProtoReleaseResponse directly +type ReleaseResponse struct { +} + +func (this *ReleaseResponse) Equal(that interface{}) bool { + + if that == nil { + return this == nil + } + + that1, ok := that.(*ReleaseResponse) + if !ok { + that2, ok := that.(ReleaseResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + + return true +} +func (x *ReleaseResponse) ToProto() *ProtoReleaseResponse { + if x == nil { + return nil + } + + proto := &ProtoReleaseResponse{} + return proto +} + +func (x *ProtoReleaseResponse) FromProto() *ReleaseResponse { + if x == nil { + return nil + } + + copysafe := &ReleaseResponse{} + return copysafe +} + +func ReleaseResponseToProtoSlice(values []*ReleaseResponse) []*ProtoReleaseResponse { + if values == nil { + return nil + } + result := make([]*ProtoReleaseResponse, len(values)) + for i, val := range values { + result[i] = val.ToProto() + } + return result +} + +func ReleaseResponseFromProtoSlice(values []*ProtoReleaseResponse) []*ReleaseResponse { + if values == nil { + return nil + } + result := make([]*ReleaseResponse, len(values)) + for i, val := range values { + result[i] = val.FromProto() + } + return result +} + +// Prevent copylock errors when using ProtoFetchRequest directly +type FetchRequest struct { + Key string `json:"key,omitempty"` +} + +func (this *FetchRequest) Equal(that interface{}) bool { + + if that == nil { + return this == nil + } + + that1, ok := that.(*FetchRequest) + if !ok { + that2, ok := that.(FetchRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + + if this.Key != that1.Key { + return false + } + return true +} +func (m *FetchRequest) GetKey() string { + if m != nil { + return m.Key + } + var defaultValue string + defaultValue = "" + return defaultValue +} +func (m *FetchRequest) SetKey(value string) { + if m != nil { + m.Key = value + } +} +func (x *FetchRequest) ToProto() *ProtoFetchRequest { + if x == nil { + return nil + } + + proto := &ProtoFetchRequest{ + Key: x.Key, + } + return proto +} + +func (x *ProtoFetchRequest) FromProto() *FetchRequest { + if x == nil { + return nil + } + + copysafe := &FetchRequest{ + Key: x.Key, + } + return copysafe +} + +func FetchRequestToProtoSlice(values []*FetchRequest) []*ProtoFetchRequest { + if values == nil { + return nil + } + result := make([]*ProtoFetchRequest, len(values)) + for i, val := range values { + result[i] = val.ToProto() + } + return result +} + +func FetchRequestFromProtoSlice(values []*ProtoFetchRequest) []*FetchRequest { + if values == nil { + return nil + } + result := make([]*FetchRequest, len(values)) + for i, val := range values { + result[i] = val.FromProto() + } + return result +} + +// Prevent copylock errors when using ProtoFetchResponse directly +type FetchResponse struct { + Resource *Resource `json:"resource,omitempty"` +} + +func (this *FetchResponse) Equal(that interface{}) bool { + + if that == nil { + return this == nil + } + + that1, ok := that.(*FetchResponse) + if !ok { + that2, ok := that.(FetchResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + + if this.Resource == nil { + if that1.Resource != nil { + return false + } + } else if !this.Resource.Equal(*that1.Resource) { + return false + } + return true +} +func (m *FetchResponse) GetResource() *Resource { + if m != nil { + return m.Resource + } + return nil +} +func (m *FetchResponse) SetResource(value *Resource) { + if m != nil { + m.Resource = value + } +} +func (x *FetchResponse) ToProto() *ProtoFetchResponse { + if x == nil { + return nil + } + + proto := &ProtoFetchResponse{ + Resource: x.Resource.ToProto(), + } + return proto +} + +func (x *ProtoFetchResponse) FromProto() *FetchResponse { + if x == nil { + return nil + } + + copysafe := &FetchResponse{ + Resource: x.Resource.FromProto(), + } + return copysafe +} + +func FetchResponseToProtoSlice(values []*FetchResponse) []*ProtoFetchResponse { + if values == nil { + return nil + } + result := make([]*ProtoFetchResponse, len(values)) + for i, val := range values { + result[i] = val.ToProto() + } + return result +} + +func FetchResponseFromProtoSlice(values []*ProtoFetchResponse) []*FetchResponse { + if values == nil { + return nil + } + result := make([]*FetchResponse, len(values)) + for i, val := range values { + result[i] = val.FromProto() + } + return result +} + +// Prevent copylock errors when using ProtoFetchAllRequest directly +type FetchAllRequest struct { + // Deprecated: marked deprecated in locket.proto + Type string `json:"type,omitempty"` + TypeCode TypeCode `json:"typeCode,omitempty"` +} + +func (this *FetchAllRequest) Equal(that interface{}) bool { + + if that == nil { + return this == nil + } + + that1, ok := that.(*FetchAllRequest) + if !ok { + that2, ok := that.(FetchAllRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + + if this.Type != that1.Type { + return false + } + if this.TypeCode != that1.TypeCode { + return false + } + return true +} + +// Deprecated: marked deprecated in locket.proto +func (m *FetchAllRequest) GetType() string { + if m != nil { + return m.Type + } + var defaultValue string + defaultValue = "" + return defaultValue +} + +// Deprecated: marked deprecated in locket.proto +func (m *FetchAllRequest) SetType(value string) { + if m != nil { + m.Type = value + } +} +func (m *FetchAllRequest) GetTypeCode() TypeCode { + if m != nil { + return m.TypeCode + } + var defaultValue TypeCode + defaultValue = 0 + return defaultValue +} +func (m *FetchAllRequest) SetTypeCode(value TypeCode) { + if m != nil { + m.TypeCode = value + } +} +func (x *FetchAllRequest) ToProto() *ProtoFetchAllRequest { + if x == nil { + return nil + } + + proto := &ProtoFetchAllRequest{ + Type: x.Type, + TypeCode: ProtoTypeCode(x.TypeCode), + } + return proto +} + +func (x *ProtoFetchAllRequest) FromProto() *FetchAllRequest { + if x == nil { + return nil + } + + copysafe := &FetchAllRequest{ + Type: x.Type, + TypeCode: TypeCode(x.TypeCode), + } + return copysafe +} + +func FetchAllRequestToProtoSlice(values []*FetchAllRequest) []*ProtoFetchAllRequest { + if values == nil { + return nil + } + result := make([]*ProtoFetchAllRequest, len(values)) + for i, val := range values { + result[i] = val.ToProto() + } + return result +} + +func FetchAllRequestFromProtoSlice(values []*ProtoFetchAllRequest) []*FetchAllRequest { + if values == nil { + return nil + } + result := make([]*FetchAllRequest, len(values)) + for i, val := range values { + result[i] = val.FromProto() + } + return result +} + +// Prevent copylock errors when using ProtoFetchAllResponse directly +type FetchAllResponse struct { + Resources []*Resource `json:"resources,omitempty"` +} + +func (this *FetchAllResponse) Equal(that interface{}) bool { + + if that == nil { + return this == nil + } + + that1, ok := that.(*FetchAllResponse) + if !ok { + that2, ok := that.(FetchAllResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + + if this.Resources == nil { + if that1.Resources != nil { + return false + } + } else if len(this.Resources) != len(that1.Resources) { + return false + } + for i := range this.Resources { + if !this.Resources[i].Equal(that1.Resources[i]) { + return false + } + } + return true +} +func (m *FetchAllResponse) GetResources() []*Resource { + if m != nil { + return m.Resources + } + return nil +} +func (m *FetchAllResponse) SetResources(value []*Resource) { + if m != nil { + m.Resources = value + } +} +func (x *FetchAllResponse) ToProto() *ProtoFetchAllResponse { + if x == nil { + return nil + } + + proto := &ProtoFetchAllResponse{ + Resources: ResourceToProtoSlice(x.Resources), + } + return proto +} + +func (x *ProtoFetchAllResponse) FromProto() *FetchAllResponse { + if x == nil { + return nil + } + + copysafe := &FetchAllResponse{ + Resources: ResourceFromProtoSlice(x.Resources), + } + return copysafe +} + +func FetchAllResponseToProtoSlice(values []*FetchAllResponse) []*ProtoFetchAllResponse { + if values == nil { + return nil + } + result := make([]*ProtoFetchAllResponse, len(values)) + for i, val := range values { + result[i] = val.ToProto() + } + return result +} + +func FetchAllResponseFromProtoSlice(values []*ProtoFetchAllResponse) []*FetchAllResponse { + if values == nil { + return nil + } + result := make([]*FetchAllResponse, len(values)) + for i, val := range values { + result[i] = val.FromProto() + } + return result +} diff --git a/models/locket_grpc.pb.go b/models/locket_grpc.pb.go index a92998e..3f25218 100644 --- a/models/locket_grpc.pb.go +++ b/models/locket_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v4.25.6 +// - protoc v6.30.0 // source: locket.proto package models @@ -29,10 +29,10 @@ const ( // // 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. type LocketClient interface { - Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error) - Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchResponse, error) - Release(ctx context.Context, in *ReleaseRequest, opts ...grpc.CallOption) (*ReleaseResponse, error) - FetchAll(ctx context.Context, in *FetchAllRequest, opts ...grpc.CallOption) (*FetchAllResponse, error) + Lock(ctx context.Context, in *ProtoLockRequest, opts ...grpc.CallOption) (*ProtoLockResponse, error) + Fetch(ctx context.Context, in *ProtoFetchRequest, opts ...grpc.CallOption) (*ProtoFetchResponse, error) + Release(ctx context.Context, in *ProtoReleaseRequest, opts ...grpc.CallOption) (*ProtoReleaseResponse, error) + FetchAll(ctx context.Context, in *ProtoFetchAllRequest, opts ...grpc.CallOption) (*ProtoFetchAllResponse, error) } type locketClient struct { @@ -43,9 +43,9 @@ func NewLocketClient(cc grpc.ClientConnInterface) LocketClient { return &locketClient{cc} } -func (c *locketClient) Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error) { +func (c *locketClient) Lock(ctx context.Context, in *ProtoLockRequest, opts ...grpc.CallOption) (*ProtoLockResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(LockResponse) + out := new(ProtoLockResponse) err := c.cc.Invoke(ctx, Locket_Lock_FullMethodName, in, out, cOpts...) if err != nil { return nil, err @@ -53,9 +53,9 @@ func (c *locketClient) Lock(ctx context.Context, in *LockRequest, opts ...grpc.C return out, nil } -func (c *locketClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchResponse, error) { +func (c *locketClient) Fetch(ctx context.Context, in *ProtoFetchRequest, opts ...grpc.CallOption) (*ProtoFetchResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(FetchResponse) + out := new(ProtoFetchResponse) err := c.cc.Invoke(ctx, Locket_Fetch_FullMethodName, in, out, cOpts...) if err != nil { return nil, err @@ -63,9 +63,9 @@ func (c *locketClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc return out, nil } -func (c *locketClient) Release(ctx context.Context, in *ReleaseRequest, opts ...grpc.CallOption) (*ReleaseResponse, error) { +func (c *locketClient) Release(ctx context.Context, in *ProtoReleaseRequest, opts ...grpc.CallOption) (*ProtoReleaseResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ReleaseResponse) + out := new(ProtoReleaseResponse) err := c.cc.Invoke(ctx, Locket_Release_FullMethodName, in, out, cOpts...) if err != nil { return nil, err @@ -73,9 +73,9 @@ func (c *locketClient) Release(ctx context.Context, in *ReleaseRequest, opts ... return out, nil } -func (c *locketClient) FetchAll(ctx context.Context, in *FetchAllRequest, opts ...grpc.CallOption) (*FetchAllResponse, error) { +func (c *locketClient) FetchAll(ctx context.Context, in *ProtoFetchAllRequest, opts ...grpc.CallOption) (*ProtoFetchAllResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(FetchAllResponse) + out := new(ProtoFetchAllResponse) err := c.cc.Invoke(ctx, Locket_FetchAll_FullMethodName, in, out, cOpts...) if err != nil { return nil, err @@ -87,10 +87,10 @@ func (c *locketClient) FetchAll(ctx context.Context, in *FetchAllRequest, opts . // All implementations must embed UnimplementedLocketServer // for forward compatibility. type LocketServer interface { - Lock(context.Context, *LockRequest) (*LockResponse, error) - Fetch(context.Context, *FetchRequest) (*FetchResponse, error) - Release(context.Context, *ReleaseRequest) (*ReleaseResponse, error) - FetchAll(context.Context, *FetchAllRequest) (*FetchAllResponse, error) + Lock(context.Context, *ProtoLockRequest) (*ProtoLockResponse, error) + Fetch(context.Context, *ProtoFetchRequest) (*ProtoFetchResponse, error) + Release(context.Context, *ProtoReleaseRequest) (*ProtoReleaseResponse, error) + FetchAll(context.Context, *ProtoFetchAllRequest) (*ProtoFetchAllResponse, error) mustEmbedUnimplementedLocketServer() } @@ -101,16 +101,16 @@ type LocketServer interface { // pointer dereference when methods are called. type UnimplementedLocketServer struct{} -func (UnimplementedLocketServer) Lock(context.Context, *LockRequest) (*LockResponse, error) { +func (UnimplementedLocketServer) Lock(context.Context, *ProtoLockRequest) (*ProtoLockResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Lock not implemented") } -func (UnimplementedLocketServer) Fetch(context.Context, *FetchRequest) (*FetchResponse, error) { +func (UnimplementedLocketServer) Fetch(context.Context, *ProtoFetchRequest) (*ProtoFetchResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Fetch not implemented") } -func (UnimplementedLocketServer) Release(context.Context, *ReleaseRequest) (*ReleaseResponse, error) { +func (UnimplementedLocketServer) Release(context.Context, *ProtoReleaseRequest) (*ProtoReleaseResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Release not implemented") } -func (UnimplementedLocketServer) FetchAll(context.Context, *FetchAllRequest) (*FetchAllResponse, error) { +func (UnimplementedLocketServer) FetchAll(context.Context, *ProtoFetchAllRequest) (*ProtoFetchAllResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FetchAll not implemented") } func (UnimplementedLocketServer) mustEmbedUnimplementedLocketServer() {} @@ -135,7 +135,7 @@ func RegisterLocketServer(s grpc.ServiceRegistrar, srv LocketServer) { } func _Locket_Lock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LockRequest) + in := new(ProtoLockRequest) if err := dec(in); err != nil { return nil, err } @@ -147,13 +147,13 @@ func _Locket_Lock_Handler(srv interface{}, ctx context.Context, dec func(interfa FullMethod: Locket_Lock_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LocketServer).Lock(ctx, req.(*LockRequest)) + return srv.(LocketServer).Lock(ctx, req.(*ProtoLockRequest)) } return interceptor(ctx, in, info, handler) } func _Locket_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FetchRequest) + in := new(ProtoFetchRequest) if err := dec(in); err != nil { return nil, err } @@ -165,13 +165,13 @@ func _Locket_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interf FullMethod: Locket_Fetch_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LocketServer).Fetch(ctx, req.(*FetchRequest)) + return srv.(LocketServer).Fetch(ctx, req.(*ProtoFetchRequest)) } return interceptor(ctx, in, info, handler) } func _Locket_Release_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ReleaseRequest) + in := new(ProtoReleaseRequest) if err := dec(in); err != nil { return nil, err } @@ -183,13 +183,13 @@ func _Locket_Release_Handler(srv interface{}, ctx context.Context, dec func(inte FullMethod: Locket_Release_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LocketServer).Release(ctx, req.(*ReleaseRequest)) + return srv.(LocketServer).Release(ctx, req.(*ProtoReleaseRequest)) } return interceptor(ctx, in, info, handler) } func _Locket_FetchAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FetchAllRequest) + in := new(ProtoFetchAllRequest) if err := dec(in); err != nil { return nil, err } @@ -201,7 +201,7 @@ func _Locket_FetchAll_Handler(srv interface{}, ctx context.Context, dec func(int FullMethod: Locket_FetchAll_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LocketServer).FetchAll(ctx, req.(*FetchAllRequest)) + return srv.(LocketServer).FetchAll(ctx, req.(*ProtoFetchAllRequest)) } return interceptor(ctx, in, info, handler) } diff --git a/models/modelsfakes/fake_locket_client.go b/models/modelsfakes/fake_locket_client.go index 0ff14bc..108ea78 100644 --- a/models/modelsfakes/fake_locket_client.go +++ b/models/modelsfakes/fake_locket_client.go @@ -10,76 +10,76 @@ import ( ) type FakeLocketClient struct { - FetchStub func(context.Context, *models.FetchRequest, ...grpc.CallOption) (*models.FetchResponse, error) + FetchStub func(context.Context, *models.ProtoFetchRequest, ...grpc.CallOption) (*models.ProtoFetchResponse, error) fetchMutex sync.RWMutex fetchArgsForCall []struct { arg1 context.Context - arg2 *models.FetchRequest + arg2 *models.ProtoFetchRequest arg3 []grpc.CallOption } fetchReturns struct { - result1 *models.FetchResponse + result1 *models.ProtoFetchResponse result2 error } fetchReturnsOnCall map[int]struct { - result1 *models.FetchResponse + result1 *models.ProtoFetchResponse result2 error } - FetchAllStub func(context.Context, *models.FetchAllRequest, ...grpc.CallOption) (*models.FetchAllResponse, error) + FetchAllStub func(context.Context, *models.ProtoFetchAllRequest, ...grpc.CallOption) (*models.ProtoFetchAllResponse, error) fetchAllMutex sync.RWMutex fetchAllArgsForCall []struct { arg1 context.Context - arg2 *models.FetchAllRequest + arg2 *models.ProtoFetchAllRequest arg3 []grpc.CallOption } fetchAllReturns struct { - result1 *models.FetchAllResponse + result1 *models.ProtoFetchAllResponse result2 error } fetchAllReturnsOnCall map[int]struct { - result1 *models.FetchAllResponse + result1 *models.ProtoFetchAllResponse result2 error } - LockStub func(context.Context, *models.LockRequest, ...grpc.CallOption) (*models.LockResponse, error) + LockStub func(context.Context, *models.ProtoLockRequest, ...grpc.CallOption) (*models.ProtoLockResponse, error) lockMutex sync.RWMutex lockArgsForCall []struct { arg1 context.Context - arg2 *models.LockRequest + arg2 *models.ProtoLockRequest arg3 []grpc.CallOption } lockReturns struct { - result1 *models.LockResponse + result1 *models.ProtoLockResponse result2 error } lockReturnsOnCall map[int]struct { - result1 *models.LockResponse + result1 *models.ProtoLockResponse result2 error } - ReleaseStub func(context.Context, *models.ReleaseRequest, ...grpc.CallOption) (*models.ReleaseResponse, error) + ReleaseStub func(context.Context, *models.ProtoReleaseRequest, ...grpc.CallOption) (*models.ProtoReleaseResponse, error) releaseMutex sync.RWMutex releaseArgsForCall []struct { arg1 context.Context - arg2 *models.ReleaseRequest + arg2 *models.ProtoReleaseRequest arg3 []grpc.CallOption } releaseReturns struct { - result1 *models.ReleaseResponse + result1 *models.ProtoReleaseResponse result2 error } releaseReturnsOnCall map[int]struct { - result1 *models.ReleaseResponse + result1 *models.ProtoReleaseResponse result2 error } invocations map[string][][]interface{} invocationsMutex sync.RWMutex } -func (fake *FakeLocketClient) Fetch(arg1 context.Context, arg2 *models.FetchRequest, arg3 ...grpc.CallOption) (*models.FetchResponse, error) { +func (fake *FakeLocketClient) Fetch(arg1 context.Context, arg2 *models.ProtoFetchRequest, arg3 ...grpc.CallOption) (*models.ProtoFetchResponse, error) { fake.fetchMutex.Lock() ret, specificReturn := fake.fetchReturnsOnCall[len(fake.fetchArgsForCall)] fake.fetchArgsForCall = append(fake.fetchArgsForCall, struct { arg1 context.Context - arg2 *models.FetchRequest + arg2 *models.ProtoFetchRequest arg3 []grpc.CallOption }{arg1, arg2, arg3}) stub := fake.FetchStub @@ -101,51 +101,51 @@ func (fake *FakeLocketClient) FetchCallCount() int { return len(fake.fetchArgsForCall) } -func (fake *FakeLocketClient) FetchCalls(stub func(context.Context, *models.FetchRequest, ...grpc.CallOption) (*models.FetchResponse, error)) { +func (fake *FakeLocketClient) FetchCalls(stub func(context.Context, *models.ProtoFetchRequest, ...grpc.CallOption) (*models.ProtoFetchResponse, error)) { fake.fetchMutex.Lock() defer fake.fetchMutex.Unlock() fake.FetchStub = stub } -func (fake *FakeLocketClient) FetchArgsForCall(i int) (context.Context, *models.FetchRequest, []grpc.CallOption) { +func (fake *FakeLocketClient) FetchArgsForCall(i int) (context.Context, *models.ProtoFetchRequest, []grpc.CallOption) { fake.fetchMutex.RLock() defer fake.fetchMutex.RUnlock() argsForCall := fake.fetchArgsForCall[i] return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 } -func (fake *FakeLocketClient) FetchReturns(result1 *models.FetchResponse, result2 error) { +func (fake *FakeLocketClient) FetchReturns(result1 *models.ProtoFetchResponse, result2 error) { fake.fetchMutex.Lock() defer fake.fetchMutex.Unlock() fake.FetchStub = nil fake.fetchReturns = struct { - result1 *models.FetchResponse + result1 *models.ProtoFetchResponse result2 error }{result1, result2} } -func (fake *FakeLocketClient) FetchReturnsOnCall(i int, result1 *models.FetchResponse, result2 error) { +func (fake *FakeLocketClient) FetchReturnsOnCall(i int, result1 *models.ProtoFetchResponse, result2 error) { fake.fetchMutex.Lock() defer fake.fetchMutex.Unlock() fake.FetchStub = nil if fake.fetchReturnsOnCall == nil { fake.fetchReturnsOnCall = make(map[int]struct { - result1 *models.FetchResponse + result1 *models.ProtoFetchResponse result2 error }) } fake.fetchReturnsOnCall[i] = struct { - result1 *models.FetchResponse + result1 *models.ProtoFetchResponse result2 error }{result1, result2} } -func (fake *FakeLocketClient) FetchAll(arg1 context.Context, arg2 *models.FetchAllRequest, arg3 ...grpc.CallOption) (*models.FetchAllResponse, error) { +func (fake *FakeLocketClient) FetchAll(arg1 context.Context, arg2 *models.ProtoFetchAllRequest, arg3 ...grpc.CallOption) (*models.ProtoFetchAllResponse, error) { fake.fetchAllMutex.Lock() ret, specificReturn := fake.fetchAllReturnsOnCall[len(fake.fetchAllArgsForCall)] fake.fetchAllArgsForCall = append(fake.fetchAllArgsForCall, struct { arg1 context.Context - arg2 *models.FetchAllRequest + arg2 *models.ProtoFetchAllRequest arg3 []grpc.CallOption }{arg1, arg2, arg3}) stub := fake.FetchAllStub @@ -167,51 +167,51 @@ func (fake *FakeLocketClient) FetchAllCallCount() int { return len(fake.fetchAllArgsForCall) } -func (fake *FakeLocketClient) FetchAllCalls(stub func(context.Context, *models.FetchAllRequest, ...grpc.CallOption) (*models.FetchAllResponse, error)) { +func (fake *FakeLocketClient) FetchAllCalls(stub func(context.Context, *models.ProtoFetchAllRequest, ...grpc.CallOption) (*models.ProtoFetchAllResponse, error)) { fake.fetchAllMutex.Lock() defer fake.fetchAllMutex.Unlock() fake.FetchAllStub = stub } -func (fake *FakeLocketClient) FetchAllArgsForCall(i int) (context.Context, *models.FetchAllRequest, []grpc.CallOption) { +func (fake *FakeLocketClient) FetchAllArgsForCall(i int) (context.Context, *models.ProtoFetchAllRequest, []grpc.CallOption) { fake.fetchAllMutex.RLock() defer fake.fetchAllMutex.RUnlock() argsForCall := fake.fetchAllArgsForCall[i] return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 } -func (fake *FakeLocketClient) FetchAllReturns(result1 *models.FetchAllResponse, result2 error) { +func (fake *FakeLocketClient) FetchAllReturns(result1 *models.ProtoFetchAllResponse, result2 error) { fake.fetchAllMutex.Lock() defer fake.fetchAllMutex.Unlock() fake.FetchAllStub = nil fake.fetchAllReturns = struct { - result1 *models.FetchAllResponse + result1 *models.ProtoFetchAllResponse result2 error }{result1, result2} } -func (fake *FakeLocketClient) FetchAllReturnsOnCall(i int, result1 *models.FetchAllResponse, result2 error) { +func (fake *FakeLocketClient) FetchAllReturnsOnCall(i int, result1 *models.ProtoFetchAllResponse, result2 error) { fake.fetchAllMutex.Lock() defer fake.fetchAllMutex.Unlock() fake.FetchAllStub = nil if fake.fetchAllReturnsOnCall == nil { fake.fetchAllReturnsOnCall = make(map[int]struct { - result1 *models.FetchAllResponse + result1 *models.ProtoFetchAllResponse result2 error }) } fake.fetchAllReturnsOnCall[i] = struct { - result1 *models.FetchAllResponse + result1 *models.ProtoFetchAllResponse result2 error }{result1, result2} } -func (fake *FakeLocketClient) Lock(arg1 context.Context, arg2 *models.LockRequest, arg3 ...grpc.CallOption) (*models.LockResponse, error) { +func (fake *FakeLocketClient) Lock(arg1 context.Context, arg2 *models.ProtoLockRequest, arg3 ...grpc.CallOption) (*models.ProtoLockResponse, error) { fake.lockMutex.Lock() ret, specificReturn := fake.lockReturnsOnCall[len(fake.lockArgsForCall)] fake.lockArgsForCall = append(fake.lockArgsForCall, struct { arg1 context.Context - arg2 *models.LockRequest + arg2 *models.ProtoLockRequest arg3 []grpc.CallOption }{arg1, arg2, arg3}) stub := fake.LockStub @@ -233,51 +233,51 @@ func (fake *FakeLocketClient) LockCallCount() int { return len(fake.lockArgsForCall) } -func (fake *FakeLocketClient) LockCalls(stub func(context.Context, *models.LockRequest, ...grpc.CallOption) (*models.LockResponse, error)) { +func (fake *FakeLocketClient) LockCalls(stub func(context.Context, *models.ProtoLockRequest, ...grpc.CallOption) (*models.ProtoLockResponse, error)) { fake.lockMutex.Lock() defer fake.lockMutex.Unlock() fake.LockStub = stub } -func (fake *FakeLocketClient) LockArgsForCall(i int) (context.Context, *models.LockRequest, []grpc.CallOption) { +func (fake *FakeLocketClient) LockArgsForCall(i int) (context.Context, *models.ProtoLockRequest, []grpc.CallOption) { fake.lockMutex.RLock() defer fake.lockMutex.RUnlock() argsForCall := fake.lockArgsForCall[i] return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 } -func (fake *FakeLocketClient) LockReturns(result1 *models.LockResponse, result2 error) { +func (fake *FakeLocketClient) LockReturns(result1 *models.ProtoLockResponse, result2 error) { fake.lockMutex.Lock() defer fake.lockMutex.Unlock() fake.LockStub = nil fake.lockReturns = struct { - result1 *models.LockResponse + result1 *models.ProtoLockResponse result2 error }{result1, result2} } -func (fake *FakeLocketClient) LockReturnsOnCall(i int, result1 *models.LockResponse, result2 error) { +func (fake *FakeLocketClient) LockReturnsOnCall(i int, result1 *models.ProtoLockResponse, result2 error) { fake.lockMutex.Lock() defer fake.lockMutex.Unlock() fake.LockStub = nil if fake.lockReturnsOnCall == nil { fake.lockReturnsOnCall = make(map[int]struct { - result1 *models.LockResponse + result1 *models.ProtoLockResponse result2 error }) } fake.lockReturnsOnCall[i] = struct { - result1 *models.LockResponse + result1 *models.ProtoLockResponse result2 error }{result1, result2} } -func (fake *FakeLocketClient) Release(arg1 context.Context, arg2 *models.ReleaseRequest, arg3 ...grpc.CallOption) (*models.ReleaseResponse, error) { +func (fake *FakeLocketClient) Release(arg1 context.Context, arg2 *models.ProtoReleaseRequest, arg3 ...grpc.CallOption) (*models.ProtoReleaseResponse, error) { fake.releaseMutex.Lock() ret, specificReturn := fake.releaseReturnsOnCall[len(fake.releaseArgsForCall)] fake.releaseArgsForCall = append(fake.releaseArgsForCall, struct { arg1 context.Context - arg2 *models.ReleaseRequest + arg2 *models.ProtoReleaseRequest arg3 []grpc.CallOption }{arg1, arg2, arg3}) stub := fake.ReleaseStub @@ -299,41 +299,41 @@ func (fake *FakeLocketClient) ReleaseCallCount() int { return len(fake.releaseArgsForCall) } -func (fake *FakeLocketClient) ReleaseCalls(stub func(context.Context, *models.ReleaseRequest, ...grpc.CallOption) (*models.ReleaseResponse, error)) { +func (fake *FakeLocketClient) ReleaseCalls(stub func(context.Context, *models.ProtoReleaseRequest, ...grpc.CallOption) (*models.ProtoReleaseResponse, error)) { fake.releaseMutex.Lock() defer fake.releaseMutex.Unlock() fake.ReleaseStub = stub } -func (fake *FakeLocketClient) ReleaseArgsForCall(i int) (context.Context, *models.ReleaseRequest, []grpc.CallOption) { +func (fake *FakeLocketClient) ReleaseArgsForCall(i int) (context.Context, *models.ProtoReleaseRequest, []grpc.CallOption) { fake.releaseMutex.RLock() defer fake.releaseMutex.RUnlock() argsForCall := fake.releaseArgsForCall[i] return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 } -func (fake *FakeLocketClient) ReleaseReturns(result1 *models.ReleaseResponse, result2 error) { +func (fake *FakeLocketClient) ReleaseReturns(result1 *models.ProtoReleaseResponse, result2 error) { fake.releaseMutex.Lock() defer fake.releaseMutex.Unlock() fake.ReleaseStub = nil fake.releaseReturns = struct { - result1 *models.ReleaseResponse + result1 *models.ProtoReleaseResponse result2 error }{result1, result2} } -func (fake *FakeLocketClient) ReleaseReturnsOnCall(i int, result1 *models.ReleaseResponse, result2 error) { +func (fake *FakeLocketClient) ReleaseReturnsOnCall(i int, result1 *models.ProtoReleaseResponse, result2 error) { fake.releaseMutex.Lock() defer fake.releaseMutex.Unlock() fake.ReleaseStub = nil if fake.releaseReturnsOnCall == nil { fake.releaseReturnsOnCall = make(map[int]struct { - result1 *models.ReleaseResponse + result1 *models.ProtoReleaseResponse result2 error }) } fake.releaseReturnsOnCall[i] = struct { - result1 *models.ReleaseResponse + result1 *models.ProtoReleaseResponse result2 error }{result1, result2} } diff --git a/scripts/generate_protos.sh b/scripts/generate_protos.sh index 518e54a..b0a0e9a 100755 --- a/scripts/generate_protos.sh +++ b/scripts/generate_protos.sh @@ -1,8 +1,9 @@ set -e DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" pushd "$DIR/../models" -protoc --proto_path=../../vendor:../../vendor/google.golang.org/protobuf/types/known/durationpb/:. \ +protoc --proto_path=../../bbs/protoc-gen-go-bbs:../../vendor:../../vendor/google.golang.org/protobuf/types/known/durationpb/:. \ --go_out=. --go_opt=paths=source_relative \ + --go-bbs_out=. --go-bbs_opt=paths=source_relative \ --go-grpc_out=. --go-grpc_opt=paths=source_relative \ - ./*.proto + ./*.proto popd From 35bb4a9b582d6577b04313e93bdecc331a866199 Mon Sep 17 00:00:00 2001 From: Brandon Roberson Date: Fri, 14 Mar 2025 17:26:52 +0000 Subject: [PATCH 05/15] Base grpc generation --- models/locket.pb.go | 62 +++++----- models/locket.proto | 10 +- models/locket_bbs_grpc.pb.go | 232 +++++++++++++++++++++++++++++++++++ models/locket_grpc.pb.go | 152 +++++++++++------------ scripts/generate_protos.sh | 2 +- 5 files changed, 346 insertions(+), 112 deletions(-) create mode 100644 models/locket_bbs_grpc.pb.go diff --git a/models/locket.pb.go b/models/locket.pb.go index a8470ae..f0b09cc 100644 --- a/models/locket.pb.go +++ b/models/locket.pb.go @@ -555,28 +555,30 @@ var file_locket_proto_rawDesc = string([]byte{ 0x00, 0x1a, 0x0a, 0x82, 0x7d, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x12, 0x11, 0x0a, 0x04, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x01, 0x1a, 0x07, 0x82, 0x7d, 0x04, 0x4c, 0x4f, 0x43, 0x4b, 0x12, 0x19, 0x0a, 0x08, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x43, 0x45, 0x10, 0x02, 0x1a, 0x0b, - 0x82, 0x7d, 0x08, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x43, 0x45, 0x32, 0x9c, 0x02, 0x0a, 0x06, - 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x3d, 0x0a, 0x04, 0x4c, 0x6f, 0x63, 0x6b, 0x12, 0x18, - 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x4c, 0x6f, 0x63, - 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, - 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x4c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x05, 0x46, 0x65, 0x74, 0x63, 0x68, 0x12, 0x19, - 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, - 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6d, 0x6f, 0x64, 0x65, - 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x07, 0x52, 0x65, 0x6c, 0x65, 0x61, - 0x73, 0x65, 0x12, 0x1b, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x65, - 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x49, 0x0a, 0x08, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x6c, 0x6c, 0x12, 0x1c, 0x2e, 0x6d, 0x6f, - 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, - 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6d, 0x6f, 0x64, 0x65, - 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x6c, 0x6c, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x25, 0x5a, 0x23, 0x63, 0x6f, - 0x64, 0x65, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x72, 0x79, 0x2e, - 0x6f, 0x72, 0x67, 0x2f, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, - 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x82, 0x7d, 0x08, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x43, 0x45, 0x32, 0xb5, 0x02, 0x0a, 0x0b, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x42, 0x0a, 0x09, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x4c, 0x6f, 0x63, 0x6b, 0x12, 0x18, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, + 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x4c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x4c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x45, 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x12, 0x19, 0x2e, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, + 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, + 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, + 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x12, 0x1b, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, + 0x68, 0x41, 0x6c, 0x6c, 0x12, 0x1c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x42, 0x25, 0x5a, 0x23, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x6c, 0x6f, 0x75, + 0x64, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x72, 0x79, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6c, 0x6f, 0x63, + 0x6b, 0x65, 0x74, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, }) var ( @@ -612,14 +614,14 @@ var file_locket_proto_depIdxs = []int32{ 1, // 3: models.ProtoFetchResponse.resource:type_name -> models.ProtoResource 0, // 4: models.ProtoFetchAllRequest.type_code:type_name -> models.ProtoTypeCode 1, // 5: models.ProtoFetchAllResponse.resources:type_name -> models.ProtoResource - 2, // 6: models.Locket.Lock:input_type -> models.ProtoLockRequest - 6, // 7: models.Locket.Fetch:input_type -> models.ProtoFetchRequest - 4, // 8: models.Locket.Release:input_type -> models.ProtoReleaseRequest - 8, // 9: models.Locket.FetchAll:input_type -> models.ProtoFetchAllRequest - 3, // 10: models.Locket.Lock:output_type -> models.ProtoLockResponse - 7, // 11: models.Locket.Fetch:output_type -> models.ProtoFetchResponse - 5, // 12: models.Locket.Release:output_type -> models.ProtoReleaseResponse - 9, // 13: models.Locket.FetchAll:output_type -> models.ProtoFetchAllResponse + 2, // 6: models.ProtoLocket.ProtoLock:input_type -> models.ProtoLockRequest + 6, // 7: models.ProtoLocket.ProtoFetch:input_type -> models.ProtoFetchRequest + 4, // 8: models.ProtoLocket.ProtoRelease:input_type -> models.ProtoReleaseRequest + 8, // 9: models.ProtoLocket.ProtoFetchAll:input_type -> models.ProtoFetchAllRequest + 3, // 10: models.ProtoLocket.ProtoLock:output_type -> models.ProtoLockResponse + 7, // 11: models.ProtoLocket.ProtoFetch:output_type -> models.ProtoFetchResponse + 5, // 12: models.ProtoLocket.ProtoRelease:output_type -> models.ProtoReleaseResponse + 9, // 13: models.ProtoLocket.ProtoFetchAll:output_type -> models.ProtoFetchAllResponse 10, // [10:14] is the sub-list for method output_type 6, // [6:10] is the sub-list for method input_type 6, // [6:6] is the sub-list for extension type_name diff --git a/models/locket.proto b/models/locket.proto index be3aab4..2681939 100644 --- a/models/locket.proto +++ b/models/locket.proto @@ -5,11 +5,11 @@ option go_package="code.cloudfoundry.org/locket/models"; import "bbs.proto"; -service Locket { - rpc Lock(ProtoLockRequest) returns (ProtoLockResponse) {} - rpc Fetch(ProtoFetchRequest) returns (ProtoFetchResponse) {} - rpc Release(ProtoReleaseRequest) returns (ProtoReleaseResponse) {} - rpc FetchAll(ProtoFetchAllRequest) returns (ProtoFetchAllResponse) {} +service ProtoLocket { + rpc ProtoLock(ProtoLockRequest) returns (ProtoLockResponse) {} + rpc ProtoFetch(ProtoFetchRequest) returns (ProtoFetchResponse) {} + rpc ProtoRelease(ProtoReleaseRequest) returns (ProtoReleaseResponse) {} + rpc ProtoFetchAll(ProtoFetchAllRequest) returns (ProtoFetchAllResponse) {} } enum ProtoTypeCode { diff --git a/models/locket_bbs_grpc.pb.go b/models/locket_bbs_grpc.pb.go new file mode 100644 index 0000000..6aada32 --- /dev/null +++ b/models/locket_bbs_grpc.pb.go @@ -0,0 +1,232 @@ +// Code generated by protoc-gen-go-bbs. DO NOT EDIT. +// versions: +// - protoc-gen-go-bbs v0.0.1 +// - protoc-gen-go-grpc TODO: get version +// - protoc v6.30.0 +// source: locket.proto + +package models + +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 ( + Locket_Lock_FullMethodName = "/models.Locket/Lock" + Locket_Fetch_FullMethodName = "/models.Locket/Fetch" + Locket_Release_FullMethodName = "/models.Locket/Release" + Locket_FetchAll_FullMethodName = "/models.Locket/FetchAll" +) + +// LocketClient is the client API for Locket 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. +type LocketClient interface { + Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error) + Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchResponse, error) + Release(ctx context.Context, in *ReleaseRequest, opts ...grpc.CallOption) (*ReleaseResponse, error) + FetchAll(ctx context.Context, in *FetchAllRequest, opts ...grpc.CallOption) (*FetchAllResponse, error) +} + +type locketClient struct { + cc grpc.ClientConnInterface +} + +func NewLocketClient(cc grpc.ClientConnInterface) LocketClient { + return &locketClient{cc} +} + +func (c *locketClient) Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LockResponse) + err := c.cc.Invoke(ctx, Locket_Lock_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *locketClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(FetchResponse) + err := c.cc.Invoke(ctx, Locket_Fetch_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *locketClient) Release(ctx context.Context, in *ReleaseRequest, opts ...grpc.CallOption) (*ReleaseResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReleaseResponse) + err := c.cc.Invoke(ctx, Locket_Release_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *locketClient) FetchAll(ctx context.Context, in *FetchAllRequest, opts ...grpc.CallOption) (*FetchAllResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(FetchAllResponse) + err := c.cc.Invoke(ctx, Locket_FetchAll_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +type LocketServer interface { + Lock(context.Context, *LockRequest) (*LockResponse, error) + Fetch(context.Context, *FetchRequest) (*FetchResponse, error) + Release(context.Context, *ReleaseRequest) (*ReleaseResponse, error) + FetchAll(context.Context, *FetchAllRequest) (*FetchAllResponse, error) + mustEmbedUnimplementedLocketServer() +} + +// UnimplementedLocketServer 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 UnimplementedLocketServer struct{} + +func (UnimplementedLocketServer) Lock(context.Context, *LockRequest) (*LockResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Lock not implemented") +} +func (UnimplementedLocketServer) Fetch(context.Context, *FetchRequest) (*FetchResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Fetch not implemented") +} +func (UnimplementedLocketServer) Release(context.Context, *ReleaseRequest) (*ReleaseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Release not implemented") +} +func (UnimplementedLocketServer) FetchAll(context.Context, *FetchAllRequest) (*FetchAllResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FetchAll not implemented") +} +func (UnimplementedLocketServer) mustEmbedUnimplementedLocketServer() {} +func (UnimplementedLocketServer) testEmbeddedByValue() {} + +// UnsafeLocketServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to LocketServer will +// result in compilation errors. +type UnsafeLocketServer interface { + mustEmbedUnimplementedLocketServer() +} + +func RegisterLocketServer(s grpc.ServiceRegistrar, srv LocketServer) { + // If the following call panics, it indicates UnimplementedLocketServer 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(&Locket_ServiceDesc, srv) +} + +func _Locket_Lock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LocketServer).Lock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Locket_Lock_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LocketServer).Lock(ctx, req.(*LockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Locket_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FetchRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LocketServer).Fetch(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Locket_Fetch_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LocketServer).Fetch(ctx, req.(*FetchRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Locket_Release_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReleaseRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LocketServer).Release(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Locket_Release_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LocketServer).Release(ctx, req.(*ReleaseRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Locket_FetchAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FetchAllRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LocketServer).FetchAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Locket_FetchAll_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LocketServer).FetchAll(ctx, req.(*FetchAllRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Locket_ServiceDesc is the grpc.ServiceDesc for Locket service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Locket_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "models.Locket", + HandlerType: (*LocketServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Lock", + Handler: _Locket_Lock_Handler, + }, + { + MethodName: "Fetch", + Handler: _Locket_Fetch_Handler, + }, + { + MethodName: "Release", + Handler: _Locket_Release_Handler, + }, + { + MethodName: "FetchAll", + Handler: _Locket_FetchAll_Handler, + }}, + Streams: []grpc.StreamDesc{}, + Metadata: "locket.proto", +} diff --git a/models/locket_grpc.pb.go b/models/locket_grpc.pb.go index 3f25218..7fd2fc0 100644 --- a/models/locket_grpc.pb.go +++ b/models/locket_grpc.pb.go @@ -19,215 +19,215 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - Locket_Lock_FullMethodName = "/models.Locket/Lock" - Locket_Fetch_FullMethodName = "/models.Locket/Fetch" - Locket_Release_FullMethodName = "/models.Locket/Release" - Locket_FetchAll_FullMethodName = "/models.Locket/FetchAll" + ProtoLocket_ProtoLock_FullMethodName = "/models.ProtoLocket/ProtoLock" + ProtoLocket_ProtoFetch_FullMethodName = "/models.ProtoLocket/ProtoFetch" + ProtoLocket_ProtoRelease_FullMethodName = "/models.ProtoLocket/ProtoRelease" + ProtoLocket_ProtoFetchAll_FullMethodName = "/models.ProtoLocket/ProtoFetchAll" ) -// LocketClient is the client API for Locket service. +// ProtoLocketClient is the client API for ProtoLocket 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. -type LocketClient interface { - Lock(ctx context.Context, in *ProtoLockRequest, opts ...grpc.CallOption) (*ProtoLockResponse, error) - Fetch(ctx context.Context, in *ProtoFetchRequest, opts ...grpc.CallOption) (*ProtoFetchResponse, error) - Release(ctx context.Context, in *ProtoReleaseRequest, opts ...grpc.CallOption) (*ProtoReleaseResponse, error) - FetchAll(ctx context.Context, in *ProtoFetchAllRequest, opts ...grpc.CallOption) (*ProtoFetchAllResponse, error) +type ProtoLocketClient interface { + ProtoLock(ctx context.Context, in *ProtoLockRequest, opts ...grpc.CallOption) (*ProtoLockResponse, error) + ProtoFetch(ctx context.Context, in *ProtoFetchRequest, opts ...grpc.CallOption) (*ProtoFetchResponse, error) + ProtoRelease(ctx context.Context, in *ProtoReleaseRequest, opts ...grpc.CallOption) (*ProtoReleaseResponse, error) + ProtoFetchAll(ctx context.Context, in *ProtoFetchAllRequest, opts ...grpc.CallOption) (*ProtoFetchAllResponse, error) } -type locketClient struct { +type protoLocketClient struct { cc grpc.ClientConnInterface } -func NewLocketClient(cc grpc.ClientConnInterface) LocketClient { - return &locketClient{cc} +func NewProtoLocketClient(cc grpc.ClientConnInterface) ProtoLocketClient { + return &protoLocketClient{cc} } -func (c *locketClient) Lock(ctx context.Context, in *ProtoLockRequest, opts ...grpc.CallOption) (*ProtoLockResponse, error) { +func (c *protoLocketClient) ProtoLock(ctx context.Context, in *ProtoLockRequest, opts ...grpc.CallOption) (*ProtoLockResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ProtoLockResponse) - err := c.cc.Invoke(ctx, Locket_Lock_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, ProtoLocket_ProtoLock_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *locketClient) Fetch(ctx context.Context, in *ProtoFetchRequest, opts ...grpc.CallOption) (*ProtoFetchResponse, error) { +func (c *protoLocketClient) ProtoFetch(ctx context.Context, in *ProtoFetchRequest, opts ...grpc.CallOption) (*ProtoFetchResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ProtoFetchResponse) - err := c.cc.Invoke(ctx, Locket_Fetch_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, ProtoLocket_ProtoFetch_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *locketClient) Release(ctx context.Context, in *ProtoReleaseRequest, opts ...grpc.CallOption) (*ProtoReleaseResponse, error) { +func (c *protoLocketClient) ProtoRelease(ctx context.Context, in *ProtoReleaseRequest, opts ...grpc.CallOption) (*ProtoReleaseResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ProtoReleaseResponse) - err := c.cc.Invoke(ctx, Locket_Release_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, ProtoLocket_ProtoRelease_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *locketClient) FetchAll(ctx context.Context, in *ProtoFetchAllRequest, opts ...grpc.CallOption) (*ProtoFetchAllResponse, error) { +func (c *protoLocketClient) ProtoFetchAll(ctx context.Context, in *ProtoFetchAllRequest, opts ...grpc.CallOption) (*ProtoFetchAllResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ProtoFetchAllResponse) - err := c.cc.Invoke(ctx, Locket_FetchAll_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, ProtoLocket_ProtoFetchAll_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -// LocketServer is the server API for Locket service. -// All implementations must embed UnimplementedLocketServer +// ProtoLocketServer is the server API for ProtoLocket service. +// All implementations must embed UnimplementedProtoLocketServer // for forward compatibility. -type LocketServer interface { - Lock(context.Context, *ProtoLockRequest) (*ProtoLockResponse, error) - Fetch(context.Context, *ProtoFetchRequest) (*ProtoFetchResponse, error) - Release(context.Context, *ProtoReleaseRequest) (*ProtoReleaseResponse, error) - FetchAll(context.Context, *ProtoFetchAllRequest) (*ProtoFetchAllResponse, error) - mustEmbedUnimplementedLocketServer() +type ProtoLocketServer interface { + ProtoLock(context.Context, *ProtoLockRequest) (*ProtoLockResponse, error) + ProtoFetch(context.Context, *ProtoFetchRequest) (*ProtoFetchResponse, error) + ProtoRelease(context.Context, *ProtoReleaseRequest) (*ProtoReleaseResponse, error) + ProtoFetchAll(context.Context, *ProtoFetchAllRequest) (*ProtoFetchAllResponse, error) + mustEmbedUnimplementedProtoLocketServer() } -// UnimplementedLocketServer must be embedded to have +// UnimplementedProtoLocketServer 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 UnimplementedLocketServer struct{} +type UnimplementedProtoLocketServer struct{} -func (UnimplementedLocketServer) Lock(context.Context, *ProtoLockRequest) (*ProtoLockResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Lock not implemented") +func (UnimplementedProtoLocketServer) ProtoLock(context.Context, *ProtoLockRequest) (*ProtoLockResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ProtoLock not implemented") } -func (UnimplementedLocketServer) Fetch(context.Context, *ProtoFetchRequest) (*ProtoFetchResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Fetch not implemented") +func (UnimplementedProtoLocketServer) ProtoFetch(context.Context, *ProtoFetchRequest) (*ProtoFetchResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ProtoFetch not implemented") } -func (UnimplementedLocketServer) Release(context.Context, *ProtoReleaseRequest) (*ProtoReleaseResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Release not implemented") +func (UnimplementedProtoLocketServer) ProtoRelease(context.Context, *ProtoReleaseRequest) (*ProtoReleaseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ProtoRelease not implemented") } -func (UnimplementedLocketServer) FetchAll(context.Context, *ProtoFetchAllRequest) (*ProtoFetchAllResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FetchAll not implemented") +func (UnimplementedProtoLocketServer) ProtoFetchAll(context.Context, *ProtoFetchAllRequest) (*ProtoFetchAllResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ProtoFetchAll not implemented") } -func (UnimplementedLocketServer) mustEmbedUnimplementedLocketServer() {} -func (UnimplementedLocketServer) testEmbeddedByValue() {} +func (UnimplementedProtoLocketServer) mustEmbedUnimplementedProtoLocketServer() {} +func (UnimplementedProtoLocketServer) testEmbeddedByValue() {} -// UnsafeLocketServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to LocketServer will +// UnsafeProtoLocketServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ProtoLocketServer will // result in compilation errors. -type UnsafeLocketServer interface { - mustEmbedUnimplementedLocketServer() +type UnsafeProtoLocketServer interface { + mustEmbedUnimplementedProtoLocketServer() } -func RegisterLocketServer(s grpc.ServiceRegistrar, srv LocketServer) { - // If the following call pancis, it indicates UnimplementedLocketServer was +func RegisterProtoLocketServer(s grpc.ServiceRegistrar, srv ProtoLocketServer) { + // If the following call pancis, it indicates UnimplementedProtoLocketServer 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(&Locket_ServiceDesc, srv) + s.RegisterService(&ProtoLocket_ServiceDesc, srv) } -func _Locket_Lock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ProtoLocket_ProtoLock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ProtoLockRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(LocketServer).Lock(ctx, in) + return srv.(ProtoLocketServer).ProtoLock(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Locket_Lock_FullMethodName, + FullMethod: ProtoLocket_ProtoLock_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LocketServer).Lock(ctx, req.(*ProtoLockRequest)) + return srv.(ProtoLocketServer).ProtoLock(ctx, req.(*ProtoLockRequest)) } return interceptor(ctx, in, info, handler) } -func _Locket_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ProtoLocket_ProtoFetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ProtoFetchRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(LocketServer).Fetch(ctx, in) + return srv.(ProtoLocketServer).ProtoFetch(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Locket_Fetch_FullMethodName, + FullMethod: ProtoLocket_ProtoFetch_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LocketServer).Fetch(ctx, req.(*ProtoFetchRequest)) + return srv.(ProtoLocketServer).ProtoFetch(ctx, req.(*ProtoFetchRequest)) } return interceptor(ctx, in, info, handler) } -func _Locket_Release_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ProtoLocket_ProtoRelease_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ProtoReleaseRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(LocketServer).Release(ctx, in) + return srv.(ProtoLocketServer).ProtoRelease(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Locket_Release_FullMethodName, + FullMethod: ProtoLocket_ProtoRelease_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LocketServer).Release(ctx, req.(*ProtoReleaseRequest)) + return srv.(ProtoLocketServer).ProtoRelease(ctx, req.(*ProtoReleaseRequest)) } return interceptor(ctx, in, info, handler) } -func _Locket_FetchAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ProtoLocket_ProtoFetchAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ProtoFetchAllRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(LocketServer).FetchAll(ctx, in) + return srv.(ProtoLocketServer).ProtoFetchAll(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Locket_FetchAll_FullMethodName, + FullMethod: ProtoLocket_ProtoFetchAll_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LocketServer).FetchAll(ctx, req.(*ProtoFetchAllRequest)) + return srv.(ProtoLocketServer).ProtoFetchAll(ctx, req.(*ProtoFetchAllRequest)) } return interceptor(ctx, in, info, handler) } -// Locket_ServiceDesc is the grpc.ServiceDesc for Locket service. +// ProtoLocket_ServiceDesc is the grpc.ServiceDesc for ProtoLocket service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) -var Locket_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "models.Locket", - HandlerType: (*LocketServer)(nil), +var ProtoLocket_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "models.ProtoLocket", + HandlerType: (*ProtoLocketServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "Lock", - Handler: _Locket_Lock_Handler, + MethodName: "ProtoLock", + Handler: _ProtoLocket_ProtoLock_Handler, }, { - MethodName: "Fetch", - Handler: _Locket_Fetch_Handler, + MethodName: "ProtoFetch", + Handler: _ProtoLocket_ProtoFetch_Handler, }, { - MethodName: "Release", - Handler: _Locket_Release_Handler, + MethodName: "ProtoRelease", + Handler: _ProtoLocket_ProtoRelease_Handler, }, { - MethodName: "FetchAll", - Handler: _Locket_FetchAll_Handler, + MethodName: "ProtoFetchAll", + Handler: _ProtoLocket_ProtoFetchAll_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/scripts/generate_protos.sh b/scripts/generate_protos.sh index b0a0e9a..c3fb080 100755 --- a/scripts/generate_protos.sh +++ b/scripts/generate_protos.sh @@ -3,7 +3,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" pushd "$DIR/../models" protoc --proto_path=../../bbs/protoc-gen-go-bbs:../../vendor:../../vendor/google.golang.org/protobuf/types/known/durationpb/:. \ --go_out=. --go_opt=paths=source_relative \ - --go-bbs_out=. --go-bbs_opt=paths=source_relative \ + --go-bbs_out=. --go-bbs_opt=paths=source_relative,debug=true \ --go-grpc_out=. --go-grpc_opt=paths=source_relative \ ./*.proto popd From 1065e01b641cbbd264e1f5fe45cc55c74b41fba3 Mon Sep 17 00:00:00 2001 From: Brandon Roberson Date: Mon, 24 Mar 2025 15:20:11 +0000 Subject: [PATCH 06/15] Remove TypeCode_ prefix Remove ToProto calls where not needed any more Regenerate fakes and protos --- lock/lock.go | 8 +- models/locket.pb.go | 115 ++++++++--------------- models/locket_bbs.pb.go | 2 +- models/locket_bbs_grpc.pb.go | 2 +- models/locket_grpc.pb.go | 2 +- models/modelsfakes/fake_locket_client.go | 104 ++++++++++---------- 6 files changed, 97 insertions(+), 136 deletions(-) diff --git a/lock/lock.go b/lock/lock.go index 9f846e7..cbac22c 100644 --- a/lock/lock.go +++ b/lock/lock.go @@ -89,11 +89,11 @@ func (l *lockRunner) Run(signals <-chan os.Signal, ready chan<- struct{}) error return err } lockRequest := &models.LockRequest{Resource: l.lock, TtlInSeconds: l.ttlInSeconds} - _, err = l.locker.Lock(ctx, lockRequest.ToProto()) + _, err = l.locker.Lock(ctx, lockRequest) if err != nil { lagerData := lager.Data{"request-uuid": uuid} fetchRequest := &models.FetchRequest{Key: l.lock.Key} - resp, fErr := l.locker.Fetch(ctx, fetchRequest.ToProto()) + resp, fErr := l.locker.Fetch(ctx, fetchRequest) if fErr != nil { logger.Error("failed-fetching-lock-owner", fErr) } else { @@ -115,7 +115,7 @@ func (l *lockRunner) Run(signals <-chan os.Signal, ready chan<- struct{}) error logger.Info("signalled", lager.Data{"signal": sig}) releaseRequest := &models.ReleaseRequest{Resource: l.lock} - _, err := l.locker.Release(context.Background(), releaseRequest.ToProto()) + _, err := l.locker.Release(context.Background(), releaseRequest) if err != nil { logger.Error("failed-to-release-lock", err) } else { @@ -133,7 +133,7 @@ func (l *lockRunner) Run(signals <-chan os.Signal, ready chan<- struct{}) error ctx, cancel := context.WithTimeout(ctx, time.Duration(l.ttlInSeconds)*time.Second) start := time.Now() lockRequest := &models.LockRequest{Resource: l.lock, TtlInSeconds: l.ttlInSeconds} - _, err = l.locker.Lock(ctx, lockRequest.ToProto(), grpc.WaitForReady(true)) + _, err = l.locker.Lock(ctx, lockRequest, grpc.WaitForReady(true)) cancel() if err != nil { if acquired { diff --git a/models/locket.pb.go b/models/locket.pb.go index f0b09cc..2e9a7ec 100644 --- a/models/locket.pb.go +++ b/models/locket.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.5 -// protoc v6.30.0 +// protoc-gen-go v1.36.6 +// protoc v5.29.4 // source: locket.proto package models @@ -505,81 +505,42 @@ func (x *ProtoFetchAllResponse) GetResources() []*ProtoResource { var File_locket_proto protoreflect.FileDescriptor -var file_locket_proto_rawDesc = string([]byte{ - 0x0a, 0x0c, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x1a, 0x09, 0x62, 0x62, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0x99, 0x01, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x12, 0x16, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x02, 0x18, 0x01, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x32, 0x0a, 0x09, 0x74, 0x79, 0x70, - 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6d, - 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x43, - 0x6f, 0x64, 0x65, 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x6b, 0x0a, - 0x10, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x4c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x31, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x74, 0x74, 0x6c, 0x5f, 0x69, 0x6e, 0x5f, 0x73, - 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x74, 0x74, - 0x6c, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x13, 0x0a, 0x11, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x4c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x48, 0x0a, 0x13, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x31, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, - 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, - 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x16, 0x0a, 0x14, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x25, 0x0a, 0x11, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x47, 0x0a, 0x12, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, - 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x15, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x22, 0x62, 0x0a, 0x14, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, - 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x02, 0x18, 0x01, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x32, 0x0a, 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x08, 0x74, 0x79, 0x70, - 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x4c, 0x0a, 0x15, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, - 0x74, 0x63, 0x68, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, - 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x73, 0x2a, 0x56, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x54, 0x79, 0x70, 0x65, - 0x43, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, - 0x00, 0x1a, 0x0a, 0x82, 0x7d, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x12, 0x11, 0x0a, - 0x04, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x01, 0x1a, 0x07, 0x82, 0x7d, 0x04, 0x4c, 0x4f, 0x43, 0x4b, - 0x12, 0x19, 0x0a, 0x08, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x43, 0x45, 0x10, 0x02, 0x1a, 0x0b, - 0x82, 0x7d, 0x08, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x43, 0x45, 0x32, 0xb5, 0x02, 0x0a, 0x0b, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x42, 0x0a, 0x09, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x4c, 0x6f, 0x63, 0x6b, 0x12, 0x18, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, - 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x4c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x4c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x45, 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x12, 0x19, 0x2e, - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, - 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, - 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, - 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x12, 0x1b, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, - 0x68, 0x41, 0x6c, 0x6c, 0x12, 0x1c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x42, 0x25, 0x5a, 0x23, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x6c, 0x6f, 0x75, - 0x64, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x72, 0x79, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6c, 0x6f, 0x63, - 0x6b, 0x65, 0x74, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -}) +const file_locket_proto_rawDesc = "" + + "\n" + + "\flocket.proto\x12\x06models\x1a\tbbs.proto\"\x99\x01\n" + + "\rProtoResource\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05owner\x18\x02 \x01(\tR\x05owner\x12\x14\n" + + "\x05value\x18\x03 \x01(\tR\x05value\x12\x16\n" + + "\x04type\x18\x04 \x01(\tB\x02\x18\x01R\x04type\x122\n" + + "\ttype_code\x18\x05 \x01(\x0e2\x15.models.ProtoTypeCodeR\btypeCode\"k\n" + + "\x10ProtoLockRequest\x121\n" + + "\bresource\x18\x01 \x01(\v2\x15.models.ProtoResourceR\bresource\x12$\n" + + "\x0ettl_in_seconds\x18\x02 \x01(\x03R\fttlInSeconds\"\x13\n" + + "\x11ProtoLockResponse\"H\n" + + "\x13ProtoReleaseRequest\x121\n" + + "\bresource\x18\x01 \x01(\v2\x15.models.ProtoResourceR\bresource\"\x16\n" + + "\x14ProtoReleaseResponse\"%\n" + + "\x11ProtoFetchRequest\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\"G\n" + + "\x12ProtoFetchResponse\x121\n" + + "\bresource\x18\x01 \x01(\v2\x15.models.ProtoResourceR\bresource\"b\n" + + "\x14ProtoFetchAllRequest\x12\x16\n" + + "\x04type\x18\x01 \x01(\tB\x02\x18\x01R\x04type\x122\n" + + "\ttype_code\x18\x02 \x01(\x0e2\x15.models.ProtoTypeCodeR\btypeCode\"L\n" + + "\x15ProtoFetchAllResponse\x123\n" + + "\tresources\x18\x01 \x03(\v2\x15.models.ProtoResourceR\tresources*V\n" + + "\rProtoTypeCode\x12\x17\n" + + "\aUNKNOWN\x10\x00\x1a\n" + + "\x82}\aUNKNOWN\x12\x11\n" + + "\x04LOCK\x10\x01\x1a\a\x82}\x04LOCK\x12\x19\n" + + "\bPRESENCE\x10\x02\x1a\v\x82}\bPRESENCE2\xb5\x02\n" + + "\vProtoLocket\x12B\n" + + "\tProtoLock\x12\x18.models.ProtoLockRequest\x1a\x19.models.ProtoLockResponse\"\x00\x12E\n" + + "\n" + + "ProtoFetch\x12\x19.models.ProtoFetchRequest\x1a\x1a.models.ProtoFetchResponse\"\x00\x12K\n" + + "\fProtoRelease\x12\x1b.models.ProtoReleaseRequest\x1a\x1c.models.ProtoReleaseResponse\"\x00\x12N\n" + + "\rProtoFetchAll\x12\x1c.models.ProtoFetchAllRequest\x1a\x1d.models.ProtoFetchAllResponse\"\x00B%Z#code.cloudfoundry.org/locket/modelsb\x06proto3" var ( file_locket_proto_rawDescOnce sync.Once diff --git a/models/locket_bbs.pb.go b/models/locket_bbs.pb.go index b38a853..e0e71a1 100644 --- a/models/locket_bbs.pb.go +++ b/models/locket_bbs.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-bbs. DO NOT EDIT. // versions: // - protoc-gen-go-bbs v0.0.1 -// - protoc v6.30.0 +// - protoc v5.29.4 // source: locket.proto package models diff --git a/models/locket_bbs_grpc.pb.go b/models/locket_bbs_grpc.pb.go index 6aada32..dbe723c 100644 --- a/models/locket_bbs_grpc.pb.go +++ b/models/locket_bbs_grpc.pb.go @@ -2,7 +2,7 @@ // versions: // - protoc-gen-go-bbs v0.0.1 // - protoc-gen-go-grpc TODO: get version -// - protoc v6.30.0 +// - protoc v5.29.4 // source: locket.proto package models diff --git a/models/locket_grpc.pb.go b/models/locket_grpc.pb.go index 7fd2fc0..e4c581a 100644 --- a/models/locket_grpc.pb.go +++ b/models/locket_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v6.30.0 +// - protoc v5.29.4 // source: locket.proto package models diff --git a/models/modelsfakes/fake_locket_client.go b/models/modelsfakes/fake_locket_client.go index 108ea78..0ff14bc 100644 --- a/models/modelsfakes/fake_locket_client.go +++ b/models/modelsfakes/fake_locket_client.go @@ -10,76 +10,76 @@ import ( ) type FakeLocketClient struct { - FetchStub func(context.Context, *models.ProtoFetchRequest, ...grpc.CallOption) (*models.ProtoFetchResponse, error) + FetchStub func(context.Context, *models.FetchRequest, ...grpc.CallOption) (*models.FetchResponse, error) fetchMutex sync.RWMutex fetchArgsForCall []struct { arg1 context.Context - arg2 *models.ProtoFetchRequest + arg2 *models.FetchRequest arg3 []grpc.CallOption } fetchReturns struct { - result1 *models.ProtoFetchResponse + result1 *models.FetchResponse result2 error } fetchReturnsOnCall map[int]struct { - result1 *models.ProtoFetchResponse + result1 *models.FetchResponse result2 error } - FetchAllStub func(context.Context, *models.ProtoFetchAllRequest, ...grpc.CallOption) (*models.ProtoFetchAllResponse, error) + FetchAllStub func(context.Context, *models.FetchAllRequest, ...grpc.CallOption) (*models.FetchAllResponse, error) fetchAllMutex sync.RWMutex fetchAllArgsForCall []struct { arg1 context.Context - arg2 *models.ProtoFetchAllRequest + arg2 *models.FetchAllRequest arg3 []grpc.CallOption } fetchAllReturns struct { - result1 *models.ProtoFetchAllResponse + result1 *models.FetchAllResponse result2 error } fetchAllReturnsOnCall map[int]struct { - result1 *models.ProtoFetchAllResponse + result1 *models.FetchAllResponse result2 error } - LockStub func(context.Context, *models.ProtoLockRequest, ...grpc.CallOption) (*models.ProtoLockResponse, error) + LockStub func(context.Context, *models.LockRequest, ...grpc.CallOption) (*models.LockResponse, error) lockMutex sync.RWMutex lockArgsForCall []struct { arg1 context.Context - arg2 *models.ProtoLockRequest + arg2 *models.LockRequest arg3 []grpc.CallOption } lockReturns struct { - result1 *models.ProtoLockResponse + result1 *models.LockResponse result2 error } lockReturnsOnCall map[int]struct { - result1 *models.ProtoLockResponse + result1 *models.LockResponse result2 error } - ReleaseStub func(context.Context, *models.ProtoReleaseRequest, ...grpc.CallOption) (*models.ProtoReleaseResponse, error) + ReleaseStub func(context.Context, *models.ReleaseRequest, ...grpc.CallOption) (*models.ReleaseResponse, error) releaseMutex sync.RWMutex releaseArgsForCall []struct { arg1 context.Context - arg2 *models.ProtoReleaseRequest + arg2 *models.ReleaseRequest arg3 []grpc.CallOption } releaseReturns struct { - result1 *models.ProtoReleaseResponse + result1 *models.ReleaseResponse result2 error } releaseReturnsOnCall map[int]struct { - result1 *models.ProtoReleaseResponse + result1 *models.ReleaseResponse result2 error } invocations map[string][][]interface{} invocationsMutex sync.RWMutex } -func (fake *FakeLocketClient) Fetch(arg1 context.Context, arg2 *models.ProtoFetchRequest, arg3 ...grpc.CallOption) (*models.ProtoFetchResponse, error) { +func (fake *FakeLocketClient) Fetch(arg1 context.Context, arg2 *models.FetchRequest, arg3 ...grpc.CallOption) (*models.FetchResponse, error) { fake.fetchMutex.Lock() ret, specificReturn := fake.fetchReturnsOnCall[len(fake.fetchArgsForCall)] fake.fetchArgsForCall = append(fake.fetchArgsForCall, struct { arg1 context.Context - arg2 *models.ProtoFetchRequest + arg2 *models.FetchRequest arg3 []grpc.CallOption }{arg1, arg2, arg3}) stub := fake.FetchStub @@ -101,51 +101,51 @@ func (fake *FakeLocketClient) FetchCallCount() int { return len(fake.fetchArgsForCall) } -func (fake *FakeLocketClient) FetchCalls(stub func(context.Context, *models.ProtoFetchRequest, ...grpc.CallOption) (*models.ProtoFetchResponse, error)) { +func (fake *FakeLocketClient) FetchCalls(stub func(context.Context, *models.FetchRequest, ...grpc.CallOption) (*models.FetchResponse, error)) { fake.fetchMutex.Lock() defer fake.fetchMutex.Unlock() fake.FetchStub = stub } -func (fake *FakeLocketClient) FetchArgsForCall(i int) (context.Context, *models.ProtoFetchRequest, []grpc.CallOption) { +func (fake *FakeLocketClient) FetchArgsForCall(i int) (context.Context, *models.FetchRequest, []grpc.CallOption) { fake.fetchMutex.RLock() defer fake.fetchMutex.RUnlock() argsForCall := fake.fetchArgsForCall[i] return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 } -func (fake *FakeLocketClient) FetchReturns(result1 *models.ProtoFetchResponse, result2 error) { +func (fake *FakeLocketClient) FetchReturns(result1 *models.FetchResponse, result2 error) { fake.fetchMutex.Lock() defer fake.fetchMutex.Unlock() fake.FetchStub = nil fake.fetchReturns = struct { - result1 *models.ProtoFetchResponse + result1 *models.FetchResponse result2 error }{result1, result2} } -func (fake *FakeLocketClient) FetchReturnsOnCall(i int, result1 *models.ProtoFetchResponse, result2 error) { +func (fake *FakeLocketClient) FetchReturnsOnCall(i int, result1 *models.FetchResponse, result2 error) { fake.fetchMutex.Lock() defer fake.fetchMutex.Unlock() fake.FetchStub = nil if fake.fetchReturnsOnCall == nil { fake.fetchReturnsOnCall = make(map[int]struct { - result1 *models.ProtoFetchResponse + result1 *models.FetchResponse result2 error }) } fake.fetchReturnsOnCall[i] = struct { - result1 *models.ProtoFetchResponse + result1 *models.FetchResponse result2 error }{result1, result2} } -func (fake *FakeLocketClient) FetchAll(arg1 context.Context, arg2 *models.ProtoFetchAllRequest, arg3 ...grpc.CallOption) (*models.ProtoFetchAllResponse, error) { +func (fake *FakeLocketClient) FetchAll(arg1 context.Context, arg2 *models.FetchAllRequest, arg3 ...grpc.CallOption) (*models.FetchAllResponse, error) { fake.fetchAllMutex.Lock() ret, specificReturn := fake.fetchAllReturnsOnCall[len(fake.fetchAllArgsForCall)] fake.fetchAllArgsForCall = append(fake.fetchAllArgsForCall, struct { arg1 context.Context - arg2 *models.ProtoFetchAllRequest + arg2 *models.FetchAllRequest arg3 []grpc.CallOption }{arg1, arg2, arg3}) stub := fake.FetchAllStub @@ -167,51 +167,51 @@ func (fake *FakeLocketClient) FetchAllCallCount() int { return len(fake.fetchAllArgsForCall) } -func (fake *FakeLocketClient) FetchAllCalls(stub func(context.Context, *models.ProtoFetchAllRequest, ...grpc.CallOption) (*models.ProtoFetchAllResponse, error)) { +func (fake *FakeLocketClient) FetchAllCalls(stub func(context.Context, *models.FetchAllRequest, ...grpc.CallOption) (*models.FetchAllResponse, error)) { fake.fetchAllMutex.Lock() defer fake.fetchAllMutex.Unlock() fake.FetchAllStub = stub } -func (fake *FakeLocketClient) FetchAllArgsForCall(i int) (context.Context, *models.ProtoFetchAllRequest, []grpc.CallOption) { +func (fake *FakeLocketClient) FetchAllArgsForCall(i int) (context.Context, *models.FetchAllRequest, []grpc.CallOption) { fake.fetchAllMutex.RLock() defer fake.fetchAllMutex.RUnlock() argsForCall := fake.fetchAllArgsForCall[i] return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 } -func (fake *FakeLocketClient) FetchAllReturns(result1 *models.ProtoFetchAllResponse, result2 error) { +func (fake *FakeLocketClient) FetchAllReturns(result1 *models.FetchAllResponse, result2 error) { fake.fetchAllMutex.Lock() defer fake.fetchAllMutex.Unlock() fake.FetchAllStub = nil fake.fetchAllReturns = struct { - result1 *models.ProtoFetchAllResponse + result1 *models.FetchAllResponse result2 error }{result1, result2} } -func (fake *FakeLocketClient) FetchAllReturnsOnCall(i int, result1 *models.ProtoFetchAllResponse, result2 error) { +func (fake *FakeLocketClient) FetchAllReturnsOnCall(i int, result1 *models.FetchAllResponse, result2 error) { fake.fetchAllMutex.Lock() defer fake.fetchAllMutex.Unlock() fake.FetchAllStub = nil if fake.fetchAllReturnsOnCall == nil { fake.fetchAllReturnsOnCall = make(map[int]struct { - result1 *models.ProtoFetchAllResponse + result1 *models.FetchAllResponse result2 error }) } fake.fetchAllReturnsOnCall[i] = struct { - result1 *models.ProtoFetchAllResponse + result1 *models.FetchAllResponse result2 error }{result1, result2} } -func (fake *FakeLocketClient) Lock(arg1 context.Context, arg2 *models.ProtoLockRequest, arg3 ...grpc.CallOption) (*models.ProtoLockResponse, error) { +func (fake *FakeLocketClient) Lock(arg1 context.Context, arg2 *models.LockRequest, arg3 ...grpc.CallOption) (*models.LockResponse, error) { fake.lockMutex.Lock() ret, specificReturn := fake.lockReturnsOnCall[len(fake.lockArgsForCall)] fake.lockArgsForCall = append(fake.lockArgsForCall, struct { arg1 context.Context - arg2 *models.ProtoLockRequest + arg2 *models.LockRequest arg3 []grpc.CallOption }{arg1, arg2, arg3}) stub := fake.LockStub @@ -233,51 +233,51 @@ func (fake *FakeLocketClient) LockCallCount() int { return len(fake.lockArgsForCall) } -func (fake *FakeLocketClient) LockCalls(stub func(context.Context, *models.ProtoLockRequest, ...grpc.CallOption) (*models.ProtoLockResponse, error)) { +func (fake *FakeLocketClient) LockCalls(stub func(context.Context, *models.LockRequest, ...grpc.CallOption) (*models.LockResponse, error)) { fake.lockMutex.Lock() defer fake.lockMutex.Unlock() fake.LockStub = stub } -func (fake *FakeLocketClient) LockArgsForCall(i int) (context.Context, *models.ProtoLockRequest, []grpc.CallOption) { +func (fake *FakeLocketClient) LockArgsForCall(i int) (context.Context, *models.LockRequest, []grpc.CallOption) { fake.lockMutex.RLock() defer fake.lockMutex.RUnlock() argsForCall := fake.lockArgsForCall[i] return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 } -func (fake *FakeLocketClient) LockReturns(result1 *models.ProtoLockResponse, result2 error) { +func (fake *FakeLocketClient) LockReturns(result1 *models.LockResponse, result2 error) { fake.lockMutex.Lock() defer fake.lockMutex.Unlock() fake.LockStub = nil fake.lockReturns = struct { - result1 *models.ProtoLockResponse + result1 *models.LockResponse result2 error }{result1, result2} } -func (fake *FakeLocketClient) LockReturnsOnCall(i int, result1 *models.ProtoLockResponse, result2 error) { +func (fake *FakeLocketClient) LockReturnsOnCall(i int, result1 *models.LockResponse, result2 error) { fake.lockMutex.Lock() defer fake.lockMutex.Unlock() fake.LockStub = nil if fake.lockReturnsOnCall == nil { fake.lockReturnsOnCall = make(map[int]struct { - result1 *models.ProtoLockResponse + result1 *models.LockResponse result2 error }) } fake.lockReturnsOnCall[i] = struct { - result1 *models.ProtoLockResponse + result1 *models.LockResponse result2 error }{result1, result2} } -func (fake *FakeLocketClient) Release(arg1 context.Context, arg2 *models.ProtoReleaseRequest, arg3 ...grpc.CallOption) (*models.ProtoReleaseResponse, error) { +func (fake *FakeLocketClient) Release(arg1 context.Context, arg2 *models.ReleaseRequest, arg3 ...grpc.CallOption) (*models.ReleaseResponse, error) { fake.releaseMutex.Lock() ret, specificReturn := fake.releaseReturnsOnCall[len(fake.releaseArgsForCall)] fake.releaseArgsForCall = append(fake.releaseArgsForCall, struct { arg1 context.Context - arg2 *models.ProtoReleaseRequest + arg2 *models.ReleaseRequest arg3 []grpc.CallOption }{arg1, arg2, arg3}) stub := fake.ReleaseStub @@ -299,41 +299,41 @@ func (fake *FakeLocketClient) ReleaseCallCount() int { return len(fake.releaseArgsForCall) } -func (fake *FakeLocketClient) ReleaseCalls(stub func(context.Context, *models.ProtoReleaseRequest, ...grpc.CallOption) (*models.ProtoReleaseResponse, error)) { +func (fake *FakeLocketClient) ReleaseCalls(stub func(context.Context, *models.ReleaseRequest, ...grpc.CallOption) (*models.ReleaseResponse, error)) { fake.releaseMutex.Lock() defer fake.releaseMutex.Unlock() fake.ReleaseStub = stub } -func (fake *FakeLocketClient) ReleaseArgsForCall(i int) (context.Context, *models.ProtoReleaseRequest, []grpc.CallOption) { +func (fake *FakeLocketClient) ReleaseArgsForCall(i int) (context.Context, *models.ReleaseRequest, []grpc.CallOption) { fake.releaseMutex.RLock() defer fake.releaseMutex.RUnlock() argsForCall := fake.releaseArgsForCall[i] return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 } -func (fake *FakeLocketClient) ReleaseReturns(result1 *models.ProtoReleaseResponse, result2 error) { +func (fake *FakeLocketClient) ReleaseReturns(result1 *models.ReleaseResponse, result2 error) { fake.releaseMutex.Lock() defer fake.releaseMutex.Unlock() fake.ReleaseStub = nil fake.releaseReturns = struct { - result1 *models.ProtoReleaseResponse + result1 *models.ReleaseResponse result2 error }{result1, result2} } -func (fake *FakeLocketClient) ReleaseReturnsOnCall(i int, result1 *models.ProtoReleaseResponse, result2 error) { +func (fake *FakeLocketClient) ReleaseReturnsOnCall(i int, result1 *models.ReleaseResponse, result2 error) { fake.releaseMutex.Lock() defer fake.releaseMutex.Unlock() fake.ReleaseStub = nil if fake.releaseReturnsOnCall == nil { fake.releaseReturnsOnCall = make(map[int]struct { - result1 *models.ProtoReleaseResponse + result1 *models.ReleaseResponse result2 error }) } fake.releaseReturnsOnCall[i] = struct { - result1 *models.ProtoReleaseResponse + result1 *models.ReleaseResponse result2 error }{result1, result2} } From 4ec3588078fd67fb1457c50cf016e35cd753ed2b Mon Sep 17 00:00:00 2001 From: Brandon Roberson Date: Mon, 31 Mar 2025 15:19:28 +0000 Subject: [PATCH 07/15] Regen protos with protoc v6.30.2 --- models/locket.pb.go | 2 +- models/locket_bbs.pb.go | 2 +- models/locket_bbs_grpc.pb.go | 2 +- models/locket_grpc.pb.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/models/locket.pb.go b/models/locket.pb.go index 2e9a7ec..86662d2 100644 --- a/models/locket.pb.go +++ b/models/locket.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.6 -// protoc v5.29.4 +// protoc v6.30.2 // source: locket.proto package models diff --git a/models/locket_bbs.pb.go b/models/locket_bbs.pb.go index e0e71a1..6b1887f 100644 --- a/models/locket_bbs.pb.go +++ b/models/locket_bbs.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-bbs. DO NOT EDIT. // versions: // - protoc-gen-go-bbs v0.0.1 -// - protoc v5.29.4 +// - protoc v6.30.2 // source: locket.proto package models diff --git a/models/locket_bbs_grpc.pb.go b/models/locket_bbs_grpc.pb.go index dbe723c..1375a74 100644 --- a/models/locket_bbs_grpc.pb.go +++ b/models/locket_bbs_grpc.pb.go @@ -2,7 +2,7 @@ // versions: // - protoc-gen-go-bbs v0.0.1 // - protoc-gen-go-grpc TODO: get version -// - protoc v5.29.4 +// - protoc v6.30.2 // source: locket.proto package models diff --git a/models/locket_grpc.pb.go b/models/locket_grpc.pb.go index e4c581a..ae6fd82 100644 --- a/models/locket_grpc.pb.go +++ b/models/locket_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v5.29.4 +// - protoc v6.30.2 // source: locket.proto package models From 138b78c643cd85815658197243802cb722cfa247 Mon Sep 17 00:00:00 2001 From: Brandon Roberson Date: Mon, 31 Mar 2025 16:29:10 +0000 Subject: [PATCH 08/15] Remove Proto references where not needed --- cmd/locket/main_test.go | 48 ++++++++++++++--------------- grpcserver/server_test.go | 24 +++++++-------- handlers/context_test.go | 2 +- handlers/handler.go | 42 ++++++++++++------------- handlers/handler_test.go | 64 +++++++++++++++++++-------------------- lock/lock_test.go | 10 +++--- 6 files changed, 95 insertions(+), 95 deletions(-) diff --git a/cmd/locket/main_test.go b/cmd/locket/main_test.go index 7b5a66b..40d25fa 100644 --- a/cmd/locket/main_test.go +++ b/cmd/locket/main_test.go @@ -177,7 +177,7 @@ var _ = Describe("Locket", func() { Resource: requestedResource, TtlInSeconds: 10, } - _, err := locketClient.Lock(context.Background(), lockRequest.ToProto()) + _, err := locketClient.Lock(context.Background(), lockRequest) Expect(err).NotTo(HaveOccurred()) }) @@ -229,7 +229,7 @@ var _ = Describe("Locket", func() { Resource: requestedResource, TtlInSeconds: 10, } - _, err := locketClient.Lock(context.Background(), lockRequest.ToProto()) + _, err := locketClient.Lock(context.Background(), lockRequest) if err == nil { break } @@ -339,7 +339,7 @@ var _ = Describe("Locket", func() { Resource: requestedResource, TtlInSeconds: 10, } - _, err = locketClient.Lock(context.Background(), lockRequest.ToProto()) + _, err = locketClient.Lock(context.Background(), lockRequest) Expect(err).To(HaveOccurred()) }) @@ -356,11 +356,11 @@ var _ = Describe("Locket", func() { Resource: requestedResource, TtlInSeconds: 10, } - _, err := locketClient.Lock(context.Background(), lockRequest.ToProto()) + _, err := locketClient.Lock(context.Background(), lockRequest) Expect(err).NotTo(HaveOccurred()) fetchRequest := &models.FetchRequest{Key: "test"} - resp, err := locketClient.Fetch(context.Background(), fetchRequest.ToProto()) + resp, err := locketClient.Fetch(context.Background(), fetchRequest) Expect(err).NotTo(HaveOccurred()) Expect(resp.Resource).To(BeEquivalentTo(expectedResource)) @@ -369,7 +369,7 @@ var _ = Describe("Locket", func() { Resource: requestedResource, TtlInSeconds: 10, } - _, err = locketClient.Lock(context.Background(), lockRequest.ToProto()) + _, err = locketClient.Lock(context.Background(), lockRequest) Expect(err).To(HaveOccurred()) }) @@ -380,7 +380,7 @@ var _ = Describe("Locket", func() { Resource: requestedResource, TtlInSeconds: 10, } - _, err := locketClient.Lock(ctx, lockRequest.ToProto()) + _, err := locketClient.Lock(ctx, lockRequest) Expect(err).NotTo(HaveOccurred()) Eventually(locketRunner).Should(gbytes.Say("some-uuid")) @@ -392,12 +392,12 @@ var _ = Describe("Locket", func() { Resource: requestedResource, TtlInSeconds: 6, } - _, err := locketClient.Lock(context.Background(), lockRequest.ToProto()) + _, err := locketClient.Lock(context.Background(), lockRequest) Expect(err).NotTo(HaveOccurred()) Eventually(func() error { fetchRequest := &models.FetchRequest{Key: "test"} - _, err := locketClient.Fetch(context.Background(), fetchRequest.ToProto()) + _, err := locketClient.Fetch(context.Background(), fetchRequest) return err }, 10*time.Second).Should(HaveOccurred()) }) @@ -409,7 +409,7 @@ var _ = Describe("Locket", func() { Resource: requestedResource, TtlInSeconds: 3, } - _, err := locketClient.Lock(context.Background(), lockRequest.ToProto()) + _, err := locketClient.Lock(context.Background(), lockRequest) Expect(err).NotTo(HaveOccurred()) ginkgomon.Kill(locketProcess) @@ -420,7 +420,7 @@ var _ = Describe("Locket", func() { Eventually(func() error { fetchRequest := &models.FetchRequest{Key: "test"} - _, err := locketClient.Fetch(context.Background(), fetchRequest.ToProto()) + _, err := locketClient.Fetch(context.Background(), fetchRequest) return err }, 6*time.Second).Should(HaveOccurred()) }) @@ -434,7 +434,7 @@ var _ = Describe("Locket", func() { It("does not throw an error releasing the lock", func() { requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} releaseRequest := &models.ReleaseRequest{Resource: requestedResource} - _, err := locketClient.Release(context.Background(), releaseRequest.ToProto()) + _, err := locketClient.Release(context.Background(), releaseRequest) Expect(err).NotTo(HaveOccurred()) }) }) @@ -444,22 +444,22 @@ var _ = Describe("Locket", func() { requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "jim", TypeCode: models.LOCK} expectedResource := &models.Resource{Key: "test", Value: "test-data", Owner: "jim", Type: "lock", TypeCode: models.LOCK} lockRequest := &models.LockRequest{Resource: requestedResource, TtlInSeconds: 10} - _, err := locketClient.Lock(context.Background(), lockRequest.ToProto()) + _, err := locketClient.Lock(context.Background(), lockRequest) Expect(err).NotTo(HaveOccurred()) fetchRequest := &models.FetchRequest{Key: "test"} - resp, err := locketClient.Fetch(context.Background(), fetchRequest.ToProto()) + resp, err := locketClient.Fetch(context.Background(), fetchRequest) Expect(err).NotTo(HaveOccurred()) Expect(resp.Resource).To(BeEquivalentTo(expectedResource)) }) It("releases the lock", func() { releaseRequest := &models.ReleaseRequest{Resource: requestedResource} - _, err := locketClient.Release(context.Background(), releaseRequest.ToProto()) + _, err := locketClient.Release(context.Background(), releaseRequest) Expect(err).NotTo(HaveOccurred()) fetchRequest := &models.FetchRequest{Key: "test"} - _, err = locketClient.Fetch(context.Background(), fetchRequest.ToProto()) + _, err = locketClient.Fetch(context.Background(), fetchRequest) Expect(err).To(HaveOccurred()) }) @@ -467,7 +467,7 @@ var _ = Describe("Locket", func() { It("throws an error", func() { requestedResource = &models.Resource{Key: "test", Value: "test-data", Owner: "nima", TypeCode: models.LOCK} releaseRequest := &models.ReleaseRequest{Resource: requestedResource} - _, err := locketClient.Release(context.Background(), releaseRequest.ToProto()) + _, err := locketClient.Release(context.Background(), releaseRequest) Expect(err).To(HaveOccurred()) }) }) @@ -485,28 +485,28 @@ var _ = Describe("Locket", func() { Resource: resource1, TtlInSeconds: 10, } - _, err := locketClient.Lock(context.Background(), lock1Request.ToProto()) + _, err := locketClient.Lock(context.Background(), lock1Request) Expect(err).NotTo(HaveOccurred()) lock2Request := &models.LockRequest{ Resource: resource2, TtlInSeconds: 10, } - _, err = locketClient.Lock(context.Background(), lock2Request.ToProto()) + _, err = locketClient.Lock(context.Background(), lock2Request) Expect(err).NotTo(HaveOccurred()) lock3Request := &models.LockRequest{ Resource: resource3, TtlInSeconds: 10, } - _, err = locketClient.Lock(context.Background(), lock3Request.ToProto()) + _, err = locketClient.Lock(context.Background(), lock3Request) Expect(err).NotTo(HaveOccurred()) lock4Request := &models.LockRequest{ Resource: resource4, TtlInSeconds: 10, } - _, err = locketClient.Lock(context.Background(), lock4Request.ToProto()) + _, err = locketClient.Lock(context.Background(), lock4Request) Expect(err).NotTo(HaveOccurred()) }) @@ -527,14 +527,14 @@ var _ = Describe("Locket", func() { It("fetches all the locks corresponding to type code", func() { fetchAllRequest := &models.FetchAllRequest{TypeCode: models.LOCK} - response, err := locketClient.FetchAll(context.Background(), fetchAllRequest.ToProto()) + response, err := locketClient.FetchAll(context.Background(), fetchAllRequest) Expect(err).NotTo(HaveOccurred()) Expect(response.Resources).To(ConsistOf(expectedResource1, expectedResource2)) }) It("fetches all the presences corresponding to type", func() { fetchAllRequest := &models.FetchAllRequest{TypeCode: models.PRESENCE} - response, err := locketClient.FetchAll(context.Background(), fetchAllRequest.ToProto()) + response, err := locketClient.FetchAll(context.Background(), fetchAllRequest) Expect(err).NotTo(HaveOccurred()) Expect(response.Resources).To(ConsistOf(expectedResource3, expectedResource4)) }) @@ -552,7 +552,7 @@ var _ = Describe("Locket", func() { _, err := sqlRunner.DB().Exec("DROP TABLE locks") Expect(err).NotTo(HaveOccurred()) fetchAllRequest := &models.FetchAllRequest{TypeCode: models.LOCK} - _, err = locketClient.FetchAll(context.Background(), fetchAllRequest.ToProto()) + _, err = locketClient.FetchAll(context.Background(), fetchAllRequest) Expect(err).To(HaveOccurred()) }) diff --git a/grpcserver/server_test.go b/grpcserver/server_test.go index b2a7a92..d1e3a6b 100644 --- a/grpcserver/server_test.go +++ b/grpcserver/server_test.go @@ -69,16 +69,16 @@ var _ = Describe("GRPCServer", func() { Expect(err).NotTo(HaveOccurred()) locketClient := models.NewLocketClient(conn) - _, err = locketClient.Lock(context.Background(), &models.ProtoLockRequest{}) + _, err = locketClient.Lock(context.Background(), &models.LockRequest{}) Expect(err).NotTo(HaveOccurred()) - _, err = locketClient.Release(context.Background(), &models.ProtoReleaseRequest{}) + _, err = locketClient.Release(context.Background(), &models.ReleaseRequest{}) Expect(err).NotTo(HaveOccurred()) - _, err = locketClient.Fetch(context.Background(), &models.ProtoFetchRequest{}) + _, err = locketClient.Fetch(context.Background(), &models.FetchRequest{}) Expect(err).NotTo(HaveOccurred()) - _, err = locketClient.FetchAll(context.Background(), &models.ProtoFetchAllRequest{}) + _, err = locketClient.FetchAll(context.Background(), &models.FetchAllRequest{}) Expect(err).NotTo(HaveOccurred()) }) @@ -102,15 +102,15 @@ type testHandler struct { models.UnimplementedLocketServer } -func (h *testHandler) Lock(ctx context.Context, req *models.ProtoLockRequest) (*models.ProtoLockResponse, error) { - return &models.ProtoLockResponse{}, nil +func (h *testHandler) Lock(ctx context.Context, req *models.LockRequest) (*models.LockResponse, error) { + return &models.LockResponse{}, nil } -func (h *testHandler) Release(ctx context.Context, req *models.ProtoReleaseRequest) (*models.ProtoReleaseResponse, error) { - return &models.ProtoReleaseResponse{}, nil +func (h *testHandler) Release(ctx context.Context, req *models.ReleaseRequest) (*models.ReleaseResponse, error) { + return &models.ReleaseResponse{}, nil } -func (h *testHandler) Fetch(ctx context.Context, req *models.ProtoFetchRequest) (*models.ProtoFetchResponse, error) { - return &models.ProtoFetchResponse{}, nil +func (h *testHandler) Fetch(ctx context.Context, req *models.FetchRequest) (*models.FetchResponse, error) { + return &models.FetchResponse{}, nil } -func (h *testHandler) FetchAll(ctx context.Context, req *models.ProtoFetchAllRequest) (*models.ProtoFetchAllResponse, error) { - return &models.ProtoFetchAllResponse{}, nil +func (h *testHandler) FetchAll(ctx context.Context, req *models.FetchAllRequest) (*models.FetchAllResponse, error) { + return &models.FetchAllResponse{}, nil } diff --git a/handlers/context_test.go b/handlers/context_test.go index 74cf64e..bf4380a 100644 --- a/handlers/context_test.go +++ b/handlers/context_test.go @@ -126,7 +126,7 @@ var _ = Describe("LocketHandler", func() { Resource: resource, TtlInSeconds: 10, } - _, err := locketHandler.Lock(ctxWithCancel, lockRequest.ToProto()) + _, err := locketHandler.Lock(ctxWithCancel, lockRequest) Expect(err).To(HaveOccurred()) Expect(err).To(MatchError(context.Canceled)) close(finishedRequest) diff --git a/handlers/handler.go b/handlers/handler.go index af6712b..01f8b1a 100644 --- a/handlers/handler.go +++ b/handlers/handler.go @@ -84,9 +84,9 @@ func (h *locketHandler) monitorRequest(requestType string, ctx context.Context, return err } -func (h *locketHandler) Lock(ctx context.Context, req *models.ProtoLockRequest) (*models.ProtoLockResponse, error) { +func (h *locketHandler) Lock(ctx context.Context, req *models.LockRequest) (*models.LockResponse, error) { var ( - response *models.ProtoLockResponse + response *models.LockResponse err error ) @@ -98,9 +98,9 @@ func (h *locketHandler) Lock(ctx context.Context, req *models.ProtoLockRequest) return response, err } -func (h *locketHandler) Release(ctx context.Context, req *models.ProtoReleaseRequest) (*models.ProtoReleaseResponse, error) { +func (h *locketHandler) Release(ctx context.Context, req *models.ReleaseRequest) (*models.ReleaseResponse, error) { var ( - response *models.ProtoReleaseResponse + response *models.ReleaseResponse err error ) @@ -112,9 +112,9 @@ func (h *locketHandler) Release(ctx context.Context, req *models.ProtoReleaseReq return response, err } -func (h *locketHandler) Fetch(ctx context.Context, req *models.ProtoFetchRequest) (*models.ProtoFetchResponse, error) { +func (h *locketHandler) Fetch(ctx context.Context, req *models.FetchRequest) (*models.FetchResponse, error) { var ( - response *models.ProtoFetchResponse + response *models.FetchResponse err error ) @@ -126,9 +126,9 @@ func (h *locketHandler) Fetch(ctx context.Context, req *models.ProtoFetchRequest return response, err } -func (h *locketHandler) FetchAll(ctx context.Context, req *models.ProtoFetchAllRequest) (*models.ProtoFetchAllResponse, error) { +func (h *locketHandler) FetchAll(ctx context.Context, req *models.FetchAllRequest) (*models.FetchAllResponse, error) { var ( - response *models.ProtoFetchAllResponse + response *models.FetchAllResponse err error ) @@ -140,7 +140,7 @@ func (h *locketHandler) FetchAll(ctx context.Context, req *models.ProtoFetchAllR return response, err } -func (h *locketHandler) lock(ctx context.Context, req *models.ProtoLockRequest) (*models.ProtoLockResponse, error) { +func (h *locketHandler) lock(ctx context.Context, req *models.LockRequest) (*models.LockResponse, error) { logger := h.logger.Session("lock") logger.Debug("started") defer logger.Debug("complete") @@ -174,7 +174,7 @@ func (h *locketHandler) lock(ctx context.Context, req *models.ProtoLockRequest) logger = logger.WithData(lager.Data{"request-uuid": requestUUID[0]}) } - lock, err := h.db.Lock(ctx, logger, req.Resource.FromProto(), req.TtlInSeconds) + lock, err := h.db.Lock(ctx, logger, req.Resource, req.TtlInSeconds) if err != nil { if err != models.ErrLockCollision { logger.Error("failed-locking-lock", err, lager.Data{ @@ -187,23 +187,23 @@ func (h *locketHandler) lock(ctx context.Context, req *models.ProtoLockRequest) h.lockPick.RegisterTTL(logger, lock) - return &models.ProtoLockResponse{}, nil + return &models.LockResponse{}, nil } -func (h *locketHandler) release(ctx context.Context, req *models.ProtoReleaseRequest) (*models.ProtoReleaseResponse, error) { +func (h *locketHandler) release(ctx context.Context, req *models.ReleaseRequest) (*models.ReleaseResponse, error) { logger := h.logger.Session("release") logger.Debug("started") defer logger.Debug("complete") - err := h.db.Release(ctx, logger, req.Resource.FromProto()) + err := h.db.Release(ctx, logger, req.Resource) if err != nil { return nil, err } - return &models.ProtoReleaseResponse{}, nil + return &models.ReleaseResponse{}, nil } -func (h *locketHandler) fetch(ctx context.Context, req *models.ProtoFetchRequest) (*models.ProtoFetchResponse, error) { +func (h *locketHandler) fetch(ctx context.Context, req *models.FetchRequest) (*models.FetchResponse, error) { logger := h.logger.Session("fetch") logger.Debug("started") defer logger.Debug("complete") @@ -213,12 +213,12 @@ func (h *locketHandler) fetch(ctx context.Context, req *models.ProtoFetchRequest return nil, err } - return &models.ProtoFetchResponse{ - Resource: lock.Resource.ToProto(), + return &models.FetchResponse{ + Resource: lock.Resource, }, nil } -func (h *locketHandler) fetchAll(ctx context.Context, req *models.ProtoFetchAllRequest) (*models.ProtoFetchAllResponse, error) { +func (h *locketHandler) fetchAll(ctx context.Context, req *models.FetchAllRequest) (*models.FetchAllResponse, error) { logger := h.logger.Session("fetch-all") logger.Debug("started") defer logger.Debug("complete") @@ -229,8 +229,8 @@ func (h *locketHandler) fetchAll(ctx context.Context, req *models.ProtoFetchAllR return nil, err } - resource := &models.ProtoResource{TypeCode: req.TypeCode} - locks, err := h.db.FetchAll(ctx, logger, models.GetType(resource.FromProto())) + resource := &models.Resource{TypeCode: req.TypeCode} + locks, err := h.db.FetchAll(ctx, logger, models.GetType(resource)) if err != nil { return nil, err } @@ -243,7 +243,7 @@ func (h *locketHandler) fetchAll(ctx context.Context, req *models.ProtoFetchAllR response := &models.FetchAllResponse{ Resources: responses, } - return response.ToProto(), nil + return response, nil } func validate(req interface{}) error { diff --git a/handlers/handler_test.go b/handlers/handler_test.go index cab7948..aa0cea3 100644 --- a/handlers/handler_test.go +++ b/handlers/handler_test.go @@ -77,7 +77,7 @@ var _ = Describe("LocketHandler", func() { }) It("reserves the lock in the database", func() { - _, err := locketHandler.Lock(context.Background(), request.ToProto()) + _, err := locketHandler.Lock(context.Background(), request) Expect(err).NotTo(HaveOccurred()) Expect(fakeLockDB.LockCallCount()).To(Equal(1)) @@ -90,7 +90,7 @@ var _ = Describe("LocketHandler", func() { }) It("increments the in-flight counter and then decrements it when done", func() { - _, err := locketHandler.Lock(context.Background(), request.ToProto()) + _, err := locketHandler.Lock(context.Background(), request) Expect(err).NotTo(HaveOccurred()) Expect(fakeLockDB.LockCallCount()).To(Equal(1)) @@ -101,7 +101,7 @@ var _ = Describe("LocketHandler", func() { }) It("registers the lock and ttl with the lock pick", func() { - _, err := locketHandler.Lock(context.Background(), request.ToProto()) + _, err := locketHandler.Lock(context.Background(), request) Expect(err).NotTo(HaveOccurred()) Expect(fakeLockPick.RegisterTTLCallCount()).To(Equal(1)) @@ -118,7 +118,7 @@ var _ = Describe("LocketHandler", func() { //lint:ignore SA1019 - testing deprecated functionality request.Resource.Type = "" request.Resource.TypeCode = models.LOCK - _, err := locketHandler.Lock(context.Background(), request.ToProto()) + _, err := locketHandler.Lock(context.Background(), request) Expect(err).NotTo(HaveOccurred()) metricsRecordSuccess(fakeRequestMetrics) @@ -129,7 +129,7 @@ var _ = Describe("LocketHandler", func() { //lint:ignore SA1019 - testing deprecated functionality request.Resource.Type = "" request.Resource.TypeCode = models.UNKNOWN - _, err := locketHandler.Lock(context.Background(), request.ToProto()) + _, err := locketHandler.Lock(context.Background(), request) Expect(err).To(HaveOccurred()) metricsRecordFailure(fakeRequestMetrics) @@ -140,7 +140,7 @@ var _ = Describe("LocketHandler", func() { //lint:ignore SA1019 - testing deprecated functionality request.Resource.Type = "" request.Resource.TypeCode = 4 - _, err := locketHandler.Lock(context.Background(), request.ToProto()) + _, err := locketHandler.Lock(context.Background(), request) Expect(err).To(HaveOccurred()) metricsRecordFailure(fakeRequestMetrics) @@ -157,7 +157,7 @@ var _ = Describe("LocketHandler", func() { }) It("returns a validation error", func() { - _, err := locketHandler.Lock(context.Background(), request.ToProto()) + _, err := locketHandler.Lock(context.Background(), request) Expect(err).To(HaveOccurred()) Expect(err).To(Equal(models.ErrInvalidTTL)) Expect(logger).To(gbytes.Say(models.ErrInvalidTTL.Error())) @@ -175,7 +175,7 @@ var _ = Describe("LocketHandler", func() { }) It("returns a validation error", func() { - _, err := locketHandler.Lock(context.Background(), request.ToProto()) + _, err := locketHandler.Lock(context.Background(), request) Expect(err).To(HaveOccurred()) Expect(err).To(Equal(models.ErrInvalidOwner)) Expect(logger).To(gbytes.Say(models.ErrInvalidOwner.Error())) @@ -197,7 +197,7 @@ var _ = Describe("LocketHandler", func() { }) JustBeforeEach(func() { - _, err = locketHandler.Lock(context.Background(), request.ToProto()) + _, err = locketHandler.Lock(context.Background(), request) }) It("returns the error", func() { @@ -234,7 +234,7 @@ var _ = Describe("LocketHandler", func() { }) It("logs and writes to the exit channel", func() { - locketHandler.Lock(context.Background(), request.ToProto()) + locketHandler.Lock(context.Background(), request) Expect(logger).To(gbytes.Say("unrecoverable-error")) metricsRecordFailure(fakeRequestMetrics) @@ -253,7 +253,7 @@ var _ = Describe("LocketHandler", func() { JustBeforeEach(func() { fakeLockDB.LockReturns(nil, errors.New("Boom.")) - locketHandler.Lock(ctx, request.ToProto()) + locketHandler.Lock(ctx, request) }) Context("when the context was closed due to a client cancellation", func() { @@ -325,7 +325,7 @@ var _ = Describe("LocketHandler", func() { JustBeforeEach(func() { go func() { releaseRequest := &models.ReleaseRequest{Resource: resource} - _, err := locketHandler.Release(context.Background(), releaseRequest.ToProto()) + _, err := locketHandler.Release(context.Background(), releaseRequest) Expect(err).NotTo(HaveOccurred()) }() }) @@ -358,7 +358,7 @@ var _ = Describe("LocketHandler", func() { It("releases the lock in the database", func() { releaseRequest := &models.ReleaseRequest{Resource: resource} - _, err := locketHandler.Release(context.Background(), releaseRequest.ToProto()) + _, err := locketHandler.Release(context.Background(), releaseRequest) Expect(err).NotTo(HaveOccurred()) Expect(fakeLockDB.ReleaseCallCount()).Should(Equal(1)) @@ -376,7 +376,7 @@ var _ = Describe("LocketHandler", func() { It("returns the error", func() { releaseRequest := &models.ReleaseRequest{Resource: resource} - _, err := locketHandler.Release(context.Background(), releaseRequest.ToProto()) + _, err := locketHandler.Release(context.Background(), releaseRequest) Expect(err).To(HaveOccurred()) metricsRecordFailure(fakeRequestMetrics) @@ -391,7 +391,7 @@ var _ = Describe("LocketHandler", func() { It("logs and writes to the exit channel", func() { releaseRequest := &models.ReleaseRequest{Resource: resource} - locketHandler.Release(context.Background(), releaseRequest.ToProto()) + locketHandler.Release(context.Background(), releaseRequest) Expect(logger).To(gbytes.Say("unrecoverable-error")) metricsRecordFailure(fakeRequestMetrics) @@ -410,7 +410,7 @@ var _ = Describe("LocketHandler", func() { JustBeforeEach(func() { fakeLockDB.ReleaseReturns(errors.New("Boom.")) releaseRequest := &models.ReleaseRequest{Resource: resource} - locketHandler.Release(ctx, releaseRequest.ToProto()) + locketHandler.Release(ctx, releaseRequest) }) Context("when the context was closed due to a client cancellation", func() { @@ -464,7 +464,7 @@ var _ = Describe("LocketHandler", func() { It("fetches the lock in the database", func() { fetchRequest := &models.FetchRequest{Key: "test-fetch"} - fetchResp, err := locketHandler.Fetch(context.Background(), fetchRequest.ToProto()) + fetchResp, err := locketHandler.Fetch(context.Background(), fetchRequest) Expect(err).NotTo(HaveOccurred()) Expect(fetchResp.Resource).To(Equal(resource)) @@ -483,7 +483,7 @@ var _ = Describe("LocketHandler", func() { It("returns the error", func() { fetchRequest := &models.FetchRequest{Key: "test-fetch"} - _, err := locketHandler.Fetch(context.Background(), fetchRequest.ToProto()) + _, err := locketHandler.Fetch(context.Background(), fetchRequest) Expect(err).To(HaveOccurred()) metricsRecordFailure(fakeRequestMetrics) @@ -498,7 +498,7 @@ var _ = Describe("LocketHandler", func() { It("logs and writes to the exit channel", func() { fetchRequest := &models.FetchRequest{Key: "test-fetch"} - locketHandler.Fetch(context.Background(), fetchRequest.ToProto()) + locketHandler.Fetch(context.Background(), fetchRequest) Expect(logger).To(gbytes.Say("unrecoverable-error")) metricsRecordFailure(fakeRequestMetrics) @@ -517,7 +517,7 @@ var _ = Describe("LocketHandler", func() { JustBeforeEach(func() { fakeLockDB.FetchReturns(nil, errors.New("boom")) fetchRequest := &models.FetchRequest{Key: "test-fetch"} - locketHandler.Fetch(ctx, fetchRequest.ToProto()) + locketHandler.Fetch(ctx, fetchRequest) }) Context("when the context was closed due to a client cancellation", func() { @@ -581,20 +581,20 @@ var _ = Describe("LocketHandler", func() { Context("when type_code is set", func() { It("should be valid on a valid type code and empty type", func() { fetchAllLockRequest := &models.FetchAllRequest{TypeCode: models.LOCK} - _, err := locketHandler.FetchAll(context.Background(), fetchAllLockRequest.ToProto()) + _, err := locketHandler.FetchAll(context.Background(), fetchAllLockRequest) Expect(err).NotTo(HaveOccurred()) metricsRecordSuccess(fakeRequestMetrics) metricsUseCorrectCallTags(fakeRequestMetrics, "FetchAll") fetchAllPresenceRequest := &models.FetchAllRequest{TypeCode: models.PRESENCE} - _, err = locketHandler.FetchAll(context.Background(), fetchAllPresenceRequest.ToProto()) + _, err = locketHandler.FetchAll(context.Background(), fetchAllPresenceRequest) Expect(err).NotTo(HaveOccurred()) }) It("should be invalid on an UNKNOWN type code and empty type", func() { fetchAllRequest := &models.FetchAllRequest{} - _, err := locketHandler.FetchAll(context.Background(), fetchAllRequest.ToProto()) + _, err := locketHandler.FetchAll(context.Background(), fetchAllRequest) Expect(err).To(HaveOccurred()) metricsRecordFailure(fakeRequestMetrics) @@ -606,7 +606,7 @@ var _ = Describe("LocketHandler", func() { Context("when the type is valid", func() { It("fetches all the presence locks in the database by type", func() { fetchAllRequest := &models.FetchAllRequest{TypeCode: models.PRESENCE} - fetchResp, err := locketHandler.FetchAll(context.Background(), fetchAllRequest.ToProto()) + fetchResp, err := locketHandler.FetchAll(context.Background(), fetchAllRequest) Expect(err).NotTo(HaveOccurred()) metricsRecordSuccess(fakeRequestMetrics) @@ -620,7 +620,7 @@ var _ = Describe("LocketHandler", func() { It("fetches all the lock locks in the database by type", func() { fetchAllRequest := &models.FetchAllRequest{TypeCode: models.LOCK} - fetchResp, err := locketHandler.FetchAll(context.Background(), fetchAllRequest.ToProto()) + fetchResp, err := locketHandler.FetchAll(context.Background(), fetchAllRequest) Expect(err).NotTo(HaveOccurred()) metricsRecordSuccess(fakeRequestMetrics) @@ -634,7 +634,7 @@ var _ = Describe("LocketHandler", func() { It("fetches all the presence locks in the database by type code", func() { fetchAllRequest := &models.FetchAllRequest{TypeCode: models.PRESENCE} - fetchResp, err := locketHandler.FetchAll(context.Background(), fetchAllRequest.ToProto()) + fetchResp, err := locketHandler.FetchAll(context.Background(), fetchAllRequest) Expect(err).NotTo(HaveOccurred()) metricsRecordSuccess(fakeRequestMetrics) @@ -648,7 +648,7 @@ var _ = Describe("LocketHandler", func() { It("fetches all the lock locks in the database by type code", func() { fetchAllRequest := &models.FetchAllRequest{TypeCode: models.LOCK} - fetchResp, err := locketHandler.FetchAll(context.Background(), fetchAllRequest.ToProto()) + fetchResp, err := locketHandler.FetchAll(context.Background(), fetchAllRequest) Expect(err).NotTo(HaveOccurred()) metricsRecordSuccess(fakeRequestMetrics) @@ -664,7 +664,7 @@ var _ = Describe("LocketHandler", func() { Context("when the type is invalid", func() { It("returns an invalid type error", func() { fetchAllRequest := &models.FetchAllRequest{Type: "dawg"} - _, err := locketHandler.FetchAll(context.Background(), fetchAllRequest.ToProto()) + _, err := locketHandler.FetchAll(context.Background(), fetchAllRequest) Expect(err).To(HaveOccurred()) metricsRecordFailure(fakeRequestMetrics) @@ -675,7 +675,7 @@ var _ = Describe("LocketHandler", func() { Context("when the type code is UNKNOWN", func() { It("returns an invalid type error", func() { fetchAllRequest := &models.FetchAllRequest{TypeCode: models.UNKNOWN} - _, err := locketHandler.FetchAll(context.Background(), fetchAllRequest.ToProto()) + _, err := locketHandler.FetchAll(context.Background(), fetchAllRequest) Expect(err).To(HaveOccurred()) metricsRecordFailure(fakeRequestMetrics) @@ -690,7 +690,7 @@ var _ = Describe("LocketHandler", func() { It("returns the error", func() { fetchAllRequest := &models.FetchAllRequest{} - _, err := locketHandler.FetchAll(context.Background(), fetchAllRequest.ToProto()) + _, err := locketHandler.FetchAll(context.Background(), fetchAllRequest) Expect(err).To(HaveOccurred()) metricsRecordFailure(fakeRequestMetrics) @@ -705,7 +705,7 @@ var _ = Describe("LocketHandler", func() { It("logs and writes to the exit channel", func() { fetchAllRequest := &models.FetchAllRequest{TypeCode: models.PRESENCE} - locketHandler.FetchAll(context.Background(), fetchAllRequest.ToProto()) + locketHandler.FetchAll(context.Background(), fetchAllRequest) Expect(logger).To(gbytes.Say("unrecoverable-error")) metricsRecordFailure(fakeRequestMetrics) @@ -724,7 +724,7 @@ var _ = Describe("LocketHandler", func() { JustBeforeEach(func() { fakeLockDB.FetchAllReturns(nil, errors.New("boom")) fetchAllRequest := &models.FetchAllRequest{} - locketHandler.FetchAll(ctx, fetchAllRequest.ToProto()) + locketHandler.FetchAll(ctx, fetchAllRequest) }) Context("when the context was closed due to a client cancellation", func() { diff --git a/lock/lock_test.go b/lock/lock_test.go index 2b32375..ef605c9 100644 --- a/lock/lock_test.go +++ b/lock/lock_test.go @@ -88,7 +88,7 @@ var _ = Describe("Lock", func() { BeforeEach(func() { fakeLocker.LockReturns(nil, errors.New("no-lock-for-you")) fetchResponse := &models.FetchResponse{Resource: &models.Resource{Owner: "joe"}} - fakeLocker.FetchReturns(fetchResponse.ToProto(), nil) + fakeLocker.FetchReturns(fetchResponse, nil) }) JustBeforeEach(func() { @@ -148,7 +148,7 @@ var _ = Describe("Lock", func() { // variable instance cannot be returned fakeLocker.LockReturns(nil, status.Errorf(codes.AlreadyExists, "lock-collision")) fetchResponse := &models.FetchResponse{Resource: &models.Resource{Owner: "joe"}} - fakeLocker.FetchReturns(fetchResponse.ToProto(), nil) + fakeLocker.FetchReturns(fetchResponse, nil) }) It("logs the initial error", func() { @@ -189,7 +189,7 @@ var _ = Describe("Lock", func() { BeforeEach(func() { done = make(chan struct{}) - fakeLocker.LockStub = func(ctx context.Context, res *models.ProtoLockRequest, opts ...grpc.CallOption) (*models.ProtoLockResponse, error) { + fakeLocker.LockStub = func(ctx context.Context, res *models.LockRequest, opts ...grpc.CallOption) (*models.LockResponse, error) { select { case <-done: return nil, nil @@ -249,7 +249,7 @@ var _ = Describe("Lock", func() { done = make(chan struct{}) lockErr = errors.New("no-lock-for-you") - fakeLocker.LockStub = func(ctx context.Context, res *models.ProtoLockRequest, opts ...grpc.CallOption) (*models.ProtoLockResponse, error) { + fakeLocker.LockStub = func(ctx context.Context, res *models.LockRequest, opts ...grpc.CallOption) (*models.LockResponse, error) { select { case <-done: return nil, lockErr @@ -359,7 +359,7 @@ var _ = Describe("Lock", func() { BeforeEach(func() { lockResult = make(chan bool, 1) - fakeLocker.LockStub = func(ctx context.Context, res *models.ProtoLockRequest, opts ...grpc.CallOption) (*models.ProtoLockResponse, error) { + fakeLocker.LockStub = func(ctx context.Context, res *models.LockRequest, opts ...grpc.CallOption) (*models.LockResponse, error) { defer GinkgoRecover() var shouldError bool Eventually(lockResult).Should(Receive(&shouldError)) From acc11ebbda35010fcc8ff36dcfbe68978faca150 Mon Sep 17 00:00:00 2001 From: Brandon Roberson Date: Tue, 1 Apr 2025 15:52:01 +0000 Subject: [PATCH 09/15] Add Proto conversions to grpc --- models/locket_bbs_grpc.pb.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/models/locket_bbs_grpc.pb.go b/models/locket_bbs_grpc.pb.go index 1375a74..486c6dc 100644 --- a/models/locket_bbs_grpc.pb.go +++ b/models/locket_bbs_grpc.pb.go @@ -46,42 +46,42 @@ func NewLocketClient(cc grpc.ClientConnInterface) LocketClient { func (c *locketClient) Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(LockResponse) - err := c.cc.Invoke(ctx, Locket_Lock_FullMethodName, in, out, cOpts...) + out := new(ProtoLockResponse) + err := c.cc.Invoke(ctx, Locket_Lock_FullMethodName, in.ToProto(), out, cOpts...) if err != nil { return nil, err } - return out, nil + return out.FromProto(), nil } func (c *locketClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(FetchResponse) - err := c.cc.Invoke(ctx, Locket_Fetch_FullMethodName, in, out, cOpts...) + out := new(ProtoFetchResponse) + err := c.cc.Invoke(ctx, Locket_Fetch_FullMethodName, in.ToProto(), out, cOpts...) if err != nil { return nil, err } - return out, nil + return out.FromProto(), nil } func (c *locketClient) Release(ctx context.Context, in *ReleaseRequest, opts ...grpc.CallOption) (*ReleaseResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ReleaseResponse) - err := c.cc.Invoke(ctx, Locket_Release_FullMethodName, in, out, cOpts...) + out := new(ProtoReleaseResponse) + err := c.cc.Invoke(ctx, Locket_Release_FullMethodName, in.ToProto(), out, cOpts...) if err != nil { return nil, err } - return out, nil + return out.FromProto(), nil } func (c *locketClient) FetchAll(ctx context.Context, in *FetchAllRequest, opts ...grpc.CallOption) (*FetchAllResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(FetchAllResponse) - err := c.cc.Invoke(ctx, Locket_FetchAll_FullMethodName, in, out, cOpts...) + out := new(ProtoFetchAllResponse) + err := c.cc.Invoke(ctx, Locket_FetchAll_FullMethodName, in.ToProto(), out, cOpts...) if err != nil { return nil, err } - return out, nil + return out.FromProto(), nil } type LocketServer interface { From ec6ab15a82533447f516977bc72305ef1e976526 Mon Sep 17 00:00:00 2001 From: Brandon Roberson Date: Mon, 14 Apr 2025 16:42:53 +0000 Subject: [PATCH 10/15] Regen protos for grpc Proto client usage --- models/locket_bbs_grpc.pb.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/models/locket_bbs_grpc.pb.go b/models/locket_bbs_grpc.pb.go index 486c6dc..1ecf684 100644 --- a/models/locket_bbs_grpc.pb.go +++ b/models/locket_bbs_grpc.pb.go @@ -37,17 +37,18 @@ type LocketClient interface { } type locketClient struct { - cc grpc.ClientConnInterface + cc grpc.ClientConnInterface + plc ProtoLocketClient } func NewLocketClient(cc grpc.ClientConnInterface) LocketClient { - return &locketClient{cc} + proto := NewProtoLocketClient(cc) + return &locketClient{cc, proto} } func (c *locketClient) Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ProtoLockResponse) - err := c.cc.Invoke(ctx, Locket_Lock_FullMethodName, in.ToProto(), out, cOpts...) + out, err := c.plc.ProtoLock(ctx, in.ToProto(), cOpts...) if err != nil { return nil, err } @@ -56,8 +57,7 @@ func (c *locketClient) Lock(ctx context.Context, in *LockRequest, opts ...grpc.C func (c *locketClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ProtoFetchResponse) - err := c.cc.Invoke(ctx, Locket_Fetch_FullMethodName, in.ToProto(), out, cOpts...) + out, err := c.plc.ProtoFetch(ctx, in.ToProto(), cOpts...) if err != nil { return nil, err } @@ -66,8 +66,7 @@ func (c *locketClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc func (c *locketClient) Release(ctx context.Context, in *ReleaseRequest, opts ...grpc.CallOption) (*ReleaseResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ProtoReleaseResponse) - err := c.cc.Invoke(ctx, Locket_Release_FullMethodName, in.ToProto(), out, cOpts...) + out, err := c.plc.ProtoRelease(ctx, in.ToProto(), cOpts...) if err != nil { return nil, err } @@ -76,8 +75,7 @@ func (c *locketClient) Release(ctx context.Context, in *ReleaseRequest, opts ... func (c *locketClient) FetchAll(ctx context.Context, in *FetchAllRequest, opts ...grpc.CallOption) (*FetchAllResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ProtoFetchAllResponse) - err := c.cc.Invoke(ctx, Locket_FetchAll_FullMethodName, in.ToProto(), out, cOpts...) + out, err := c.plc.ProtoFetchAll(ctx, in.ToProto(), cOpts...) if err != nil { return nil, err } From 6cef80868cc72e6b0446d36888c4f3c59f049a0a Mon Sep 17 00:00:00 2001 From: Brandon Roberson Date: Wed, 23 Apr 2025 16:25:27 +0000 Subject: [PATCH 11/15] Regenerate certs --- cmd/locket/fixtures/ca.crl | 28 ++++---- cmd/locket/fixtures/ca.crt | 50 +++++++------- cmd/locket/fixtures/ca.key | 98 +++++++++++++-------------- cmd/locket/fixtures/cert.crt | 44 ++++++------ cmd/locket/fixtures/cert.csr | 24 +++---- cmd/locket/fixtures/cert.key | 50 +++++++------- cmd/locket/fixtures/metron/CA.crl | 28 ++++---- cmd/locket/fixtures/metron/CA.crt | 50 +++++++------- cmd/locket/fixtures/metron/CA.key | 98 +++++++++++++-------------- cmd/locket/fixtures/metron/client.crt | 46 ++++++------- cmd/locket/fixtures/metron/client.csr | 26 +++---- cmd/locket/fixtures/metron/client.key | 50 +++++++------- cmd/locket/fixtures/metron/metron.crt | 46 ++++++------- cmd/locket/fixtures/metron/metron.csr | 26 +++---- cmd/locket/fixtures/metron/metron.key | 50 +++++++------- 15 files changed, 357 insertions(+), 357 deletions(-) diff --git a/cmd/locket/fixtures/ca.crl b/cmd/locket/fixtures/ca.crl index bd0061e..da29efe 100644 --- a/cmd/locket/fixtures/ca.crl +++ b/cmd/locket/fixtures/ca.crl @@ -1,16 +1,16 @@ -----BEGIN X509 CRL----- -MIICfDBmAgEBMA0GCSqGSIb3DQEBCwUAMA0xCzAJBgNVBAMTAmNhFw0yMzEyMjAx -OTI5MzBaFw0yNTA2MjAxOTI5MjhaMACgIzAhMB8GA1UdIwQYMBaAFM/SC2sJ0Kag -O1Zym+Az7B7Ibp4OMA0GCSqGSIb3DQEBCwUAA4ICAQClBr5hD45gt8kXGua2vNTz -z7GTRydC9pUQLWBvQz/m1yvKVQaUPa9cU4M2of6JP3ru/BhgDYr5vXhik5ej/e1w -ZgWnHM9pg8gT6l2OBlUpGN3kwwkYhehBwT3DeMwrV/qqjVGWLpW334kfKzFSvrmT -AFo75mvfgFpBNpm/5aCpzeyNrN1EUk0CA1z9bARQJOvhfoj1AZ8izD0T9lZYAekl -SLJRd7m9QgyowQssSdKf5iWr61jJjaHXchlAbr2uKeO0OWhIZEG3fWCOgwy/Cl+8 -tZgkS717OIN4fENhp8h0zweMvZvQC+W+1pQm9xXpY2ReI9cp31HACohHW6M6NRgc -AdCO7IBFozWkHOdozd5vX9XoCBlhoW1D5l7clj/eLig+hnMtn5VH0sCdeQ9aYL4P -dZL5CawbEfi2Nwwp85tsVta3carY1O3af+PaOfMO0yHIScU4z+hphz2Xg/uz1ox+ -wN4odkItntj4Q3J7mf8qvszmxULrxO2Bv+7R/kyb7fUOa8ZSn5HScOiUurNm1ucG -mTo9g8YO7NgNUmBQcGBWnrG0GkK8AnsVWgxWa+8O2YNzm+hLlf5LbbYC/IMMGzvi -BWzBAewbEXK/i51fN/mU0H2SsyZn3j1d9lwvnLSURDqCcBt71h+Ps0/ee92BT0zq -5HYbzsNj9MWN3xzUZ1015w== +MIICfDBmAgEBMA0GCSqGSIb3DQEBCwUAMA0xCzAJBgNVBAMTAmNhFw0yNTA0MjMx +NjIxMTdaFw0yNjEwMjMxNjIxMTZaMACgIzAhMB8GA1UdIwQYMBaAFFbdxIyFojrJ +AN6rUQIgQ0C7JbwGMA0GCSqGSIb3DQEBCwUAA4ICAQCecRjVFyYLgWbFj7XrmEoV +VYaCrtYsfBqbIVdilI+ZiujLG9mL9NanCVZkuE95ECeRtt4jwU15XenYgmsn31qY +iAuqiahosUYa4Wf5hzMI+YF/jZbFljwnMiHY42jfu0fX1nR3Y0/c2XesOKR0QNjI +Ii5K3WxkMquKt5BUk4qn5N7lNgPE65pJ9K+Hs9GMGEG4xE5l/YuzY+Q5raJ2p60Y +DB67FkcT18WOqqSyWoSnSC0qyB695+Hbgyg+YEs2JbdmHWYygKMfxGkldHajtg6V +MbuZPQH22QAzINoPxv0hzFniKdt3vBCsw5H3Rq0PI9fg1e96gBsSvxzlqgXvAYLP +hbbImfqneHG1Vd+GOtRlxrX/osQr2jMZl8luqoTohbmeJmtB0GPruZYNMk3GM4hP +FxXFM4FY5sP7tIJlhJrks9D6Ak9Fg3tgWVnQPD6y/I4YkcHKbYS/MFBZElKFoisg +VtswqUXeZ/vTuOZNYdAeGwEQ/2U6lwH1rkC7XbhuQajWfmN75VbmHFSWWcwQXOv/ +g7/YTTJSF6rJ4tz86WGSbjoTDmctA9ktx/vnx08O657Fgy1gqHYSEgfyQIdjSqsw +Jw/jvBeTMRUoaUNTwXdg3LbwS2ji+gZMjmiIB0MdCvO3UnHnacaeKROHtMA3z5Yl +DDkgkdsSLulELz2KmWTNqw== -----END X509 CRL----- diff --git a/cmd/locket/fixtures/ca.crt b/cmd/locket/fixtures/ca.crt index b7d7f12..59b2b50 100644 --- a/cmd/locket/fixtures/ca.crt +++ b/cmd/loc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qFVw9e6tMR9mCiBihVj38GjYA +iRDgeh3Bj7HtNpiaIkgzfs6ZUCP5QyMi5fyczioi1GiBXvqGQUhdaaovDS8dlUox +2/8UcFbkUHRY6zgLu1vsNysa3P/vTY43dtfu9k4pDimwJ8lDDYZVJb7vLt1Mog== -----END CERTIFICATE----- diff --git a/cmd/locket/fixtures/ca.key b/cmd/locket/fixtures/ca.key index 8125191..02b75f7 100644 --- a/cmd/locket/fixtures/ca.key +++ b/cmd/locket/fixtures/ca.key @@ -1,51 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -MIIJJwIBAAKCAgEArl2wAhLkZspnfykktCEPUZTwVAqxgDAw0LotNIOZwqWkkyP8 -KWNsznnLmFfb4AH2+kEfyck1ECsAZhlMS1CfWCbYu0vbim4qt5akasTpxmrBp+6t -ZhVfEO0/VoTgW2BiT/KtqG5LPdX5xmhxB4yejKtCoTTu0rrpiITSivt1blG/zjMp -IgDJCgy4QdXPHS23C0R8jDfYHFbcMZ55KNH3MkKshNUT10rJYXDEfYwH0Ucg1BqX -PVytCtBmMSFDawlWGWcrO1QFxB7Ool4zpSsIkAqZw451ehq3S2Z/BRyAu/I/kSAF -BD5FEOvmKvZFTquvnARsu6VkCjdWmqYvpwF6nN3JNA3nqNgEVxH0VWOUVMsPki1W -rRD9mD281FgJFEa+zQoZvRdry636qPOoxX9F6n7mfc8P//q+GahC/laIPEFyGQ8V -i184NkqQ55ZQvwwCquwYL7lqgDr7wwAUMxEythc63j3YfFcB1r7nJYgrUGACydAJ -lGXf3SDw5YoBk+Ovy5DACfFwF8h53BmvtCnmLka+ifP/a6gYXJekKy7hl0ElQHp6 -LQWe+avKYg62jxyJTVfrl615WpSDfY9wpMR3hvcUJr40QFzyMyaAtsqGnd6jr4DH -MC7lqNcp1PfRSjXpGTLJ/qvJv8gwmpTk400NLMcTAJgaoC3j2FQmjV0xQtMCAwEA -AQKCAgBgvFt0mxSaLnrC4omZYaoFAdNfXNtjGdlLQ67mrog0o/8tHs68C4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ypOLp4C2AAinxSRjOaTfalwlkTNI +fKptvBnc0YRRsJ+sGvr8SKFCLqMd42kkKkKTDgDM04wFkR+45UId46mpqp0ieU47 +2krlCBMlrTrKWbTOU5ylsCVrqx7VJulF5gmhXD23IQfIVHDay55UXODIJsq6prsv +vTtpiUhFuP009xJIvi1kL6XJ8BmpsH4w3zHcNP2F5wQERxzI/ggbDPMzQOs8 -----END RSA PRIVATE KEY----- diff --git a/cmd/locket/fixtures/cert.crt b/cmd/locket/fixtures/cert.crt index 4d60b93..20e067e 100644 --- a/cmd/locket/fixtures/cert.crt +++ b/cmd/locket/fixtures/cert.crt @@ -1,25 +1,25 @@ -----BEGIN CERTIFICATE----- -MIIENjCCAh6gAwIBAgIRALe2szG8yo72lV2xcyGIPkkwDQYJKoZIhvcNAQELBQAw -DTELMAkGA1UEAxMCY2EwHhcNMjMxMjIwMTkxOTMxWhcNMjUwNjIwMTkyOTI3WjAP +MIIENjCCAh6gAwIBAgIRAMzeMZeV1BKP586rSqKtt3MwDQYJKoZIhvcNAQELBQAw +DTELMAkGA1UEAxMCY2EwHhcNMjUwNDIzMTYxMTE3WhcNMjYxMDIzMTYyMTE1WjAP MQ0wCwYDVQQDEwRjZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA -sJjtUUWoTuzIrLgXRMbmARjHk5ipF80wVma5bEOXl5nXowxRHtqy46K/WvZGhdRn -LD12/bxHrGJmA5sSFNwDa+eSYx89s2UTDXGxTm3Xkd2d8cPTqRxEZF9q3Xz+gGMb -mV/HCLEPqdqTVUPNDoaz2bWVssXmc1EPFOHATYl4jE2TJcg2JkfihhUTbxwxBaw6 -LrzOLJDsUwIlQturrddCHizVgQju3sbl91KX46l9rgfJvT9v/wdRWcZQTUxo1vR0 -m2sDT1ZUSdlxGbo7iB6we44nRP/tyecHYK0/yYdBJTxy+XlxI9jyyMJsytjATNw0 -j+aJvXq1tbuYp0CHaHPDvQIDAQABo4GOMIGLMA4GA1UdDw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9rQaDpXYho5fomW05XPiY= -----END CERTIFICATE----- diff --git a/cmd/locket/fixtures/cert.csr b/cmd/locket/fixtures/cert.csr index d2cedc0..2cc9df0 100644 --- a/cmd/locket/fixtures/cert.csr +++ b/cmd/locket/fixtures/cert.csr @@ -1,16 +1,16 @@ -----BEGIN CERTIFICATE REQUEST----- MIICgTCCAWkCAQAwDzENMAsGA1UEAxMEY2VydDCCASIwDQYJKoZIhvcNAQEBBQAD -ggEPADCCAQoCggEBALCY7VFFqE7syKy4F0TG5gEYx5OYqRfNMFZmuWxDl5eZ16MM -UR7asuOiv1r2RoXUZyw9dv28R6xiZgObEhTcA2vnkmMfPbNlEw1xsU5t15HdnfHD -06kcRGRfat18/oBjG5lfxwixD6nak1VDzQ6Gs9m1lbLF5nNRDxThwE2JeIxNkyXI -NiZH4oYVE28cMQWsOi68ziyQ7FMCJULbq63XQh4s1YEI7t7G5fdSl+Opfa4Hyb0/ -b/8HUVnGUE1MaNb0dJtrA09WVEnZcRm6O4gesHuOJ0T/7cnnB2CtP8mHQSU8cvl5 -cSPY8sjCbMrYwEzcNI/mib16tbW7mKdAh2hzw70CAwEAAaAtMCsGCSqGSIb3DQEJ +ggEPADCCAQoCggEBAN8JVHmbxDMOW8XiyDbob0a3dEZayuwZP6K5kmbwB57h/Vmb +iFTjKPHy+td5DjezCMu3lws9xPAgs3HIIwYsHRfuYUmyPx0cvMKASIjG/E7ymxcD +7oGj36wNjZ//Jzi1lmzuV4r5V1mn6wHyUbULY7Y1pj520wQP9dvxxZXFHYJmMXqb +SbAznDkGaJ039kfz8ZyaJLTywVysLc5TzbIWtha3v4gyBZlUj06quxT9N7HW8aEl +oe4jbj9PhyRGqQf2XXjjPojgE01TzuRAnZ+FaJ56zL/n4m3ZJy7QHB5In2+7jyNu +1q7L5A0IPHs1zr0jIR0yBMc8KuD4fNCPsgSIhcUCAwEAAaAtMCsGCSqGSIb3DQEJ DjEeMBwwGgYDVR0RBBMwEYIJbG9jYWxob3N0hwR/AAABMA0GCSqGSIb3DQEBCwUA -A4IBAQA/Oya3hOpKi05df6wHJrg58/tV980jGBBLDEZIWvuvhQL5J5PcoVIwpN4k -UzZjjvlS20B0jzQV21JQCWJvakenpULeT0Ypg/A19uKCsT5c85mUc5LCflzSL0a5 -939uJDK5yVgh5IpJsm3EMEkIhmgw6WM+4guf0KOMU9JU/jhxkMxY4+7CSu63/HII -FsmRfV9fRpA77gmrF144aQnZR6kMx/ZSp7BW7i61wCIBZklGKUI5EdwxlcOFIs1R -kVJMx7LbwPC9CTIMyXa8x1RKolZTAbQq0foPuUIJLdEMfaEifpVeJ4kyPCGHejTZ -ysi1JereHe3oox17qtO5kUzIf4AD +A4IBAQACDJkjeMcMqNrE5gIzNIvHlK29pW2CkFHfQgExRDuXJ/DZSQRbOI3c6iDu +DLV4I26Bk7ippIasHuAbln2kqOdhps+8rnVUlAU9YYj09U/gZfuPueIZsqAdosw1 +bbElARw1P877iF1HT/aofcyERwsv2WVUJLdRNqcLtaxuSuJNQ0lR1DAt5DCISuIi +daTx/DBzVWyGLOEd2aqvfk00bjATzMtqESRPQzQVb/vfIW1VdKZFx4KdD/ObyMgD +EfeeTIUzvjG+vK6kZF56hFEJcIXVNskWh+v/jne6JQX7dqdbJ4D65BAasyvj2HY/ +L3c9+DCpDlDFMyhP4Hy2uecBj/qa -----END CERTIFICATE REQUEST----- diff --git a/cmd/locket/fixtures/cert.key b/cmd/locket/fixtures/cert.key index 60b25e0..1186cfa 100644 --- a/cmd/locket/fixtures/cert.key +++ b/cmd/locket/fixtures/cert.key @@ -1,27 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEAsJjtUUWoTuzIrLgXRMbmARjHk5ipF80wVma5bEOXl5nXowxR -Htqy46K/WvZGhdRnLD12/bxHrGJmA5sSFNwDa+eSYx89s2UTDXGxTm3Xkd2d8cPT -qRxEZF9q3Xz+gGMbmV/HCLEPqdqTVUPNDoaz2bWVssXmc1EPFOHATYl4jE2TJcg2 -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W+d +bGO4wQUCgYEA8/73PXDzKlcXdY3+iUVYu6M6RWBD/+ntxku9B9waMI5MgaCoSHAz +fESUPEuPbRWsgJj3btolxI7KRMgZzyFNWjU2h89MoTKZgUAwWf337YYUs2gZkQQD +KS/QRGCxpRToS3J/W8YFjAWrLR4XebAlz3qelIiwvQ8NJm1fS1KgBb8CgYEA6gJj +I5WWIJu+9wuyxYA/KHTZuLuWuxCoXdh5uTzYYGF0zK/P7GIdzP6a3i7qtE25YDqr +N2laAP3ATtthREKROet7ldVyXnkd5snpL3Q8nIlIkNeuamV6PFcN4jpn52DXasyO +3NP7iD0qR3VY++l71uQxN2M3BvwGCZCJkoII/XsCgYEAxPlhSTWk6Np0Ms+V2+Wi +05/bS+SCINgNv1anXPAAKJDIDKHRGOGTfs+yR9bMC8lCgHJ81f3AHaUUf2B3DXMa +CigJRKxCdaPurpxOLGhNvW/PyGHSufJeRuK1pG3XG6j8OuRNEp6THc35uaugUfm1 +HIEmAk0zOP0spYgINTuXuesCgYEAyXaAr5QLCcvMXpgdstc0iLoA73/gxvASY6kJ +MqbliiSdD9OU6GeYTHIuFnbB7bS0kdowqaXzrMLJm5pXZRMCQKExZs+6hQc07QqL +zST/Qa0XYkuth0ASOnygIVIzPgorq3Cs1gVSmfo+ugKXN1nOGjWfAZZTO5oiAH4F +UrLM1p0CgYEA45s6s1mpXBlMBMMO0iOEvVw7CH3c4XIW1kgnb74slc4khBsUqJ3S +u9PSqW623fL9jNomd3+DDZ9vCm6GL5Qa9bSk8sVlA9K/WiozyAMOJsiC51cuKykP +JWqjQJTsMar6qni/J0xcXTVSHGKzfzVbqPr+zCZd+idBFG3EDGqdIjg= -----END RSA PRIVATE KEY----- diff --git a/cmd/locket/fixtures/metron/CA.crl b/cmd/locket/fixtures/metron/CA.crl index 4f6f6c5..a28ca17 100644 --- a/cmd/locket/fixtures/metron/CA.crl +++ b/cmd/locket/fixtures/metron/CA.crl @@ -1,16 +1,16 @@ -----BEGIN X509 CRL----- -MIICf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ju6dlye5i07AmlaEb6ceRPsZoU9lBfZU5mL6nM/rPa6zTiYXwWsONt6jM0hn +ipScQ71zPKPumoxxVIhAdymBgv/3RQWyW1hDiKY4OOsO+Aq923BMOq+25rbNntfX +x49cpQYHwuTvj/wCUoATp6z/ooWqAVh7aboGWZc70vSj+tgQFnmr3527InbROaFf +bd9A6HAHyqGkzP+oJpVvYdcBy2Pzjo6g+5xrlsIXnr+9bndSLO0SuCDer5PGf5UE +TI2tkBP/efx551eVejC8/vmNN7ht6PAAY2V2bhbfbqtcjKh01IM2UsjzAfbSbsho +pIXv+qnjMX6aVjUggg4cb06ImnEUU4m4M9HkzJHsNxxrTlZU7xo5NC7IIhPgkSmU +gI4eVnReJwdakcFI3QdsRu7fNNXLyqEohTE67kFIqbNRm4OgQxfnyKL4D/+Gzxwi +PK25x1MgEXMGZwRxjpoXFxN6TCdGl8B8bkka/Fhi+NQiKshOAQElT1jzJK3KRPDP +U15Ge1pzX3+CUXMdJtblloxaUKxMvJkkjw15KPKXm2pNbRO3att9RsEEJDAPcsne +/236TV9FLh9WR2ZBKp+l1Y77EMCvZoA9b6rX1m+hqPGM1BXBmOP4BUeOoCmTAO6b +KQf5wXjFOo6xXS2L1HVGPA== -----END X509 CRL----- diff --git a/cmd/locket/fixtures/metron/CA.crt b/cmd/locket/fixtures/metron/CA.crt index e708751..933542a 100644 --- a/cmd/locket/fixtures/metron/CA.crt +++ b/cmd/locket/fixtures/metron/CA.crt @@ -1,28 +1,28 @@ -----BEGIN CERTIFICATE----- MIIE2jCCAsKgAwIBAgIBATANBgkqhkiG9w0BAQsFADANMQswCQYDVQQDEwJDQTAe -Fw0yMzEyMjAxOTE5MjdaFw0yNTA2MjAxOTI5MjVaMA0xCzAJBgNVBAMTAkNBMIIC -IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA6AEw9w7rC4dsvkRVBDKMac+G -lb2+HEUmItWApud3UbhYy+hW/YSg3UnbbohiBAa4LBMZyh5NfUw3qaUb6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hxekzQC6jvkR +v59UUcB2Ew8LyFwZHMd+B720+iyW9ouKHlxa7m7LuLVsvXeegX/sIZINAp600LdV +F1SwtQBGboEvztSKqksCAwEAAaNFMEMwDgYDVR0PAQH/BAQDAgEGMBIGA1UdEwEB +/wQIMAYBAf8CAQAwHQYDVR0OBBYEFAVPTet1M+3Erz2j07aSbbgykuKlMA0GCSqG +SIb3DQEBCwUAA4ICAQAOBadxoiPnoq3tk97GEQtfGksEE1fS27vkQyuG8YQD1EZN +uDOK3UsZ5fVszHzQ9W7qa15yttNJvAGC7thuR/WsCdHzVaPGAD8Sc7e6GHbLvpT1 +x0ojD2a1fLw4zZZzoPqZpwJuDIdVfbrpMqFuFmh9z+g0q/BeYSCBNyeDyzf1XLZJ +CohhXmlhCTW4LMCXX4kCLDZ3f1DH4trxX+hsBbVl7kWqFikaCRUO6VoOpBS1ur2f +7bUKDGEc6f6zWqZvex2c5IIED2Vzxw4w0CTmrOmpHNLloHiP5peiuS0IJSDPxUOH +7uB64QEG7MzUbkUOzuS6Pu9odcwPzW9AuiDwhqojPzd6G3hOL5HW1yCzHESRjoj5 +I4WBYIcxktn0207ay/m6Yn9YZJyTz7YfhdKgtWwwqsGnzy2vpPSZ0EvG4l0N+/5D +PscGmaFQZn456JOJUOnScqI//bb5zUqTs4RgE+uuql1WIUXuSmvioa7sxX3iposA +o6dyxTHuoCxm/yOc7iv5ilT19gkvVbR3ftaRei/9koiRquN8gEn6kjQYRssrVcs3 +QomhX2ncB5RkhxcVKqTJs1tQZbd3RMZaos/DqMQKvtq36cfDohWlcEthuen5rXUC +OEun1JKPA5SYzjWb1+94WHV7tTq2hc6U/wnu1tIqCsG/FeGebzI9wnicHvb/eQ== -----END CERTIFICATE----- diff --git a/cmd/locket/fixtures/metron/CA.key b/cmd/locket/fixtures/metron/CA.key index bd105cb..96bc3a8 100644 --- a/cmd/locket/fixtures/metron/CA.key +++ b/cmd/locket/fixtures/metron/CA.key @@ -1,51 +1,51 @@ -----BEGIN RSA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NXQx1w5ol2bQR0Z4g0NbUbz2zVymiZIqt4Bxq +mibVXcMkEUQ+REMwGfgmjsumWuYdqPNMC8SQRTAVJ6V92GY3K9/1zRpxq0ur/mIS +EKBobI38maeoLsC5T+/78IF+mr2Ct4khUD3tnjNj0CIyXwre2Hb9kw5eWaQ0HEis +4bJn0QtUwAYzq30TCWDHelx+OEhFuTv4RmeS07Di3nsMhfDBgGucxfIKkyhuNnS9 +9Wk4rxFrhI1cGgFnghB37ASbjEWipnAIllVDbQiGMj/cBLhzzph8XLzKQaa9sq/A +Vm78OQKCAQEAwOIXxIX4NbRUzU/EcLP7+TMzVPo9a2XgQlH20PQ62CV4xHVlcjmz +IijI9OW1JPlQfBDgSjLM7AfVOtxwQtPaAvABq72Oti/GEkSJcT7nNhe+LVjmtWAQ +IDPdVHpb/JdsY05TeLF1hh3E32iwhGImPhgHWsAx2oAyEflq1m0uElUqSxn606SS +ptKLe/Onb9i4f8IydAew3Hnr1mgDizy4ssK4FVeurHE3Qrp0is2fHGc9MHEb3ujJ +VX+FJKfetC/8XK5qKsP6oLv1L2An+78nIh+STOHt0y5q8dL065d21juCc82LJVjy +Uihou/K/f1X5+z4AfhDM/8EZb5nEdUj3QQKCAQBOI1sX3HsAuNPXe7oXxXfmtNtt +FiZuKJHuGqc/vjQpBYrizkaqjf8KvMFFHCfb2adEfgwl6UGgsLqvSQGHrM+AwQFY +uDmoA4fgPYJ7HemCY87P18lOSd0CYooAERVw04LxwFQIUkVkPbW7g/9JL1RBSTL9 +8XHE1Dk9zSJPptbxJLh1ybzT+nC14XSBVUOac0MjWFwluesOq+89Kgsuq6SrWXRU +Ejmy/m+gE2c8Kh09WfbCnoWBc/JXIU6mvYZ6UrAaMKSmsRBJi7dekCEqb/D1ZBQF +aK69jLszszEG+AzGiW6u/49aZiN9+tXa1xX9aFnF2ogNYLJznU3YOXjsVisD -----END RSA PRIVATE KEY----- diff --git a/cmd/locket/fixtures/metron/client.crt b/cmd/locket/fixtures/metron/client.crt index c29cbcf..04b2ca5 100644 --- a/cmd/locket/fixtures/metron/client.crt +++ b/cmd/locket/fixtures/metron/client.crt @@ -1,25 +1,25 @@ -----BEGIN CERTIFICATE----- -MIIELzCCAhegAwIBAgIRAKhempG18bErM4oUIdhD2UcwDQYJKoZIhvcNAQELBQAw -DTELMAkGA1UEAxMCQ0EwHhcNMjMxMjIwMTkxOTI3WhcNMjUwNjIwMTkyOTI0WjAR -MQ8wDQYDVQQDEwZjbGllbnQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB -AQDNjTtiSpCIx4OjgH75LZwnI1ClgdD0mx8i6xbE+3E+m9ITc0kcix+wrkz07q/d -q7VAMnLxnWSpoNk75bbi5aQfQIrhfzN2HzcesYiqP54youExAWlFXCkfRwi7G0Yb -nO4vONVBmb/at9zwK7EdyG3lJtzImBNzWa9h5gSOonJe2F3ASqMkZ2euztGMBye6 -/YrsAVPHjI/mRYKWypOfMYfVpUOpQq2M7BSMhZvomwhLoef16ifFHgrKxsW9S5ay -kAHtrHeFLPF9ZqByB1Y1LGL+YJ+s38I6WpVrRS3rPBAmF6ar2Dm2Udg0fV4nAMSi -IC+f1P7lMCaudRQ9VYXrU2jDAgMBAAGjgYUwgYIwDgYDVR0PAQH/BAQDAgO4MB0G -A1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAdBgNVHQ4EFgQUusiHhqV6K5Gw -v2Ps3mEv8h56cXkwHwYDVR0jBBgwFoAU4qmOmof2zvEJf2x2bL2MZOdGOzAwEQYD -VR0RBAowCIIGY2xpZW50MA0GCSqGSIb3DQEBCwUAA4ICAQC/HTsuUnSY91k4UA96 -dyvJm1mVA81VPZYQDhKgvWOqZnNE9ulZq2oFXewtCKa2jpKPUKcgTu3W0ynTNyYF -WdsJZ7K0Zn/VxYXl6ILq9I/HNuSwspPgJatu4zH/w5kqsDNv6tIFqTfQ1r8+etDZ -bZBSdVFA1W7jRWYYUBCIsAJdMextDGOtnejzRd8P+G5JeruLG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7gwHQYD +VR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMB0GA1UdDgQWBBRI7oL9c6UJArhJ +wKzdpyvC6dlQkzAfBgNVHSMEGDAWgBQFT03rdTPtxK89o9O2km24MpLipTARBgNV +HREECjAIggZjbGllbnQwDQYJKoZIhvcNAQELBQADggIBAHNfKvzyUfndJz7C7nMk +6Q1470f6m5Zq3+px8LzhyMtnbMzIQclBHFeHTgfTzJdgOVRCdR0AonsIT73DcEZh +bk2ZBU4Nu7qTKOzcgG1h/3AGvf08lOEAxXa4Q5bJ/bnRLOXLwN5EqdjgLq5iDr1G ++DWSr/imgOr8gq/+aTYnFqycFq4HD4b/AlRs1AKBgvqUnF6Gw3PvdPFqntjD/16O +Ma0p/0qQtPDnEttgx8VN9ac9xeTX9Dt3z2m1OspCjkokwWLgL3TbuvBbIrtY8m65 +L8s+9i8V0DIW86jY76PV7AH7Xefm6g9FS153OVP+ES+CrEJYCQZH1x0hzndXRxt7 +4xq/nHomcMQwICcwuEa/IBBHLQJo+IwbxL+QPOW4tThoDOna2GRHt8WZTiutTe2/ +WV/xz9c9T/tq9FusdNRnDfoTmhzNv1XxYkahjy99LHa1ReOpDggvpuXD8QDUYEPr +nKhcZxIu9tvAYohKVHQZxcqk+SnyHaDLBqfvB55nsaNMqfTPaR56JwV53UTjZ/Js +SuN0nGG1Rb7RfhNZ2tC7qAUM4z8dh7dlsPjUQKk6MnrMu1Tsn8V/GEqW+o/teC2F +fFJd3XW5yi2Qxy1N+U8dpk1ds41x26N8rkWekbZxjwd1i7ObQMeMs5MiODFEHdpw +HDg3l5txdnuxpp+WqcY74eRt -----END CERTIFICATE----- diff --git a/cmd/locket/fixtures/metron/client.csr b/cmd/locket/fixtures/metron/client.csr index 8436862..d6aeea4 100644 --- a/cmd/locket/fixtures/metron/client.csr +++ b/cmd/locket/fixtures/metron/client.csr @@ -1,16 +1,16 @@ -----BEGIN CERTIFICATE REQUEST----- MIICejCCAWICAQAwETEPMA0GA1UE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2maPg5gEJG7xb7f1ViiZMa0PCRUyt +zgo0DvA33Yq27s5onuRr/tl4iJoc7qBgpw13ueRyd78+6AOoPxdRoVDdTcCqabrU +YnMkGHLkIDJM1yltBA2sVS28W/g3BQZ5c6fUqEkQxwIDAQABoCQwIgYJKoZIhvcN +AQkOMRUwEzARBgNVHREECjAIggZjbGllbnQwDQYJKoZIhvcNAQELBQADggEBAM08 +KsTfS1oBQbcI51qgfAYGrv8Rzu90OSdLwLtudFskLiTRbDBSHxyuq74zlxbalGaa +EpnlWCqLWd+maeKqHxZ63JFAa3gsTCwWkLYKGrDVT6BTiNI3I9YUBsNDAUxFFuMh +lZmBRadbyh7XmNB1CAjHb+nehALd8Nletwbb1IwJgtSOvwL5+lww1V7RK/iRMJHn +ZP4H/oTAIB22EB4BDdLkSW9hxjP7XL8zMo/fXy6P6XGJF2xEW7TYRYfsZtr4TMsw +mNRZmSKTZxW1QTOanIvMGUTd7r9/iXYXb2eiktONaUtdOLYEnCbr5i+no2SEL9Nm +xfQ+dNVjBZZ5s6EHxHk= -----END CERTIFICATE REQUEST----- diff --git a/cmd/locket/fixtures/metron/client.key b/cmd/locket/fixtures/metron/client.key index fe90fe9..65e1240 100644 --- a/cmd/locket/fixtures/metron/client.key +++ b/cmd/locket/fixtures/metron/client.key @@ -1,27 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAzY07YkqQiMeDo4B++S2cJyNQpYHQ9JsfIusWxPtxPpvSE3NJ -HIsfsK5M9O6v3au1QDJy8Z1kqaDZO+W24uWkH0CK4X8zdh83HrGIqj+eMqLhMQFp -RVwpH0cIuxtGG5zuLzjVQZm/2rfc8CuxHcht5SbcyJgTc1mvYeYEjqJyXthdwEqj -JGdnrs7RjAcnuv2K7AFTx4yP5kWClsqTnzGH1aVDqUKtjOwUjIWb6JsIS6Hn9eon -xR4KysbFvUuWspAB7ax3hSzxfWagcgdWNSxi/mCfrN/COlqVa0Ut6zwQJhemq9g5 -tlHYNH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03noO6blc/VV7T/V3mWR/NrvBAoGBAP1g +UyHTyTlTzEtLi5sBiVEfmQwIFqUdxCXnuMpjBS5NQPv9VwMLNxb8Zun5ptQ0v+tb +Zldp5G6PIB+9SVKLg8SIzCCccVCKpDcfuvg7M4xKFEolT8ty+Fh5hncAICyBCfww +QgqoB2NLP1gbI3YRmfA8x0B0j7KqZgerJtsUB46HAoGALeS+/dauoP79ysusQdgC +/9HC/FsCFxOuIMs78hZ8BNCCF5l1HDYxCIwYJGU6VMU+TEqU8gTpwr7MsLL0STP8 +tQkBExUi7ivb8SpLtbbat46FbS8fUs//WoLeAgyyPfHmL7kVAChQ/0rnGA+yQjvY +hZESh7OFhEzzOyL5Kh7GiwECgYA8fWibZNJfa1AUkb6MjPtZcK+7HZs6ZDbVzdJi +Du3Htg3TmxHQ2jaWuD9hkIZxlv5SlAmEyPUOKAFFUo1UtZYJr5b8Gh07Wz4FIwAi +DxApZ+4cHXhFW/dKOAkQE+madlwJ5wN9Q8wvumEvCZuXrnAP2JLBIpLD1sZxAj1O +hCOhtQKBgAsF5M1ZFowJXQPQkWkPBFL974q2kq6rvlp8UmyVl3rbDvQLb2F2+oDP +/yYCzFaylAQ7iHEBOT656i6hx+ozKFmv6/gVGZQ0AJa2ZbxpTPS3GV4ssCDm7PG1 +y2TZ2yPF2bv+b43dSfRc3M4pmB4N48Yr9ajgo0ZXcd5wQl67CmyQ -----END RSA PRIVATE KEY----- diff --git a/cmd/locket/fixtures/metron/metron.crt b/cmd/locket/fixtures/metron/metron.crt index ab31fa1..38c5c54 100644 --- a/cmd/locket/fixtures/metron/metron.crt +++ b/cmd/locket/fixtures/metron/metron.crt @@ -1,25 +1,25 @@ -----BEGIN CERTIFICATE----- -MIIELzCCAhegAwIBAgIRAON4IqW0w8UK1yZTwGHoj/kwDQYJKoZIhvcNAQELBQAw -DTELMAkGA1UEAxMCQ0EwHhcNMjMxMjIwMTkxOTI4WhcNMjUwNjIwMTkyOTI0WjAR -MQ8wDQYDVQQD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BtvqYRDT89X5NNOQHbDsfHHFWi3lNo +Q33QTMJ9JZJIOJJNNTBxF2Z+Gq6dGWBEd8OkzxHszexciXIdLhSTYUcLTtXMILNK +WZ6+DGhudaTphCBilnhcEks5GrMlzi0XTxPnMB1yXJjJnftLVphRgTBRtnt4v543 +HUPUxBtfsXndUuqtwWv1qlI3KUgVWUyipLil3rwy7Vl62SoNkajOqAaulDTb8snF +V0Q/Y6lxFPZdn0S71prFbl8kcFpArlrL18fFKVM38Jky/0Bs13B5BUMz72bkVJQM +Ufv6E5qGkLhrU4Cbm+ipZjCEnzo7AIuWUNYFqyd9JNfJG7ylDY8RIPpJkLghZHmm +OSBR/XQN7k9JLyQaU2wWoBp9ukLYsqkVyB8M+FeQgQkaobs9Wfi/P5vwh7oFsCfB +Ak8sJ/kbLS15Ilt2lRh6J1+p14kr+FjA0XIQ3vO2SiUrDmbL4loM3jpBJ9WEZhqg +lhBGXDMCYTN7kgKetDklH3v2EF2OuWfOZSySNEWiT8W3iPb5yh7LXLmfUMCWrLvq +/Y9Iu5B+n7YvOFh0Gb1LM0/pPKO+OubEltSmw2MvzL46hebWH77XUJ/ZwOSnn/ZJ +OyI4A9b2olDXgV9jX7CIQgep -----END CERTIFICATE----- diff --git a/cmd/locket/fixtures/metron/metron.csr b/cmd/locket/fixtures/metron/metron.csr index 7cd02e5..d739c81 100644 --- a/cmd/locket/fixtures/metron/metron.csr +++ b/cmd/locket/fixtures/metron/metron.csr @@ -1,16 +1,16 @@ -----BEGIN CERTIFICATE REQUEST----- MIICejCCAWICAQAwETEPMA0GA1UEAxMGbWV0cm9uMIIBIjANBgkqhkiG9w0BAQEF -AAOCAQ8AMIIBCgKCAQEA1z3mPbNVi3SNNo3TGEAMGK0m28kcu6XkOCEMAaePcJtF -cv57DoeCOnLUtpkkoRsLCvYsCCc3+o36S7hAGZ7Y4xErJm8o78uNlH6og+FBUv0O -3uyscHaRsEGshMgwStMwRLhsCZ40CZ0jlzAL+9dCesrZkRZsz7Fvya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5FtJoNIBAvMvJJaduW17Szo9/137OQZvtpMHG5pfCeVNVpjgMyDHURP/TXI +N1Ib8gxiiQdirYDHTaOTQ2B19VO7hukHsVtD2rHuIYsgEm3MJrfkwxqdYl2z46r8 +M6MspU5/9PawBn2PVYC2b4GfTB8GX/R/a290tB+q2uRmwOK/ZybajeQa/y7Rzt0b +k7eCIE9b3EjhyU4syraR77OaNSU9uQA6gQ5etV+TPOfhb/7b5q5rQhLvTWVhauuh +iJO2bue+wtvnyMAsu3Zh+5jSD0ODFVIAFaovuQMxilw3CwNl9Ua/Edn+PYPKZyLK +lnc6JLr8rpLILLIAPCE= -----END CERTIFICATE REQUEST----- diff --git a/cmd/locket/fixtures/metron/metron.key b/cmd/locket/fixtures/metron/metron.key index 4512814..8e03a19 100644 --- a/cmd/locket/fixtures/metron/metron.key +++ b/cmd/locket/fixtures/metron/metron.key @@ -1,27 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEA1z3mPbNVi3SNNo3TGEAMGK0m28kcu6XkOCEMAaePcJtFcv57 -DoeCOnLUtpkkoRsLCvYsCCc3+o36S7hAGZ7Y4xErJm8o78uNlH6og+FBUv0O3uys -cHaRsEGshMgwStMwRLhsCZ40CZ0jlzAL+9dCesrZkRZsz7FvyaK/l7Uh5d7xqMie -fka0kDdj309IKCZeXwYNzPsDbpHlXX4lpf11PW3FNLti/ClbMYQiaa9XVLgKgbvk -1RIFwwZHY47je44SZHFw5d25xjI8/bBumFaBJhWOT1Ozp/G2AECKuimVz2fmitko -nbCjFVjhwzz4a5x3YuQev9KufUFxCQnSeFqB1wIDAQABAoIBAQCZ9rYeRoyXf5yP -fG2WeCHu+NTF/JroA2c3WzQ6bsBlHTxVYIFnyDi4VHGh1/PipfSFN8gRYPRi7nIu -/bIkYYLlEd/a00LmHKW+pccm5tcSZN/hSEyk+buG58NfC8+3hk+NqJnnW1n/0n6l -5AF+eOEd8sIkTXUyL8s14YvJGhEQWtSMOYYbDPuj+f647m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bGB +1U8v5US1jfPTZE93tr6d4f7teUf6NihAa9HZp0Y/paPHfcFB5ZaQ3QKelNl/9vR+ +gR3B+TDwqK07jwXvHN7J8RUfzZXnVL/2kA8QAKdAIplpZc2wfWO37+iPPQAO2Ryd +HzoCFbswdMgCCP/XO3FIXdkCgYBWqk6ImfofE7SFoHnh8tOvb1mthu5NZyMz1A7+ +bH6/Z6sc0SgaSibXdPGUdezR+wvA0/5helLaZqHQfBRCRYI8Qk0gp08oTOKaZGaF +DPiCIoMgvnF43+Men9YbgefqEP8kV+C5SdB0y1KZ/06+xDKoHlRfCG8hO4/YDIQw +T333BQKBgQDLe6YiylFNmIu/ci9nGe/Fm6APNdlU7tuXHfdBxceaB8xbYulhEiwd +i4J5gARFNHnVn7V5FDzy1zZbFjUOGrzbEx9fAsCYBR+ahik/Oi4hrYSDVQdsHSIO +HHF4EHcI/fBE5m9OmPPVZICe3JJnIjaXKw3mOUEhG1EQab6SlRgWQQ== -----END RSA PRIVATE KEY----- From 09ec009d48d4430f7782116b5277ae5adcee3e39 Mon Sep 17 00:00:00 2001 From: Brandon Roberson Date: Fri, 9 May 2025 19:55:01 +0000 Subject: [PATCH 12/15] Regenerate protos (remove ProtoLocketClient) --- models/locket_bbs_grpc.pb.go | 55 +++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/models/locket_bbs_grpc.pb.go b/models/locket_bbs_grpc.pb.go index 1ecf684..3cffb60 100644 --- a/models/locket_bbs_grpc.pb.go +++ b/models/locket_bbs_grpc.pb.go @@ -9,6 +9,7 @@ package models import ( context "context" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -37,18 +38,18 @@ type LocketClient interface { } type locketClient struct { - cc grpc.ClientConnInterface - plc ProtoLocketClient + cc grpc.ClientConnInterface } func NewLocketClient(cc grpc.ClientConnInterface) LocketClient { - proto := NewProtoLocketClient(cc) - return &locketClient{cc, proto} + return &locketClient{cc} } func (c *locketClient) Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out, err := c.plc.ProtoLock(ctx, in.ToProto(), cOpts...) + out := new(ProtoLockResponse) + protoIn := in.ToProto() + err := c.cc.Invoke(ctx, Locket_Lock_FullMethodName, protoIn, out, cOpts...) if err != nil { return nil, err } @@ -57,7 +58,9 @@ func (c *locketClient) Lock(ctx context.Context, in *LockRequest, opts ...grpc.C func (c *locketClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out, err := c.plc.ProtoFetch(ctx, in.ToProto(), cOpts...) + out := new(ProtoFetchResponse) + protoIn := in.ToProto() + err := c.cc.Invoke(ctx, Locket_Fetch_FullMethodName, protoIn, out, cOpts...) if err != nil { return nil, err } @@ -66,7 +69,9 @@ func (c *locketClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc func (c *locketClient) Release(ctx context.Context, in *ReleaseRequest, opts ...grpc.CallOption) (*ReleaseResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out, err := c.plc.ProtoRelease(ctx, in.ToProto(), cOpts...) + out := new(ProtoReleaseResponse) + protoIn := in.ToProto() + err := c.cc.Invoke(ctx, Locket_Release_FullMethodName, protoIn, out, cOpts...) if err != nil { return nil, err } @@ -75,7 +80,9 @@ func (c *locketClient) Release(ctx context.Context, in *ReleaseRequest, opts ... func (c *locketClient) FetchAll(ctx context.Context, in *FetchAllRequest, opts ...grpc.CallOption) (*FetchAllResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out, err := c.plc.ProtoFetchAll(ctx, in.ToProto(), cOpts...) + out := new(ProtoFetchAllResponse) + protoIn := in.ToProto() + err := c.cc.Invoke(ctx, Locket_FetchAll_FullMethodName, protoIn, out, cOpts...) if err != nil { return nil, err } @@ -132,72 +139,80 @@ func RegisterLocketServer(s grpc.ServiceRegistrar, srv LocketServer) { func _Locket_Lock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(LockRequest) - if err := dec(in); err != nil { + if err := dec(in.ToProto()); err != nil { return nil, err } if interceptor == nil { - return srv.(LocketServer).Lock(ctx, in) + response, err := srv.(LocketServer).Lock(ctx, in) + return response.ToProto(), err } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: Locket_Lock_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LocketServer).Lock(ctx, req.(*LockRequest)) + response, err := srv.(LocketServer).Lock(ctx, req.(*LockRequest)) + return response.ToProto(), err } return interceptor(ctx, in, info, handler) } func _Locket_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(FetchRequest) - if err := dec(in); err != nil { + if err := dec(in.ToProto()); err != nil { return nil, err } if interceptor == nil { - return srv.(LocketServer).Fetch(ctx, in) + response, err := srv.(LocketServer).Fetch(ctx, in) + return response.ToProto(), err } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: Locket_Fetch_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LocketServer).Fetch(ctx, req.(*FetchRequest)) + response, err := srv.(LocketServer).Fetch(ctx, req.(*FetchRequest)) + return response.ToProto(), err } return interceptor(ctx, in, info, handler) } func _Locket_Release_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ReleaseRequest) - if err := dec(in); err != nil { + if err := dec(in.ToProto()); err != nil { return nil, err } if interceptor == nil { - return srv.(LocketServer).Release(ctx, in) + response, err := srv.(LocketServer).Release(ctx, in) + return response.ToProto(), err } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: Locket_Release_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LocketServer).Release(ctx, req.(*ReleaseRequest)) + response, err := srv.(LocketServer).Release(ctx, req.(*ReleaseRequest)) + return response.ToProto(), err } return interceptor(ctx, in, info, handler) } func _Locket_FetchAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(FetchAllRequest) - if err := dec(in); err != nil { + if err := dec(in.ToProto()); err != nil { return nil, err } if interceptor == nil { - return srv.(LocketServer).FetchAll(ctx, in) + response, err := srv.(LocketServer).FetchAll(ctx, in) + return response.ToProto(), err } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: Locket_FetchAll_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LocketServer).FetchAll(ctx, req.(*FetchAllRequest)) + response, err := srv.(LocketServer).FetchAll(ctx, req.(*FetchAllRequest)) + return response.ToProto(), err } return interceptor(ctx, in, info, handler) } From 6a31f4e99097efb7e8c21551e4452c33c43dea24 Mon Sep 17 00:00:00 2001 From: Brandon Roberson Date: Fri, 9 May 2025 20:26:38 +0000 Subject: [PATCH 13/15] Remove debug flag --- scripts/generate_protos.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate_protos.sh b/scripts/generate_protos.sh index c3fb080..b0a0e9a 100755 --- a/scripts/generate_protos.sh +++ b/scripts/generate_protos.sh @@ -3,7 +3,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" pushd "$DIR/../models" protoc --proto_path=../../bbs/protoc-gen-go-bbs:../../vendor:../../vendor/google.golang.org/protobuf/types/known/durationpb/:. \ --go_out=. --go_opt=paths=source_relative \ - --go-bbs_out=. --go-bbs_opt=paths=source_relative,debug=true \ + --go-bbs_out=. --go-bbs_opt=paths=source_relative \ --go-grpc_out=. --go-grpc_opt=paths=source_relative \ ./*.proto popd From d4c5a22c24772943136acde5bce8448205a6766f Mon Sep 17 00:00:00 2001 From: Brandon Roberson Date: Fri, 9 May 2025 20:27:49 +0000 Subject: [PATCH 14/15] Regenerate protos (in from protoIn) --- models/locket_bbs_grpc.pb.go | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/models/locket_bbs_grpc.pb.go b/models/locket_bbs_grpc.pb.go index 3cffb60..98142b8 100644 --- a/models/locket_bbs_grpc.pb.go +++ b/models/locket_bbs_grpc.pb.go @@ -9,7 +9,6 @@ package models import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -138,10 +137,12 @@ func RegisterLocketServer(s grpc.ServiceRegistrar, srv LocketServer) { } func _Locket_Lock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LockRequest) - if err := dec(in.ToProto()); err != nil { + protoIn := new(ProtoLockRequest) + if err := dec(protoIn); err != nil { return nil, err } + in := protoIn.FromProto() + if interceptor == nil { response, err := srv.(LocketServer).Lock(ctx, in) return response.ToProto(), err @@ -158,10 +159,12 @@ func _Locket_Lock_Handler(srv interface{}, ctx context.Context, dec func(interfa } func _Locket_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FetchRequest) - if err := dec(in.ToProto()); err != nil { + protoIn := new(ProtoFetchRequest) + if err := dec(protoIn); err != nil { return nil, err } + in := protoIn.FromProto() + if interceptor == nil { response, err := srv.(LocketServer).Fetch(ctx, in) return response.ToProto(), err @@ -178,10 +181,12 @@ func _Locket_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interf } func _Locket_Release_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ReleaseRequest) - if err := dec(in.ToProto()); err != nil { + protoIn := new(ProtoReleaseRequest) + if err := dec(protoIn); err != nil { return nil, err } + in := protoIn.FromProto() + if interceptor == nil { response, err := srv.(LocketServer).Release(ctx, in) return response.ToProto(), err @@ -198,10 +203,12 @@ func _Locket_Release_Handler(srv interface{}, ctx context.Context, dec func(inte } func _Locket_FetchAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FetchAllRequest) - if err := dec(in.ToProto()); err != nil { + protoIn := new(ProtoFetchAllRequest) + if err := dec(protoIn); err != nil { return nil, err } + in := protoIn.FromProto() + if interceptor == nil { response, err := srv.(LocketServer).FetchAll(ctx, in) return response.ToProto(), err From 1912cdc54959c75722c1eb43c8dc7393419e2134 Mon Sep 17 00:00:00 2001 From: Brandon Roberson Date: Mon, 30 Jun 2025 17:44:03 +0000 Subject: [PATCH 15/15] Regen protos --- models/locket.pb.go | 2 +- models/locket_bbs.pb.go | 2 +- models/locket_bbs_grpc.pb.go | 2 +- models/locket_grpc.pb.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/models/locket.pb.go b/models/locket.pb.go index 86662d2..e8771c6 100644 --- a/models/locket.pb.go +++ b/models/locket.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.6 -// protoc v6.30.2 +// protoc v6.31.1 // source: locket.proto package models diff --git a/models/locket_bbs.pb.go b/models/locket_bbs.pb.go index 6b1887f..7cff3d0 100644 --- a/models/locket_bbs.pb.go +++ b/models/locket_bbs.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-bbs. DO NOT EDIT. // versions: // - protoc-gen-go-bbs v0.0.1 -// - protoc v6.30.2 +// - protoc v6.31.1 // source: locket.proto package models diff --git a/models/locket_bbs_grpc.pb.go b/models/locket_bbs_grpc.pb.go index 98142b8..1b40b35 100644 --- a/models/locket_bbs_grpc.pb.go +++ b/models/locket_bbs_grpc.pb.go @@ -2,7 +2,7 @@ // versions: // - protoc-gen-go-bbs v0.0.1 // - protoc-gen-go-grpc TODO: get version -// - protoc v6.30.2 +// - protoc v6.31.1 // source: locket.proto package models diff --git a/models/locket_grpc.pb.go b/models/locket_grpc.pb.go index ae6fd82..7b7f994 100644 --- a/models/locket_grpc.pb.go +++ b/models/locket_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v6.30.2 +// - protoc v6.31.1 // source: locket.proto package models