mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-01 14:47:38 +00:00
e4bb2808f1
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5197 See https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#vmstorage-groups-at-vmselect Thanks to @zekker6 for the initial pull request at https://github.com/VictoriaMetrics/VictoriaMetrics-enterprise/pull/718
19 lines
405 B
Go
19 lines
405 B
Go
package netutil
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
// ParseGroupAddr parses `groupID/addrX` addr and returns (groupID, addrX).
|
|
//
|
|
// If addr doesn't contain `groupID/` prefix, then ("", addr) is returned.
|
|
func ParseGroupAddr(addr string) (string, string) {
|
|
n := strings.IndexByte(addr, '/')
|
|
if n < 0 {
|
|
return "", addr
|
|
}
|
|
if strings.HasPrefix(addr, "file:") {
|
|
return "", addr
|
|
}
|
|
return addr[:n], addr[n+1:]
|
|
}
|