diff --git a/Makefile b/Makefile index 0d20d887..362531f4 100644 --- a/Makefile +++ b/Makefile @@ -48,6 +48,15 @@ gen-cascade: --go-grpc_opt=paths=source_relative \ proto/supernode/action/cascade/service.proto +gen-supernode: + protoc \ + --proto_path=proto \ + --go_out=gen \ + --go_opt=paths=source_relative \ + --go-grpc_out=gen \ + --go-grpc_opt=paths=source_relative \ + proto/supernode/supernode.proto + # Define the paths SUPERNODE_SRC=supernode/main.go DATA_DIR=tests/system/supernode-data1 @@ -61,11 +70,16 @@ CONFIG_FILE3=tests/system/config.test-3.yml SETUP_SCRIPT=tests/scripts/setup-supernodes.sh # Install Lumera +# Optional: specify lumera binary path to skip download +LUMERAD_BINARY ?= +# Optional: specify installation mode (latest-release, latest-tag, or vX.Y.Z) +INSTALL_MODE ?=latest-tag + install-lumera: @echo "Installing Lumera..." @chmod +x tests/scripts/install-lumera.sh - @sudo tests/scripts/install-lumera.sh latest-tag - + @sudo LUMERAD_BINARY="$(LUMERAD_BINARY)" tests/scripts/install-lumera.sh $(INSTALL_MODE) + @echo "PtTDUHythfRfXHh63yzyiGDid4TZj2P76Zd,18749999981413" > ~/claims.csv # Setup supernode environments setup-supernodes: @echo "Setting up all supernode environments..." diff --git a/gen/supernode/action/cascade/service.pb.go b/gen/supernode/action/cascade/service.pb.go index d084e367..ded0dd47 100644 --- a/gen/supernode/action/cascade/service.pb.go +++ b/gen/supernode/action/cascade/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.35.2 -// protoc v3.12.4 +// protoc v3.21.12 // source: supernode/action/cascade/service.proto package cascade @@ -514,226 +514,6 @@ func (x *DownloadEvent) GetMessage() string { return "" } -type HealthCheckRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *HealthCheckRequest) Reset() { - *x = HealthCheckRequest{} - mi := &file_supernode_action_cascade_service_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *HealthCheckRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthCheckRequest) ProtoMessage() {} - -func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message { - mi := &file_supernode_action_cascade_service_proto_msgTypes[7] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HealthCheckRequest.ProtoReflect.Descriptor instead. -func (*HealthCheckRequest) Descriptor() ([]byte, []int) { - return file_supernode_action_cascade_service_proto_rawDescGZIP(), []int{7} -} - -// The HealthCheckResponse represents system health status. -type HealthCheckResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Cpu *HealthCheckResponse_CPU `protobuf:"bytes,1,opt,name=cpu,proto3" json:"cpu,omitempty"` - Memory *HealthCheckResponse_Memory `protobuf:"bytes,2,opt,name=memory,proto3" json:"memory,omitempty"` - TasksInProgress []string `protobuf:"bytes,3,rep,name=tasks_in_progress,json=tasksInProgress,proto3" json:"tasks_in_progress,omitempty"` -} - -func (x *HealthCheckResponse) Reset() { - *x = HealthCheckResponse{} - mi := &file_supernode_action_cascade_service_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *HealthCheckResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthCheckResponse) ProtoMessage() {} - -func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message { - mi := &file_supernode_action_cascade_service_proto_msgTypes[8] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead. -func (*HealthCheckResponse) Descriptor() ([]byte, []int) { - return file_supernode_action_cascade_service_proto_rawDescGZIP(), []int{8} -} - -func (x *HealthCheckResponse) GetCpu() *HealthCheckResponse_CPU { - if x != nil { - return x.Cpu - } - return nil -} - -func (x *HealthCheckResponse) GetMemory() *HealthCheckResponse_Memory { - if x != nil { - return x.Memory - } - return nil -} - -func (x *HealthCheckResponse) GetTasksInProgress() []string { - if x != nil { - return x.TasksInProgress - } - return nil -} - -type HealthCheckResponse_CPU struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Usage string `protobuf:"bytes,1,opt,name=usage,proto3" json:"usage,omitempty"` - Remaining string `protobuf:"bytes,2,opt,name=remaining,proto3" json:"remaining,omitempty"` -} - -func (x *HealthCheckResponse_CPU) Reset() { - *x = HealthCheckResponse_CPU{} - mi := &file_supernode_action_cascade_service_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *HealthCheckResponse_CPU) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthCheckResponse_CPU) ProtoMessage() {} - -func (x *HealthCheckResponse_CPU) ProtoReflect() protoreflect.Message { - mi := &file_supernode_action_cascade_service_proto_msgTypes[9] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HealthCheckResponse_CPU.ProtoReflect.Descriptor instead. -func (*HealthCheckResponse_CPU) Descriptor() ([]byte, []int) { - return file_supernode_action_cascade_service_proto_rawDescGZIP(), []int{8, 0} -} - -func (x *HealthCheckResponse_CPU) GetUsage() string { - if x != nil { - return x.Usage - } - return "" -} - -func (x *HealthCheckResponse_CPU) GetRemaining() string { - if x != nil { - return x.Remaining - } - return "" -} - -type HealthCheckResponse_Memory struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Total uint64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` - Used uint64 `protobuf:"varint,2,opt,name=used,proto3" json:"used,omitempty"` - Available uint64 `protobuf:"varint,3,opt,name=available,proto3" json:"available,omitempty"` - UsedPerc float64 `protobuf:"fixed64,4,opt,name=used_perc,json=usedPerc,proto3" json:"used_perc,omitempty"` -} - -func (x *HealthCheckResponse_Memory) Reset() { - *x = HealthCheckResponse_Memory{} - mi := &file_supernode_action_cascade_service_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *HealthCheckResponse_Memory) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthCheckResponse_Memory) ProtoMessage() {} - -func (x *HealthCheckResponse_Memory) ProtoReflect() protoreflect.Message { - mi := &file_supernode_action_cascade_service_proto_msgTypes[10] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HealthCheckResponse_Memory.ProtoReflect.Descriptor instead. -func (*HealthCheckResponse_Memory) Descriptor() ([]byte, []int) { - return file_supernode_action_cascade_service_proto_rawDescGZIP(), []int{8, 1} -} - -func (x *HealthCheckResponse_Memory) GetTotal() uint64 { - if x != nil { - return x.Total - } - return 0 -} - -func (x *HealthCheckResponse_Memory) GetUsed() uint64 { - if x != nil { - return x.Used - } - return 0 -} - -func (x *HealthCheckResponse_Memory) GetAvailable() uint64 { - if x != nil { - return x.Available - } - return 0 -} - -func (x *HealthCheckResponse_Memory) GetUsedPerc() float64 { - if x != nil { - return x.UsedPerc - } - return 0 -} - var File_supernode_action_cascade_service_proto protoreflect.FileDescriptor var file_supernode_action_cascade_service_proto_rawDesc = []byte{ @@ -780,68 +560,40 @@ var file_supernode_action_cascade_service_proto_rawDesc = []byte{ 0x64, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x22, 0x14, 0x0a, 0x12, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xdc, 0x02, 0x0a, 0x13, 0x48, 0x65, 0x61, 0x6c, 0x74, - 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, - 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x61, - 0x73, 0x63, 0x61, 0x64, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x43, 0x50, 0x55, 0x52, 0x03, 0x63, - 0x70, 0x75, 0x12, 0x3b, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x61, 0x73, 0x63, 0x61, 0x64, 0x65, 0x2e, 0x48, 0x65, 0x61, - 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, - 0x2a, 0x0a, 0x11, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x5f, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x67, - 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x61, 0x73, 0x6b, - 0x73, 0x49, 0x6e, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x1a, 0x39, 0x0a, 0x03, 0x43, - 0x50, 0x55, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x61, - 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x6d, - 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x1a, 0x6d, 0x0a, 0x06, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, - 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x75, 0x73, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x76, - 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x61, - 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x64, - 0x5f, 0x70, 0x65, 0x72, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x75, 0x73, 0x65, - 0x64, 0x50, 0x65, 0x72, 0x63, 0x2a, 0xb6, 0x02, 0x0a, 0x12, 0x53, 0x75, 0x70, 0x65, 0x72, 0x6e, - 0x6f, 0x64, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, - 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x41, 0x43, 0x54, - 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x54, 0x52, 0x49, 0x45, 0x56, 0x45, 0x44, 0x10, 0x01, 0x12, - 0x17, 0x0a, 0x13, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x45, 0x45, 0x5f, 0x56, 0x45, - 0x52, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x02, 0x12, 0x1e, 0x0a, 0x1a, 0x54, 0x4f, 0x50, 0x5f, - 0x53, 0x55, 0x50, 0x45, 0x52, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x5f, - 0x50, 0x41, 0x53, 0x53, 0x45, 0x44, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x10, 0x4d, 0x45, 0x54, 0x41, - 0x44, 0x41, 0x54, 0x41, 0x5f, 0x44, 0x45, 0x43, 0x4f, 0x44, 0x45, 0x44, 0x10, 0x04, 0x12, 0x16, - 0x0a, 0x12, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x48, 0x41, 0x53, 0x48, 0x5f, 0x56, 0x45, 0x52, 0x49, - 0x46, 0x49, 0x45, 0x44, 0x10, 0x05, 0x12, 0x11, 0x0a, 0x0d, 0x49, 0x4e, 0x50, 0x55, 0x54, 0x5f, - 0x45, 0x4e, 0x43, 0x4f, 0x44, 0x45, 0x44, 0x10, 0x06, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x49, 0x47, - 0x4e, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, - 0x07, 0x12, 0x12, 0x0a, 0x0e, 0x52, 0x51, 0x49, 0x44, 0x5f, 0x47, 0x45, 0x4e, 0x45, 0x52, 0x41, - 0x54, 0x45, 0x44, 0x10, 0x08, 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x51, 0x49, 0x44, 0x5f, 0x56, 0x45, - 0x52, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x09, 0x12, 0x14, 0x0a, 0x10, 0x41, 0x52, 0x54, 0x45, - 0x46, 0x41, 0x43, 0x54, 0x53, 0x5f, 0x53, 0x54, 0x4f, 0x52, 0x45, 0x44, 0x10, 0x0a, 0x12, 0x14, - 0x0a, 0x10, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x49, 0x4e, 0x41, 0x4c, 0x49, 0x5a, - 0x45, 0x44, 0x10, 0x0b, 0x12, 0x18, 0x0a, 0x14, 0x41, 0x52, 0x54, 0x45, 0x46, 0x41, 0x43, 0x54, - 0x53, 0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x4c, 0x4f, 0x41, 0x44, 0x45, 0x44, 0x10, 0x0c, 0x32, 0xe2, - 0x01, 0x0a, 0x0e, 0x43, 0x61, 0x73, 0x63, 0x61, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x43, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x18, 0x2e, - 0x63, 0x61, 0x73, 0x63, 0x61, 0x64, 0x65, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, + 0x2a, 0xb6, 0x02, 0x0a, 0x12, 0x53, 0x75, 0x70, 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, + 0x57, 0x4e, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, + 0x45, 0x54, 0x52, 0x49, 0x45, 0x56, 0x45, 0x44, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x41, 0x43, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x45, 0x45, 0x5f, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x02, 0x12, 0x1e, 0x0a, 0x1a, 0x54, 0x4f, 0x50, 0x5f, 0x53, 0x55, 0x50, 0x45, 0x52, + 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x5f, 0x50, 0x41, 0x53, 0x53, 0x45, + 0x44, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x10, 0x4d, 0x45, 0x54, 0x41, 0x44, 0x41, 0x54, 0x41, 0x5f, + 0x44, 0x45, 0x43, 0x4f, 0x44, 0x45, 0x44, 0x10, 0x04, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x41, 0x54, + 0x41, 0x5f, 0x48, 0x41, 0x53, 0x48, 0x5f, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x05, 0x12, 0x11, 0x0a, 0x0d, 0x49, 0x4e, 0x50, 0x55, 0x54, 0x5f, 0x45, 0x4e, 0x43, 0x4f, 0x44, + 0x45, 0x44, 0x10, 0x06, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x49, 0x47, 0x4e, 0x41, 0x54, 0x55, 0x52, + 0x45, 0x5f, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x07, 0x12, 0x12, 0x0a, 0x0e, + 0x52, 0x51, 0x49, 0x44, 0x5f, 0x47, 0x45, 0x4e, 0x45, 0x52, 0x41, 0x54, 0x45, 0x44, 0x10, 0x08, + 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x51, 0x49, 0x44, 0x5f, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x09, 0x12, 0x14, 0x0a, 0x10, 0x41, 0x52, 0x54, 0x45, 0x46, 0x41, 0x43, 0x54, 0x53, + 0x5f, 0x53, 0x54, 0x4f, 0x52, 0x45, 0x44, 0x10, 0x0a, 0x12, 0x14, 0x0a, 0x10, 0x41, 0x43, 0x54, + 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x49, 0x4e, 0x41, 0x4c, 0x49, 0x5a, 0x45, 0x44, 0x10, 0x0b, 0x12, + 0x18, 0x0a, 0x14, 0x41, 0x52, 0x54, 0x45, 0x46, 0x41, 0x43, 0x54, 0x53, 0x5f, 0x44, 0x4f, 0x57, + 0x4e, 0x4c, 0x4f, 0x41, 0x44, 0x45, 0x44, 0x10, 0x0c, 0x32, 0x98, 0x01, 0x0a, 0x0e, 0x43, 0x61, + 0x73, 0x63, 0x61, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x08, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x63, 0x61, 0x73, 0x63, 0x61, + 0x64, 0x65, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x63, 0x61, 0x73, 0x63, 0x61, 0x64, 0x65, 0x2e, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x30, + 0x01, 0x12, 0x41, 0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x18, 0x2e, + 0x63, 0x61, 0x73, 0x63, 0x61, 0x64, 0x65, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x63, 0x61, 0x73, 0x63, 0x61, 0x64, - 0x65, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x28, 0x01, 0x30, 0x01, 0x12, 0x48, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1b, 0x2e, 0x63, 0x61, 0x73, 0x63, 0x61, 0x64, 0x65, 0x2e, - 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x63, 0x61, 0x73, 0x63, 0x61, 0x64, 0x65, 0x2e, 0x48, 0x65, 0x61, - 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x41, 0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x18, 0x2e, 0x63, - 0x61, 0x73, 0x63, 0x61, 0x64, 0x65, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x63, 0x61, 0x73, 0x63, 0x61, 0x64, 0x65, - 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x30, 0x01, 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x4c, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, - 0x2f, 0x73, 0x75, 0x70, 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, - 0x75, 0x70, 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2f, - 0x63, 0x61, 0x73, 0x63, 0x61, 0x64, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x30, 0x01, 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x4c, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, + 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x67, 0x65, 0x6e, 0x2f, + 0x73, 0x75, 0x70, 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x2f, 0x63, 0x61, 0x73, 0x63, 0x61, 0x64, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -857,41 +609,33 @@ func file_supernode_action_cascade_service_proto_rawDescGZIP() []byte { } var file_supernode_action_cascade_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_supernode_action_cascade_service_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_supernode_action_cascade_service_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_supernode_action_cascade_service_proto_goTypes = []any{ - (SupernodeEventType)(0), // 0: cascade.SupernodeEventType - (*RegisterRequest)(nil), // 1: cascade.RegisterRequest - (*DataChunk)(nil), // 2: cascade.DataChunk - (*Metadata)(nil), // 3: cascade.Metadata - (*RegisterResponse)(nil), // 4: cascade.RegisterResponse - (*DownloadRequest)(nil), // 5: cascade.DownloadRequest - (*DownloadResponse)(nil), // 6: cascade.DownloadResponse - (*DownloadEvent)(nil), // 7: cascade.DownloadEvent - (*HealthCheckRequest)(nil), // 8: cascade.HealthCheckRequest - (*HealthCheckResponse)(nil), // 9: cascade.HealthCheckResponse - (*HealthCheckResponse_CPU)(nil), // 10: cascade.HealthCheckResponse.CPU - (*HealthCheckResponse_Memory)(nil), // 11: cascade.HealthCheckResponse.Memory + (SupernodeEventType)(0), // 0: cascade.SupernodeEventType + (*RegisterRequest)(nil), // 1: cascade.RegisterRequest + (*DataChunk)(nil), // 2: cascade.DataChunk + (*Metadata)(nil), // 3: cascade.Metadata + (*RegisterResponse)(nil), // 4: cascade.RegisterResponse + (*DownloadRequest)(nil), // 5: cascade.DownloadRequest + (*DownloadResponse)(nil), // 6: cascade.DownloadResponse + (*DownloadEvent)(nil), // 7: cascade.DownloadEvent } var file_supernode_action_cascade_service_proto_depIdxs = []int32{ - 2, // 0: cascade.RegisterRequest.chunk:type_name -> cascade.DataChunk - 3, // 1: cascade.RegisterRequest.metadata:type_name -> cascade.Metadata - 0, // 2: cascade.RegisterResponse.event_type:type_name -> cascade.SupernodeEventType - 7, // 3: cascade.DownloadResponse.event:type_name -> cascade.DownloadEvent - 2, // 4: cascade.DownloadResponse.chunk:type_name -> cascade.DataChunk - 0, // 5: cascade.DownloadEvent.event_type:type_name -> cascade.SupernodeEventType - 10, // 6: cascade.HealthCheckResponse.cpu:type_name -> cascade.HealthCheckResponse.CPU - 11, // 7: cascade.HealthCheckResponse.memory:type_name -> cascade.HealthCheckResponse.Memory - 1, // 8: cascade.CascadeService.Register:input_type -> cascade.RegisterRequest - 8, // 9: cascade.CascadeService.HealthCheck:input_type -> cascade.HealthCheckRequest - 5, // 10: cascade.CascadeService.Download:input_type -> cascade.DownloadRequest - 4, // 11: cascade.CascadeService.Register:output_type -> cascade.RegisterResponse - 9, // 12: cascade.CascadeService.HealthCheck:output_type -> cascade.HealthCheckResponse - 6, // 13: cascade.CascadeService.Download:output_type -> cascade.DownloadResponse - 11, // [11:14] is the sub-list for method output_type - 8, // [8:11] is the sub-list for method input_type - 8, // [8:8] is the sub-list for extension type_name - 8, // [8:8] is the sub-list for extension extendee - 0, // [0:8] is the sub-list for field type_name + 2, // 0: cascade.RegisterRequest.chunk:type_name -> cascade.DataChunk + 3, // 1: cascade.RegisterRequest.metadata:type_name -> cascade.Metadata + 0, // 2: cascade.RegisterResponse.event_type:type_name -> cascade.SupernodeEventType + 7, // 3: cascade.DownloadResponse.event:type_name -> cascade.DownloadEvent + 2, // 4: cascade.DownloadResponse.chunk:type_name -> cascade.DataChunk + 0, // 5: cascade.DownloadEvent.event_type:type_name -> cascade.SupernodeEventType + 1, // 6: cascade.CascadeService.Register:input_type -> cascade.RegisterRequest + 5, // 7: cascade.CascadeService.Download:input_type -> cascade.DownloadRequest + 4, // 8: cascade.CascadeService.Register:output_type -> cascade.RegisterResponse + 6, // 9: cascade.CascadeService.Download:output_type -> cascade.DownloadResponse + 8, // [8:10] is the sub-list for method output_type + 6, // [6:8] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_supernode_action_cascade_service_proto_init() } @@ -913,7 +657,7 @@ func file_supernode_action_cascade_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_supernode_action_cascade_service_proto_rawDesc, NumEnums: 1, - NumMessages: 11, + NumMessages: 7, NumExtensions: 0, NumServices: 1, }, diff --git a/gen/supernode/action/cascade/service_grpc.pb.go b/gen/supernode/action/cascade/service_grpc.pb.go index 576cfea3..fc196a20 100644 --- a/gen/supernode/action/cascade/service_grpc.pb.go +++ b/gen/supernode/action/cascade/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v3.12.4 +// - protoc v3.21.12 // source: supernode/action/cascade/service.proto package cascade @@ -19,9 +19,8 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - CascadeService_Register_FullMethodName = "/cascade.CascadeService/Register" - CascadeService_HealthCheck_FullMethodName = "/cascade.CascadeService/HealthCheck" - CascadeService_Download_FullMethodName = "/cascade.CascadeService/Download" + CascadeService_Register_FullMethodName = "/cascade.CascadeService/Register" + CascadeService_Download_FullMethodName = "/cascade.CascadeService/Download" ) // CascadeServiceClient is the client API for CascadeService service. @@ -29,7 +28,6 @@ const ( // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type CascadeServiceClient interface { Register(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[RegisterRequest, RegisterResponse], error) - HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) Download(ctx context.Context, in *DownloadRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[DownloadResponse], error) } @@ -54,16 +52,6 @@ func (c *cascadeServiceClient) Register(ctx context.Context, opts ...grpc.CallOp // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type CascadeService_RegisterClient = grpc.BidiStreamingClient[RegisterRequest, RegisterResponse] -func (c *cascadeServiceClient) HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(HealthCheckResponse) - err := c.cc.Invoke(ctx, CascadeService_HealthCheck_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *cascadeServiceClient) Download(ctx context.Context, in *DownloadRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[DownloadResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &CascadeService_ServiceDesc.Streams[1], CascadeService_Download_FullMethodName, cOpts...) @@ -88,7 +76,6 @@ type CascadeService_DownloadClient = grpc.ServerStreamingClient[DownloadResponse // for forward compatibility. type CascadeServiceServer interface { Register(grpc.BidiStreamingServer[RegisterRequest, RegisterResponse]) error - HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) Download(*DownloadRequest, grpc.ServerStreamingServer[DownloadResponse]) error mustEmbedUnimplementedCascadeServiceServer() } @@ -103,9 +90,6 @@ type UnimplementedCascadeServiceServer struct{} func (UnimplementedCascadeServiceServer) Register(grpc.BidiStreamingServer[RegisterRequest, RegisterResponse]) error { return status.Errorf(codes.Unimplemented, "method Register not implemented") } -func (UnimplementedCascadeServiceServer) HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method HealthCheck not implemented") -} func (UnimplementedCascadeServiceServer) Download(*DownloadRequest, grpc.ServerStreamingServer[DownloadResponse]) error { return status.Errorf(codes.Unimplemented, "method Download not implemented") } @@ -137,24 +121,6 @@ func _CascadeService_Register_Handler(srv interface{}, stream grpc.ServerStream) // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type CascadeService_RegisterServer = grpc.BidiStreamingServer[RegisterRequest, RegisterResponse] -func _CascadeService_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(HealthCheckRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CascadeServiceServer).HealthCheck(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: CascadeService_HealthCheck_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CascadeServiceServer).HealthCheck(ctx, req.(*HealthCheckRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _CascadeService_Download_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(DownloadRequest) if err := stream.RecvMsg(m); err != nil { @@ -172,12 +138,7 @@ type CascadeService_DownloadServer = grpc.ServerStreamingServer[DownloadResponse var CascadeService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "cascade.CascadeService", HandlerType: (*CascadeServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "HealthCheck", - Handler: _CascadeService_HealthCheck_Handler, - }, - }, + Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ { StreamName: "Register", diff --git a/gen/supernode/agents/.gitkeep b/gen/supernode/agents/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/gen/supernode/service.pb.go b/gen/supernode/service.pb.go new file mode 100644 index 00000000..5495e2c3 --- /dev/null +++ b/gen/supernode/service.pb.go @@ -0,0 +1,338 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.2 +// protoc v3.12.4 +// source: supernode/service.proto + +package supernode + +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 HealthCheckRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *HealthCheckRequest) Reset() { + *x = HealthCheckRequest{} + mi := &file_supernode_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HealthCheckRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HealthCheckRequest) ProtoMessage() {} + +func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message { + mi := &file_supernode_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HealthCheckRequest.ProtoReflect.Descriptor instead. +func (*HealthCheckRequest) Descriptor() ([]byte, []int) { + return file_supernode_service_proto_rawDescGZIP(), []int{0} +} + +// The HealthCheckResponse represents system health status. +type HealthCheckResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Cpu *HealthCheckResponse_CPU `protobuf:"bytes,1,opt,name=cpu,proto3" json:"cpu,omitempty"` + Memory *HealthCheckResponse_Memory `protobuf:"bytes,2,opt,name=memory,proto3" json:"memory,omitempty"` + TasksInProgress []string `protobuf:"bytes,3,rep,name=tasks_in_progress,json=tasksInProgress,proto3" json:"tasks_in_progress,omitempty"` +} + +func (x *HealthCheckResponse) Reset() { + *x = HealthCheckResponse{} + mi := &file_supernode_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HealthCheckResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HealthCheckResponse) ProtoMessage() {} + +func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message { + mi := &file_supernode_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead. +func (*HealthCheckResponse) Descriptor() ([]byte, []int) { + return file_supernode_service_proto_rawDescGZIP(), []int{1} +} + +func (x *HealthCheckResponse) GetCpu() *HealthCheckResponse_CPU { + if x != nil { + return x.Cpu + } + return nil +} + +func (x *HealthCheckResponse) GetMemory() *HealthCheckResponse_Memory { + if x != nil { + return x.Memory + } + return nil +} + +func (x *HealthCheckResponse) GetTasksInProgress() []string { + if x != nil { + return x.TasksInProgress + } + return nil +} + +type HealthCheckResponse_CPU struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Usage string `protobuf:"bytes,1,opt,name=usage,proto3" json:"usage,omitempty"` + Remaining string `protobuf:"bytes,2,opt,name=remaining,proto3" json:"remaining,omitempty"` +} + +func (x *HealthCheckResponse_CPU) Reset() { + *x = HealthCheckResponse_CPU{} + mi := &file_supernode_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HealthCheckResponse_CPU) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HealthCheckResponse_CPU) ProtoMessage() {} + +func (x *HealthCheckResponse_CPU) ProtoReflect() protoreflect.Message { + mi := &file_supernode_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HealthCheckResponse_CPU.ProtoReflect.Descriptor instead. +func (*HealthCheckResponse_CPU) Descriptor() ([]byte, []int) { + return file_supernode_service_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *HealthCheckResponse_CPU) GetUsage() string { + if x != nil { + return x.Usage + } + return "" +} + +func (x *HealthCheckResponse_CPU) GetRemaining() string { + if x != nil { + return x.Remaining + } + return "" +} + +type HealthCheckResponse_Memory struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Total uint64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + Used uint64 `protobuf:"varint,2,opt,name=used,proto3" json:"used,omitempty"` + Available uint64 `protobuf:"varint,3,opt,name=available,proto3" json:"available,omitempty"` + UsedPerc float64 `protobuf:"fixed64,4,opt,name=used_perc,json=usedPerc,proto3" json:"used_perc,omitempty"` +} + +func (x *HealthCheckResponse_Memory) Reset() { + *x = HealthCheckResponse_Memory{} + mi := &file_supernode_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HealthCheckResponse_Memory) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HealthCheckResponse_Memory) ProtoMessage() {} + +func (x *HealthCheckResponse_Memory) ProtoReflect() protoreflect.Message { + mi := &file_supernode_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HealthCheckResponse_Memory.ProtoReflect.Descriptor instead. +func (*HealthCheckResponse_Memory) Descriptor() ([]byte, []int) { + return file_supernode_service_proto_rawDescGZIP(), []int{1, 1} +} + +func (x *HealthCheckResponse_Memory) GetTotal() uint64 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *HealthCheckResponse_Memory) GetUsed() uint64 { + if x != nil { + return x.Used + } + return 0 +} + +func (x *HealthCheckResponse_Memory) GetAvailable() uint64 { + if x != nil { + return x.Available + } + return 0 +} + +func (x *HealthCheckResponse_Memory) GetUsedPerc() float64 { + if x != nil { + return x.UsedPerc + } + return 0 +} + +var File_supernode_service_proto protoreflect.FileDescriptor + +var file_supernode_service_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x73, 0x75, 0x70, 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x73, 0x75, 0x70, 0x65, 0x72, + 0x6e, 0x6f, 0x64, 0x65, 0x22, 0x14, 0x0a, 0x12, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xe0, 0x02, 0x0a, 0x13, 0x48, + 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x34, 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x22, 0x2e, 0x73, 0x75, 0x70, 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, + 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, + 0x43, 0x50, 0x55, 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x3d, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, + 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x73, 0x75, 0x70, 0x65, 0x72, + 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x52, + 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x2a, 0x0a, 0x11, 0x74, 0x61, 0x73, 0x6b, 0x73, + 0x5f, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x0f, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x49, 0x6e, 0x50, 0x72, 0x6f, 0x67, 0x72, + 0x65, 0x73, 0x73, 0x1a, 0x39, 0x0a, 0x03, 0x43, 0x50, 0x55, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x73, + 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, + 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x1a, 0x6d, + 0x0a, 0x06, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, + 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x12, + 0x0a, 0x04, 0x75, 0x73, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x75, 0x73, + 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, + 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x72, 0x63, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x01, 0x52, 0x08, 0x75, 0x73, 0x65, 0x64, 0x50, 0x65, 0x72, 0x63, 0x32, 0x60, 0x0a, + 0x10, 0x53, 0x75, 0x70, 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x4c, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x12, 0x1d, 0x2e, 0x73, 0x75, 0x70, 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x48, 0x65, 0x61, + 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1e, 0x2e, 0x73, 0x75, 0x70, 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, + 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, + 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4c, 0x75, + 0x6d, 0x65, 0x72, 0x61, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x73, 0x75, 0x70, + 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x75, 0x70, 0x65, 0x72, + 0x6e, 0x6f, 0x64, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_supernode_service_proto_rawDescOnce sync.Once + file_supernode_service_proto_rawDescData = file_supernode_service_proto_rawDesc +) + +func file_supernode_service_proto_rawDescGZIP() []byte { + file_supernode_service_proto_rawDescOnce.Do(func() { + file_supernode_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_supernode_service_proto_rawDescData) + }) + return file_supernode_service_proto_rawDescData +} + +var file_supernode_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_supernode_service_proto_goTypes = []any{ + (*HealthCheckRequest)(nil), // 0: supernode.HealthCheckRequest + (*HealthCheckResponse)(nil), // 1: supernode.HealthCheckResponse + (*HealthCheckResponse_CPU)(nil), // 2: supernode.HealthCheckResponse.CPU + (*HealthCheckResponse_Memory)(nil), // 3: supernode.HealthCheckResponse.Memory +} +var file_supernode_service_proto_depIdxs = []int32{ + 2, // 0: supernode.HealthCheckResponse.cpu:type_name -> supernode.HealthCheckResponse.CPU + 3, // 1: supernode.HealthCheckResponse.memory:type_name -> supernode.HealthCheckResponse.Memory + 0, // 2: supernode.SupernodeService.HealthCheck:input_type -> supernode.HealthCheckRequest + 1, // 3: supernode.SupernodeService.HealthCheck:output_type -> supernode.HealthCheckResponse + 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 + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_supernode_service_proto_init() } +func file_supernode_service_proto_init() { + if File_supernode_service_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_supernode_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_supernode_service_proto_goTypes, + DependencyIndexes: file_supernode_service_proto_depIdxs, + MessageInfos: file_supernode_service_proto_msgTypes, + }.Build() + File_supernode_service_proto = out.File + file_supernode_service_proto_rawDesc = nil + file_supernode_service_proto_goTypes = nil + file_supernode_service_proto_depIdxs = nil +} diff --git a/gen/supernode/service_grpc.pb.go b/gen/supernode/service_grpc.pb.go new file mode 100644 index 00000000..f5bd7a6b --- /dev/null +++ b/gen/supernode/service_grpc.pb.go @@ -0,0 +1,121 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v3.12.4 +// source: supernode/service.proto + +package supernode + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + SupernodeService_HealthCheck_FullMethodName = "/supernode.SupernodeService/HealthCheck" +) + +// SupernodeServiceClient is the client API for SupernodeService 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 SupernodeServiceClient interface { + HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) +} + +type supernodeServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSupernodeServiceClient(cc grpc.ClientConnInterface) SupernodeServiceClient { + return &supernodeServiceClient{cc} +} + +func (c *supernodeServiceClient) HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(HealthCheckResponse) + err := c.cc.Invoke(ctx, SupernodeService_HealthCheck_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SupernodeServiceServer is the server API for SupernodeService service. +// All implementations must embed UnimplementedSupernodeServiceServer +// for forward compatibility. +type SupernodeServiceServer interface { + HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) + mustEmbedUnimplementedSupernodeServiceServer() +} + +// UnimplementedSupernodeServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedSupernodeServiceServer struct{} + +func (UnimplementedSupernodeServiceServer) HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HealthCheck not implemented") +} +func (UnimplementedSupernodeServiceServer) mustEmbedUnimplementedSupernodeServiceServer() {} +func (UnimplementedSupernodeServiceServer) testEmbeddedByValue() {} + +// UnsafeSupernodeServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SupernodeServiceServer will +// result in compilation errors. +type UnsafeSupernodeServiceServer interface { + mustEmbedUnimplementedSupernodeServiceServer() +} + +func RegisterSupernodeServiceServer(s grpc.ServiceRegistrar, srv SupernodeServiceServer) { + // If the following call pancis, it indicates UnimplementedSupernodeServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&SupernodeService_ServiceDesc, srv) +} + +func _SupernodeService_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HealthCheckRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SupernodeServiceServer).HealthCheck(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SupernodeService_HealthCheck_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SupernodeServiceServer).HealthCheck(ctx, req.(*HealthCheckRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// SupernodeService_ServiceDesc is the grpc.ServiceDesc for SupernodeService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SupernodeService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "supernode.SupernodeService", + HandlerType: (*SupernodeServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "HealthCheck", + Handler: _SupernodeService_HealthCheck_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "supernode/service.proto", +} diff --git a/gen/supernode/supernode.pb.go b/gen/supernode/supernode.pb.go new file mode 100644 index 00000000..0b3610f1 --- /dev/null +++ b/gen/supernode/supernode.pb.go @@ -0,0 +1,420 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.2 +// protoc v3.21.12 +// source: supernode/supernode.proto + +package supernode + +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 StatusRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *StatusRequest) Reset() { + *x = StatusRequest{} + mi := &file_supernode_supernode_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatusRequest) ProtoMessage() {} + +func (x *StatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_supernode_supernode_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead. +func (*StatusRequest) Descriptor() ([]byte, []int) { + return file_supernode_supernode_proto_rawDescGZIP(), []int{0} +} + +// The StatusResponse represents system status. +type StatusResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Cpu *StatusResponse_CPU `protobuf:"bytes,1,opt,name=cpu,proto3" json:"cpu,omitempty"` + Memory *StatusResponse_Memory `protobuf:"bytes,2,opt,name=memory,proto3" json:"memory,omitempty"` + Services []*StatusResponse_ServiceTasks `protobuf:"bytes,3,rep,name=services,proto3" json:"services,omitempty"` + AvailableServices []string `protobuf:"bytes,4,rep,name=available_services,json=availableServices,proto3" json:"available_services,omitempty"` +} + +func (x *StatusResponse) Reset() { + *x = StatusResponse{} + mi := &file_supernode_supernode_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatusResponse) ProtoMessage() {} + +func (x *StatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_supernode_supernode_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead. +func (*StatusResponse) Descriptor() ([]byte, []int) { + return file_supernode_supernode_proto_rawDescGZIP(), []int{1} +} + +func (x *StatusResponse) GetCpu() *StatusResponse_CPU { + if x != nil { + return x.Cpu + } + return nil +} + +func (x *StatusResponse) GetMemory() *StatusResponse_Memory { + if x != nil { + return x.Memory + } + return nil +} + +func (x *StatusResponse) GetServices() []*StatusResponse_ServiceTasks { + if x != nil { + return x.Services + } + return nil +} + +func (x *StatusResponse) GetAvailableServices() []string { + if x != nil { + return x.AvailableServices + } + return nil +} + +type StatusResponse_CPU struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Usage string `protobuf:"bytes,1,opt,name=usage,proto3" json:"usage,omitempty"` + Remaining string `protobuf:"bytes,2,opt,name=remaining,proto3" json:"remaining,omitempty"` +} + +func (x *StatusResponse_CPU) Reset() { + *x = StatusResponse_CPU{} + mi := &file_supernode_supernode_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StatusResponse_CPU) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatusResponse_CPU) ProtoMessage() {} + +func (x *StatusResponse_CPU) ProtoReflect() protoreflect.Message { + mi := &file_supernode_supernode_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatusResponse_CPU.ProtoReflect.Descriptor instead. +func (*StatusResponse_CPU) Descriptor() ([]byte, []int) { + return file_supernode_supernode_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *StatusResponse_CPU) GetUsage() string { + if x != nil { + return x.Usage + } + return "" +} + +func (x *StatusResponse_CPU) GetRemaining() string { + if x != nil { + return x.Remaining + } + return "" +} + +type StatusResponse_Memory struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Total uint64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + Used uint64 `protobuf:"varint,2,opt,name=used,proto3" json:"used,omitempty"` + Available uint64 `protobuf:"varint,3,opt,name=available,proto3" json:"available,omitempty"` + UsedPerc float64 `protobuf:"fixed64,4,opt,name=used_perc,json=usedPerc,proto3" json:"used_perc,omitempty"` +} + +func (x *StatusResponse_Memory) Reset() { + *x = StatusResponse_Memory{} + mi := &file_supernode_supernode_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StatusResponse_Memory) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatusResponse_Memory) ProtoMessage() {} + +func (x *StatusResponse_Memory) ProtoReflect() protoreflect.Message { + mi := &file_supernode_supernode_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatusResponse_Memory.ProtoReflect.Descriptor instead. +func (*StatusResponse_Memory) Descriptor() ([]byte, []int) { + return file_supernode_supernode_proto_rawDescGZIP(), []int{1, 1} +} + +func (x *StatusResponse_Memory) GetTotal() uint64 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *StatusResponse_Memory) GetUsed() uint64 { + if x != nil { + return x.Used + } + return 0 +} + +func (x *StatusResponse_Memory) GetAvailable() uint64 { + if x != nil { + return x.Available + } + return 0 +} + +func (x *StatusResponse_Memory) GetUsedPerc() float64 { + if x != nil { + return x.UsedPerc + } + return 0 +} + +// ServiceTasks contains task information for a specific service +type StatusResponse_ServiceTasks struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` + TaskIds []string `protobuf:"bytes,2,rep,name=task_ids,json=taskIds,proto3" json:"task_ids,omitempty"` + TaskCount int32 `protobuf:"varint,3,opt,name=task_count,json=taskCount,proto3" json:"task_count,omitempty"` +} + +func (x *StatusResponse_ServiceTasks) Reset() { + *x = StatusResponse_ServiceTasks{} + mi := &file_supernode_supernode_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StatusResponse_ServiceTasks) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatusResponse_ServiceTasks) ProtoMessage() {} + +func (x *StatusResponse_ServiceTasks) ProtoReflect() protoreflect.Message { + mi := &file_supernode_supernode_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatusResponse_ServiceTasks.ProtoReflect.Descriptor instead. +func (*StatusResponse_ServiceTasks) Descriptor() ([]byte, []int) { + return file_supernode_supernode_proto_rawDescGZIP(), []int{1, 2} +} + +func (x *StatusResponse_ServiceTasks) GetServiceName() string { + if x != nil { + return x.ServiceName + } + return "" +} + +func (x *StatusResponse_ServiceTasks) GetTaskIds() []string { + if x != nil { + return x.TaskIds + } + return nil +} + +func (x *StatusResponse_ServiceTasks) GetTaskCount() int32 { + if x != nil { + return x.TaskCount + } + return 0 +} + +var File_supernode_supernode_proto protoreflect.FileDescriptor + +var file_supernode_supernode_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x73, 0x75, 0x70, 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x73, 0x75, 0x70, 0x65, + 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x73, 0x75, 0x70, + 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x85, 0x04, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x03, 0x63, 0x70, + 0x75, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x73, 0x75, 0x70, 0x65, 0x72, 0x6e, + 0x6f, 0x64, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x2e, 0x43, 0x50, 0x55, 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x38, 0x0a, 0x06, 0x6d, + 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x73, 0x75, + 0x70, 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x52, 0x06, 0x6d, + 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x42, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x73, 0x75, 0x70, 0x65, 0x72, 0x6e, + 0x6f, 0x64, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x52, + 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x61, 0x76, 0x61, + 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x1a, 0x39, 0x0a, 0x03, 0x43, 0x50, 0x55, 0x12, + 0x14, 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x75, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x69, + 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, + 0x69, 0x6e, 0x67, 0x1a, 0x6d, 0x0a, 0x06, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x14, 0x0a, + 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x74, 0x6f, + 0x74, 0x61, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x04, 0x75, 0x73, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x76, 0x61, 0x69, 0x6c, + 0x61, 0x62, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x61, 0x76, 0x61, 0x69, + 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x70, 0x65, + 0x72, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x75, 0x73, 0x65, 0x64, 0x50, 0x65, + 0x72, 0x63, 0x1a, 0x6b, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x61, 0x73, + 0x6b, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, + 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x32, + 0x54, 0x0a, 0x10, 0x53, 0x75, 0x70, 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x40, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x12, 0x18, 0x2e, 0x73, 0x75, 0x70, 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x73, 0x75, 0x70, + 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x4c, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x6f, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x67, 0x65, 0x6e, + 0x2f, 0x73, 0x75, 0x70, 0x65, 0x72, 0x6e, 0x6f, 0x64, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_supernode_supernode_proto_rawDescOnce sync.Once + file_supernode_supernode_proto_rawDescData = file_supernode_supernode_proto_rawDesc +) + +func file_supernode_supernode_proto_rawDescGZIP() []byte { + file_supernode_supernode_proto_rawDescOnce.Do(func() { + file_supernode_supernode_proto_rawDescData = protoimpl.X.CompressGZIP(file_supernode_supernode_proto_rawDescData) + }) + return file_supernode_supernode_proto_rawDescData +} + +var file_supernode_supernode_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_supernode_supernode_proto_goTypes = []any{ + (*StatusRequest)(nil), // 0: supernode.StatusRequest + (*StatusResponse)(nil), // 1: supernode.StatusResponse + (*StatusResponse_CPU)(nil), // 2: supernode.StatusResponse.CPU + (*StatusResponse_Memory)(nil), // 3: supernode.StatusResponse.Memory + (*StatusResponse_ServiceTasks)(nil), // 4: supernode.StatusResponse.ServiceTasks +} +var file_supernode_supernode_proto_depIdxs = []int32{ + 2, // 0: supernode.StatusResponse.cpu:type_name -> supernode.StatusResponse.CPU + 3, // 1: supernode.StatusResponse.memory:type_name -> supernode.StatusResponse.Memory + 4, // 2: supernode.StatusResponse.services:type_name -> supernode.StatusResponse.ServiceTasks + 0, // 3: supernode.SupernodeService.GetStatus:input_type -> supernode.StatusRequest + 1, // 4: supernode.SupernodeService.GetStatus:output_type -> supernode.StatusResponse + 4, // [4:5] is the sub-list for method output_type + 3, // [3:4] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_supernode_supernode_proto_init() } +func file_supernode_supernode_proto_init() { + if File_supernode_supernode_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_supernode_supernode_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_supernode_supernode_proto_goTypes, + DependencyIndexes: file_supernode_supernode_proto_depIdxs, + MessageInfos: file_supernode_supernode_proto_msgTypes, + }.Build() + File_supernode_supernode_proto = out.File + file_supernode_supernode_proto_rawDesc = nil + file_supernode_supernode_proto_goTypes = nil + file_supernode_supernode_proto_depIdxs = nil +} diff --git a/gen/supernode/supernode_grpc.pb.go b/gen/supernode/supernode_grpc.pb.go new file mode 100644 index 00000000..783c3f8c --- /dev/null +++ b/gen/supernode/supernode_grpc.pb.go @@ -0,0 +1,125 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v3.21.12 +// source: supernode/supernode.proto + +package supernode + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + SupernodeService_GetStatus_FullMethodName = "/supernode.SupernodeService/GetStatus" +) + +// SupernodeServiceClient is the client API for SupernodeService 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. +// +// SupernodeService provides status information for all services +type SupernodeServiceClient interface { + GetStatus(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) +} + +type supernodeServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSupernodeServiceClient(cc grpc.ClientConnInterface) SupernodeServiceClient { + return &supernodeServiceClient{cc} +} + +func (c *supernodeServiceClient) GetStatus(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(StatusResponse) + err := c.cc.Invoke(ctx, SupernodeService_GetStatus_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SupernodeServiceServer is the server API for SupernodeService service. +// All implementations must embed UnimplementedSupernodeServiceServer +// for forward compatibility. +// +// SupernodeService provides status information for all services +type SupernodeServiceServer interface { + GetStatus(context.Context, *StatusRequest) (*StatusResponse, error) + mustEmbedUnimplementedSupernodeServiceServer() +} + +// UnimplementedSupernodeServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedSupernodeServiceServer struct{} + +func (UnimplementedSupernodeServiceServer) GetStatus(context.Context, *StatusRequest) (*StatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetStatus not implemented") +} +func (UnimplementedSupernodeServiceServer) mustEmbedUnimplementedSupernodeServiceServer() {} +func (UnimplementedSupernodeServiceServer) testEmbeddedByValue() {} + +// UnsafeSupernodeServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SupernodeServiceServer will +// result in compilation errors. +type UnsafeSupernodeServiceServer interface { + mustEmbedUnimplementedSupernodeServiceServer() +} + +func RegisterSupernodeServiceServer(s grpc.ServiceRegistrar, srv SupernodeServiceServer) { + // If the following call pancis, it indicates UnimplementedSupernodeServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&SupernodeService_ServiceDesc, srv) +} + +func _SupernodeService_GetStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SupernodeServiceServer).GetStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SupernodeService_GetStatus_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SupernodeServiceServer).GetStatus(ctx, req.(*StatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// SupernodeService_ServiceDesc is the grpc.ServiceDesc for SupernodeService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SupernodeService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "supernode.SupernodeService", + HandlerType: (*SupernodeServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetStatus", + Handler: _SupernodeService_GetStatus_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "supernode/supernode.proto", +} diff --git a/go.mod b/go.mod index 7292b8e3..abad780a 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ replace github.com/LumeraProtocol/supernode/supernode => ./supernode require ( cosmossdk.io/math v1.5.3 - github.com/LumeraProtocol/lumera v1.5.0 + github.com/LumeraProtocol/lumera v1.6.0 github.com/LumeraProtocol/rq-go v0.2.1 github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/cenkalti/backoff/v4 v4.3.0 @@ -28,11 +28,9 @@ require ( github.com/patrickmn/go-cache v2.1.0+incompatible github.com/pkg/errors v0.9.1 github.com/shirou/gopsutil/v3 v3.24.5 - github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.10.0 - github.com/x-cray/logrus-prefixed-formatter v0.5.2 go.uber.org/mock v0.5.2 go.uber.org/ratelimit v0.3.1 golang.org/x/crypto v0.36.0 @@ -40,7 +38,6 @@ require ( golang.org/x/sys v0.31.0 google.golang.org/grpc v1.71.0 google.golang.org/protobuf v1.36.6 - gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/yaml.v3 v3.0.1 lukechampine.com/blake3 v1.4.0 ) @@ -134,7 +131,6 @@ require ( github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect diff --git a/go.sum b/go.sum index 0d2e187a..498582a4 100644 --- a/go.sum +++ b/go.sum @@ -61,8 +61,8 @@ github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3 github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/LumeraProtocol/lumera v1.5.0 h1:LDPtd155PjG/LKk34x/3vhC9H+J9tHoxwrcwRMG6jzM= -github.com/LumeraProtocol/lumera v1.5.0/go.mod h1:c1M+sjewuCvxw+pznwlspUzenDJI8Y+suKB3RFKS2Wo= +github.com/LumeraProtocol/lumera v1.6.0 h1:5I172U/f1Migt7tRxnywhz5aRKCpBOx/IMgOzhJfTP0= +github.com/LumeraProtocol/lumera v1.6.0/go.mod h1:c1M+sjewuCvxw+pznwlspUzenDJI8Y+suKB3RFKS2Wo= github.com/LumeraProtocol/rq-go v0.2.1 h1:8B3UzRChLsGMmvZ+UVbJsJj6JZzL9P9iYxbdUwGsQI4= github.com/LumeraProtocol/rq-go v0.2.1/go.mod h1:APnKCZRh1Es2Vtrd2w4kCLgAyaL5Bqrkz/BURoRJ+O8= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -558,8 +558,6 @@ github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxU github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM= github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= -github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD6Q= github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ= @@ -733,8 +731,6 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= @@ -798,8 +794,6 @@ github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/x-cray/logrus-prefixed-formatter v0.5.2 h1:00txxvfBM9muc0jiLIEAkAcIMJzfthRT6usrui8uGmg= -github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -987,7 +981,6 @@ golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1110,8 +1103,6 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= -gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= diff --git a/p2p/kademlia/bootstrap.go b/p2p/kademlia/bootstrap.go index 6dcd71c2..8ce18f10 100644 --- a/p2p/kademlia/bootstrap.go +++ b/p2p/kademlia/bootstrap.go @@ -3,7 +3,6 @@ package kademlia import ( "context" "fmt" - "os" "strconv" "strings" "sync" @@ -34,11 +33,6 @@ func (s *DHT) parseNode(extP2P string, selfAddr string) (*Node, error) { return nil, errors.New("empty address") } - /*if strings.Contains(extP2P, "0.0.0.0") { - fmt.Println("skippping node") - return nil, errors.New("invalid address") - }*/ - if extP2P == selfAddr { return nil, errors.New("self address") } @@ -61,24 +55,12 @@ func (s *DHT) parseNode(extP2P string, selfAddr string) (*Node, error) { if err != nil { return nil, errors.New("invalid port number") } - - // For system testing, use port+1 if SYSTEM_TEST=true - if os.Getenv("SYSTEM_TEST") == "true" { - port = uint16(portNum) + 1 - logtrace.Info(context.Background(), "Using port+1 for system testing", logtrace.Fields{ - logtrace.FieldModule: "p2p", - "original_port": portNum, - "adjusted_port": port, - }) - } else { - // For normal P2P operation, always use the default port - port = defaultNetworkPort - } + port = uint16(portNum) } } else { // No port in the address ip = extP2P - port = defaultNetworkPort + port = defaultSuperNodeP2PPort } if ip == "" { @@ -170,13 +152,32 @@ func (s *DHT) ConfigureBootstrapNodes(ctx context.Context, bootstrapNodes string continue } - // Parse the node from the IP address - node, err := s.parseNode(latestIP, selfAddress) + // Extract IP from the address (remove port if present) + var ip string + if idx := strings.LastIndex(latestIP, ":"); idx != -1 { + ip = latestIP[:idx] + } else { + ip = latestIP + } + + // Use p2p_port from supernode record + p2pPort := defaultSuperNodeP2PPort + if supernode.P2PPort != "" { + if port, err := strconv.ParseUint(supernode.P2PPort, 10, 16); err == nil { + p2pPort = int(port) + } + } + + // Create full address with p2p port for validation + fullAddress := fmt.Sprintf("%s:%d", ip, p2pPort) + + // Parse the node from the full address + node, err := s.parseNode(fullAddress, selfAddress) if err != nil { logtrace.Warn(ctx, "Skip Bad Bootstrap Address", logtrace.Fields{ logtrace.FieldModule: "p2p", logtrace.FieldError: err.Error(), - "address": latestIP, + "address": fullAddress, "supernode": supernode.SupernodeAccount, }) continue @@ -184,7 +185,7 @@ func (s *DHT) ConfigureBootstrapNodes(ctx context.Context, bootstrapNodes string // Store the supernode account as the node ID node.ID = []byte(supernode.SupernodeAccount) - mapNodes[latestIP] = node + mapNodes[fullAddress] = node } // Convert the map to a slice diff --git a/proto/supernode/action/cascade/service.proto b/proto/supernode/action/cascade/service.proto index 23be1d35..e8cb9a97 100644 --- a/proto/supernode/action/cascade/service.proto +++ b/proto/supernode/action/cascade/service.proto @@ -4,7 +4,6 @@ option go_package = "github.com/LumeraProtocol/supernode/gen/supernode/action/ca service CascadeService { rpc Register (stream RegisterRequest) returns (stream RegisterResponse); - rpc HealthCheck(HealthCheckRequest) returns (HealthCheckResponse); rpc Download (DownloadRequest) returns (stream DownloadResponse); } @@ -62,23 +61,3 @@ enum SupernodeEventType { ARTEFACTS_DOWNLOADED = 12; } -message HealthCheckRequest {} - -// The HealthCheckResponse represents system health status. -message HealthCheckResponse { - message CPU { - string usage = 1; - string remaining = 2; - } - - message Memory { - uint64 total = 1; - uint64 used = 2; - uint64 available = 3; - double used_perc = 4; - } - - CPU cpu = 1; - Memory memory = 2; - repeated string tasks_in_progress = 3; -} \ No newline at end of file diff --git a/proto/supernode/agents/.gitkeep b/proto/supernode/agents/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/proto/supernode/nft/.gitkeep b/proto/supernode/nft/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/proto/supernode/service.proto b/proto/supernode/service.proto new file mode 100644 index 00000000..62073561 --- /dev/null +++ b/proto/supernode/service.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; +package supernode; +option go_package = "github.com/LumeraProtocol/supernode/gen/supernode"; + +service SupernodeService { + rpc HealthCheck(HealthCheckRequest) returns (HealthCheckResponse); +} + +message HealthCheckRequest {} + +// The HealthCheckResponse represents system health status. +message HealthCheckResponse { + message CPU { + string usage = 1; + string remaining = 2; +} + +message Memory { + uint64 total = 1; + uint64 used = 2; + uint64 available = 3; + double used_perc = 4; +} + +CPU cpu = 1; + Memory memory = 2; + repeated string tasks_in_progress = 3; +} diff --git a/proto/supernode/supernode.proto b/proto/supernode/supernode.proto new file mode 100644 index 00000000..10d72990 --- /dev/null +++ b/proto/supernode/supernode.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; +package supernode; +option go_package = "github.com/LumeraProtocol/supernode/gen/supernode"; + +// SupernodeService provides status information for all services +service SupernodeService { + rpc GetStatus(StatusRequest) returns (StatusResponse); +} + +message StatusRequest {} + +// The StatusResponse represents system status. +message StatusResponse { + message CPU { + string usage = 1; + string remaining = 2; + } + + message Memory { + uint64 total = 1; + uint64 used = 2; + uint64 available = 3; + double used_perc = 4; + } + + // ServiceTasks contains task information for a specific service + message ServiceTasks { + string service_name = 1; + repeated string task_ids = 2; + int32 task_count = 3; + } + + CPU cpu = 1; + Memory memory = 2; + repeated ServiceTasks services = 3; + repeated string available_services = 4; +} \ No newline at end of file diff --git a/sdk/action/client.go b/sdk/action/client.go index ca19ec57..6bb3ed0a 100644 --- a/sdk/action/client.go +++ b/sdk/action/client.go @@ -4,9 +4,12 @@ import ( "context" "fmt" + "github.com/LumeraProtocol/supernode/sdk/adapters/lumera" + "github.com/LumeraProtocol/supernode/sdk/adapters/supernodeservice" "github.com/LumeraProtocol/supernode/sdk/config" "github.com/LumeraProtocol/supernode/sdk/event" "github.com/LumeraProtocol/supernode/sdk/log" + "github.com/LumeraProtocol/supernode/sdk/net" "github.com/LumeraProtocol/supernode/sdk/task" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -16,24 +19,25 @@ import ( // //go:generate mockery --name=Client --output=testutil/mocks --outpkg=mocks --filename=client_mock.go type Client interface { - // - signature: Base64-encoded cryptographic signature of the file's data hash (blake3) - // 1- hash(blake3) > 2- sign > 3- base64 - // The signature must be created by the same account that created the Lumera action. - // It must be a digital signature of the data hash found in the action's CASCADE metadata. + // StartCascade initiates a cascade operation with file path, action ID, and signature + // signature: Base64-encoded signature of file's blake3 hash by action creator StartCascade(ctx context.Context, filePath string, actionID string, signature string) (string, error) DeleteTask(ctx context.Context, taskID string) error GetTask(ctx context.Context, taskID string) (*task.TaskEntry, bool) SubscribeToEvents(ctx context.Context, eventType event.EventType, handler event.Handler) error SubscribeToAllEvents(ctx context.Context, handler event.Handler) error - DownloadCascade(ctx context.Context, actionID, outputPath string) (string, error) + GetSupernodeStatus(ctx context.Context, supernodeAddress string) (*supernodeservice.SupernodeStatusresponse, error) + // DownloadCascade downloads cascade to outputDir, filename determined by action ID + DownloadCascade(ctx context.Context, actionID, outputDir string) (string, error) } // ClientImpl implements the Client interface type ClientImpl struct { - config config.Config - taskManager task.Manager - logger log.Logger - keyring keyring.Keyring + config config.Config + taskManager task.Manager + logger log.Logger + keyring keyring.Keyring + lumeraClient lumera.Client } // Verify interface compliance at compile time @@ -45,15 +49,31 @@ func NewClient(ctx context.Context, config config.Config, logger log.Logger) (Cl logger = log.NewNoopLogger() } - taskManager, err := task.NewManager(ctx, config, logger) + // Create lumera client once + lumeraClient, err := lumera.NewAdapter(ctx, + lumera.ConfigParams{ + GRPCAddr: config.Lumera.GRPCAddr, + ChainID: config.Lumera.ChainID, + KeyName: config.Account.KeyName, + Keyring: config.Account.Keyring, + }, + logger) + if err != nil { + return nil, fmt.Errorf("failed to create lumera client: %w", err) + } + + // Create task manager with shared lumera client + taskManager, err := task.NewManagerWithLumeraClient(ctx, config, logger, lumeraClient) if err != nil { return nil, fmt.Errorf("failed to create task manager: %w", err) } return &ClientImpl{ - config: config, - taskManager: taskManager, - logger: logger, + config: config, + taskManager: taskManager, + logger: logger, + keyring: config.Account.Keyring, + lumeraClient: lumeraClient, }, nil } @@ -130,16 +150,68 @@ func (c *ClientImpl) SubscribeToAllEvents(ctx context.Context, handler event.Han return nil } -func (c *ClientImpl) DownloadCascade( - ctx context.Context, - actionID, outputPath string, -) (string, error) { +// GetSupernodeStatus retrieves the status of a specific supernode by its address +func (c *ClientImpl) GetSupernodeStatus(ctx context.Context, supernodeAddress string) (*supernodeservice.SupernodeStatusresponse, error) { + if supernodeAddress == "" { + c.logger.Error(ctx, "Empty supernode address provided") + return nil, fmt.Errorf("supernode address cannot be empty") + } + + c.logger.Debug(ctx, "Getting supernode status", "address", supernodeAddress) + + // Get supernode details from blockchain + supernode, err := c.lumeraClient.GetSupernodeBySupernodeAddress(ctx, supernodeAddress) + if err != nil { + c.logger.Error(ctx, "Failed to get supernode details", "address", supernodeAddress, "error", err) + return nil, fmt.Errorf("failed to get supernode details: %w", err) + } + + // Get the latest IP address for the supernode + if len(supernode.PrevIpAddresses) == 0 { + return nil, fmt.Errorf("no IP addresses found for supernode %s", supernodeAddress) + } + + ipAddress := supernode.PrevIpAddresses[0].Address + + // Create lumera supernode object for network client + lumeraSupernode := lumera.Supernode{ + CosmosAddress: supernodeAddress, + GrpcEndpoint: ipAddress, + State: lumera.SUPERNODE_STATE_ACTIVE, // Assume active since we're querying + } + + // Create network client factory + clientFactory := net.NewClientFactory(ctx, c.logger, c.keyring, c.lumeraClient, net.FactoryConfig{ + LocalCosmosAddress: c.config.Account.LocalCosmosAddress, + PeerType: c.config.Account.PeerType, + }) + + // Create client for the specific supernode + supernodeClient, err := clientFactory.CreateClient(ctx, lumeraSupernode) + if err != nil { + c.logger.Error(ctx, "Failed to create supernode client", "address", supernodeAddress, "error", err) + return nil, fmt.Errorf("failed to create supernode client: %w", err) + } + defer supernodeClient.Close(ctx) + + // Get the supernode status + status, err := supernodeClient.GetSupernodeStatus(ctx) + if err != nil { + c.logger.Error(ctx, "Failed to get supernode status", "address", supernodeAddress, "error", err) + return nil, fmt.Errorf("failed to get supernode status: %w", err) + } + + c.logger.Info(ctx, "Successfully retrieved supernode status", "address", supernodeAddress) + return status, nil +} + +func (c *ClientImpl) DownloadCascade(ctx context.Context, actionID, outputDir string) (string, error) { if actionID == "" { return "", fmt.Errorf("actionID is empty") } - taskID, err := c.taskManager.CreateDownloadTask(ctx, actionID, outputPath) + taskID, err := c.taskManager.CreateDownloadTask(ctx, actionID, outputDir) if err != nil { return "", fmt.Errorf("create download task: %w", err) } diff --git a/sdk/adapters/lumera/adapter.go b/sdk/adapters/lumera/adapter.go index 126adbe2..8da42756 100644 --- a/sdk/adapters/lumera/adapter.go +++ b/sdk/adapters/lumera/adapter.go @@ -9,9 +9,9 @@ import ( actiontypes "github.com/LumeraProtocol/lumera/x/action/v1/types" sntypes "github.com/LumeraProtocol/lumera/x/supernode/v1/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" lumeraclient "github.com/LumeraProtocol/supernode/pkg/lumera" "github.com/cosmos/cosmos-sdk/crypto/keyring" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/golang/protobuf/proto" ) diff --git a/sdk/adapters/supernodeservice/adapter.go b/sdk/adapters/supernodeservice/adapter.go index 7b4cc7a4..34a5817f 100644 --- a/sdk/adapters/supernodeservice/adapter.go +++ b/sdk/adapters/supernodeservice/adapter.go @@ -5,7 +5,9 @@ import ( "fmt" "io" "os" + "path/filepath" + "github.com/LumeraProtocol/supernode/gen/supernode" "github.com/LumeraProtocol/supernode/gen/supernode/action/cascade" "github.com/LumeraProtocol/supernode/pkg/net" "github.com/LumeraProtocol/supernode/sdk/event" @@ -15,11 +17,12 @@ import ( ) type cascadeAdapter struct { - client cascade.CascadeServiceClient - logger log.Logger + client cascade.CascadeServiceClient + statusClient supernode.SupernodeServiceClient + logger log.Logger } -func NewCascadeAdapter(ctx context.Context, client cascade.CascadeServiceClient, logger log.Logger) CascadeServiceClient { +func NewCascadeAdapter(ctx context.Context, conn *grpc.ClientConn, logger log.Logger) CascadeServiceClient { if logger == nil { logger = log.NewNoopLogger() } @@ -27,8 +30,9 @@ func NewCascadeAdapter(ctx context.Context, client cascade.CascadeServiceClient, logger.Debug(ctx, "Creating cascade service adapter") return &cascadeAdapter{ - client: client, - logger: logger, + client: cascade.NewCascadeServiceClient(conn), + statusClient: supernode.NewSupernodeServiceClient(conn), + logger: logger, } } @@ -164,6 +168,18 @@ func (a *cascadeAdapter) CascadeSupernodeRegister(ctx context.Context, in *Casca }, nil } +func (a *cascadeAdapter) GetSupernodeStatus(ctx context.Context) (SupernodeStatusresponse, error) { + resp, err := a.statusClient.GetStatus(ctx, &supernode.StatusRequest{}) + if err != nil { + a.logger.Error(ctx, "Failed to get supernode status", "error", err) + return SupernodeStatusresponse{}, fmt.Errorf("failed to get supernode status: %w", err) + } + + a.logger.Debug(ctx, "Supernode status retrieved", "status", resp) + + return *toSdkSupernodeStatus(resp), nil +} + // CascadeSupernodeDownload downloads a file from a supernode gRPC stream func (a *cascadeAdapter) CascadeSupernodeDownload( ctx context.Context, @@ -178,16 +194,20 @@ func (a *cascadeAdapter) CascadeSupernodeDownload( ActionId: in.ActionID, }, opts...) if err != nil { - a.logger.Error(ctx, "failed to create download stream", - "action_id", in.ActionID, "error", err) + a.logger.Error(ctx, "failed to create download stream", "action_id", in.ActionID, "error", err) return nil, err } // 2. Prepare destination file + // Create directory structure if it doesn't exist + if err := os.MkdirAll(filepath.Dir(in.OutputPath), 0755); err != nil { + a.logger.Error(ctx, "failed to create output directory", "path", filepath.Dir(in.OutputPath), "error", err) + return nil, fmt.Errorf("create output directory: %w", err) + } + outFile, err := os.Create(in.OutputPath) if err != nil { - a.logger.Error(ctx, "failed to create output file", - "path", in.OutputPath, "error", err) + a.logger.Error(ctx, "failed to create output file", "path", in.OutputPath, "error", err) return nil, fmt.Errorf("create output file: %w", err) } defer outFile.Close() @@ -211,10 +231,7 @@ func (a *cascadeAdapter) CascadeSupernodeDownload( // 3a. Progress / event message case *cascade.DownloadResponse_Event: - a.logger.Info(ctx, "supernode event", - "event_type", x.Event.EventType, - "message", x.Event.Message, - "action_id", in.ActionID) + a.logger.Info(ctx, "supernode event", "event_type", x.Event.EventType, "message", x.Event.Message, "action_id", in.ActionID) if in.EventLogger != nil { in.EventLogger(ctx, toSdkEvent(x.Event.EventType), x.Event.Message, event.EventData{ @@ -237,17 +254,11 @@ func (a *cascadeAdapter) CascadeSupernodeDownload( bytesWritten += int64(len(data)) chunkIndex++ - a.logger.Debug(ctx, "received chunk", - "chunk_index", chunkIndex, - "chunk_size", len(data), - "bytes_written", bytesWritten) + a.logger.Debug(ctx, "received chunk", "chunk_index", chunkIndex, "chunk_size", len(data), "bytes_written", bytesWritten) } } - a.logger.Info(ctx, "download complete", - "bytes_written", bytesWritten, - "path", in.OutputPath, - "action_id", in.ActionID) + a.logger.Info(ctx, "download complete", "bytes_written", bytesWritten, "path", in.OutputPath, "action_id", in.ActionID) return &CascadeSupernodeDownloadResponse{ Success: true, @@ -287,3 +298,37 @@ func toSdkEvent(e cascade.SupernodeEventType) event.EventType { return event.SupernodeUnknown } } + +func toSdkSupernodeStatus(resp *supernode.StatusResponse) *SupernodeStatusresponse { + result := &SupernodeStatusresponse{} + + // Convert CPU data + if resp.Cpu != nil { + result.CPU.Usage = resp.Cpu.Usage + result.CPU.Remaining = resp.Cpu.Remaining + } + + // Convert Memory data + if resp.Memory != nil { + result.Memory.Total = resp.Memory.Total + result.Memory.Used = resp.Memory.Used + result.Memory.Available = resp.Memory.Available + result.Memory.UsedPerc = resp.Memory.UsedPerc + } + + // Convert Services data + result.Services = make([]ServiceTasks, 0, len(resp.Services)) + for _, service := range resp.Services { + result.Services = append(result.Services, ServiceTasks{ + ServiceName: service.ServiceName, + TaskIDs: service.TaskIds, + TaskCount: service.TaskCount, + }) + } + + // Convert AvailableServices data + result.AvailableServices = make([]string, len(resp.AvailableServices)) + copy(result.AvailableServices, resp.AvailableServices) + + return result +} diff --git a/sdk/adapters/supernodeservice/types.go b/sdk/adapters/supernodeservice/types.go index f78decf9..79a67c6b 100644 --- a/sdk/adapters/supernodeservice/types.go +++ b/sdk/adapters/supernodeservice/types.go @@ -28,6 +28,27 @@ type CascadeSupernodeRegisterResponse struct { TxHash string } +// ServiceTasks contains task information for a specific service +type ServiceTasks struct { + ServiceName string + TaskIDs []string + TaskCount int32 +} + +type SupernodeStatusresponse struct { + CPU struct { + Usage string + Remaining string + } + Memory struct { + Total uint64 + Used uint64 + Available uint64 + UsedPerc float64 + } + Services []ServiceTasks + AvailableServices []string +} type CascadeSupernodeDownloadRequest struct { ActionID string TaskID string @@ -44,5 +65,6 @@ type CascadeSupernodeDownloadResponse struct { //go:generate mockery --name=CascadeServiceClient --output=testutil/mocks --outpkg=mocks --filename=cascade_service_mock.go type CascadeServiceClient interface { CascadeSupernodeRegister(ctx context.Context, in *CascadeSupernodeRegisterRequest, opts ...grpc.CallOption) (*CascadeSupernodeRegisterResponse, error) + GetSupernodeStatus(ctx context.Context) (SupernodeStatusresponse, error) CascadeSupernodeDownload(ctx context.Context, in *CascadeSupernodeDownloadRequest, opts ...grpc.CallOption) (*CascadeSupernodeDownloadResponse, error) } diff --git a/sdk/net/client.go b/sdk/net/client.go index ee058d84..6366bc5e 100644 --- a/sdk/net/client.go +++ b/sdk/net/client.go @@ -15,6 +15,7 @@ type SupernodeClient interface { // HealthCheck performs a health check on the supernode HealthCheck(ctx context.Context) (*grpc_health_v1.HealthCheckResponse, error) + GetSupernodeStatus(ctx context.Context) (*supernodeservice.SupernodeStatusresponse, error) // Download downloads the cascade action file Download(ctx context.Context, in *supernodeservice.CascadeSupernodeDownloadRequest, opts ...grpc.CallOption) (*supernodeservice.CascadeSupernodeDownloadResponse, error) diff --git a/sdk/net/impl.go b/sdk/net/impl.go index bccfc367..98b68338 100644 --- a/sdk/net/impl.go +++ b/sdk/net/impl.go @@ -5,7 +5,6 @@ import ( "fmt" "github.com/LumeraProtocol/lumera/x/lumeraid/securekeyx" - "github.com/LumeraProtocol/supernode/gen/supernode/action/cascade" ltc "github.com/LumeraProtocol/supernode/pkg/net/credentials" "github.com/LumeraProtocol/supernode/pkg/net/credentials/alts/conn" "github.com/LumeraProtocol/supernode/pkg/net/grpc/client" @@ -93,7 +92,7 @@ func NewSupernodeClient(ctx context.Context, logger log.Logger, keyring keyring. // Create service clients cascadeClient := supernodeservice.NewCascadeAdapter( ctx, - cascade.NewCascadeServiceClient(conn), + conn, logger, ) @@ -129,6 +128,16 @@ func (c *supernodeClient) HealthCheck(ctx context.Context) (*grpc_health_v1.Heal return resp, nil } +func (c *supernodeClient) GetSupernodeStatus(ctx context.Context) (*supernodeservice.SupernodeStatusresponse, error) { + resp, err := c.cascadeClient.GetSupernodeStatus(ctx) + if err != nil { + return nil, fmt.Errorf("failed to get supernode status: %w", err) + } + + c.logger.Debug(ctx, "Supernode status retrieved successfully") + return &resp, nil +} + // Download downloads the cascade action file func (c *supernodeClient) Download(ctx context.Context, in *supernodeservice.CascadeSupernodeDownloadRequest, opts ...grpc.CallOption) (*supernodeservice.CascadeSupernodeDownloadResponse, error) { resp, err := c.cascadeClient.CascadeSupernodeDownload(ctx, in, opts...) diff --git a/sdk/task/download.go b/sdk/task/download.go index 36b99c44..147ea9f0 100644 --- a/sdk/task/download.go +++ b/sdk/task/download.go @@ -65,33 +65,42 @@ func (t *CascadeDownloadTask) downloadFromSupernodes(ctx context.Context, supern OutputPath: t.outputPath, } - var lastErr error - for idx, sn := range supernodes { - t.LogEvent(ctx, event.SDKDownloadAttempt, "attempting download from super-node", event.EventData{ - event.KeySupernode: sn.GrpcEndpoint, - event.KeySupernodeAddress: sn.CosmosAddress, - event.KeyIteration: idx + 1, - }) + // Process supernodes in pairs + var allErrors []error + for i := 0; i < len(supernodes); i += 2 { + // Determine how many supernodes to try in this batch (1 or 2) + batchSize := 2 + if i+1 >= len(supernodes) { + batchSize = 1 + } - if err := t.attemptDownload(ctx, sn, clientFactory, req); err != nil { - lastErr = err - t.LogEvent(ctx, event.SDKDownloadFailure, "download from super-node failed", event.EventData{ - event.KeySupernode: sn.GrpcEndpoint, - event.KeySupernodeAddress: sn.CosmosAddress, - event.KeyIteration: idx + 1, - event.KeyError: err.Error(), + t.logger.Info(ctx, "attempting concurrent download from supernode batch", "batch_start", i, "batch_size", batchSize) + + // Try downloading from this batch concurrently + result, batchErrors := t.attemptConcurrentDownload(ctx, supernodes[i:i+batchSize], clientFactory, req, i) + + if result != nil { + // Success! Log and return + t.LogEvent(ctx, event.SDKDownloadSuccessful, "download successful", event.EventData{ + event.KeySupernode: result.SupernodeEndpoint, + event.KeySupernodeAddress: result.SupernodeAddress, + event.KeyIteration: result.Iteration, }) - continue + return nil } - t.LogEvent(ctx, event.SDKDownloadSuccessful, "download successful", event.EventData{ - event.KeySupernode: sn.GrpcEndpoint, - event.KeySupernodeAddress: sn.CosmosAddress, - event.KeyIteration: idx + 1, - }) - return nil + // Both (or the single one) failed, collect errors + allErrors = append(allErrors, batchErrors...) + + // Log batch failure + t.logger.Warn(ctx, "download batch failed", "batch_start", i, "batch_size", batchSize, "errors", len(batchErrors)) + } + + // All attempts failed + if len(allErrors) > 0 { + return fmt.Errorf("failed to download from all super-nodes: %v", allErrors) } - return fmt.Errorf("failed to download from all super-nodes: %w", lastErr) + return fmt.Errorf("no supernodes available for download") } func (t *CascadeDownloadTask) attemptDownload( @@ -129,3 +138,106 @@ func (t *CascadeDownloadTask) attemptDownload( return nil } + +// downloadResult holds the result of a successful download attempt +type downloadResult struct { + SupernodeAddress string + SupernodeEndpoint string + Iteration int +} + +// attemptConcurrentDownload tries to download from multiple supernodes concurrently +// Returns the first successful result or all errors if all attempts fail +func (t *CascadeDownloadTask) attemptConcurrentDownload( + ctx context.Context, + batch lumera.Supernodes, + factory *net.ClientFactory, + req *supernodeservice.CascadeSupernodeDownloadRequest, + baseIteration int, +) (*downloadResult, []error) { + // Create a cancellable context for this batch + batchCtx, cancelBatch := context.WithCancel(ctx) + defer cancelBatch() + + // Channels for results + type attemptResult struct { + success *downloadResult + err error + idx int + } + resultCh := make(chan attemptResult, len(batch)) + + // Start concurrent download attempts + for idx, sn := range batch { + iteration := baseIteration + idx + 1 + + // Log download attempt + t.LogEvent(ctx, event.SDKDownloadAttempt, "attempting download from super-node", event.EventData{ + event.KeySupernode: sn.GrpcEndpoint, + event.KeySupernodeAddress: sn.CosmosAddress, + event.KeyIteration: iteration, + }) + + go func(sn lumera.Supernode, idx int, iter int) { + // Create a copy of the request for this goroutine + reqCopy := &supernodeservice.CascadeSupernodeDownloadRequest{ + ActionID: req.ActionID, + TaskID: req.TaskID, + OutputPath: req.OutputPath, + } + + err := t.attemptDownload(batchCtx, sn, factory, reqCopy) + if err != nil { + resultCh <- attemptResult{ + err: err, + idx: idx, + } + return + } + + resultCh <- attemptResult{ + success: &downloadResult{ + SupernodeAddress: sn.CosmosAddress, + SupernodeEndpoint: sn.GrpcEndpoint, + Iteration: iter, + }, + idx: idx, + } + }(sn, idx, iteration) + } + + // Collect results + var errors []error + for i := 0; i < len(batch); i++ { + select { + case result := <-resultCh: + if result.success != nil { + // Success! Cancel other attempts and return + cancelBatch() + // Drain remaining results to avoid goroutine leaks + go func() { + for j := i + 1; j < len(batch); j++ { + <-resultCh + } + }() + return result.success, nil + } + + // Log failure + sn := batch[result.idx] + t.LogEvent(ctx, event.SDKDownloadFailure, "download from super-node failed", event.EventData{ + event.KeySupernode: sn.GrpcEndpoint, + event.KeySupernodeAddress: sn.CosmosAddress, + event.KeyIteration: baseIteration + result.idx + 1, + event.KeyError: result.err.Error(), + }) + errors = append(errors, result.err) + + case <-ctx.Done(): + return nil, []error{ctx.Err()} + } + } + + // All attempts in this batch failed + return nil, errors +} diff --git a/sdk/task/helpers.go b/sdk/task/helpers.go index 1646a326..44c9a662 100644 --- a/sdk/task/helpers.go +++ b/sdk/task/helpers.go @@ -4,6 +4,8 @@ import ( "context" "encoding/base64" "fmt" + "path/filepath" + "strings" "github.com/LumeraProtocol/supernode/sdk/adapters/lumera" ) @@ -99,3 +101,19 @@ func (m *ManagerImpl) validateDownloadAction(ctx context.Context, actionID strin return action, nil } + +// Helper function to ensure output path has the correct filename +func ensureOutputPathWithFilename(outputPath, filename string) string { + // If outputPath is empty, just return the filename + if outputPath == "" { + return filename + } + + // Check if the path already ends with the filename + if strings.HasSuffix(outputPath, filename) { + return outputPath + } + + // Otherwise, append the filename to the path + return filepath.Join(outputPath, filename) +} diff --git a/sdk/task/manager.go b/sdk/task/manager.go index 1f1f0a19..fc25cf30 100644 --- a/sdk/task/manager.go +++ b/sdk/task/manager.go @@ -3,6 +3,7 @@ package task import ( "context" "fmt" + "path" "github.com/LumeraProtocol/supernode/sdk/adapters/lumera" "github.com/LumeraProtocol/supernode/sdk/config" @@ -45,9 +46,6 @@ func NewManager(ctx context.Context, config config.Config, logger log.Logger) (M logger.Info(ctx, "Initializing task manager") - // 2 - Event bus - eventBus := event.NewBus(ctx, logger, MAX_EVENT_WORKERS) - // 3 - Create the Lumera client adapter clientAdapter, err := lumera.NewAdapter(ctx, lumera.ConfigParams{ @@ -62,6 +60,20 @@ func NewManager(ctx context.Context, config config.Config, logger log.Logger) (M panic(fmt.Sprintf("Failed to create Lumera client: %v", err)) } + return NewManagerWithLumeraClient(ctx, config, logger, clientAdapter) +} + +func NewManagerWithLumeraClient(ctx context.Context, config config.Config, logger log.Logger, lumeraClient lumera.Client) (Manager, error) { + // 1 - Logger + if logger == nil { + logger = log.NewNoopLogger() + } + + logger.Info(ctx, "Initializing task manager with provided lumera client") + + // 2 - Event bus + eventBus := event.NewBus(ctx, logger, MAX_EVENT_WORKERS) + taskCache, err := NewTaskCache(ctx, logger) if err != nil { logger.Error(ctx, "Failed to create task cache", "error", err) @@ -69,7 +81,7 @@ func NewManager(ctx context.Context, config config.Config, logger log.Logger) (M } return &ManagerImpl{ - lumeraClient: clientAdapter, + lumeraClient: lumeraClient, config: config, taskCache: taskCache, eventBus: eventBus, @@ -229,21 +241,30 @@ func (m *ManagerImpl) Close(ctx context.Context) { } } -func (m *ManagerImpl) CreateDownloadTask( - ctx context.Context, - actionID string, - outputPath string, -) (string, error) { - +func (m *ManagerImpl) CreateDownloadTask(ctx context.Context, actionID string, outputDir string) (string, error) { // First validate the action before creating the task action, err := m.validateDownloadAction(ctx, actionID) if err != nil { return "", err } + // Decode metadata to get the filename + metadata, err := m.lumeraClient.DecodeCascadeMetadata(ctx, action) + if err != nil { + return "", fmt.Errorf("failed to decode cascade metadata: %w", err) + } + + // Ensure we have a filename from metadata + if metadata.FileName == "" { + return "", fmt.Errorf("no filename found in cascade metadata") + } + + // Ensure the output path includes the correct filename + finalOutputPath := path.Join(outputDir, action.ID, metadata.FileName) + taskID := uuid.New().String()[:8] - m.logger.Debug(ctx, "Generated download task ID", "task_id", taskID) + m.logger.Debug(ctx, "Generated download task ID", "task_id", taskID, "final_output_path", finalOutputPath) baseTask := BaseTask{ TaskID: taskID, @@ -257,7 +278,8 @@ func (m *ManagerImpl) CreateDownloadTask( logger: m.logger, } - task := NewCascadeDownloadTask(baseTask, actionID, outputPath) + // Use the final output path with the correct filename + task := NewCascadeDownloadTask(baseTask, actionID, finalOutputPath) // Store task in cache m.taskCache.Set(ctx, taskID, task, TaskTypeCascade, actionID) @@ -275,6 +297,6 @@ func (m *ManagerImpl) CreateDownloadTask( } }() - m.logger.Info(ctx, "Download Cascade task created successfully", "taskID", taskID) + m.logger.Info(ctx, "Download Cascade task created successfully", "taskID", taskID, "outputPath", finalOutputPath) return taskID, nil } diff --git a/supernode/cmd/start.go b/supernode/cmd/start.go index b7e7bbd6..8b3a206c 100644 --- a/supernode/cmd/start.go +++ b/supernode/cmd/start.go @@ -103,6 +103,11 @@ The supernode will connect to the Lumera network and begin participating in the // Create cascade action server cascadeActionServer := cascade.NewCascadeActionServer(cService) + // Create supernode status service + statusService := common.NewSupernodeStatusService() + statusService.RegisterTaskProvider(cService) + supernodeServer := server.NewSupernodeServer(statusService) + // Configure server serverConfig := &server.Config{ @@ -117,6 +122,7 @@ The supernode will connect to the Lumera network and begin participating in the kr, lumeraClient, cascadeActionServer, + supernodeServer, ) if err != nil { return fmt.Errorf("failed to create gRPC server: %w", err) diff --git a/supernode/node/action/server/cascade/cascade_action_server.go b/supernode/node/action/server/cascade/cascade_action_server.go index 238b53d6..5865279e 100644 --- a/supernode/node/action/server/cascade/cascade_action_server.go +++ b/supernode/node/action/server/cascade/cascade_action_server.go @@ -1,7 +1,6 @@ package cascade import ( - "context" "encoding/hex" "fmt" "io" @@ -162,28 +161,6 @@ func (server *ActionServer) Register(stream pb.CascadeService_RegisterServer) er return nil } -func (server *ActionServer) HealthCheck(ctx context.Context, _ *pb.HealthCheckRequest) (*pb.HealthCheckResponse, error) { - resp, err := server.factory.NewCascadeRegistrationTask().HealthCheck(ctx) - if err != nil { - logtrace.Error(ctx, "error retrieving health-check metrics for supernode", logtrace.Fields{}) - return nil, err - } - - return &pb.HealthCheckResponse{ - Cpu: &pb.HealthCheckResponse_CPU{ - Usage: resp.CPU.Usage, - Remaining: resp.CPU.Remaining, - }, - Memory: &pb.HealthCheckResponse_Memory{ - Total: resp.Memory.Total, - Used: resp.Memory.Used, - Available: resp.Memory.Available, - UsedPerc: resp.Memory.UsedPerc, - }, - TasksInProgress: resp.TasksInProgress, - }, nil -} - func (server *ActionServer) Download(req *pb.DownloadRequest, stream pb.CascadeService_DownloadServer) error { fields := logtrace.Fields{ logtrace.FieldMethod: "Download", diff --git a/supernode/node/supernode/server/healthcheck.go b/supernode/node/supernode/server/healthcheck.go new file mode 100644 index 00000000..1ad828c0 --- /dev/null +++ b/supernode/node/supernode/server/healthcheck.go @@ -0,0 +1,29 @@ +package server + +import ( + "context" + pb "github.com/LumeraProtocol/supernode/gen/supernode" + "github.com/LumeraProtocol/supernode/pkg/logtrace" +) + +func (server *SupernodeActionServer) HealthCheck(ctx context.Context, _ *pb.HealthCheckRequest) (*pb.HealthCheckResponse, error) { + resp, err := server.factory.NewSupernodeTask().HealthCheck(ctx) + if err != nil { + logtrace.Error(ctx, "error retrieving health-check metrics for supernode", logtrace.Fields{}) + return nil, err + } + + return &pb.HealthCheckResponse{ + Cpu: &pb.HealthCheckResponse_CPU{ + Usage: resp.CPU.Usage, + Remaining: resp.CPU.Remaining, + }, + Memory: &pb.HealthCheckResponse_Memory{ + Total: resp.Memory.Total, + Used: resp.Memory.Used, + Available: resp.Memory.Available, + UsedPerc: resp.Memory.UsedPerc, + }, + TasksInProgress: resp.TasksInProgress, + }, nil +} diff --git a/supernode/node/supernode/server/server.go b/supernode/node/supernode/server/server.go index e4ad906c..737756b5 100644 --- a/supernode/node/supernode/server/server.go +++ b/supernode/node/supernode/server/server.go @@ -12,9 +12,11 @@ import ( healthpb "google.golang.org/grpc/health/grpc_health_v1" "github.com/LumeraProtocol/lumera/x/lumeraid/securekeyx" + "github.com/LumeraProtocol/supernode/gen/supernode" "github.com/LumeraProtocol/supernode/pkg/errgroup" "github.com/LumeraProtocol/supernode/pkg/logtrace" "github.com/LumeraProtocol/supernode/pkg/lumera" + "github.com/LumeraProtocol/supernode/supernode/services/common" ltc "github.com/LumeraProtocol/supernode/pkg/net/credentials" "github.com/LumeraProtocol/supernode/pkg/net/credentials/alts/conn" @@ -149,3 +151,17 @@ func New(config *Config, name string, kr keyring.Keyring, lumeraClient lumera.Cl lumeraClient: lumeraClient, }, nil } + +type SupernodeActionServer struct { + supernode.UnimplementedSupernodeServiceServer + factory common.TaskFactory +} + +// NewSupernodeActionServer creates a new SupernodeActionServer with injected service +func NewSupernodeActionServer(factory common.TaskFactory) *SupernodeActionServer { + return &SupernodeActionServer{factory: factory} +} + +func (server *SupernodeActionServer) Desc() *grpc.ServiceDesc { + return &supernode.SupernodeService_ServiceDesc +} diff --git a/supernode/node/supernode/server/status_server.go b/supernode/node/supernode/server/status_server.go new file mode 100644 index 00000000..c68a4728 --- /dev/null +++ b/supernode/node/supernode/server/status_server.go @@ -0,0 +1,65 @@ +package server + +import ( + "context" + + "google.golang.org/grpc" + + pb "github.com/LumeraProtocol/supernode/gen/supernode" + "github.com/LumeraProtocol/supernode/supernode/services/common" +) + +// SupernodeServer implements the SupernodeService gRPC service +type SupernodeServer struct { + pb.UnimplementedSupernodeServiceServer + statusService *common.SupernodeStatusService +} + +// NewSupernodeServer creates a new SupernodeServer +func NewSupernodeServer(statusService *common.SupernodeStatusService) *SupernodeServer { + return &SupernodeServer{ + statusService: statusService, + } +} + +// GetStatus implements SupernodeService.GetStatus +func (s *SupernodeServer) GetStatus(ctx context.Context, req *pb.StatusRequest) (*pb.StatusResponse, error) { + // Get status from the common service + status, err := s.statusService.GetStatus(ctx) + if err != nil { + return nil, err + } + + // Convert to protobuf response + response := &pb.StatusResponse{ + Cpu: &pb.StatusResponse_CPU{ + Usage: status.CPU.Usage, + Remaining: status.CPU.Remaining, + }, + Memory: &pb.StatusResponse_Memory{ + Total: status.Memory.Total, + Used: status.Memory.Used, + Available: status.Memory.Available, + UsedPerc: status.Memory.UsedPerc, + }, + Services: make([]*pb.StatusResponse_ServiceTasks, 0, len(status.Services)), + AvailableServices: status.AvailableServices, + } + + // Convert service tasks + for _, service := range status.Services { + serviceTask := &pb.StatusResponse_ServiceTasks{ + ServiceName: service.ServiceName, + TaskIds: service.TaskIDs, + TaskCount: service.TaskCount, + } + response.Services = append(response.Services, serviceTask) + } + + return response, nil +} + +// Desc implements the service interface for gRPC service registration +func (s *SupernodeServer) Desc() *grpc.ServiceDesc { + return &pb.SupernodeService_ServiceDesc +} diff --git a/supernode/node/supernode/server/status_server_test.go b/supernode/node/supernode/server/status_server_test.go new file mode 100644 index 00000000..133f38ff --- /dev/null +++ b/supernode/node/supernode/server/status_server_test.go @@ -0,0 +1,80 @@ +package server + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + pb "github.com/LumeraProtocol/supernode/gen/supernode" + "github.com/LumeraProtocol/supernode/supernode/services/common" +) + +func TestSupernodeServer_GetStatus(t *testing.T) { + ctx := context.Background() + + // Create status service + statusService := common.NewSupernodeStatusService() + + // Create server + server := NewSupernodeServer(statusService) + + // Test with empty service + resp, err := server.GetStatus(ctx, &pb.StatusRequest{}) + require.NoError(t, err) + assert.NotNil(t, resp) + + // Check basic structure + assert.NotNil(t, resp.Cpu) + assert.NotNil(t, resp.Memory) + assert.NotEmpty(t, resp.Cpu.Usage) + assert.NotEmpty(t, resp.Cpu.Remaining) + assert.True(t, resp.Memory.Total > 0) + + // Should have no services initially + assert.Empty(t, resp.Services) + assert.Empty(t, resp.AvailableServices) +} + +func TestSupernodeServer_GetStatusWithService(t *testing.T) { + ctx := context.Background() + + // Create status service + statusService := common.NewSupernodeStatusService() + + // Add a mock task provider + mockProvider := &common.MockTaskProvider{ + ServiceName: "test-service", + TaskIDs: []string{"task1", "task2"}, + } + statusService.RegisterTaskProvider(mockProvider) + + // Create server + server := NewSupernodeServer(statusService) + + // Test with service + resp, err := server.GetStatus(ctx, &pb.StatusRequest{}) + require.NoError(t, err) + assert.NotNil(t, resp) + + // Should have one service + assert.Len(t, resp.Services, 1) + assert.Len(t, resp.AvailableServices, 1) + assert.Equal(t, []string{"test-service"}, resp.AvailableServices) + + // Check service details + service := resp.Services[0] + assert.Equal(t, "test-service", service.ServiceName) + assert.Equal(t, int32(2), service.TaskCount) + assert.Equal(t, []string{"task1", "task2"}, service.TaskIds) +} + +func TestSupernodeServer_Desc(t *testing.T) { + statusService := common.NewSupernodeStatusService() + server := NewSupernodeServer(statusService) + + desc := server.Desc() + assert.NotNil(t, desc) + assert.Equal(t, "supernode.SupernodeService", desc.ServiceName) +} diff --git a/supernode/services/cascade/healthcheck.go b/supernode/services/cascade/healthcheck.go deleted file mode 100644 index d9e33122..00000000 --- a/supernode/services/cascade/healthcheck.go +++ /dev/null @@ -1,71 +0,0 @@ -package cascade - -import ( - "context" - "fmt" - "log" - "time" - - "github.com/LumeraProtocol/supernode/pkg/logtrace" - "github.com/shirou/gopsutil/v3/cpu" - "github.com/shirou/gopsutil/v3/mem" -) - -type HealthCheckResponse struct { - CPU struct { - Usage string - Remaining string - } - Memory struct { - Total uint64 - Used uint64 - Available uint64 - UsedPerc float64 - } - TasksInProgress []string -} - -func (task *CascadeRegistrationTask) HealthCheck(ctx context.Context) (HealthCheckResponse, error) { - fields := logtrace.Fields{ - logtrace.FieldMethod: "HealthCheck", - logtrace.FieldModule: "CascadeActionServer", - } - logtrace.Info(ctx, "healthcheck request received", fields) - - var resp HealthCheckResponse - - percentages, err := cpu.Percent(time.Second, false) - if err != nil { - log.Fatal(err) - } - fmt.Println(percentages) - usage := percentages[0] - remaining := 100 - usage - - // Memory stats - vmem, err := mem.VirtualMemory() - if err != nil { - logtrace.Error(ctx, "failed to get memory info", logtrace.Fields{logtrace.FieldError: err.Error()}) - return resp, err - } - resp.Memory.Total = vmem.Total - resp.Memory.Used = vmem.Used - resp.Memory.Available = vmem.Available - resp.Memory.UsedPerc = vmem.UsedPercent - - // Tasks - for _, t := range task.Worker.Tasks() { - resp.TasksInProgress = append(resp.TasksInProgress, t.ID()) - } - - logtrace.Info(ctx, "top-style healthcheck data", logtrace.Fields{ - "cpu_usage": fmt.Sprintf("%.2f", usage), - "cpu_remaining": fmt.Sprintf("%.2f", remaining), - "mem_total": resp.Memory.Total, - "mem_used": resp.Memory.Used, - "mem_used%": resp.Memory.UsedPerc, - "task_count": len(resp.TasksInProgress), - }) - - return resp, nil -} diff --git a/supernode/services/cascade/healthcheck_test.go b/supernode/services/cascade/healthcheck_test.go deleted file mode 100644 index 4c2b3b9b..00000000 --- a/supernode/services/cascade/healthcheck_test.go +++ /dev/null @@ -1,84 +0,0 @@ -package cascade - -import ( - "context" - "testing" - - "github.com/LumeraProtocol/supernode/supernode/services/common" - "github.com/stretchr/testify/assert" -) - -func TestHealthCheck(t *testing.T) { - ctx := context.Background() - - tests := []struct { - name string - taskCount int - expectErr bool - expectTasks int - }{ - { - name: "no tasks", - taskCount: 0, - expectErr: false, - expectTasks: 0, - }, - { - name: "one task", - taskCount: 1, - expectErr: false, - expectTasks: 1, - }, - { - name: "multiple tasks", - taskCount: 3, - expectErr: false, - expectTasks: 3, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - // Setup service and worker - service := &CascadeService{ - SuperNodeService: common.NewSuperNodeService(nil), - } - - var primaryTask *CascadeRegistrationTask - - go func() { - service.RunHelper(ctx, "node-id", "prefix") - }() - - // Register tasks - for i := 0; i < tt.taskCount; i++ { - task := NewCascadeRegistrationTask(service) - service.Worker.AddTask(task) - if i == 0 { - primaryTask = task - } - } - - // Always call HealthCheck from first task (if any), otherwise create a temp one - if primaryTask == nil { - primaryTask = NewCascadeRegistrationTask(service) - } - - resp, err := primaryTask.HealthCheck(ctx) - if tt.expectErr { - assert.Error(t, err) - return - } - - assert.NoError(t, err) - - // Memory checks - assert.True(t, resp.Memory.Total > 0) - assert.True(t, resp.Memory.Used <= resp.Memory.Total) - assert.True(t, resp.Memory.UsedPerc >= 0 && resp.Memory.UsedPerc <= 100) - - // Task count check - assert.Equal(t, tt.expectTasks, len(resp.TasksInProgress)) - }) - } -} diff --git a/supernode/services/cascade/interfaces.go b/supernode/services/cascade/interfaces.go index 82c7002b..36d2525a 100644 --- a/supernode/services/cascade/interfaces.go +++ b/supernode/services/cascade/interfaces.go @@ -14,7 +14,6 @@ type TaskFactory interface { // RegistrationTaskService interface allows to register a new cascade type RegistrationTaskService interface { Register(ctx context.Context, req *RegisterRequest, send func(resp *RegisterResponse) error) error - HealthCheck(ctx context.Context) (HealthCheckResponse, error) Download(ctx context.Context, req *DownloadRequest, send func(resp *DownloadResponse) error) error DownloadCleanup(ctx context.Context, actionID string) error } diff --git a/supernode/services/cascade/service.go b/supernode/services/cascade/service.go index ae440dfd..f0cb1093 100644 --- a/supernode/services/cascade/service.go +++ b/supernode/services/cascade/service.go @@ -32,6 +32,20 @@ func (service *CascadeService) Run(ctx context.Context) error { return service.RunHelper(ctx, service.config.SupernodeAccountAddress, logPrefix) } +// GetServiceName returns the name of the cascade service +func (service *CascadeService) GetServiceName() string { + return "cascade" +} + +// GetRunningTasks returns a list of currently running task IDs +func (service *CascadeService) GetRunningTasks() []string { + var taskIDs []string + for _, task := range service.Worker.Tasks() { + taskIDs = append(taskIDs, task.ID()) + } + return taskIDs +} + // NewCascadeService returns a new CascadeService instance func NewCascadeService(config *Config, lumera lumera.Client, p2pClient p2p.Client, codec codec.Codec, rqstore rqstore.Store) *CascadeService { return &CascadeService{ diff --git a/supernode/services/common/interfaces.go b/supernode/services/common/interfaces.go new file mode 100644 index 00000000..baf27343 --- /dev/null +++ b/supernode/services/common/interfaces.go @@ -0,0 +1,22 @@ +package common + +import "context" + +// TaskFactory defines an interface to create a new cascade registration task +// +//go:generate mockgen -destination=mocks/supernode_interfaces_mock.go -package=supernodemocks -source=interfaces.go +type TaskFactory interface { + NewSupernodeTask() SupernodeTaskService +} + +// SupernodeTaskService interface allows to perform supernode actions +type SupernodeTaskService interface { + HealthCheck(ctx context.Context) (HealthCheckResponse, error) +} + +// NewSupernodeTask creates a new task for supernode +func (service *SuperNodeService) NewSupernodeTask() SupernodeTaskService { + task := NewSuperNodeTask("supernode") + service.Worker.AddTask(task) + return task +} diff --git a/supernode/services/common/supernode_status.go b/supernode/services/common/supernode_status.go new file mode 100644 index 00000000..631ebd58 --- /dev/null +++ b/supernode/services/common/supernode_status.go @@ -0,0 +1,125 @@ +package common + +import ( + "context" + "fmt" + "time" + + "github.com/LumeraProtocol/supernode/pkg/logtrace" + "github.com/shirou/gopsutil/v3/cpu" + "github.com/shirou/gopsutil/v3/mem" +) + +// StatusResponse represents system status +type StatusResponse struct { + CPU struct { + Usage string + Remaining string + } + Memory struct { + Total uint64 + Used uint64 + Available uint64 + UsedPerc float64 + } + Services []ServiceTasks + AvailableServices []string +} + +// ServiceTasks contains task information for a specific service +type ServiceTasks struct { + ServiceName string + TaskIDs []string + TaskCount int32 +} + +// TaskProvider interface for services to provide their running tasks +type TaskProvider interface { + GetServiceName() string + GetRunningTasks() []string +} + +// SupernodeStatusService provides centralized status information +type SupernodeStatusService struct { + taskProviders []TaskProvider +} + +// NewSupernodeStatusService creates a new supernode status service +func NewSupernodeStatusService() *SupernodeStatusService { + return &SupernodeStatusService{ + taskProviders: make([]TaskProvider, 0), + } +} + +// RegisterTaskProvider registers a service as a task provider +func (s *SupernodeStatusService) RegisterTaskProvider(provider TaskProvider) { + s.taskProviders = append(s.taskProviders, provider) +} + +// GetStatus returns the current system status including all registered services +func (s *SupernodeStatusService) GetStatus(ctx context.Context) (StatusResponse, error) { + fields := logtrace.Fields{ + logtrace.FieldMethod: "GetStatus", + logtrace.FieldModule: "SupernodeStatusService", + } + logtrace.Info(ctx, "status request received", fields) + + var resp StatusResponse + + // Get CPU information + percentages, err := cpu.Percent(time.Second, false) + if err != nil { + logtrace.Error(ctx, "failed to get cpu info", logtrace.Fields{logtrace.FieldError: err.Error()}) + return resp, err + } + + usage := percentages[0] + remaining := 100 - usage + resp.CPU.Usage = fmt.Sprintf("%.2f", usage) + resp.CPU.Remaining = fmt.Sprintf("%.2f", remaining) + + // Get Memory information + vmem, err := mem.VirtualMemory() + if err != nil { + logtrace.Error(ctx, "failed to get memory info", logtrace.Fields{logtrace.FieldError: err.Error()}) + return resp, err + } + resp.Memory.Total = vmem.Total + resp.Memory.Used = vmem.Used + resp.Memory.Available = vmem.Available + resp.Memory.UsedPerc = vmem.UsedPercent + + // Get service information from all registered providers + resp.Services = make([]ServiceTasks, 0, len(s.taskProviders)) + resp.AvailableServices = make([]string, 0, len(s.taskProviders)) + + for _, provider := range s.taskProviders { + serviceName := provider.GetServiceName() + tasks := provider.GetRunningTasks() + + serviceTask := ServiceTasks{ + ServiceName: serviceName, + TaskIDs: tasks, + TaskCount: int32(len(tasks)), + } + resp.Services = append(resp.Services, serviceTask) + resp.AvailableServices = append(resp.AvailableServices, serviceName) + } + + totalTasks := 0 + for _, service := range resp.Services { + totalTasks += int(service.TaskCount) + } + + logtrace.Info(ctx, "status data collected", logtrace.Fields{ + "cpu_usage": fmt.Sprintf("%.2f", usage), + "cpu_remaining": fmt.Sprintf("%.2f", remaining), + "mem_total": resp.Memory.Total, + "mem_used": resp.Memory.Used, + "mem_used%": resp.Memory.UsedPerc, + "service_count": len(resp.Services), + "total_tasks": totalTasks, + }) + + return resp, nil +} diff --git a/supernode/services/common/supernode_status_test.go b/supernode/services/common/supernode_status_test.go new file mode 100644 index 00000000..6391e104 --- /dev/null +++ b/supernode/services/common/supernode_status_test.go @@ -0,0 +1,118 @@ +package common + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestSupernodeStatusService(t *testing.T) { + ctx := context.Background() + + t.Run("empty service", func(t *testing.T) { + statusService := NewSupernodeStatusService() + + resp, err := statusService.GetStatus(ctx) + assert.NoError(t, err) + + // Should have CPU and Memory info + assert.NotEmpty(t, resp.CPU.Usage) + assert.NotEmpty(t, resp.CPU.Remaining) + assert.True(t, resp.Memory.Total > 0) + + // Should have empty services list + assert.Empty(t, resp.Services) + assert.Empty(t, resp.AvailableServices) + }) + + t.Run("single service with tasks", func(t *testing.T) { + statusService := NewSupernodeStatusService() + + // Register a mock task provider + mockProvider := &MockTaskProvider{ + ServiceName: "test-service", + TaskIDs: []string{"task1", "task2", "task3"}, + } + statusService.RegisterTaskProvider(mockProvider) + + resp, err := statusService.GetStatus(ctx) + assert.NoError(t, err) + + // Should have one service + assert.Len(t, resp.Services, 1) + assert.Len(t, resp.AvailableServices, 1) + assert.Equal(t, []string{"test-service"}, resp.AvailableServices) + + service := resp.Services[0] + assert.Equal(t, "test-service", service.ServiceName) + assert.Equal(t, int32(3), service.TaskCount) + assert.Equal(t, []string{"task1", "task2", "task3"}, service.TaskIDs) + }) + + t.Run("multiple services", func(t *testing.T) { + statusService := NewSupernodeStatusService() + + // Register multiple mock task providers + cascadeProvider := &MockTaskProvider{ + ServiceName: "cascade", + TaskIDs: []string{"cascade1", "cascade2"}, + } + senseProvider := &MockTaskProvider{ + ServiceName: "sense", + TaskIDs: []string{"sense1"}, + } + + statusService.RegisterTaskProvider(cascadeProvider) + statusService.RegisterTaskProvider(senseProvider) + + resp, err := statusService.GetStatus(ctx) + assert.NoError(t, err) + + // Should have two services + assert.Len(t, resp.Services, 2) + assert.Len(t, resp.AvailableServices, 2) + assert.Contains(t, resp.AvailableServices, "cascade") + assert.Contains(t, resp.AvailableServices, "sense") + + // Check services are present + serviceMap := make(map[string]ServiceTasks) + for _, service := range resp.Services { + serviceMap[service.ServiceName] = service + } + + cascade, ok := serviceMap["cascade"] + assert.True(t, ok) + assert.Equal(t, int32(2), cascade.TaskCount) + assert.Equal(t, []string{"cascade1", "cascade2"}, cascade.TaskIDs) + + sense, ok := serviceMap["sense"] + assert.True(t, ok) + assert.Equal(t, int32(1), sense.TaskCount) + assert.Equal(t, []string{"sense1"}, sense.TaskIDs) + }) + + t.Run("service with no tasks", func(t *testing.T) { + statusService := NewSupernodeStatusService() + + // Register a mock task provider with no tasks + mockProvider := &MockTaskProvider{ + ServiceName: "empty-service", + TaskIDs: []string{}, + } + statusService.RegisterTaskProvider(mockProvider) + + resp, err := statusService.GetStatus(ctx) + assert.NoError(t, err) + + // Should have one service + assert.Len(t, resp.Services, 1) + assert.Len(t, resp.AvailableServices, 1) + assert.Equal(t, []string{"empty-service"}, resp.AvailableServices) + + service := resp.Services[0] + assert.Equal(t, "empty-service", service.ServiceName) + assert.Equal(t, int32(0), service.TaskCount) + assert.Empty(t, service.TaskIDs) + }) +} diff --git a/supernode/services/common/test_helpers.go b/supernode/services/common/test_helpers.go new file mode 100644 index 00000000..c49b940a --- /dev/null +++ b/supernode/services/common/test_helpers.go @@ -0,0 +1,15 @@ +package common + +// MockTaskProvider for testing (exported for use in other packages) +type MockTaskProvider struct { + ServiceName string + TaskIDs []string +} + +func (m *MockTaskProvider) GetServiceName() string { + return m.ServiceName +} + +func (m *MockTaskProvider) GetRunningTasks() []string { + return m.TaskIDs +} diff --git a/tests/scripts/install-lumera.sh b/tests/scripts/install-lumera.sh index 4c657e82..d3c5773c 100755 --- a/tests/scripts/install-lumera.sh +++ b/tests/scripts/install-lumera.sh @@ -5,17 +5,40 @@ set -e # Exit immediately if a command exits with a non-zero status # ./install-lumera.sh # uses latest release # ./install-lumera.sh latest-tag # uses latest tag from /tags # ./install-lumera.sh v1.1.0 # installs this specific version +# LUMERAD_BINARY=/path/to/binary ./install-lumera.sh # uses existing binary -# Support mode argument: 'latest-release' (default) or 'latest-tag' +install_binary() { + local binary_path="$1" + chmod +x "$binary_path" + sudo cp "$binary_path" /usr/local/bin/lumerad + + # Verify installation + if which lumerad > /dev/null; then + echo "Installed: $(lumerad version 2>/dev/null || echo "unknown version")" + else + echo "Installation failed" + exit 1 + fi +} + +# Check if binary path is provided via environment variable +if [ -n "$LUMERAD_BINARY" ]; then + if [ ! -f "$LUMERAD_BINARY" ]; then + echo "Binary not found: $LUMERAD_BINARY" + exit 1 + fi + install_binary "$LUMERAD_BINARY" + exit 0 +fi + +# Support mode argument: 'latest-release' (default), 'latest-tag', or specific version MODE="${1:-latest-release}" REPO="LumeraProtocol/lumera" GITHUB_API="https://api.github.com/repos/$REPO" -echo "Installation mode: $MODE" - +# Determine tag and download URL based on mode if [ "$MODE" == "latest-tag" ]; then - echo "Fetching latest tag from GitHub..." if command -v jq >/dev/null 2>&1; then TAG_NAME=$(curl -s "$GITHUB_API/tags" | jq -r '.[0].name') else @@ -28,7 +51,6 @@ elif [[ "$MODE" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${TAG_NAME}/lumera_${TAG_NAME}_linux_amd64.tar.gz" elif [ "$MODE" == "latest-release" ]; then - echo "Fetching latest release information..." RELEASE_INFO=$(curl -s -S -L "$GITHUB_API/releases/latest") # Extract tag name and download URL @@ -41,14 +63,15 @@ elif [ "$MODE" == "latest-release" ]; then fi else - echo "❌ Error: Invalid mode '$MODE'" + echo "Error: Invalid mode '$MODE'" echo "Usage: $0 [latest-release|latest-tag|vX.Y.Z]" + echo " or: LUMERAD_BINARY=/path/to/binary $0" exit 1 fi echo "Selected tag: $TAG_NAME" -echo "Download URL: $DOWNLOAD_URL" +# Validate that we have the required information if [ -z "$TAG_NAME" ] || [ -z "$DOWNLOAD_URL" ]; then echo "Error: Could not determine tag or download URL" exit 1 @@ -57,8 +80,8 @@ fi # Download and extract the release TEMP_DIR=$(mktemp -d) ORIG_DIR=$(pwd) -echo "Downloading Lumera from $DOWNLOAD_URL" curl -L --progress-bar "$DOWNLOAD_URL" -o "$TEMP_DIR/lumera.tar.gz" + cd "$TEMP_DIR" tar -xzf lumera.tar.gz rm lumera.tar.gz @@ -66,24 +89,13 @@ rm lumera.tar.gz # Install WASM library WASM_LIB=$(find . -type f -name "libwasmvm*.so" -print -quit) if [ -n "$WASM_LIB" ]; then - echo "Installing WASM library: $WASM_LIB" sudo cp "$WASM_LIB" /usr/lib/ fi # Find and install lumerad binary LUMERAD_PATH=$(find . -type f -name "lumerad" -print -quit) if [ -n "$LUMERAD_PATH" ]; then - echo "Installing lumerad binary from: $LUMERAD_PATH" - chmod +x "$LUMERAD_PATH" - sudo cp "$LUMERAD_PATH" /usr/local/bin/ - - # Verify installation - if which lumerad > /dev/null; then - echo "Installation successful. Lumerad version: $(lumerad version 2>/dev/null || echo "unknown")" - else - echo "Error: Lumerad installation failed" - exit 1 - fi + install_binary "$LUMERAD_PATH" else echo "Error: Could not find lumerad binary in the package" exit 1 @@ -91,5 +103,4 @@ fi # Clean up cd "$ORIG_DIR" -rm -rf "$TEMP_DIR" -echo "Lumera installation complete" \ No newline at end of file +rm -rf "$TEMP_DIR" \ No newline at end of file diff --git a/tests/system/e2e_cascade_test.go b/tests/system/e2e_cascade_test.go index 6402c6ad..1181e039 100644 --- a/tests/system/e2e_cascade_test.go +++ b/tests/system/e2e_cascade_test.go @@ -238,7 +238,7 @@ func TestCascadeE2E(t *testing.T) { ) require.NoError(t, err, "Failed to create Lumera client configuration") - lumeraClinet, err := lumera.NewClient(ctx, lumeraCfg) + lumeraClinet, err := lumera.NewClient(context.Background(), lumeraCfg) require.NoError(t, err, "Failed to initialize Lumera client") // --------------------------------------- @@ -360,7 +360,7 @@ func TestCascadeE2E(t *testing.T) { // Wait for transaction to be included in a block sut.AwaitNextBlock(t) - + time.Sleep(5 * time.Second) // Allow some time for the transaction to be processed // Verify the account can be queried with its public key //accountResp := cli.CustomQuery("q", "auth", "account", userAddress) //require.Contains(t, accountResp, "public_key", "User account public key should be available") @@ -406,8 +406,6 @@ func TestCascadeE2E(t *testing.T) { require.NotEmpty(t, actionID, "Action ID should not be empty") t.Logf("Extracted action ID: %s", actionID) - time.Sleep(60 * time.Second) - // Set up action client configuration // This defines how to connect to network services accConfig := sdkconfig.AccountConfig{ @@ -427,7 +425,7 @@ func TestCascadeE2E(t *testing.T) { // Initialize action client for cascade operations actionClient, err := action.NewClient( - ctx, + context.Background(), actionConfig, nil, // Nil logger - use default @@ -443,7 +441,7 @@ func TestCascadeE2E(t *testing.T) { completionCh := make(chan bool, 1) // Subscribe to ALL events - err = actionClient.SubscribeToAllEvents(ctx, func(ctx context.Context, e event.Event) { + err = actionClient.SubscribeToAllEvents(context.Background(), func(ctx context.Context, e event.Event) { // Only capture TxhasReceived events if e.Type == event.SDKTaskTxHashReceived { if txHash, ok := e.Data[event.KeyTxHash].(string); ok && txHash != "" { @@ -560,17 +558,54 @@ func TestCascadeE2E(t *testing.T) { t.Log("Test completed successfully!") - time.Sleep(1 * time.Minute) + time.Sleep(10 * time.Second) - outputFileName := "output.txt" - outputFileFullpath := filepath.Join(t.TempDir(), outputFileName) + outputFileBaseDir := filepath.Join(".") // Try to download the file using the action ID - dtaskID, err := actionClient.DownloadCascade(ctx, actionID, outputFileFullpath) + dtaskID, err := actionClient.DownloadCascade(context.Background(), actionID, outputFileBaseDir) t.Logf("Download response: %s", dtaskID) require.NoError(t, err, "Failed to download cascade data using action ID") - time.Sleep(30 * time.Second) // Wait to ensure all events are processed + time.Sleep(10 * time.Second) // Wait to ensure all events are processed + + // --------------------------------------- + // Step 11: Validate downloaded files exist + // --------------------------------------- + t.Log("Step 11: Validating downloaded files exist in expected directory structure") + + // Construct expected directory path: baseDir/{actionID}/ + expectedDownloadDir := filepath.Join(outputFileBaseDir, actionID) + t.Logf("Checking for files in directory: %s", expectedDownloadDir) + + // Check if the action directory exists + if _, err := os.Stat(expectedDownloadDir); os.IsNotExist(err) { + t.Fatalf("Expected download directory does not exist: %s", expectedDownloadDir) + } + + // Read directory contents + files, err := os.ReadDir(expectedDownloadDir) + require.NoError(t, err, "Failed to read download directory: %s", expectedDownloadDir) + + // Filter out directories, only count actual files + fileCount := 0 + var fileNames []string + for _, file := range files { + if !file.IsDir() { + fileCount++ + fileNames = append(fileNames, file.Name()) + } + } + + t.Logf("Found %d files in download directory: %v", fileCount, fileNames) + + // Validate that at least one file was downloaded + require.True(t, fileCount >= 1, "Expected at least 1 file in download directory %s, found %d files", expectedDownloadDir, fileCount) + + status, err := actionClient.GetSupernodeStatus(ctx, "lumera1cjyc4ruq739e2lakuhargejjkr0q5vg6x3d7kp") + t.Logf("Supernode status: %+v", status) + require.NoError(t, err, "Failed to get supernode status") + } func Blake3Hash(msg []byte) ([]byte, error) { hasher := blake3.New(32, nil) diff --git a/tests/system/go.mod b/tests/system/go.mod index 58ee56c4..4f9ee576 100644 --- a/tests/system/go.mod +++ b/tests/system/go.mod @@ -27,7 +27,7 @@ require ( require ( cosmossdk.io/math v1.5.3 - github.com/LumeraProtocol/lumera v1.5.0 + github.com/LumeraProtocol/lumera v1.6.0 github.com/LumeraProtocol/supernode v0.0.0-00010101000000-000000000000 github.com/cometbft/cometbft v0.38.17 github.com/tidwall/gjson v1.14.2 @@ -125,7 +125,6 @@ require ( github.com/linxGnu/grocksdb v1.9.8 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect github.com/minio/highwayhash v1.0.3 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect @@ -143,7 +142,6 @@ require ( github.com/rs/zerolog v1.34.0 // indirect github.com/sagikazarmark/locafero v0.7.0 // indirect github.com/sasha-s/go-deadlock v0.3.5 // indirect - github.com/sirupsen/logrus v1.9.3 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.12.0 // indirect github.com/spf13/viper v1.20.1 // indirect @@ -153,7 +151,6 @@ require ( github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/x-cray/logrus-prefixed-formatter v0.5.2 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect @@ -170,7 +167,6 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250422160041-2d3770c4ea7f // indirect google.golang.org/protobuf v1.36.6 // indirect - gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.2 // indirect nhooyr.io/websocket v1.8.10 // indirect diff --git a/tests/system/go.sum b/tests/system/go.sum index 395110bf..ba702050 100644 --- a/tests/system/go.sum +++ b/tests/system/go.sum @@ -73,8 +73,8 @@ github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.48 github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.48.1 h1:8nn+rsCvTq9axyEh382S0PFLBeaFwNsT43IrPWzctRU= github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.48.1/go.mod h1:viRWSEhtMZqz1rhwmOVKkWl6SwmVowfL9O2YR5gI2PE= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/LumeraProtocol/lumera v1.5.0 h1:LDPtd155PjG/LKk34x/3vhC9H+J9tHoxwrcwRMG6jzM= -github.com/LumeraProtocol/lumera v1.5.0/go.mod h1:c1M+sjewuCvxw+pznwlspUzenDJI8Y+suKB3RFKS2Wo= +github.com/LumeraProtocol/lumera v1.6.0 h1:5I172U/f1Migt7tRxnywhz5aRKCpBOx/IMgOzhJfTP0= +github.com/LumeraProtocol/lumera v1.6.0/go.mod h1:c1M+sjewuCvxw+pznwlspUzenDJI8Y+suKB3RFKS2Wo= github.com/LumeraProtocol/rq-go v0.2.1 h1:8B3UzRChLsGMmvZ+UVbJsJj6JZzL9P9iYxbdUwGsQI4= github.com/LumeraProtocol/rq-go v0.2.1/go.mod h1:APnKCZRh1Es2Vtrd2w4kCLgAyaL5Bqrkz/BURoRJ+O8= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= @@ -563,8 +563,6 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= -github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD6Q= github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ= @@ -802,8 +800,6 @@ github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/x-cray/logrus-prefixed-formatter v0.5.2 h1:00txxvfBM9muc0jiLIEAkAcIMJzfthRT6usrui8uGmg= -github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -983,7 +979,6 @@ golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1103,8 +1098,6 @@ gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qS gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= -gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=