mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-04 02:57:44 +01:00
fix master maintenance logic
Signed-off-by: Lei Liu <lei01.liu@horizon.ai>
This commit is contained in:
1 parent
ee90236a97
commit
46755ea1e1
8 files changed
+50
-42
No files matched your search
@@ -1,7 +1,9 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func ParseInt(text string, defaultValue int) int {
|
||||
@@ -24,3 +26,22 @@ func ParseUint64(text string, defaultValue uint64) uint64 {
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
func ParseFilerUrl(entryPath string) (filerServer string, filerPort int64, path string, err error) {
|
||||
if !strings.HasPrefix(entryPath, "http://") && !strings.HasPrefix(entryPath, "https://") {
|
||||
entryPath = "http://" + entryPath
|
||||
}
|
||||
|
||||
var u *url.URL
|
||||
u, err = url.Parse(entryPath)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
filerServer = u.Hostname()
|
||||
portString := u.Port()
|
||||
if portString != "" {
|
||||
filerPort, err = strconv.ParseInt(portString, 10, 32)
|
||||
}
|
||||
path = u.Path
|
||||
return
|
||||
}
|
||||
Reference in new issue
Block a user