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)
| 477 | // backend segment. Backend names containing colons are preserved because we |
| 478 | // split on the first colon after the prefix only. |
| 479 | func 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 | } |
no outgoing calls
no test coverage detected