MCPcopy
hub / github.com/mudler/LocalAI / ParseNodeScopedKey

Function ParseNodeScopedKey

core/services/galleryop/operation.go:479–489  ·  view source on GitHub ↗

ParseNodeScopedKey extracts (nodeID, backend) from a key built by NodeScopedKey. Returns ok=false for keys that lack the prefix or are missing the nodeID or backend segment. Backend names containing colons are preserved because we split on the first colon after the prefix only.

(key string)

Source from the content-addressed store, hash-verified

477// backend segment. Backend names containing colons are preserved because we
478// split on the first colon after the prefix only.
479func ParseNodeScopedKey(key string) (nodeID, backend string, ok bool) {
480 rest, hasPrefix := strings.CutPrefix(key, NodeScopedKeyPrefix)
481 if !hasPrefix {
482 return "", "", false
483 }
484 nodeID, backend, ok = strings.Cut(rest, ":")
485 if !ok || nodeID == "" || backend == "" {
486 return "", "", false
487 }
488 return nodeID, backend, true
489}

Callers 2

RegisterUIAPIRoutesFunction · 0.92
backends_test.goFile · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected