From 888df0385eb1745bfa088842b304c6fa9245158c Mon Sep 17 00:00:00 2001 From: anonpenguin23 Date: Wed, 11 Feb 2026 07:24:27 +0200 Subject: [PATCH] Removed dead code --- e2e/env.go | 9 -------- pkg/deployments/types.go | 2 -- pkg/gateway/http_gateway.go | 10 +++----- pkg/ipfs/cluster_util.go | 13 ----------- pkg/namespace/node_selector.go | 20 ---------------- pkg/serverless/execution/lifecycle.go | 33 --------------------------- pkg/serverless/registry.go | 21 ----------------- 7 files changed, 3 insertions(+), 105 deletions(-) diff --git a/e2e/env.go b/e2e/env.go index 6a96e16..a5be043 100644 --- a/e2e/env.go +++ b/e2e/env.go @@ -478,11 +478,6 @@ func GetAPIKey() string { return apiKey } -// GetJWT returns the gateway JWT token (currently not auto-discovered) -func GetJWT() string { - return "" -} - // GetBootstrapPeers returns bootstrap peer addresses from config func GetBootstrapPeers() []string { cacheMutex.RLock() @@ -748,10 +743,6 @@ func NewNetworkClient(t *testing.T) client.NetworkClient { cfg.APIKey = GetAPIKey() cfg.QuietMode = true // Suppress debug logs in tests - if jwt := GetJWT(); jwt != "" { - cfg.JWT = jwt - } - if peers := GetBootstrapPeers(); len(peers) > 0 { cfg.BootstrapPeers = peers } diff --git a/pkg/deployments/types.go b/pkg/deployments/types.go index 8cbcbda..c34fbd9 100644 --- a/pkg/deployments/types.go +++ b/pkg/deployments/types.go @@ -249,9 +249,7 @@ var ( ErrNoNodesAvailable = &DeploymentError{Message: "no nodes available for deployment"} ErrDeploymentNotFound = &DeploymentError{Message: "deployment not found"} ErrNamespaceNotAssigned = &DeploymentError{Message: "namespace has no home node assigned"} - ErrInvalidDeploymentType = &DeploymentError{Message: "invalid deployment type"} ErrSubdomainTaken = &DeploymentError{Message: "subdomain already in use"} - ErrDomainReserved = &DeploymentError{Message: "domain is reserved"} ) // DeploymentError represents a deployment-related error diff --git a/pkg/gateway/http_gateway.go b/pkg/gateway/http_gateway.go index 528f069..9c1d1d3 100644 --- a/pkg/gateway/http_gateway.go +++ b/pkg/gateway/http_gateway.go @@ -23,9 +23,8 @@ import ( type HTTPGateway struct { logger *logging.ColoredLogger config *config.HTTPGatewayConfig - router chi.Router - reverseProxies map[string]*httputil.ReverseProxy - mu sync.RWMutex + router chi.Router + mu sync.RWMutex server *http.Server } @@ -46,8 +45,7 @@ func NewHTTPGateway(logger *logging.ColoredLogger, cfg *config.HTTPGatewayConfig gateway := &HTTPGateway{ logger: logger, config: cfg, - router: chi.NewRouter(), - reverseProxies: make(map[string]*httputil.ReverseProxy), + router: chi.NewRouter(), } // Set up router middleware @@ -110,8 +108,6 @@ func (hg *HTTPGateway) initializeRoutes() error { } } - hg.reverseProxies[routeName] = proxy - // Register route handler hg.registerRouteHandler(routeName, routeConfig, proxy) diff --git a/pkg/ipfs/cluster_util.go b/pkg/ipfs/cluster_util.go index 2f976da..4fd5777 100644 --- a/pkg/ipfs/cluster_util.go +++ b/pkg/ipfs/cluster_util.go @@ -77,19 +77,6 @@ func parseIPFSPort(rawURL string) (int, error) { return port, nil } -func parsePeerHostAndPort(multiaddr string) (string, int) { - parts := strings.Split(multiaddr, "/") - var hostStr string - var port int - for i, part := range parts { - if part == "ip4" || part == "dns" || part == "dns4" { - hostStr = parts[i+1] - } else if part == "tcp" { - fmt.Sscanf(parts[i+1], "%d", &port) - } - } - return hostStr, port -} func extractIPFromMultiaddrForCluster(maddr string) string { parts := strings.Split(maddr, "/") diff --git a/pkg/namespace/node_selector.go b/pkg/namespace/node_selector.go index 013adff..2be31ad 100644 --- a/pkg/namespace/node_selector.go +++ b/pkg/namespace/node_selector.go @@ -363,23 +363,3 @@ func (cns *ClusterNodeSelector) calculateCapacityScore( return totalScore } -// GetNodeByID retrieves a node's information by ID -func (cns *ClusterNodeSelector) GetNodeByID(ctx context.Context, nodeID string) (*nodeInfo, error) { - internalCtx := client.WithInternalAuth(ctx) - - var results []nodeInfo - query := `SELECT id, ip_address, COALESCE(internal_ip, ip_address) as internal_ip FROM dns_nodes WHERE id = ? LIMIT 1` - err := cns.db.Query(internalCtx, &results, query, nodeID) - if err != nil { - return nil, &ClusterError{ - Message: "failed to query node", - Cause: err, - } - } - - if len(results) == 0 { - return nil, nil - } - - return &results[0], nil -} diff --git a/pkg/serverless/execution/lifecycle.go b/pkg/serverless/execution/lifecycle.go index 22f9f20..ca94e64 100644 --- a/pkg/serverless/execution/lifecycle.go +++ b/pkg/serverless/execution/lifecycle.go @@ -81,36 +81,3 @@ func (m *ModuleLifecycle) ValidateModule(module wazero.CompiledModule) error { return nil } -// InstantiateModule creates a module instance for execution. -// Note: This method is currently unused but kept for potential future use. -func (m *ModuleLifecycle) InstantiateModule(ctx context.Context, compiled wazero.CompiledModule, config wazero.ModuleConfig) error { - if compiled == nil { - return fmt.Errorf("compiled module is nil") - } - - instance, err := m.runtime.InstantiateModule(ctx, compiled, config) - if err != nil { - return fmt.Errorf("failed to instantiate module: %w", err) - } - - // Close immediately - this is just for validation - _ = instance.Close(ctx) - - return nil -} - -// ModuleInfo provides information about a compiled module. -type ModuleInfo struct { - CID string - SizeBytes int - Compiled bool -} - -// GetModuleInfo returns information about a module. -func (m *ModuleLifecycle) GetModuleInfo(wasmCID string, wasmBytes []byte, isCompiled bool) *ModuleInfo { - return &ModuleInfo{ - CID: wasmCID, - SizeBytes: len(wasmBytes), - Compiled: isCompiled, - } -} diff --git a/pkg/serverless/registry.go b/pkg/serverless/registry.go index 0d2bf6f..38102ed 100644 --- a/pkg/serverless/registry.go +++ b/pkg/serverless/registry.go @@ -438,27 +438,6 @@ func (r *Registry) uploadWASM(ctx context.Context, wasmBytes []byte, name string return resp.Cid, nil } -// getLatestVersion returns the latest version number for a function. -func (r *Registry) getLatestVersion(ctx context.Context, namespace, name string) (int, error) { - query := `SELECT MAX(version) FROM functions WHERE namespace = ? AND name = ?` - - var maxVersion sql.NullInt64 - var results []struct { - MaxVersion sql.NullInt64 `db:"max(version)"` - } - - if err := r.db.Query(ctx, &results, query, namespace, name); err != nil { - return 0, err - } - - if len(results) == 0 || !results[0].MaxVersion.Valid { - return 0, ErrFunctionNotFound - } - - maxVersion = results[0].MaxVersion - return int(maxVersion.Int64), nil -} - // getByNameInternal retrieves a function by name regardless of status. func (r *Registry) getByNameInternal(ctx context.Context, namespace, name string) (*Function, error) { namespace = strings.TrimSpace(namespace)