Skip to content

Supernode server#95

Merged
mateeullahmalik merged 2 commits intomasterfrom
supernode-server
Jul 7, 2025
Merged

Supernode server#95
mateeullahmalik merged 2 commits intomasterfrom
supernode-server

Conversation

@mateeullahmalik
Copy link
Collaborator

No description provided.

j-rafique added 2 commits July 3, 2025 19:52
- Added gRPC service SupernodeService with GetStatus method to provide system status.
- Created StatusRequest and StatusResponse messages to encapsulate request and response data.
- Integrated CPU and memory metrics retrieval using gopsutil library in SupernodeStatusService.
- Removed HealthCheck RPC from CascadeService and replaced it with a centralized status service.
- Updated CascadeAdapter to utilize the new SupernodeService for status checks.
- Implemented unit tests for SupernodeServer and SupernodeStatusService to ensure correct functionality.
- Refactored existing health check logic into common service for better reusability.
- Removed redundant test files for supernode status and task services.
- Implemented a new centralized SupernodeStatusService to manage system metrics and task information.
- Introduced MetricsCollector for CPU and memory monitoring.
- Created a unified StatusResponse structure to encapsulate service status details.
- Developed a StorageHandler for P2P operations, including file storage and symbol management.
- Enhanced task status management with a new Status type and associated methods.
- Updated tests to reflect the new structure and ensure comprehensive coverage of service functionalities.
@mateeullahmalik mateeullahmalik requested review from Copilot and j-rafique and removed request for j-rafique July 7, 2025 05:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a centralized status service for the Supernode, refactors shared code into base and storage packages, and updates cascade and SDK layers to use the new status API.

  • Added SupernodeStatusService with CPU/memory metrics and task aggregation via TaskProvider.
  • Refactored common into base (task/service helpers) and storage (P2P storage handler), updating imports accordingly.
  • Replaced legacy HealthCheck with GetStatus across cascade service, gRPC server, and SDK adapter; updated protobuf definitions and generated code.

Reviewed Changes

Copilot reviewed 35 out of 37 changed files in this pull request and generated no comments.

Show a summary per file
File Description
supernode/services/common/supernode/types.go Defines StatusResponse, ServiceTasks, and TaskProvider
supernode/services/common/supernode/service.go Implements SupernodeStatusService
supernode/services/common/supernode/metrics.go Adds MetricsCollector for CPU/memory
supernode/services/common/base/supernode_task.go Moves task helper into base and updates NewSuperNodeTask import
supernode/services/common/storage/handler.go Moves storage handler into storage package
supernode/services/cascade/{status.go,service.go,...} Updates cascade to use new status service and TaskProvider interface
sdk/adapters/supernodeservice/{types.go,adapter.go} Updates SDK adapter to call GetStatus and fix type mappings
proto/supernode/{supernode.proto,action/cascade/service.proto} Updates protobuf for status API; removes cascade HealthCheck RPC
Comments suppressed due to low confidence (4)

sdk/adapters/supernodeservice/types.go:38

  • [nitpick] The type name SupernodeStatusresponse does not follow Go conventions. Rename to SupernodeStatusResponse to match exported naming patterns and related types.
type SupernodeStatusresponse struct {

supernode/services/common/supernode/metrics.go:23

  • There are no unit tests covering error paths when cpu.Percent fails. Consider adding tests that simulate cpu.Percent returning an error to verify proper error logging and propagation.
func (m *MetricsCollector) CollectCPUMetrics(ctx context.Context) (usage, remaining string, err error) {

supernode/services/common/supernode/metrics.go:38

  • The error path for mem.VirtualMemory is not covered in tests. Add a unit test that mocks mem.VirtualMemory to return an error and asserts that CollectMemoryMetrics returns the error.
func (m *MetricsCollector) CollectMemoryMetrics(ctx context.Context) (total, used, available uint64, usedPerc float64, err error) {

supernode/services/common/base/supernode_task.go:57

  • The code calls task.New(...) but the task package is not imported. Add import "github.com/LumeraProtocol/supernode/pkg/common/task" (or correct alias) so that task.New resolves correctly.
		Task:      task.New(common.StatusTaskStarted),

@mateeullahmalik mateeullahmalik merged commit bd1d9e2 into master Jul 7, 2025
2 of 7 checks passed
@mateeullahmalik mateeullahmalik deleted the supernode-server branch July 15, 2025 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants