From 403913d8cf13d11f445c608056e6fb384d21ed27 Mon Sep 17 00:00:00 2001 From: mr Date: Thu, 12 Feb 2026 13:39:52 +0100 Subject: [PATCH] new oclib match --- entrypoint.go | 2 +- models/peer/peer_cache.go | 4 ++-- tools/api.go | 2 +- tools/enums.go | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/entrypoint.go b/entrypoint.go index b1403bd..284f1aa 100644 --- a/entrypoint.go +++ b/entrypoint.go @@ -92,7 +92,7 @@ func GenerateNodeID() (string, error) { // will turn into standards api hostnames func (d LibDataEnum) API() string { - return tools.DefaultAPI[d]() + return tools.Str[d] } // will turn into standards name diff --git a/models/peer/peer_cache.go b/models/peer/peer_cache.go index af8ea35..a420867 100644 --- a/models/peer/peer_cache.go +++ b/models/peer/peer_cache.go @@ -29,7 +29,7 @@ type PeerCache struct { // urlFormat formats the URL of the peer with the data type API function func urlFormat(hostUrl string, dt tools.DataType) string { - return hostUrl + "/" + strings.ReplaceAll(dt.API(), "oc-", "") + return hostUrl + "/" + strings.ReplaceAll(dt.String(), "oc-", "") } // checkPeerStatus checks the status of a peer @@ -62,7 +62,7 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string, url := "" // Check the status of the peer - if mypeer, ok := CheckPeerStatus(peerID, dt.API()); !ok && mypeer != nil { + if mypeer, ok := CheckPeerStatus(peerID, dt.String()); !ok && mypeer != nil { // If the peer is not reachable, add the execution to the failed executions list pexec := &PeerExecution{ Method: method.String(), diff --git a/tools/api.go b/tools/api.go index 2071356..8656d87 100644 --- a/tools/api.go +++ b/tools/api.go @@ -157,7 +157,7 @@ func (a *API) CheckRemoteAPIs(apis []DataType) (State, map[string]string, error) reachable := false for _, api := range apis { // Check the state of each remote API in the list var resp APIStatusResponse - b, err := caller.CallGet("http://"+api.API()+":8080", "/oc/version/status") // Call the status endpoint of the remote API (standard OC status endpoint) + b, err := caller.CallGet("http://"+api.InnerAPI()+":8080", "/oc/version/status") // Call the status endpoint of the remote API (standard OC status endpoint) if err != nil { l.Error().Msg(api.String() + " not reachable") state = REDUCED_SERVICE // If a remote API is not reachable, return reduced service diff --git a/tools/enums.go b/tools/enums.go index 5c2ea75..75ed1c2 100644 --- a/tools/enums.go +++ b/tools/enums.go @@ -84,7 +84,7 @@ var MINIO = func() string { } // Bind the standard API name to the data type -var DefaultAPI = [...]func() string{ +var InnerDefaultAPI = [...]func() string{ NOAPI, CATALOGAPI, CATALOGAPI, @@ -151,8 +151,8 @@ func FromInt(i int) string { return Str[i] } -func (d DataType) API() string { // API - Returns the API name of the data type - return DefaultAPI[d]() +func (d DataType) InnerAPI() string { // API - Returns the API name of the data type + return InnerDefaultAPI[d]() } func (d DataType) String() string { // String - Returns the string name of the data type