Documentation ¶
Index ¶
Constants ¶
const SplitString = "\\s+|;|,"
SplitString is used for split Hostlist
Variables ¶
This section is empty.
Functions ¶
func RegisterHostlist ¶
func RegisterHostlist(builder constructor)
RegisterHostlist used in each realization's init function
Types ¶
type FromCmd ¶
FromCmd is an abstract struct Other Hostlist that get hostlist from Command may want to inherit from it.
func (*FromCmd) Get ¶
func (hc *FromCmd) Get() (list HostInfoList, err error)
Get is part of Hostlist Interface. It executes cmd from @Args, and translate each line to hostname by @LineProcessor
func (*FromCmd) ShouldBreak ¶
ShouldBreak makes default disicion: fallthrough
type HostInfoList ¶
type HostInfoList []*HostInfo
HostInfoList is updated version for Hostlist
func GetHostList ¶
func GetHostList(str, prefer string) (list HostInfoList, err error)
GetHostList returns the final host list. It'll use cache if possible.
func GetHostListNoCache ¶
func GetHostListNoCache(str, prefer string) (list HostInfoList, err error)
GetHostListNoCache returns the final host list.
func MakeHostInfoListFromStringList ¶
func MakeHostInfoListFromStringList(list []string) HostInfoList
MakeHostInfoListFromStringList helps migrate old implementation.
type Hostlist ¶
type Hostlist interface { Name() string Priority() int // `0` has a higher Priority over `1` // Get() ([]string, error) Get() (HostInfoList, error) // if you're definitely sure that user want to use this Hostlist, return true. // for example, if user gives `-f ./xxx`, then obviously that he wants use this file: ./xxx. // in this case, no matter Get() method succeed or not, break. ShouldBreak() bool }
Hostlist should be able to give a hostname list by a single string.
type WithFilter ¶
type WithFilter interface { Hostlist Filter(HostInfoList) HostInfoList }
WithFilter has a Filter over Hostlist Implementation then has the ability to filter hosts