mirror of
https://github.com/DeBrosOfficial/orama.git
synced 2026-03-17 08:36:57 +00:00
Removed dead code
This commit is contained in:
parent
b305f562d7
commit
888df0385e
@ -478,11 +478,6 @@ func GetAPIKey() string {
|
|||||||
return apiKey
|
return apiKey
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetJWT returns the gateway JWT token (currently not auto-discovered)
|
|
||||||
func GetJWT() string {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetBootstrapPeers returns bootstrap peer addresses from config
|
// GetBootstrapPeers returns bootstrap peer addresses from config
|
||||||
func GetBootstrapPeers() []string {
|
func GetBootstrapPeers() []string {
|
||||||
cacheMutex.RLock()
|
cacheMutex.RLock()
|
||||||
@ -748,10 +743,6 @@ func NewNetworkClient(t *testing.T) client.NetworkClient {
|
|||||||
cfg.APIKey = GetAPIKey()
|
cfg.APIKey = GetAPIKey()
|
||||||
cfg.QuietMode = true // Suppress debug logs in tests
|
cfg.QuietMode = true // Suppress debug logs in tests
|
||||||
|
|
||||||
if jwt := GetJWT(); jwt != "" {
|
|
||||||
cfg.JWT = jwt
|
|
||||||
}
|
|
||||||
|
|
||||||
if peers := GetBootstrapPeers(); len(peers) > 0 {
|
if peers := GetBootstrapPeers(); len(peers) > 0 {
|
||||||
cfg.BootstrapPeers = peers
|
cfg.BootstrapPeers = peers
|
||||||
}
|
}
|
||||||
|
|||||||
@ -249,9 +249,7 @@ var (
|
|||||||
ErrNoNodesAvailable = &DeploymentError{Message: "no nodes available for deployment"}
|
ErrNoNodesAvailable = &DeploymentError{Message: "no nodes available for deployment"}
|
||||||
ErrDeploymentNotFound = &DeploymentError{Message: "deployment not found"}
|
ErrDeploymentNotFound = &DeploymentError{Message: "deployment not found"}
|
||||||
ErrNamespaceNotAssigned = &DeploymentError{Message: "namespace has no home node assigned"}
|
ErrNamespaceNotAssigned = &DeploymentError{Message: "namespace has no home node assigned"}
|
||||||
ErrInvalidDeploymentType = &DeploymentError{Message: "invalid deployment type"}
|
|
||||||
ErrSubdomainTaken = &DeploymentError{Message: "subdomain already in use"}
|
ErrSubdomainTaken = &DeploymentError{Message: "subdomain already in use"}
|
||||||
ErrDomainReserved = &DeploymentError{Message: "domain is reserved"}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// DeploymentError represents a deployment-related error
|
// DeploymentError represents a deployment-related error
|
||||||
|
|||||||
@ -23,9 +23,8 @@ import (
|
|||||||
type HTTPGateway struct {
|
type HTTPGateway struct {
|
||||||
logger *logging.ColoredLogger
|
logger *logging.ColoredLogger
|
||||||
config *config.HTTPGatewayConfig
|
config *config.HTTPGatewayConfig
|
||||||
router chi.Router
|
router chi.Router
|
||||||
reverseProxies map[string]*httputil.ReverseProxy
|
mu sync.RWMutex
|
||||||
mu sync.RWMutex
|
|
||||||
server *http.Server
|
server *http.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,8 +45,7 @@ func NewHTTPGateway(logger *logging.ColoredLogger, cfg *config.HTTPGatewayConfig
|
|||||||
gateway := &HTTPGateway{
|
gateway := &HTTPGateway{
|
||||||
logger: logger,
|
logger: logger,
|
||||||
config: cfg,
|
config: cfg,
|
||||||
router: chi.NewRouter(),
|
router: chi.NewRouter(),
|
||||||
reverseProxies: make(map[string]*httputil.ReverseProxy),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up router middleware
|
// Set up router middleware
|
||||||
@ -110,8 +108,6 @@ func (hg *HTTPGateway) initializeRoutes() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hg.reverseProxies[routeName] = proxy
|
|
||||||
|
|
||||||
// Register route handler
|
// Register route handler
|
||||||
hg.registerRouteHandler(routeName, routeConfig, proxy)
|
hg.registerRouteHandler(routeName, routeConfig, proxy)
|
||||||
|
|
||||||
|
|||||||
@ -77,19 +77,6 @@ func parseIPFSPort(rawURL string) (int, error) {
|
|||||||
return port, nil
|
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 {
|
func extractIPFromMultiaddrForCluster(maddr string) string {
|
||||||
parts := strings.Split(maddr, "/")
|
parts := strings.Split(maddr, "/")
|
||||||
|
|||||||
@ -363,23 +363,3 @@ func (cns *ClusterNodeSelector) calculateCapacityScore(
|
|||||||
return totalScore
|
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
|
|
||||||
}
|
|
||||||
|
|||||||
@ -81,36 +81,3 @@ func (m *ModuleLifecycle) ValidateModule(module wazero.CompiledModule) error {
|
|||||||
return nil
|
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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -438,27 +438,6 @@ func (r *Registry) uploadWASM(ctx context.Context, wasmBytes []byte, name string
|
|||||||
return resp.Cid, nil
|
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.
|
// getByNameInternal retrieves a function by name regardless of status.
|
||||||
func (r *Registry) getByNameInternal(ctx context.Context, namespace, name string) (*Function, error) {
|
func (r *Registry) getByNameInternal(ctx context.Context, namespace, name string) (*Function, error) {
|
||||||
namespace = strings.TrimSpace(namespace)
|
namespace = strings.TrimSpace(namespace)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user