diff --git a/client/client.go b/client/client.go deleted file mode 100644 index ad05315..0000000 --- a/client/client.go +++ /dev/null @@ -1,47 +0,0 @@ -package client - -import ( - "context" - - kraken "github.com/dezh-tech/immortal/client/gen" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - "google.golang.org/grpc/metadata" -) - -type Client struct { - RegistryService kraken.ServiceRegistryClient - ConfigService kraken.ConfigClient - conn *grpc.ClientConn -} - -func NewClient(endpoint string) (*Client, error) { - conn, err := grpc.NewClient(endpoint, grpc.WithTransportCredentials(insecure.NewCredentials())) - if err != nil { - return nil, err - } - - return &Client{ - RegistryService: kraken.NewServiceRegistryClient(conn), - ConfigService: kraken.NewConfigClient(conn), - conn: conn, - }, nil -} - -func (c *Client) RegisterService(ctx context.Context, - port, region string, hb uint32, -) (*kraken.RegisterServiceResponse, error) { - return c.RegistryService.RegisterService(ctx, &kraken.RegisterServiceRequest{ - Type: kraken.ServiceTypeEnum_RELAY, - Port: port, - HeartbeatDurationInSec: hb, - Region: region, - }) -} - -func (c *Client) GetConfig(ctx context.Context, id string) (*kraken.GetConfigResponse, error) { - md := metadata.New(map[string]string{"x-identifier": id}) - ctx = metadata.NewOutgoingContext(ctx, md) - - return c.ConfigService.GetConfig(ctx, &kraken.EmptyRequest{}) -} diff --git a/client/gen/kraken.pb.go b/client/gen/kraken.pb.go deleted file mode 100644 index 2d1b6d8..0000000 --- a/client/gen/kraken.pb.go +++ /dev/null @@ -1,823 +0,0 @@ -// Define the syntax version for Protocol Buffers - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc (unknown) -// source: kraken.proto - -// Define the package for the services and messages - -package client - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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) -) - -// Types of services that can be registered -type ServiceTypeEnum int32 - -const ( - ServiceTypeEnum_UNKNOWN ServiceTypeEnum = 0 // Unknown service type - ServiceTypeEnum_RELAY ServiceTypeEnum = 1 // Relay service type -) - -// Enum value maps for ServiceTypeEnum. -var ( - ServiceTypeEnum_name = map[int32]string{ - 0: "UNKNOWN", - 1: "RELAY", - } - ServiceTypeEnum_value = map[string]int32{ - "UNKNOWN": 0, - "RELAY": 1, - } -) - -func (x ServiceTypeEnum) Enum() *ServiceTypeEnum { - p := new(ServiceTypeEnum) - *p = x - return p -} - -func (x ServiceTypeEnum) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ServiceTypeEnum) Descriptor() protoreflect.EnumDescriptor { - return file_kraken_proto_enumTypes[0].Descriptor() -} - -func (ServiceTypeEnum) Type() protoreflect.EnumType { - return &file_kraken_proto_enumTypes[0] -} - -func (x ServiceTypeEnum) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ServiceTypeEnum.Descriptor instead. -func (ServiceTypeEnum) EnumDescriptor() ([]byte, []int) { - return file_kraken_proto_rawDescGZIP(), []int{0} -} - -// Request to register a service -type RegisterServiceRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Port string `protobuf:"bytes,1,opt,name=port,proto3" json:"port,omitempty"` // Service grpc port - HeartbeatDurationInSec uint32 `protobuf:"varint,2,opt,name=heartbeat_duration_in_sec,json=heartbeatDurationInSec,proto3" json:"heartbeat_duration_in_sec,omitempty"` // Heartbeat interval in seconds - Type ServiceTypeEnum `protobuf:"varint,3,opt,name=type,proto3,enum=kraken.ServiceTypeEnum" json:"type,omitempty"` // Type of the service (e.g., RELAY) - Region string `protobuf:"bytes,4,opt,name=region,proto3" json:"region,omitempty"` // Region of the service -} - -func (x *RegisterServiceRequest) Reset() { - *x = RegisterServiceRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_kraken_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RegisterServiceRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RegisterServiceRequest) ProtoMessage() {} - -func (x *RegisterServiceRequest) ProtoReflect() protoreflect.Message { - mi := &file_kraken_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) -} - -// Deprecated: Use RegisterServiceRequest.ProtoReflect.Descriptor instead. -func (*RegisterServiceRequest) Descriptor() ([]byte, []int) { - return file_kraken_proto_rawDescGZIP(), []int{0} -} - -func (x *RegisterServiceRequest) GetPort() string { - if x != nil { - return x.Port - } - return "" -} - -func (x *RegisterServiceRequest) GetHeartbeatDurationInSec() uint32 { - if x != nil { - return x.HeartbeatDurationInSec - } - return 0 -} - -func (x *RegisterServiceRequest) GetType() ServiceTypeEnum { - if x != nil { - return x.Type - } - return ServiceTypeEnum_UNKNOWN -} - -func (x *RegisterServiceRequest) GetRegion() string { - if x != nil { - return x.Region - } - return "" -} - -// Response after registering a service -type RegisterServiceResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // Indicates if registration was successful - Message *string `protobuf:"bytes,2,opt,name=message,proto3,oneof" json:"message,omitempty"` // Optional message with additional information - Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` // Token assigned to the registered service -} - -func (x *RegisterServiceResponse) Reset() { - *x = RegisterServiceResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_kraken_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RegisterServiceResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RegisterServiceResponse) ProtoMessage() {} - -func (x *RegisterServiceResponse) ProtoReflect() protoreflect.Message { - mi := &file_kraken_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 mi.MessageOf(x) -} - -// Deprecated: Use RegisterServiceResponse.ProtoReflect.Descriptor instead. -func (*RegisterServiceResponse) Descriptor() ([]byte, []int) { - return file_kraken_proto_rawDescGZIP(), []int{1} -} - -func (x *RegisterServiceResponse) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -func (x *RegisterServiceResponse) GetMessage() string { - if x != nil && x.Message != nil { - return *x.Message - } - return "" -} - -func (x *RegisterServiceResponse) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - -// Empty request used for methods that do not require parameters -type EmptyRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *EmptyRequest) Reset() { - *x = EmptyRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_kraken_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EmptyRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EmptyRequest) ProtoMessage() {} - -func (x *EmptyRequest) ProtoReflect() protoreflect.Message { - mi := &file_kraken_proto_msgTypes[2] - 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) -} - -// Deprecated: Use EmptyRequest.ProtoReflect.Descriptor instead. -func (*EmptyRequest) Descriptor() ([]byte, []int) { - return file_kraken_proto_rawDescGZIP(), []int{2} -} - -// Request to add a log entry -type AddLogRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // Log message content - Stack string `protobuf:"bytes,2,opt,name=stack,proto3" json:"stack,omitempty"` // Stack trace or additional log details -} - -func (x *AddLogRequest) Reset() { - *x = AddLogRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_kraken_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddLogRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddLogRequest) ProtoMessage() {} - -func (x *AddLogRequest) ProtoReflect() protoreflect.Message { - mi := &file_kraken_proto_msgTypes[3] - 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) -} - -// Deprecated: Use AddLogRequest.ProtoReflect.Descriptor instead. -func (*AddLogRequest) Descriptor() ([]byte, []int) { - return file_kraken_proto_rawDescGZIP(), []int{3} -} - -func (x *AddLogRequest) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -func (x *AddLogRequest) GetStack() string { - if x != nil { - return x.Stack - } - return "" -} - -// Response after adding a log entry -type AddLogResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // Indicates if the log entry was successfully added - Message *string `protobuf:"bytes,2,opt,name=message,proto3,oneof" json:"message,omitempty"` // Optional message with additional information -} - -func (x *AddLogResponse) Reset() { - *x = AddLogResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_kraken_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddLogResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddLogResponse) ProtoMessage() {} - -func (x *AddLogResponse) ProtoReflect() protoreflect.Message { - mi := &file_kraken_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 mi.MessageOf(x) -} - -// Deprecated: Use AddLogResponse.ProtoReflect.Descriptor instead. -func (*AddLogResponse) Descriptor() ([]byte, []int) { - return file_kraken_proto_rawDescGZIP(), []int{4} -} - -func (x *AddLogResponse) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -func (x *AddLogResponse) GetMessage() string { - if x != nil && x.Message != nil { - return *x.Message - } - return "" -} - -// Configuration limitations -type Limitations struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MaxMessageLength int32 `protobuf:"varint,1,opt,name=max_message_length,json=maxMessageLength,proto3" json:"max_message_length,omitempty"` // Maximum allowed message length - MaxSubscriptions int32 `protobuf:"varint,2,opt,name=max_subscriptions,json=maxSubscriptions,proto3" json:"max_subscriptions,omitempty"` // Maximum number of subscriptions allowed - MaxFilters int32 `protobuf:"varint,3,opt,name=max_filters,json=maxFilters,proto3" json:"max_filters,omitempty"` // Maximum number of filters allowed - MaxSubidLength int32 `protobuf:"varint,4,opt,name=max_subid_length,json=maxSubidLength,proto3" json:"max_subid_length,omitempty"` // Maximum length of a subscription ID - MinPowDifficulty int32 `protobuf:"varint,5,opt,name=min_pow_difficulty,json=minPowDifficulty,proto3" json:"min_pow_difficulty,omitempty"` // Minimum proof-of-work difficulty - AuthRequired bool `protobuf:"varint,6,opt,name=auth_required,json=authRequired,proto3" json:"auth_required,omitempty"` // Indicates if authentication is required - PaymentRequired bool `protobuf:"varint,7,opt,name=payment_required,json=paymentRequired,proto3" json:"payment_required,omitempty"` // Indicates if payment is required - RestrictedWrites bool `protobuf:"varint,8,opt,name=restricted_writes,json=restrictedWrites,proto3" json:"restricted_writes,omitempty"` // Indicates if writes are restricted - MaxEventTags int32 `protobuf:"varint,9,opt,name=max_event_tags,json=maxEventTags,proto3" json:"max_event_tags,omitempty"` // Maximum number of event tags allowed - MaxContentLength int32 `protobuf:"varint,10,opt,name=max_content_length,json=maxContentLength,proto3" json:"max_content_length,omitempty"` // Maximum length of content allowed - CreatedAtLowerLimit int64 `protobuf:"varint,11,opt,name=created_at_lower_limit,json=createdAtLowerLimit,proto3" json:"created_at_lower_limit,omitempty"` // Lower limit for creation timestamps - CreatedAtUpperLimit int64 `protobuf:"varint,12,opt,name=created_at_upper_limit,json=createdAtUpperLimit,proto3" json:"created_at_upper_limit,omitempty"` // Upper limit for creation timestamps - DefaultQueryLimit uint32 `protobuf:"varint,13,opt,name=default_query_limit,json=defaultQueryLimit,proto3" json:"default_query_limit,omitempty"` // Defualt of query limit - MaxQueryLimit uint32 `protobuf:"varint,14,opt,name=max_query_limit,json=maxQueryLimit,proto3" json:"max_query_limit,omitempty"` // Maximum of query limit -} - -func (x *Limitations) Reset() { - *x = Limitations{} - if protoimpl.UnsafeEnabled { - mi := &file_kraken_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Limitations) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Limitations) ProtoMessage() {} - -func (x *Limitations) ProtoReflect() protoreflect.Message { - mi := &file_kraken_proto_msgTypes[5] - 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) -} - -// Deprecated: Use Limitations.ProtoReflect.Descriptor instead. -func (*Limitations) Descriptor() ([]byte, []int) { - return file_kraken_proto_rawDescGZIP(), []int{5} -} - -func (x *Limitations) GetMaxMessageLength() int32 { - if x != nil { - return x.MaxMessageLength - } - return 0 -} - -func (x *Limitations) GetMaxSubscriptions() int32 { - if x != nil { - return x.MaxSubscriptions - } - return 0 -} - -func (x *Limitations) GetMaxFilters() int32 { - if x != nil { - return x.MaxFilters - } - return 0 -} - -func (x *Limitations) GetMaxSubidLength() int32 { - if x != nil { - return x.MaxSubidLength - } - return 0 -} - -func (x *Limitations) GetMinPowDifficulty() int32 { - if x != nil { - return x.MinPowDifficulty - } - return 0 -} - -func (x *Limitations) GetAuthRequired() bool { - if x != nil { - return x.AuthRequired - } - return false -} - -func (x *Limitations) GetPaymentRequired() bool { - if x != nil { - return x.PaymentRequired - } - return false -} - -func (x *Limitations) GetRestrictedWrites() bool { - if x != nil { - return x.RestrictedWrites - } - return false -} - -func (x *Limitations) GetMaxEventTags() int32 { - if x != nil { - return x.MaxEventTags - } - return 0 -} - -func (x *Limitations) GetMaxContentLength() int32 { - if x != nil { - return x.MaxContentLength - } - return 0 -} - -func (x *Limitations) GetCreatedAtLowerLimit() int64 { - if x != nil { - return x.CreatedAtLowerLimit - } - return 0 -} - -func (x *Limitations) GetCreatedAtUpperLimit() int64 { - if x != nil { - return x.CreatedAtUpperLimit - } - return 0 -} - -func (x *Limitations) GetDefaultQueryLimit() uint32 { - if x != nil { - return x.DefaultQueryLimit - } - return 0 -} - -func (x *Limitations) GetMaxQueryLimit() uint32 { - if x != nil { - return x.MaxQueryLimit - } - return 0 -} - -// Response containing configuration details -type GetConfigResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Limitations *Limitations `protobuf:"bytes,1,opt,name=limitations,proto3" json:"limitations,omitempty"` // Configuration limitations - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` // Service URL -} - -func (x *GetConfigResponse) Reset() { - *x = GetConfigResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_kraken_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetConfigResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetConfigResponse) ProtoMessage() {} - -func (x *GetConfigResponse) ProtoReflect() protoreflect.Message { - mi := &file_kraken_proto_msgTypes[6] - 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) -} - -// Deprecated: Use GetConfigResponse.ProtoReflect.Descriptor instead. -func (*GetConfigResponse) Descriptor() ([]byte, []int) { - return file_kraken_proto_rawDescGZIP(), []int{6} -} - -func (x *GetConfigResponse) GetLimitations() *Limitations { - if x != nil { - return x.Limitations - } - return nil -} - -func (x *GetConfigResponse) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -var File_kraken_proto protoreflect.FileDescriptor - -var file_kraken_proto_rawDesc = []byte{ - 0x0a, 0x0c, 0x6b, 0x72, 0x61, 0x6b, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, - 0x6b, 0x72, 0x61, 0x6b, 0x65, 0x6e, 0x22, 0xac, 0x01, 0x0a, 0x16, 0x72, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x39, 0x0a, 0x19, 0x68, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, - 0x61, 0x74, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x5f, 0x73, - 0x65, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x16, 0x68, 0x65, 0x61, 0x72, 0x74, 0x62, - 0x65, 0x61, 0x74, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x53, 0x65, 0x63, - 0x12, 0x2b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, - 0x2e, 0x6b, 0x72, 0x61, 0x6b, 0x65, 0x6e, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, - 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, - 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x22, 0x74, 0x0a, 0x17, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, - 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x07, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x42, - 0x0a, 0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x0e, 0x0a, 0x0c, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x3f, 0x0a, 0x0d, 0x61, - 0x64, 0x64, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x22, 0x55, 0x0a, 0x0e, - 0x61, 0x64, 0x64, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, - 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x22, 0xf4, 0x04, 0x0a, 0x0b, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x6d, 0x61, 0x78, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x10, 0x6d, 0x61, 0x78, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x12, 0x2b, 0x0a, 0x11, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x6d, 0x61, - 0x78, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1f, - 0x0a, 0x0b, 0x6d, 0x61, 0x78, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6d, 0x61, 0x78, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x12, - 0x28, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x75, 0x62, 0x69, 0x64, 0x5f, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x53, 0x75, - 0x62, 0x69, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x2c, 0x0a, 0x12, 0x6d, 0x69, 0x6e, - 0x5f, 0x70, 0x6f, 0x77, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x6d, 0x69, 0x6e, 0x50, 0x6f, 0x77, 0x44, 0x69, 0x66, - 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x5f, - 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, - 0x61, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x29, 0x0a, 0x10, - 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x72, 0x65, 0x73, 0x74, 0x72, - 0x69, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x73, 0x18, 0x08, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x10, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x65, 0x64, 0x57, 0x72, - 0x69, 0x74, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0e, 0x6d, 0x61, 0x78, 0x5f, 0x65, 0x76, 0x65, 0x6e, - 0x74, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x61, - 0x78, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x61, 0x67, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x6d, 0x61, - 0x78, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x43, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x33, 0x0a, 0x16, 0x63, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x5f, 0x6c, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x6c, 0x69, 0x6d, - 0x69, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x13, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x64, 0x41, 0x74, 0x4c, 0x6f, 0x77, 0x65, 0x72, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x33, 0x0a, - 0x16, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x5f, 0x75, 0x70, 0x70, 0x65, - 0x72, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x13, 0x63, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x55, 0x70, 0x70, 0x65, 0x72, 0x4c, 0x69, 0x6d, - 0x69, 0x74, 0x12, 0x2e, 0x0a, 0x13, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x71, 0x75, - 0x65, 0x72, 0x79, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x11, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x6d, - 0x69, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, - 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x6d, 0x61, 0x78, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x5c, 0x0a, 0x11, 0x67, 0x65, - 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x35, 0x0a, 0x0b, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6b, 0x72, 0x61, 0x6b, 0x65, 0x6e, 0x2e, 0x6c, 0x69, - 0x6d, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0b, 0x6c, 0x69, 0x6d, 0x69, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x2a, 0x29, 0x0a, 0x0f, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0b, 0x0a, 0x07, 0x55, - 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x4c, 0x41, - 0x59, 0x10, 0x01, 0x32, 0x65, 0x0a, 0x0f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, - 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x12, 0x52, 0x0a, 0x0f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, - 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1e, 0x2e, 0x6b, 0x72, 0x61, 0x6b, - 0x65, 0x6e, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6b, 0x72, 0x61, 0x6b, - 0x65, 0x6e, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x46, 0x0a, 0x06, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3c, 0x0a, 0x09, 0x67, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x12, 0x14, 0x2e, 0x6b, 0x72, 0x61, 0x6b, 0x65, 0x6e, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6b, 0x72, 0x61, 0x6b, 0x65, 0x6e, - 0x2e, 0x67, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x32, 0x3e, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x37, 0x0a, 0x06, 0x61, 0x64, 0x64, - 0x4c, 0x6f, 0x67, 0x12, 0x15, 0x2e, 0x6b, 0x72, 0x61, 0x6b, 0x65, 0x6e, 0x2e, 0x61, 0x64, 0x64, - 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6b, 0x72, 0x61, - 0x6b, 0x65, 0x6e, 0x2e, 0x61, 0x64, 0x64, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x64, 0x65, 0x7a, 0x68, 0x2d, 0x74, 0x65, 0x63, 0x68, 0x2f, 0x69, 0x6d, 0x6d, 0x6f, 0x72, - 0x74, 0x61, 0x6c, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_kraken_proto_rawDescOnce sync.Once - file_kraken_proto_rawDescData = file_kraken_proto_rawDesc -) - -func file_kraken_proto_rawDescGZIP() []byte { - file_kraken_proto_rawDescOnce.Do(func() { - file_kraken_proto_rawDescData = protoimpl.X.CompressGZIP(file_kraken_proto_rawDescData) - }) - return file_kraken_proto_rawDescData -} - -var file_kraken_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_kraken_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_kraken_proto_goTypes = []interface{}{ - (ServiceTypeEnum)(0), // 0: kraken.ServiceTypeEnum - (*RegisterServiceRequest)(nil), // 1: kraken.registerServiceRequest - (*RegisterServiceResponse)(nil), // 2: kraken.registerServiceResponse - (*EmptyRequest)(nil), // 3: kraken.EmptyRequest - (*AddLogRequest)(nil), // 4: kraken.addLogRequest - (*AddLogResponse)(nil), // 5: kraken.addLogResponse - (*Limitations)(nil), // 6: kraken.limitations - (*GetConfigResponse)(nil), // 7: kraken.getConfigResponse -} -var file_kraken_proto_depIdxs = []int32{ - 0, // 0: kraken.registerServiceRequest.type:type_name -> kraken.ServiceTypeEnum - 6, // 1: kraken.getConfigResponse.limitations:type_name -> kraken.limitations - 1, // 2: kraken.ServiceRegistry.registerService:input_type -> kraken.registerServiceRequest - 3, // 3: kraken.Config.getConfig:input_type -> kraken.EmptyRequest - 4, // 4: kraken.Log.addLog:input_type -> kraken.addLogRequest - 2, // 5: kraken.ServiceRegistry.registerService:output_type -> kraken.registerServiceResponse - 7, // 6: kraken.Config.getConfig:output_type -> kraken.getConfigResponse - 5, // 7: kraken.Log.addLog:output_type -> kraken.addLogResponse - 5, // [5:8] is the sub-list for method output_type - 2, // [2:5] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_kraken_proto_init() } -func file_kraken_proto_init() { - if File_kraken_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_kraken_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegisterServiceRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_kraken_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegisterServiceResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_kraken_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EmptyRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_kraken_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddLogRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_kraken_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddLogResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_kraken_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Limitations); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_kraken_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetConfigResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_kraken_proto_msgTypes[1].OneofWrappers = []interface{}{} - file_kraken_proto_msgTypes[4].OneofWrappers = []interface{}{} - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_kraken_proto_rawDesc, - NumEnums: 1, - NumMessages: 7, - NumExtensions: 0, - NumServices: 3, - }, - GoTypes: file_kraken_proto_goTypes, - DependencyIndexes: file_kraken_proto_depIdxs, - EnumInfos: file_kraken_proto_enumTypes, - MessageInfos: file_kraken_proto_msgTypes, - }.Build() - File_kraken_proto = out.File - file_kraken_proto_rawDesc = nil - file_kraken_proto_goTypes = nil - file_kraken_proto_depIdxs = nil -} diff --git a/client/gen/kraken_grpc.pb.go b/client/gen/kraken_grpc.pb.go deleted file mode 100644 index 3905f12..0000000 --- a/client/gen/kraken_grpc.pb.go +++ /dev/null @@ -1,293 +0,0 @@ -// Define the syntax version for Protocol Buffers - -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc (unknown) -// source: kraken.proto - -// Define the package for the services and messages - -package client - -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.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - ServiceRegistry_RegisterService_FullMethodName = "/kraken.ServiceRegistry/registerService" -) - -// ServiceRegistryClient is the client API for ServiceRegistry 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 ServiceRegistryClient interface { - // Registers a service with the registry - RegisterService(ctx context.Context, in *RegisterServiceRequest, opts ...grpc.CallOption) (*RegisterServiceResponse, error) -} - -type serviceRegistryClient struct { - cc grpc.ClientConnInterface -} - -func NewServiceRegistryClient(cc grpc.ClientConnInterface) ServiceRegistryClient { - return &serviceRegistryClient{cc} -} - -func (c *serviceRegistryClient) RegisterService(ctx context.Context, in *RegisterServiceRequest, opts ...grpc.CallOption) (*RegisterServiceResponse, error) { - out := new(RegisterServiceResponse) - err := c.cc.Invoke(ctx, ServiceRegistry_RegisterService_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ServiceRegistryServer is the server API for ServiceRegistry service. -// All implementations should embed UnimplementedServiceRegistryServer -// for forward compatibility -type ServiceRegistryServer interface { - // Registers a service with the registry - RegisterService(context.Context, *RegisterServiceRequest) (*RegisterServiceResponse, error) -} - -// UnimplementedServiceRegistryServer should be embedded to have forward compatible implementations. -type UnimplementedServiceRegistryServer struct { -} - -func (UnimplementedServiceRegistryServer) RegisterService(context.Context, *RegisterServiceRequest) (*RegisterServiceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RegisterService not implemented") -} - -// UnsafeServiceRegistryServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ServiceRegistryServer will -// result in compilation errors. -type UnsafeServiceRegistryServer interface { - mustEmbedUnimplementedServiceRegistryServer() -} - -func RegisterServiceRegistryServer(s grpc.ServiceRegistrar, srv ServiceRegistryServer) { - s.RegisterService(&ServiceRegistry_ServiceDesc, srv) -} - -func _ServiceRegistry_RegisterService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RegisterServiceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceRegistryServer).RegisterService(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ServiceRegistry_RegisterService_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceRegistryServer).RegisterService(ctx, req.(*RegisterServiceRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// ServiceRegistry_ServiceDesc is the grpc.ServiceDesc for ServiceRegistry service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var ServiceRegistry_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "kraken.ServiceRegistry", - HandlerType: (*ServiceRegistryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "registerService", - Handler: _ServiceRegistry_RegisterService_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "kraken.proto", -} - -const ( - Config_GetConfig_FullMethodName = "/kraken.Config/getConfig" -) - -// ConfigClient is the client API for Config 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 ConfigClient interface { - // Retrieves the current configuration - GetConfig(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*GetConfigResponse, error) -} - -type configClient struct { - cc grpc.ClientConnInterface -} - -func NewConfigClient(cc grpc.ClientConnInterface) ConfigClient { - return &configClient{cc} -} - -func (c *configClient) GetConfig(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*GetConfigResponse, error) { - out := new(GetConfigResponse) - err := c.cc.Invoke(ctx, Config_GetConfig_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ConfigServer is the server API for Config service. -// All implementations should embed UnimplementedConfigServer -// for forward compatibility -type ConfigServer interface { - // Retrieves the current configuration - GetConfig(context.Context, *EmptyRequest) (*GetConfigResponse, error) -} - -// UnimplementedConfigServer should be embedded to have forward compatible implementations. -type UnimplementedConfigServer struct { -} - -func (UnimplementedConfigServer) GetConfig(context.Context, *EmptyRequest) (*GetConfigResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetConfig not implemented") -} - -// UnsafeConfigServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ConfigServer will -// result in compilation errors. -type UnsafeConfigServer interface { - mustEmbedUnimplementedConfigServer() -} - -func RegisterConfigServer(s grpc.ServiceRegistrar, srv ConfigServer) { - s.RegisterService(&Config_ServiceDesc, srv) -} - -func _Config_GetConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(EmptyRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ConfigServer).GetConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Config_GetConfig_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ConfigServer).GetConfig(ctx, req.(*EmptyRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Config_ServiceDesc is the grpc.ServiceDesc for Config service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Config_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "kraken.Config", - HandlerType: (*ConfigServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "getConfig", - Handler: _Config_GetConfig_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "kraken.proto", -} - -const ( - Log_AddLog_FullMethodName = "/kraken.Log/addLog" -) - -// LogClient is the client API for Log 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 LogClient interface { - // Adds a log entry - AddLog(ctx context.Context, in *AddLogRequest, opts ...grpc.CallOption) (*AddLogResponse, error) -} - -type logClient struct { - cc grpc.ClientConnInterface -} - -func NewLogClient(cc grpc.ClientConnInterface) LogClient { - return &logClient{cc} -} - -func (c *logClient) AddLog(ctx context.Context, in *AddLogRequest, opts ...grpc.CallOption) (*AddLogResponse, error) { - out := new(AddLogResponse) - err := c.cc.Invoke(ctx, Log_AddLog_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// LogServer is the server API for Log service. -// All implementations should embed UnimplementedLogServer -// for forward compatibility -type LogServer interface { - // Adds a log entry - AddLog(context.Context, *AddLogRequest) (*AddLogResponse, error) -} - -// UnimplementedLogServer should be embedded to have forward compatible implementations. -type UnimplementedLogServer struct { -} - -func (UnimplementedLogServer) AddLog(context.Context, *AddLogRequest) (*AddLogResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddLog not implemented") -} - -// UnsafeLogServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to LogServer will -// result in compilation errors. -type UnsafeLogServer interface { - mustEmbedUnimplementedLogServer() -} - -func RegisterLogServer(s grpc.ServiceRegistrar, srv LogServer) { - s.RegisterService(&Log_ServiceDesc, srv) -} - -func _Log_AddLog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AddLogRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogServer).AddLog(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Log_AddLog_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogServer).AddLog(ctx, req.(*AddLogRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Log_ServiceDesc is the grpc.ServiceDesc for Log service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Log_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "kraken.Log", - HandlerType: (*LogServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "addLog", - Handler: _Log_AddLog_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "kraken.proto", -} diff --git a/client/proto/kraken.proto b/client/proto/kraken.proto deleted file mode 100644 index 7172874..0000000 --- a/client/proto/kraken.proto +++ /dev/null @@ -1,91 +0,0 @@ -// Define the syntax version for Protocol Buffers -syntax = "proto3"; - -// Define the package for the services and messages -package kraken; - -option go_package = "github.com/dezh-tech/immortal/client"; - -// Service definitions - -// ServiceRegistry handles service registration -service ServiceRegistry { - // Registers a service with the registry - rpc registerService (registerServiceRequest) returns (registerServiceResponse); -} - -// Config service provides configuration details -service Config { - // Retrieves the current configuration - rpc getConfig (EmptyRequest) returns (getConfigResponse); -} - -// Log service handles logging operations -service Log { - // Adds a log entry - rpc addLog (addLogRequest) returns (addLogResponse); -} - -// Message definitions - -// Request to register a service -message registerServiceRequest { - string port = 1; // Service grpc port - uint32 heartbeat_duration_in_sec = 2; // Heartbeat interval in seconds - ServiceTypeEnum type = 3; // Type of the service (e.g., RELAY) - string region = 4; // Region of the service -} - -// Response after registering a service -message registerServiceResponse { - bool success = 1; // Indicates if registration was successful - optional string message = 2; // Optional message with additional information - string token = 3; // Token assigned to the registered service -} - -// Empty request used for methods that do not require parameters -message EmptyRequest {} - -// Request to add a log entry -message addLogRequest { - string message = 1; // Log message content - string stack = 2; // Stack trace or additional log details -} - -// Response after adding a log entry -message addLogResponse { - bool success = 1; // Indicates if the log entry was successfully added - optional string message = 2; // Optional message with additional information -} - -// Configuration limitations -message limitations { - int32 max_message_length = 1; // Maximum allowed message length - int32 max_subscriptions = 2; // Maximum number of subscriptions allowed - int32 max_filters = 3; // Maximum number of filters allowed - int32 max_subid_length = 4; // Maximum length of a subscription ID - int32 min_pow_difficulty = 5; // Minimum proof-of-work difficulty - bool auth_required = 6; // Indicates if authentication is required - bool payment_required = 7; // Indicates if payment is required - bool restricted_writes = 8; // Indicates if writes are restricted - int32 max_event_tags = 9; // Maximum number of event tags allowed - int32 max_content_length = 10; // Maximum length of content allowed - int64 created_at_lower_limit = 11; // Lower limit for creation timestamps - int64 created_at_upper_limit = 12; // Upper limit for creation timestamps - uint32 default_query_limit = 13; // Defualt of query limit - uint32 max_query_limit = 14; // Maximum of query limit -} - -// Response containing configuration details -message getConfigResponse { - limitations limitations = 1; // Configuration limitations - string url = 2; // Service URL -} - -// Enum definitions - -// Types of services that can be registered -enum ServiceTypeEnum { - UNKNOWN = 0; // Unknown service type - RELAY = 1; // Relay service type -} diff --git a/cmd/commands/run.go b/cmd/commands/run.go index dafbd43..4af82e9 100644 --- a/cmd/commands/run.go +++ b/cmd/commands/run.go @@ -7,8 +7,8 @@ import ( "os/signal" "syscall" + "github.com/dezh-tech/immortal/cmd/relay" "github.com/dezh-tech/immortal/config" - "github.com/dezh-tech/immortal/relay" ) func HandleRun(args []string) { diff --git a/relay/relay.go b/cmd/relay/relay.go similarity index 76% rename from relay/relay.go rename to cmd/relay/relay.go index ea8c57b..b735223 100644 --- a/relay/relay.go +++ b/cmd/relay/relay.go @@ -6,14 +6,14 @@ import ( "log" "time" - "github.com/dezh-tech/immortal/client" "github.com/dezh-tech/immortal/config" - "github.com/dezh-tech/immortal/database" - "github.com/dezh-tech/immortal/handler" - "github.com/dezh-tech/immortal/metrics" - "github.com/dezh-tech/immortal/relay/redis" - "github.com/dezh-tech/immortal/server/grpc" - "github.com/dezh-tech/immortal/server/websocket" + "github.com/dezh-tech/immortal/delivery/grpc" + "github.com/dezh-tech/immortal/delivery/websocket" + "github.com/dezh-tech/immortal/infrastructure/database" + grpcclient "github.com/dezh-tech/immortal/infrastructure/grpc_client" + "github.com/dezh-tech/immortal/infrastructure/metrics" + "github.com/dezh-tech/immortal/infrastructure/redis" + "github.com/dezh-tech/immortal/repository" ) // Relay keeps all concepts such as server, database and manages them. @@ -39,13 +39,13 @@ func New(cfg *config.Config) (*Relay, error) { return nil, err } - c, err := client.NewClient(cfg.Kraken.Endpoint) + c, err := grpcclient.New(cfg.GRPCClient.Endpoint) if err != nil { return nil, err } resp, err := c.RegisterService(context.Background(), fmt.Sprint(cfg.GRPCServer.Port), - cfg.Kraken.Region, cfg.Kraken.Heartbeat) + cfg.GRPCClient.Region, cfg.GRPCClient.Heartbeat) if err != nil { return nil, err } @@ -54,7 +54,7 @@ func New(cfg *config.Config) (*Relay, error) { return nil, fmt.Errorf("cant register to master: %s", *resp.Message) } - params, err := c.GetConfig(context.Background(), resp.Token) + params, err := c.GetParameters(context.Background(), resp.Token) if err != nil { return nil, err } @@ -64,7 +64,7 @@ func New(cfg *config.Config) (*Relay, error) { return nil, err } - h := handler.New(db, cfg.Handler) + h := repository.New(db, cfg.Handler) ws, err := websocket.New(cfg.WebsocketServer, h, m, r) if err != nil { diff --git a/config/config.go b/config/config.go index 80e2ec3..008a143 100644 --- a/config/config.go +++ b/config/config.go @@ -3,25 +3,25 @@ package config import ( "os" - "github.com/dezh-tech/immortal/client" - "github.com/dezh-tech/immortal/database" - "github.com/dezh-tech/immortal/handler" - "github.com/dezh-tech/immortal/relay/redis" - "github.com/dezh-tech/immortal/server/grpc" - "github.com/dezh-tech/immortal/server/websocket" + "github.com/dezh-tech/immortal/delivery/grpc" + "github.com/dezh-tech/immortal/delivery/websocket" + "github.com/dezh-tech/immortal/infrastructure/database" + grpcclient "github.com/dezh-tech/immortal/infrastructure/grpc_client" + "github.com/dezh-tech/immortal/infrastructure/redis" + "github.com/dezh-tech/immortal/repository" "github.com/joho/godotenv" "gopkg.in/yaml.v3" ) // Config represents the configs used by relay and other concepts on system. type Config struct { - Environment string `yaml:"environment"` - Kraken client.Config `yaml:"kraken"` - WebsocketServer websocket.Config `yaml:"ws_server"` - Database database.Config `yaml:"database"` - RedisConf redis.Config `yaml:"redis"` - GRPCServer grpc.Config `yaml:"grpc_server"` - Handler handler.Config + Environment string `yaml:"environment"` + GRPCClient grpcclient.Config `yaml:"manager"` + WebsocketServer websocket.Config `yaml:"ws_server"` + Database database.Config `yaml:"database"` + RedisConf redis.Config `yaml:"redis"` + GRPCServer grpc.Config `yaml:"grpc_server"` + Handler repository.Config } // Load loads config from file and env. diff --git a/config/config.yml b/config/config.yml index ffab3a2..2242e53 100644 --- a/config/config.yml +++ b/config/config.yml @@ -28,13 +28,13 @@ grpc_server: # default is 50050. port: 50050 -# kraken contains information about connection with kraken instance. -kraken: - # IP address of kraken instance. - # default is local network kraken:8888. - endpoint: "kraken:8888" +# manager contains information about connection with manager instance. +manger: + # IP address of manager instance. + # default is local network manager:8888. + endpoint: "manager:8888" - # duration for kraken to ping this relay. + # duration for manager to ping this relay. # default is 1 minute. heartbeat_in_second: 60 diff --git a/config/parameters.go b/config/parameters.go index 7b45e6d..fd678d6 100644 --- a/config/parameters.go +++ b/config/parameters.go @@ -1,18 +1,18 @@ package config import ( - kraken "github.com/dezh-tech/immortal/client/gen" - "github.com/dezh-tech/immortal/handler" - "github.com/dezh-tech/immortal/server/websocket" + "github.com/dezh-tech/immortal/delivery/websocket" + mpb "github.com/dezh-tech/immortal/infrastructure/grpc_client/gen" + "github.com/dezh-tech/immortal/repository" "github.com/dezh-tech/immortal/utils" ) type Parameters struct { - Handler *handler.Config + Handler *repository.Config WebsocketServer *websocket.Config } -func (c *Config) LoadParameters(params *kraken.GetConfigResponse) error { +func (c *Config) LoadParameters(params *mpb.GetParametersResponse) error { url, err := utils.ParseURL(params.Url) if err != nil { return err @@ -35,7 +35,7 @@ func (c *Config) LoadParameters(params *kraken.GetConfigResponse) error { CreatedAtUpperLimit: params.Limitations.CreatedAtUpperLimit, } - c.Handler = handler.Config{ + c.Handler = repository.Config{ DefaultQueryLimit: params.Limitations.DefaultQueryLimit, MaxQueryLimit: params.Limitations.MaxQueryLimit, } diff --git a/client/buf/buf.gen.yaml b/delivery/grpc/buf/buf.gen.yaml similarity index 100% rename from client/buf/buf.gen.yaml rename to delivery/grpc/buf/buf.gen.yaml diff --git a/server/grpc/config.go b/delivery/grpc/config.go similarity index 100% rename from server/grpc/config.go rename to delivery/grpc/config.go diff --git a/server/grpc/gen/health.pb.go b/delivery/grpc/gen/health.pb.go similarity index 88% rename from server/grpc/gen/health.pb.go rename to delivery/grpc/gen/health.pb.go index 5363093..9e938a0 100644 --- a/server/grpc/gen/health.pb.go +++ b/delivery/grpc/gen/health.pb.go @@ -4,7 +4,7 @@ // protoc (unknown) // source: health.proto -package gen +package grpc import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -75,7 +75,7 @@ type Service struct { unknownFields protoimpl.UnknownFields Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=immortal.Status" json:"status,omitempty"` + Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=relay.v1.Status" json:"status,omitempty"` Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` } @@ -237,17 +237,17 @@ var File_health_proto protoreflect.FileDescriptor var file_health_proto_rawDesc = []byte{ 0x0a, 0x0c, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, - 0x69, 0x6d, 0x6d, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x22, 0x61, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, + 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x76, 0x31, 0x22, 0x61, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x69, 0x6d, 0x6d, 0x6f, 0x72, 0x74, - 0x61, 0x6c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, + 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x71, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x11, 0x2e, 0x69, 0x6d, 0x6d, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, + 0x32, 0x11, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, @@ -257,13 +257,13 @@ var file_health_proto_rawDesc = []byte{ 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x49, 0x53, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x02, 0x32, 0x4c, 0x0a, 0x0d, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x17, 0x2e, 0x69, 0x6d, 0x6d, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x69, 0x6d, - 0x6d, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x75, 0x73, 0x12, 0x17, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, 0x65, + 0x6c, 0x61, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x2d, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x65, 0x7a, 0x68, 0x2d, 0x74, 0x65, 0x63, 0x68, 0x2f, 0x69, 0x6d, - 0x6d, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x67, 0x72, - 0x70, 0x63, 0x2f, 0x67, 0x65, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -281,16 +281,16 @@ func file_health_proto_rawDescGZIP() []byte { var file_health_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_health_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_health_proto_goTypes = []interface{}{ - (Status)(0), // 0: immortal.Status - (*Service)(nil), // 1: immortal.Service - (*StatusRequest)(nil), // 2: immortal.StatusRequest - (*StatusResponse)(nil), // 3: immortal.StatusResponse + (Status)(0), // 0: relay.v1.Status + (*Service)(nil), // 1: relay.v1.Service + (*StatusRequest)(nil), // 2: relay.v1.StatusRequest + (*StatusResponse)(nil), // 3: relay.v1.StatusResponse } var file_health_proto_depIdxs = []int32{ - 0, // 0: immortal.Service.status:type_name -> immortal.Status - 1, // 1: immortal.StatusResponse.services:type_name -> immortal.Service - 2, // 2: immortal.HealthService.Status:input_type -> immortal.StatusRequest - 3, // 3: immortal.HealthService.Status:output_type -> immortal.StatusResponse + 0, // 0: relay.v1.Service.status:type_name -> relay.v1.Status + 1, // 1: relay.v1.StatusResponse.services:type_name -> relay.v1.Service + 2, // 2: relay.v1.HealthService.Status:input_type -> relay.v1.StatusRequest + 3, // 3: relay.v1.HealthService.Status:output_type -> relay.v1.StatusResponse 3, // [3:4] is the sub-list for method output_type 2, // [2:3] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name diff --git a/server/grpc/gen/health_grpc.pb.go b/delivery/grpc/gen/health_grpc.pb.go similarity index 96% rename from server/grpc/gen/health_grpc.pb.go rename to delivery/grpc/gen/health_grpc.pb.go index 7c9afc5..1db2542 100644 --- a/server/grpc/gen/health_grpc.pb.go +++ b/delivery/grpc/gen/health_grpc.pb.go @@ -4,7 +4,7 @@ // - protoc (unknown) // source: health.proto -package gen +package grpc import ( context "context" @@ -19,7 +19,7 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - HealthService_Status_FullMethodName = "/immortal.HealthService/Status" + HealthService_Status_FullMethodName = "/relay.v1.HealthService/Status" ) // HealthServiceClient is the client API for HealthService service. @@ -94,7 +94,7 @@ func _HealthService_Status_Handler(srv interface{}, ctx context.Context, dec fun // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var HealthService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "immortal.HealthService", + ServiceName: "relay.v1.HealthService", HandlerType: (*HealthServiceServer)(nil), Methods: []grpc.MethodDesc{ { diff --git a/server/grpc/health.go b/delivery/grpc/health.go similarity index 64% rename from server/grpc/health.go rename to delivery/grpc/health.go index 402c60d..3542a45 100644 --- a/server/grpc/health.go +++ b/delivery/grpc/health.go @@ -5,7 +5,7 @@ import ( "time" "github.com/dezh-tech/immortal" - "github.com/dezh-tech/immortal/server/grpc/gen" + rpb "github.com/dezh-tech/immortal/delivery/grpc/gen" ) type healthServer struct { @@ -18,18 +18,18 @@ func newHealthServer(server *Server) *healthServer { } } -func (s healthServer) Status(ctx context.Context, _ *gen.StatusRequest) (*gen.StatusResponse, error) { - services := make([]*gen.Service, 0) +func (s healthServer) Status(ctx context.Context, _ *rpb.StatusRequest) (*rpb.StatusResponse, error) { + services := make([]*rpb.Service, 0) - redisStatus := gen.Status_CONNECTED + redisStatus := rpb.Status_CONNECTED redisMessage := "" if err := s.Redis.Client.Ping(ctx).Err(); err != nil { - redisStatus = gen.Status_DISCONNECTED + redisStatus = rpb.Status_DISCONNECTED redisMessage = err.Error() } - redis := gen.Service{ + redis := rpb.Service{ Name: "redis", Status: redisStatus, Message: redisMessage, @@ -37,15 +37,15 @@ func (s healthServer) Status(ctx context.Context, _ *gen.StatusRequest) (*gen.St services = append(services, &redis) - mongoStatus := gen.Status_CONNECTED + mongoStatus := rpb.Status_CONNECTED mongoMessage := "" if err := s.DB.Client.Ping(ctx, nil); err != nil { - mongoStatus = gen.Status_DISCONNECTED + mongoStatus = rpb.Status_DISCONNECTED mongoMessage = err.Error() } - mongo := gen.Service{ + mongo := rpb.Service{ Name: "mongo", Status: mongoStatus, Message: mongoMessage, @@ -53,7 +53,7 @@ func (s healthServer) Status(ctx context.Context, _ *gen.StatusRequest) (*gen.St services = append(services, &mongo) - return &gen.StatusResponse{ + return &rpb.StatusResponse{ Uptime: int64(time.Since(s.StartTime).Seconds()), Version: immortal.StringVersion(), Services: services, diff --git a/server/grpc/proto/health.proto b/delivery/grpc/proto/health.proto similarity index 82% rename from server/grpc/proto/health.proto rename to delivery/grpc/proto/health.proto index 8a6b257..6da411e 100644 --- a/server/grpc/proto/health.proto +++ b/delivery/grpc/proto/health.proto @@ -1,19 +1,13 @@ syntax = "proto3"; -package immortal; +package relay.v1; -option go_package = "github.com/dezh-tech/immortal/server/grpc/gen"; +option go_package = "github.com/dezh-tech/immortal/delivery/grpc"; service HealthService { rpc Status (StatusRequest) returns (StatusResponse); } -enum Status { - UNKNOWN = 0; - CONNECTED = 1; - DISCONNECTED = 2; -} - message Service { string name = 1; Status status = 2; @@ -26,4 +20,10 @@ message StatusResponse { repeated Service services = 1; int64 uptime = 2; string version = 3; -} \ No newline at end of file +} + +enum Status { + UNKNOWN = 0; + CONNECTED = 1; + DISCONNECTED = 2; +} diff --git a/server/grpc/server.go b/delivery/grpc/server.go similarity index 83% rename from server/grpc/server.go rename to delivery/grpc/server.go index fe9c5d2..42b83ff 100644 --- a/server/grpc/server.go +++ b/delivery/grpc/server.go @@ -7,9 +7,9 @@ import ( "strconv" "time" - "github.com/dezh-tech/immortal/database" - "github.com/dezh-tech/immortal/relay/redis" - "github.com/dezh-tech/immortal/server/grpc/gen" + rpb "github.com/dezh-tech/immortal/delivery/grpc/gen" + "github.com/dezh-tech/immortal/infrastructure/database" + "github.com/dezh-tech/immortal/infrastructure/redis" "google.golang.org/grpc" ) @@ -50,7 +50,7 @@ func (s *Server) Start() error { healthServer := newHealthServer(s) - gen.RegisterHealthServiceServer(grpcServer, healthServer) + rpb.RegisterHealthServiceServer(grpcServer, healthServer) s.listener = listener s.grpc = grpcServer diff --git a/server/websocket/auth_handler.go b/delivery/websocket/auth_handler.go similarity index 100% rename from server/websocket/auth_handler.go rename to delivery/websocket/auth_handler.go diff --git a/server/websocket/client_state.go b/delivery/websocket/client_state.go similarity index 100% rename from server/websocket/client_state.go rename to delivery/websocket/client_state.go diff --git a/server/websocket/close_handler.go b/delivery/websocket/close_handler.go similarity index 100% rename from server/websocket/close_handler.go rename to delivery/websocket/close_handler.go diff --git a/server/websocket/config.go b/delivery/websocket/config.go similarity index 100% rename from server/websocket/config.go rename to delivery/websocket/config.go diff --git a/server/websocket/event_handler.go b/delivery/websocket/event_handler.go similarity index 100% rename from server/websocket/event_handler.go rename to delivery/websocket/event_handler.go diff --git a/server/websocket/req_handler.go b/delivery/websocket/req_handler.go similarity index 100% rename from server/websocket/req_handler.go rename to delivery/websocket/req_handler.go diff --git a/server/websocket/server.go b/delivery/websocket/server.go similarity index 92% rename from server/websocket/server.go rename to delivery/websocket/server.go index 8219fa0..68db8d9 100644 --- a/server/websocket/server.go +++ b/delivery/websocket/server.go @@ -8,9 +8,9 @@ import ( "strconv" "sync" - "github.com/dezh-tech/immortal/handler" - "github.com/dezh-tech/immortal/metrics" - "github.com/dezh-tech/immortal/relay/redis" + "github.com/dezh-tech/immortal/infrastructure/metrics" + "github.com/dezh-tech/immortal/infrastructure/redis" + "github.com/dezh-tech/immortal/repository" "github.com/dezh-tech/immortal/types/filter" "github.com/dezh-tech/immortal/types/message" "github.com/gorilla/websocket" @@ -26,12 +26,12 @@ type Server struct { config Config conns map[*websocket.Conn]clientState - handler *handler.Handler + handler *repository.Handler metrics *metrics.Metrics redis *redis.Redis } -func New(cfg Config, h *handler.Handler, m *metrics.Metrics, r *redis.Redis, +func New(cfg Config, h *repository.Handler, m *metrics.Metrics, r *redis.Redis, ) (*Server, error) { return &Server{ config: cfg, diff --git a/server/websocket/task_scheduler.go b/delivery/websocket/task_scheduler.go similarity index 100% rename from server/websocket/task_scheduler.go rename to delivery/websocket/task_scheduler.go diff --git a/server/websocket/utils.go b/delivery/websocket/utils.go similarity index 100% rename from server/websocket/utils.go rename to delivery/websocket/utils.go diff --git a/database/config.go b/infrastructure/database/config.go similarity index 100% rename from database/config.go rename to infrastructure/database/config.go diff --git a/database/database.go b/infrastructure/database/database.go similarity index 100% rename from database/database.go rename to infrastructure/database/database.go diff --git a/server/grpc/buf/buf.gen.yaml b/infrastructure/grpc_client/buf/buf.gen.yaml similarity index 100% rename from server/grpc/buf/buf.gen.yaml rename to infrastructure/grpc_client/buf/buf.gen.yaml diff --git a/infrastructure/grpc_client/client.go b/infrastructure/grpc_client/client.go new file mode 100644 index 0000000..573ee32 --- /dev/null +++ b/infrastructure/grpc_client/client.go @@ -0,0 +1,47 @@ +package grpcclient + +import ( + "context" + + mpb "github.com/dezh-tech/immortal/infrastructure/grpc_client/gen" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/metadata" +) + +type Client struct { + RegistryService mpb.ServiceRegistryClient + ParametersService mpb.ParametersClient + conn *grpc.ClientConn +} + +func New(endpoint string) (*Client, error) { + conn, err := grpc.NewClient(endpoint, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + return nil, err + } + + return &Client{ + RegistryService: mpb.NewServiceRegistryClient(conn), + ParametersService: mpb.NewParametersClient(conn), + conn: conn, + }, nil +} + +func (c *Client) RegisterService(ctx context.Context, + port, region string, hb uint32, +) (*mpb.RegisterServiceResponse, error) { + return c.RegistryService.RegisterService(ctx, &mpb.RegisterServiceRequest{ + Type: mpb.ServiceTypeEnum_RELAY, + Port: port, + HeartbeatDurationInSec: hb, + Region: region, + }) +} + +func (c *Client) GetParameters(ctx context.Context, id string) (*mpb.GetParametersResponse, error) { + md := metadata.New(map[string]string{"x-identifier": id}) + ctx = metadata.NewOutgoingContext(ctx, md) + + return c.ParametersService.GetParameters(ctx, &mpb.GetParametersRequest{}) +} diff --git a/client/config.go b/infrastructure/grpc_client/config.go similarity index 88% rename from client/config.go rename to infrastructure/grpc_client/config.go index 5b44620..2aba0f1 100644 --- a/client/config.go +++ b/infrastructure/grpc_client/config.go @@ -1,4 +1,4 @@ -package client +package grpcclient type Config struct { Endpoint string `yaml:"endpoint"` diff --git a/infrastructure/grpc_client/gen/config.pb.go b/infrastructure/grpc_client/gen/config.pb.go new file mode 100644 index 0000000..3f2c5a2 --- /dev/null +++ b/infrastructure/grpc_client/gen/config.pb.go @@ -0,0 +1,422 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.33.0 +// protoc (unknown) +// source: config.proto + +package grpc_client + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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 Limitations struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MaxMessageLength int32 `protobuf:"varint,1,opt,name=max_message_length,json=maxMessageLength,proto3" json:"max_message_length,omitempty"` + MaxSubscriptions int32 `protobuf:"varint,2,opt,name=max_subscriptions,json=maxSubscriptions,proto3" json:"max_subscriptions,omitempty"` + MaxFilters int32 `protobuf:"varint,3,opt,name=max_filters,json=maxFilters,proto3" json:"max_filters,omitempty"` + MaxSubidLength int32 `protobuf:"varint,4,opt,name=max_subid_length,json=maxSubidLength,proto3" json:"max_subid_length,omitempty"` + MinPowDifficulty int32 `protobuf:"varint,5,opt,name=min_pow_difficulty,json=minPowDifficulty,proto3" json:"min_pow_difficulty,omitempty"` + AuthRequired bool `protobuf:"varint,6,opt,name=auth_required,json=authRequired,proto3" json:"auth_required,omitempty"` + PaymentRequired bool `protobuf:"varint,7,opt,name=payment_required,json=paymentRequired,proto3" json:"payment_required,omitempty"` + RestrictedWrites bool `protobuf:"varint,8,opt,name=restricted_writes,json=restrictedWrites,proto3" json:"restricted_writes,omitempty"` + MaxEventTags int32 `protobuf:"varint,9,opt,name=max_event_tags,json=maxEventTags,proto3" json:"max_event_tags,omitempty"` + MaxContentLength int32 `protobuf:"varint,10,opt,name=max_content_length,json=maxContentLength,proto3" json:"max_content_length,omitempty"` + CreatedAtLowerLimit int64 `protobuf:"varint,11,opt,name=created_at_lower_limit,json=createdAtLowerLimit,proto3" json:"created_at_lower_limit,omitempty"` + CreatedAtUpperLimit int64 `protobuf:"varint,12,opt,name=created_at_upper_limit,json=createdAtUpperLimit,proto3" json:"created_at_upper_limit,omitempty"` + DefaultQueryLimit uint32 `protobuf:"varint,13,opt,name=default_query_limit,json=defaultQueryLimit,proto3" json:"default_query_limit,omitempty"` + MaxQueryLimit uint32 `protobuf:"varint,14,opt,name=max_query_limit,json=maxQueryLimit,proto3" json:"max_query_limit,omitempty"` +} + +func (x *Limitations) Reset() { + *x = Limitations{} + if protoimpl.UnsafeEnabled { + mi := &file_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Limitations) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Limitations) ProtoMessage() {} + +func (x *Limitations) ProtoReflect() protoreflect.Message { + mi := &file_config_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) +} + +// Deprecated: Use Limitations.ProtoReflect.Descriptor instead. +func (*Limitations) Descriptor() ([]byte, []int) { + return file_config_proto_rawDescGZIP(), []int{0} +} + +func (x *Limitations) GetMaxMessageLength() int32 { + if x != nil { + return x.MaxMessageLength + } + return 0 +} + +func (x *Limitations) GetMaxSubscriptions() int32 { + if x != nil { + return x.MaxSubscriptions + } + return 0 +} + +func (x *Limitations) GetMaxFilters() int32 { + if x != nil { + return x.MaxFilters + } + return 0 +} + +func (x *Limitations) GetMaxSubidLength() int32 { + if x != nil { + return x.MaxSubidLength + } + return 0 +} + +func (x *Limitations) GetMinPowDifficulty() int32 { + if x != nil { + return x.MinPowDifficulty + } + return 0 +} + +func (x *Limitations) GetAuthRequired() bool { + if x != nil { + return x.AuthRequired + } + return false +} + +func (x *Limitations) GetPaymentRequired() bool { + if x != nil { + return x.PaymentRequired + } + return false +} + +func (x *Limitations) GetRestrictedWrites() bool { + if x != nil { + return x.RestrictedWrites + } + return false +} + +func (x *Limitations) GetMaxEventTags() int32 { + if x != nil { + return x.MaxEventTags + } + return 0 +} + +func (x *Limitations) GetMaxContentLength() int32 { + if x != nil { + return x.MaxContentLength + } + return 0 +} + +func (x *Limitations) GetCreatedAtLowerLimit() int64 { + if x != nil { + return x.CreatedAtLowerLimit + } + return 0 +} + +func (x *Limitations) GetCreatedAtUpperLimit() int64 { + if x != nil { + return x.CreatedAtUpperLimit + } + return 0 +} + +func (x *Limitations) GetDefaultQueryLimit() uint32 { + if x != nil { + return x.DefaultQueryLimit + } + return 0 +} + +func (x *Limitations) GetMaxQueryLimit() uint32 { + if x != nil { + return x.MaxQueryLimit + } + return 0 +} + +type GetParametersRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetParametersRequest) Reset() { + *x = GetParametersRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_config_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetParametersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetParametersRequest) ProtoMessage() {} + +func (x *GetParametersRequest) ProtoReflect() protoreflect.Message { + mi := &file_config_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 mi.MessageOf(x) +} + +// Deprecated: Use GetParametersRequest.ProtoReflect.Descriptor instead. +func (*GetParametersRequest) Descriptor() ([]byte, []int) { + return file_config_proto_rawDescGZIP(), []int{1} +} + +type GetParametersResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Limitations *Limitations `protobuf:"bytes,1,opt,name=limitations,proto3" json:"limitations,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` +} + +func (x *GetParametersResponse) Reset() { + *x = GetParametersResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_config_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetParametersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetParametersResponse) ProtoMessage() {} + +func (x *GetParametersResponse) ProtoReflect() protoreflect.Message { + mi := &file_config_proto_msgTypes[2] + 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) +} + +// Deprecated: Use GetParametersResponse.ProtoReflect.Descriptor instead. +func (*GetParametersResponse) Descriptor() ([]byte, []int) { + return file_config_proto_rawDescGZIP(), []int{2} +} + +func (x *GetParametersResponse) GetLimitations() *Limitations { + if x != nil { + return x.Limitations + } + return nil +} + +func (x *GetParametersResponse) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +var File_config_proto protoreflect.FileDescriptor + +var file_config_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x22, 0xf4, 0x04, 0x0a, 0x0b, 0x4c, + 0x69, 0x6d, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x6d, 0x61, + 0x78, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x2b, 0x0a, 0x11, 0x6d, 0x61, 0x78, 0x5f, + 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x61, 0x78, 0x5f, 0x66, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6d, 0x61, 0x78, 0x46, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x12, 0x28, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x75, + 0x62, 0x69, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x53, 0x75, 0x62, 0x69, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x12, 0x2c, 0x0a, 0x12, 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x6f, 0x77, 0x5f, 0x64, 0x69, 0x66, 0x66, + 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x6d, 0x69, + 0x6e, 0x50, 0x6f, 0x77, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x12, 0x23, + 0x0a, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x61, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, + 0x72, 0x65, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x72, + 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x70, + 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x2b, + 0x0a, 0x11, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x77, 0x72, 0x69, + 0x74, 0x65, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x72, 0x65, 0x73, 0x74, 0x72, + 0x69, 0x63, 0x74, 0x65, 0x64, 0x57, 0x72, 0x69, 0x74, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0e, 0x6d, + 0x61, 0x78, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x61, 0x67, + 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x6d, 0x61, 0x78, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x6d, + 0x61, 0x78, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, + 0x33, 0x0a, 0x16, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x5f, 0x6c, 0x6f, + 0x77, 0x65, 0x72, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x13, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x4c, 0x6f, 0x77, 0x65, 0x72, 0x4c, + 0x69, 0x6d, 0x69, 0x74, 0x12, 0x33, 0x0a, 0x16, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, + 0x61, 0x74, 0x5f, 0x75, 0x70, 0x70, 0x65, 0x72, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x13, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x55, + 0x70, 0x70, 0x65, 0x72, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x2e, 0x0a, 0x13, 0x64, 0x65, 0x66, + 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, + 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x11, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x6d, 0x61, 0x78, + 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x0e, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x6d, 0x69, + 0x74, 0x22, 0x16, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x64, 0x0a, 0x15, 0x47, 0x65, 0x74, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x39, 0x0a, 0x0b, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x0b, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x10, 0x0a, + 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x32, + 0x62, 0x0a, 0x0a, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x54, 0x0a, + 0x0d, 0x47, 0x65, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x20, + 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x21, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, + 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x64, 0x65, 0x7a, 0x68, 0x2d, 0x74, 0x65, 0x63, 0x68, 0x2f, 0x69, 0x6d, 0x6d, 0x6f, + 0x72, 0x74, 0x61, 0x6c, 0x2f, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, + 0x75, 0x72, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_config_proto_rawDescOnce sync.Once + file_config_proto_rawDescData = file_config_proto_rawDesc +) + +func file_config_proto_rawDescGZIP() []byte { + file_config_proto_rawDescOnce.Do(func() { + file_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_config_proto_rawDescData) + }) + return file_config_proto_rawDescData +} + +var file_config_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_config_proto_goTypes = []interface{}{ + (*Limitations)(nil), // 0: manager.v1.Limitations + (*GetParametersRequest)(nil), // 1: manager.v1.GetParametersRequest + (*GetParametersResponse)(nil), // 2: manager.v1.GetParametersResponse +} +var file_config_proto_depIdxs = []int32{ + 0, // 0: manager.v1.GetParametersResponse.limitations:type_name -> manager.v1.Limitations + 1, // 1: manager.v1.Parameters.GetParameters:input_type -> manager.v1.GetParametersRequest + 2, // 2: manager.v1.Parameters.GetParameters:output_type -> manager.v1.GetParametersResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_config_proto_init() } +func file_config_proto_init() { + if File_config_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Limitations); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetParametersRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetParametersResponse); 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_config_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_config_proto_goTypes, + DependencyIndexes: file_config_proto_depIdxs, + MessageInfos: file_config_proto_msgTypes, + }.Build() + File_config_proto = out.File + file_config_proto_rawDesc = nil + file_config_proto_goTypes = nil + file_config_proto_depIdxs = nil +} diff --git a/infrastructure/grpc_client/gen/config_grpc.pb.go b/infrastructure/grpc_client/gen/config_grpc.pb.go new file mode 100644 index 0000000..2fe2a36 --- /dev/null +++ b/infrastructure/grpc_client/gen/config_grpc.pb.go @@ -0,0 +1,107 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: config.proto + +package grpc_client + +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.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Parameters_GetParameters_FullMethodName = "/manager.v1.Parameters/GetParameters" +) + +// ParametersClient is the client API for Parameters 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 ParametersClient interface { + GetParameters(ctx context.Context, in *GetParametersRequest, opts ...grpc.CallOption) (*GetParametersResponse, error) +} + +type parametersClient struct { + cc grpc.ClientConnInterface +} + +func NewParametersClient(cc grpc.ClientConnInterface) ParametersClient { + return ¶metersClient{cc} +} + +func (c *parametersClient) GetParameters(ctx context.Context, in *GetParametersRequest, opts ...grpc.CallOption) (*GetParametersResponse, error) { + out := new(GetParametersResponse) + err := c.cc.Invoke(ctx, Parameters_GetParameters_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ParametersServer is the server API for Parameters service. +// All implementations should embed UnimplementedParametersServer +// for forward compatibility +type ParametersServer interface { + GetParameters(context.Context, *GetParametersRequest) (*GetParametersResponse, error) +} + +// UnimplementedParametersServer should be embedded to have forward compatible implementations. +type UnimplementedParametersServer struct { +} + +func (UnimplementedParametersServer) GetParameters(context.Context, *GetParametersRequest) (*GetParametersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetParameters not implemented") +} + +// UnsafeParametersServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ParametersServer will +// result in compilation errors. +type UnsafeParametersServer interface { + mustEmbedUnimplementedParametersServer() +} + +func RegisterParametersServer(s grpc.ServiceRegistrar, srv ParametersServer) { + s.RegisterService(&Parameters_ServiceDesc, srv) +} + +func _Parameters_GetParameters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetParametersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ParametersServer).GetParameters(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Parameters_GetParameters_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ParametersServer).GetParameters(ctx, req.(*GetParametersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Parameters_ServiceDesc is the grpc.ServiceDesc for Parameters service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Parameters_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "manager.v1.Parameters", + HandlerType: (*ParametersServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetParameters", + Handler: _Parameters_GetParameters_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "config.proto", +} diff --git a/infrastructure/grpc_client/gen/log.pb.go b/infrastructure/grpc_client/gen/log.pb.go new file mode 100644 index 0000000..f8ef997 --- /dev/null +++ b/infrastructure/grpc_client/gen/log.pb.go @@ -0,0 +1,235 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.33.0 +// protoc (unknown) +// source: log.proto + +package grpc_client + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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 AddLogRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + Stack string `protobuf:"bytes,2,opt,name=stack,proto3" json:"stack,omitempty"` +} + +func (x *AddLogRequest) Reset() { + *x = AddLogRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_log_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddLogRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddLogRequest) ProtoMessage() {} + +func (x *AddLogRequest) ProtoReflect() protoreflect.Message { + mi := &file_log_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) +} + +// Deprecated: Use AddLogRequest.ProtoReflect.Descriptor instead. +func (*AddLogRequest) Descriptor() ([]byte, []int) { + return file_log_proto_rawDescGZIP(), []int{0} +} + +func (x *AddLogRequest) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *AddLogRequest) GetStack() string { + if x != nil { + return x.Stack + } + return "" +} + +type AddLogResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + Message *string `protobuf:"bytes,2,opt,name=message,proto3,oneof" json:"message,omitempty"` +} + +func (x *AddLogResponse) Reset() { + *x = AddLogResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_log_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddLogResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddLogResponse) ProtoMessage() {} + +func (x *AddLogResponse) ProtoReflect() protoreflect.Message { + mi := &file_log_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 mi.MessageOf(x) +} + +// Deprecated: Use AddLogResponse.ProtoReflect.Descriptor instead. +func (*AddLogResponse) Descriptor() ([]byte, []int) { + return file_log_proto_rawDescGZIP(), []int{1} +} + +func (x *AddLogResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *AddLogResponse) GetMessage() string { + if x != nil && x.Message != nil { + return *x.Message + } + return "" +} + +var File_log_proto protoreflect.FileDescriptor + +var file_log_proto_rawDesc = []byte{ + 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x22, 0x3f, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x4c, 0x6f, + 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x22, 0x55, 0x0a, 0x0e, 0x41, 0x64, 0x64, 0x4c, + 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, + 0x46, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x3f, 0x0a, 0x06, 0x41, 0x64, 0x64, 0x4c, 0x6f, 0x67, + 0x12, 0x19, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, + 0x64, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x4c, 0x6f, 0x67, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x65, 0x7a, 0x68, 0x2d, 0x74, 0x65, 0x63, 0x68, 0x2f, + 0x69, 0x6d, 0x6d, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2f, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x73, 0x74, + 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_log_proto_rawDescOnce sync.Once + file_log_proto_rawDescData = file_log_proto_rawDesc +) + +func file_log_proto_rawDescGZIP() []byte { + file_log_proto_rawDescOnce.Do(func() { + file_log_proto_rawDescData = protoimpl.X.CompressGZIP(file_log_proto_rawDescData) + }) + return file_log_proto_rawDescData +} + +var file_log_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_log_proto_goTypes = []interface{}{ + (*AddLogRequest)(nil), // 0: manager.v1.AddLogRequest + (*AddLogResponse)(nil), // 1: manager.v1.AddLogResponse +} +var file_log_proto_depIdxs = []int32{ + 0, // 0: manager.v1.Log.AddLog:input_type -> manager.v1.AddLogRequest + 1, // 1: manager.v1.Log.AddLog:output_type -> manager.v1.AddLogResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_log_proto_init() } +func file_log_proto_init() { + if File_log_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_log_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddLogRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_log_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddLogResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_log_proto_msgTypes[1].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_log_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_log_proto_goTypes, + DependencyIndexes: file_log_proto_depIdxs, + MessageInfos: file_log_proto_msgTypes, + }.Build() + File_log_proto = out.File + file_log_proto_rawDesc = nil + file_log_proto_goTypes = nil + file_log_proto_depIdxs = nil +} diff --git a/infrastructure/grpc_client/gen/log_grpc.pb.go b/infrastructure/grpc_client/gen/log_grpc.pb.go new file mode 100644 index 0000000..8013370 --- /dev/null +++ b/infrastructure/grpc_client/gen/log_grpc.pb.go @@ -0,0 +1,107 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: log.proto + +package grpc_client + +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.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Log_AddLog_FullMethodName = "/manager.v1.Log/AddLog" +) + +// LogClient is the client API for Log 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 LogClient interface { + AddLog(ctx context.Context, in *AddLogRequest, opts ...grpc.CallOption) (*AddLogResponse, error) +} + +type logClient struct { + cc grpc.ClientConnInterface +} + +func NewLogClient(cc grpc.ClientConnInterface) LogClient { + return &logClient{cc} +} + +func (c *logClient) AddLog(ctx context.Context, in *AddLogRequest, opts ...grpc.CallOption) (*AddLogResponse, error) { + out := new(AddLogResponse) + err := c.cc.Invoke(ctx, Log_AddLog_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// LogServer is the server API for Log service. +// All implementations should embed UnimplementedLogServer +// for forward compatibility +type LogServer interface { + AddLog(context.Context, *AddLogRequest) (*AddLogResponse, error) +} + +// UnimplementedLogServer should be embedded to have forward compatible implementations. +type UnimplementedLogServer struct { +} + +func (UnimplementedLogServer) AddLog(context.Context, *AddLogRequest) (*AddLogResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddLog not implemented") +} + +// UnsafeLogServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to LogServer will +// result in compilation errors. +type UnsafeLogServer interface { + mustEmbedUnimplementedLogServer() +} + +func RegisterLogServer(s grpc.ServiceRegistrar, srv LogServer) { + s.RegisterService(&Log_ServiceDesc, srv) +} + +func _Log_AddLog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddLogRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogServer).AddLog(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Log_AddLog_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogServer).AddLog(ctx, req.(*AddLogRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Log_ServiceDesc is the grpc.ServiceDesc for Log service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Log_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "manager.v1.Log", + HandlerType: (*LogServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AddLog", + Handler: _Log_AddLog_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "log.proto", +} diff --git a/infrastructure/grpc_client/gen/servie_registery.pb.go b/infrastructure/grpc_client/gen/servie_registery.pb.go new file mode 100644 index 0000000..4aaa817 --- /dev/null +++ b/infrastructure/grpc_client/gen/servie_registery.pb.go @@ -0,0 +1,324 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.33.0 +// protoc (unknown) +// source: servie_registery.proto + +package grpc_client + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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 ServiceTypeEnum int32 + +const ( + ServiceTypeEnum_UNKNOWN ServiceTypeEnum = 0 + ServiceTypeEnum_RELAY ServiceTypeEnum = 1 +) + +// Enum value maps for ServiceTypeEnum. +var ( + ServiceTypeEnum_name = map[int32]string{ + 0: "UNKNOWN", + 1: "RELAY", + } + ServiceTypeEnum_value = map[string]int32{ + "UNKNOWN": 0, + "RELAY": 1, + } +) + +func (x ServiceTypeEnum) Enum() *ServiceTypeEnum { + p := new(ServiceTypeEnum) + *p = x + return p +} + +func (x ServiceTypeEnum) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ServiceTypeEnum) Descriptor() protoreflect.EnumDescriptor { + return file_servie_registery_proto_enumTypes[0].Descriptor() +} + +func (ServiceTypeEnum) Type() protoreflect.EnumType { + return &file_servie_registery_proto_enumTypes[0] +} + +func (x ServiceTypeEnum) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ServiceTypeEnum.Descriptor instead. +func (ServiceTypeEnum) EnumDescriptor() ([]byte, []int) { + return file_servie_registery_proto_rawDescGZIP(), []int{0} +} + +type RegisterServiceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Port string `protobuf:"bytes,1,opt,name=port,proto3" json:"port,omitempty"` + HeartbeatDurationInSec uint32 `protobuf:"varint,2,opt,name=heartbeat_duration_in_sec,json=heartbeatDurationInSec,proto3" json:"heartbeat_duration_in_sec,omitempty"` + Type ServiceTypeEnum `protobuf:"varint,3,opt,name=type,proto3,enum=manager.v1.ServiceTypeEnum" json:"type,omitempty"` + Region string `protobuf:"bytes,4,opt,name=region,proto3" json:"region,omitempty"` +} + +func (x *RegisterServiceRequest) Reset() { + *x = RegisterServiceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_servie_registery_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegisterServiceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterServiceRequest) ProtoMessage() {} + +func (x *RegisterServiceRequest) ProtoReflect() protoreflect.Message { + mi := &file_servie_registery_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) +} + +// Deprecated: Use RegisterServiceRequest.ProtoReflect.Descriptor instead. +func (*RegisterServiceRequest) Descriptor() ([]byte, []int) { + return file_servie_registery_proto_rawDescGZIP(), []int{0} +} + +func (x *RegisterServiceRequest) GetPort() string { + if x != nil { + return x.Port + } + return "" +} + +func (x *RegisterServiceRequest) GetHeartbeatDurationInSec() uint32 { + if x != nil { + return x.HeartbeatDurationInSec + } + return 0 +} + +func (x *RegisterServiceRequest) GetType() ServiceTypeEnum { + if x != nil { + return x.Type + } + return ServiceTypeEnum_UNKNOWN +} + +func (x *RegisterServiceRequest) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + +type RegisterServiceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + Message *string `protobuf:"bytes,2,opt,name=message,proto3,oneof" json:"message,omitempty"` + Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` +} + +func (x *RegisterServiceResponse) Reset() { + *x = RegisterServiceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_servie_registery_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegisterServiceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterServiceResponse) ProtoMessage() {} + +func (x *RegisterServiceResponse) ProtoReflect() protoreflect.Message { + mi := &file_servie_registery_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 mi.MessageOf(x) +} + +// Deprecated: Use RegisterServiceResponse.ProtoReflect.Descriptor instead. +func (*RegisterServiceResponse) Descriptor() ([]byte, []int) { + return file_servie_registery_proto_rawDescGZIP(), []int{1} +} + +func (x *RegisterServiceResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *RegisterServiceResponse) GetMessage() string { + if x != nil && x.Message != nil { + return *x.Message + } + return "" +} + +func (x *RegisterServiceResponse) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +var File_servie_registery_proto protoreflect.FileDescriptor + +var file_servie_registery_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x73, 0x65, 0x72, 0x76, 0x69, 0x65, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x2e, 0x76, 0x31, 0x22, 0xb0, 0x01, 0x0a, 0x16, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, + 0x6f, 0x72, 0x74, 0x12, 0x39, 0x0a, 0x19, 0x68, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, + 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x5f, 0x73, 0x65, 0x63, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x16, 0x68, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, + 0x74, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x12, 0x2f, + 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, + 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x22, 0x74, 0x0a, 0x17, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x07, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x12, 0x14, 0x0a, 0x05, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2a, 0x29, 0x0a, + 0x0f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, + 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x09, 0x0a, + 0x05, 0x52, 0x45, 0x4c, 0x41, 0x59, 0x10, 0x01, 0x32, 0x6d, 0x0a, 0x0f, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x12, 0x5a, 0x0a, 0x0f, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x22, + 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x65, 0x7a, 0x68, 0x2d, 0x74, 0x65, 0x63, 0x68, 0x2f, + 0x69, 0x6d, 0x6d, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2f, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x73, 0x74, + 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_servie_registery_proto_rawDescOnce sync.Once + file_servie_registery_proto_rawDescData = file_servie_registery_proto_rawDesc +) + +func file_servie_registery_proto_rawDescGZIP() []byte { + file_servie_registery_proto_rawDescOnce.Do(func() { + file_servie_registery_proto_rawDescData = protoimpl.X.CompressGZIP(file_servie_registery_proto_rawDescData) + }) + return file_servie_registery_proto_rawDescData +} + +var file_servie_registery_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_servie_registery_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_servie_registery_proto_goTypes = []interface{}{ + (ServiceTypeEnum)(0), // 0: manager.v1.ServiceTypeEnum + (*RegisterServiceRequest)(nil), // 1: manager.v1.RegisterServiceRequest + (*RegisterServiceResponse)(nil), // 2: manager.v1.RegisterServiceResponse +} +var file_servie_registery_proto_depIdxs = []int32{ + 0, // 0: manager.v1.RegisterServiceRequest.type:type_name -> manager.v1.ServiceTypeEnum + 1, // 1: manager.v1.ServiceRegistry.RegisterService:input_type -> manager.v1.RegisterServiceRequest + 2, // 2: manager.v1.ServiceRegistry.RegisterService:output_type -> manager.v1.RegisterServiceResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_servie_registery_proto_init() } +func file_servie_registery_proto_init() { + if File_servie_registery_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_servie_registery_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegisterServiceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_servie_registery_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegisterServiceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_servie_registery_proto_msgTypes[1].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_servie_registery_proto_rawDesc, + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_servie_registery_proto_goTypes, + DependencyIndexes: file_servie_registery_proto_depIdxs, + EnumInfos: file_servie_registery_proto_enumTypes, + MessageInfos: file_servie_registery_proto_msgTypes, + }.Build() + File_servie_registery_proto = out.File + file_servie_registery_proto_rawDesc = nil + file_servie_registery_proto_goTypes = nil + file_servie_registery_proto_depIdxs = nil +} diff --git a/infrastructure/grpc_client/gen/servie_registery_grpc.pb.go b/infrastructure/grpc_client/gen/servie_registery_grpc.pb.go new file mode 100644 index 0000000..5ef400c --- /dev/null +++ b/infrastructure/grpc_client/gen/servie_registery_grpc.pb.go @@ -0,0 +1,107 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: servie_registery.proto + +package grpc_client + +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.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + ServiceRegistry_RegisterService_FullMethodName = "/manager.v1.ServiceRegistry/RegisterService" +) + +// ServiceRegistryClient is the client API for ServiceRegistry 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 ServiceRegistryClient interface { + RegisterService(ctx context.Context, in *RegisterServiceRequest, opts ...grpc.CallOption) (*RegisterServiceResponse, error) +} + +type serviceRegistryClient struct { + cc grpc.ClientConnInterface +} + +func NewServiceRegistryClient(cc grpc.ClientConnInterface) ServiceRegistryClient { + return &serviceRegistryClient{cc} +} + +func (c *serviceRegistryClient) RegisterService(ctx context.Context, in *RegisterServiceRequest, opts ...grpc.CallOption) (*RegisterServiceResponse, error) { + out := new(RegisterServiceResponse) + err := c.cc.Invoke(ctx, ServiceRegistry_RegisterService_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ServiceRegistryServer is the server API for ServiceRegistry service. +// All implementations should embed UnimplementedServiceRegistryServer +// for forward compatibility +type ServiceRegistryServer interface { + RegisterService(context.Context, *RegisterServiceRequest) (*RegisterServiceResponse, error) +} + +// UnimplementedServiceRegistryServer should be embedded to have forward compatible implementations. +type UnimplementedServiceRegistryServer struct { +} + +func (UnimplementedServiceRegistryServer) RegisterService(context.Context, *RegisterServiceRequest) (*RegisterServiceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterService not implemented") +} + +// UnsafeServiceRegistryServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ServiceRegistryServer will +// result in compilation errors. +type UnsafeServiceRegistryServer interface { + mustEmbedUnimplementedServiceRegistryServer() +} + +func RegisterServiceRegistryServer(s grpc.ServiceRegistrar, srv ServiceRegistryServer) { + s.RegisterService(&ServiceRegistry_ServiceDesc, srv) +} + +func _ServiceRegistry_RegisterService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RegisterServiceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceRegistryServer).RegisterService(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ServiceRegistry_RegisterService_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceRegistryServer).RegisterService(ctx, req.(*RegisterServiceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ServiceRegistry_ServiceDesc is the grpc.ServiceDesc for ServiceRegistry service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ServiceRegistry_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "manager.v1.ServiceRegistry", + HandlerType: (*ServiceRegistryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RegisterService", + Handler: _ServiceRegistry_RegisterService_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "servie_registery.proto", +} diff --git a/infrastructure/grpc_client/proto/config.proto b/infrastructure/grpc_client/proto/config.proto new file mode 100644 index 0000000..b361bc0 --- /dev/null +++ b/infrastructure/grpc_client/proto/config.proto @@ -0,0 +1,33 @@ +syntax = "proto3"; + +package manager.v1; + +option go_package = "github.com/dezh-tech/immortal/infrastructure/grpc_client"; + +service Parameters { + rpc GetParameters (GetParametersRequest) returns (GetParametersResponse); +} + +message Limitations { + int32 max_message_length = 1; + int32 max_subscriptions = 2; + int32 max_filters = 3; + int32 max_subid_length = 4; + int32 min_pow_difficulty = 5; + bool auth_required = 6; + bool payment_required = 7; + bool restricted_writes = 8; + int32 max_event_tags = 9; + int32 max_content_length = 10; + int64 created_at_lower_limit = 11; + int64 created_at_upper_limit = 12; + uint32 default_query_limit = 13; + uint32 max_query_limit = 14; +} + +message GetParametersRequest {} + +message GetParametersResponse { + Limitations limitations = 1; + string url = 2; +} diff --git a/infrastructure/grpc_client/proto/log.proto b/infrastructure/grpc_client/proto/log.proto new file mode 100644 index 0000000..667d1a2 --- /dev/null +++ b/infrastructure/grpc_client/proto/log.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package manager.v1; + +option go_package = "github.com/dezh-tech/immortal/infrastructure/grpc_client"; + +service Log { + rpc AddLog (AddLogRequest) returns (AddLogResponse); +} + +message AddLogRequest { + string message = 1; + string stack = 2; +} + +message AddLogResponse { + bool success = 1; + optional string message = 2; +} diff --git a/infrastructure/grpc_client/proto/servie_registery.proto b/infrastructure/grpc_client/proto/servie_registery.proto new file mode 100644 index 0000000..8a3672d --- /dev/null +++ b/infrastructure/grpc_client/proto/servie_registery.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; + +package manager.v1; + +option go_package = "github.com/dezh-tech/immortal/infrastructure/grpc_client"; + +service ServiceRegistry { + rpc RegisterService (RegisterServiceRequest) returns (RegisterServiceResponse); +} + +message RegisterServiceRequest { + string port = 1; + uint32 heartbeat_duration_in_sec = 2; + ServiceTypeEnum type = 3; + string region = 4; +} + +message RegisterServiceResponse { + bool success = 1; + optional string message = 2; + string token = 3; +} + +enum ServiceTypeEnum { + UNKNOWN = 0; + RELAY = 1; +} diff --git a/metrics/metrics.go b/infrastructure/metrics/metrics.go similarity index 100% rename from metrics/metrics.go rename to infrastructure/metrics/metrics.go diff --git a/relay/redis/redis.go b/infrastructure/redis/redis.go similarity index 100% rename from relay/redis/redis.go rename to infrastructure/redis/redis.go diff --git a/relay/redis/redis_config.go b/infrastructure/redis/redis_config.go similarity index 100% rename from relay/redis/redis_config.go rename to infrastructure/redis/redis_config.go diff --git a/makefile b/makefile index ed5cdce..1c69bf7 100644 --- a/makefile +++ b/makefile @@ -40,10 +40,10 @@ build: ### Proto proto: - $(RM) client/gen - $(RM) server/grpc/gen - cd client/buf && buf generate --template buf.gen.yaml ../proto - cd server/grpc/buf && buf generate --template buf.gen.yaml ../proto + $(RM) infrastructure/grpc_client/gen + $(RM) delivery/grpc/gen + cd infrastructure/grpc_client/buf && buf generate --template buf.gen.yaml ../proto + cd delivery/grpc/buf && buf generate --template buf.gen.yaml ../proto ### pre commit pre-commit: fmt check unit-test diff --git a/handler/config.go b/repository/config.go similarity index 80% rename from handler/config.go rename to repository/config.go index d82e7e5..14d99a4 100644 --- a/handler/config.go +++ b/repository/config.go @@ -1,4 +1,4 @@ -package handler +package repository type Config struct { DefaultQueryLimit uint32 diff --git a/handler/delete.go b/repository/delete.go similarity index 97% rename from handler/delete.go rename to repository/delete.go index d7aae6f..6e09811 100644 --- a/handler/delete.go +++ b/repository/delete.go @@ -1,4 +1,4 @@ -package handler +package repository import ( "context" diff --git a/handler/event.go b/repository/event.go similarity index 98% rename from handler/event.go rename to repository/event.go index 75c74e9..b0dd0a4 100644 --- a/handler/event.go +++ b/repository/event.go @@ -1,4 +1,4 @@ -package handler +package repository import ( "context" diff --git a/handler/handler.go b/repository/handler.go similarity index 98% rename from handler/handler.go rename to repository/handler.go index 2bb158b..c83a4bf 100644 --- a/handler/handler.go +++ b/repository/handler.go @@ -1,7 +1,7 @@ -package handler +package repository import ( - "github.com/dezh-tech/immortal/database" + "github.com/dezh-tech/immortal/infrastructure/database" "github.com/dezh-tech/immortal/types" ) diff --git a/handler/req.go b/repository/req.go similarity index 99% rename from handler/req.go rename to repository/req.go index a58fdc6..2f55fb1 100644 --- a/handler/req.go +++ b/repository/req.go @@ -1,4 +1,4 @@ -package handler +package repository import ( "context"