Documentation ¶
Index ¶
- Variables
- func CaptureHost(hostport string) string
- func CheckHostnameIPMismatch(local string, hostsMap map[string][]string) ([]string, error)
- func CheckLocalMissing(local string, hostports []string) error
- func IndexOf(slice []string, element string) int
- func MS(d time.Duration) int64
- func Min(a, b int) int
- func ReadHostsFile(file string) ([]string, error)
- func SelectDuration(opt, def time.Duration) time.Duration
- func SelectInt(opt, def int) int
- func SingleNodeCluster(local string, hostsMap map[string][]string) bool
- func TakeNode(nodes *[]string, index int) string
- func TimeNowMS() int64
- func TimeZero() time.Time
- func UnixMS(t time.Time) int64
- type Timestamp
Constants ¶
This section is empty.
Variables ¶
var HostportPattern = regexp.MustCompile(`^(\d+.\d+.\d+.\d+):\d+$`)
HostportPattern is regex to match a host:port
Functions ¶
func CaptureHost ¶
CaptureHost takes a host:port and returns the host.
func CheckHostnameIPMismatch ¶
CheckHostnameIPMismatch checks for a hostname/IP mismatch in a map of hosts to host:ports. If there is a mismatch, returns the mismatched hosts and an error, otherwise nil and nil.
func CheckLocalMissing ¶
CheckLocalMissing checks a slice of host:ports for the given local host:port, return an error if not found, otherwise nil.
func ReadHostsFile ¶
ReadHostsFile reads a file containing a JSON array of hosts
func SelectDuration ¶
SelectDuration takes an option and a default value and returns the default value if the option is equal to zero, and the option otherwise.
func SelectInt ¶
SelectInt takes an option and a default value and returns the default value if the option is equal to zero, and the option otherwise.
func SingleNodeCluster ¶
SingleNodeCluster determines if local is the only host:port contained within the hostsMap