Documentation ¶
Overview ¶
(C) Copyright 2019 Intel Corporation.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE The Government's rights to use, modify, reproduce, release, perform, display, or disclose this software are subject to the terms of the Apache License as provided in Contract No. 8F-30005. Any reproduction of computer software, computer software documentation, or portions thereof marked with this legend must also reproduce the markings.
(C) Copyright 2019 Intel Corporation.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE The Government's rights to use, modify, reproduce, release, perform, display, or disclose this software are subject to the terms of the Apache License as provided in Contract No. 8F-30005. Any reproduction of computer software, computer software documentation, or portions thereof marked with this legend must also reproduce the markings.
(C) Copyright 2019 Intel Corporation.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE The Government's rights to use, modify, reproduce, release, perform, display, or disclose this software are subject to the terms of the Apache License as provided in Contract No. 8F-30005. Any reproduction of computer software, computer software documentation, or portions thereof marked with this legend must also reproduce the markings.
(C) Copyright 2019 Intel Corporation.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE The Government's rights to use, modify, reproduce, release, perform, display, or disclose this software are subject to the terms of the Apache License as provided in Contract No. 8F-30005. Any reproduction of computer software, computer software documentation, or portions thereof marked with this legend must also reproduce the markings.
(C) Copyright 2019 Intel Corporation.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE The Government's rights to use, modify, reproduce, release, perform, display, or disclose this software are subject to the terms of the Apache License as provided in Contract No. 8F-30005. Any reproduction of computer software, computer software documentation, or portions thereof marked with this legend must also reproduce the markings.
Index ¶
- Constants
- Variables
- func Compress(stringHosts string) (string, error)
- func Count(stringHosts string) (int, error)
- func Expand(stringHosts string) (string, error)
- type HostGroups
- type HostList
- func (hl *HostList) Count() int
- func (hl *HostList) Delete(stringHosts string) (int, error)
- func (hl *HostList) DeleteHost(stringHost string) error
- func (hl *HostList) DeleteNth(n int) error
- func (hl *HostList) DerangedString() string
- func (hl *HostList) Find(stringHost string) (int, bool)
- func (hl *HostList) Intersects(stringHosts string) (*HostList, error)
- func (hl *HostList) IsEmpty() bool
- func (hl *HostList) Nth(n int) (string, error)
- func (hl *HostList) Pop() (hostName string, err error)
- func (hl *HostList) PopRange() (hostRange string, err error)
- func (hl *HostList) Push(stringHosts string) error
- func (hl *HostList) PushHost(stringHost string) error
- func (hl *HostList) PushList(other *HostList) error
- func (hl *HostList) RangedString() string
- func (hl *HostList) Shift() (hostName string, err error)
- func (hl *HostList) ShiftRange() (hostRange string, err error)
- func (hl *HostList) String() string
- func (hl *HostList) Uniq()
- func (hl *HostList) Within(stringHosts string) (bool, error)
- type HostSet
- func (hs *HostSet) Count() int
- func (hs *HostSet) Delete(stringHosts string) (int, error)
- func (hs *HostSet) DerangedString() string
- func (hs *HostSet) Insert(stringHosts string) (int, error)
- func (hs *HostSet) Intersects(stringHosts string) (*HostSet, error)
- func (hs *HostSet) MergeSet(other *HostSet) error
- func (hs *HostSet) Pop() (string, error)
- func (hs *HostSet) PopRange() (string, error)
- func (hs *HostSet) RangedString() string
- func (hs *HostSet) Shift() (string, error)
- func (hs *HostSet) ShiftRange() (string, error)
- func (hs *HostSet) String() string
- func (hs *HostSet) Within(stringHosts string) (bool, error)
Constants ¶
const (
// MaxRange is the largest host range (hi - lo) supported
MaxRange = 16384
)
Variables ¶
var ( ErrEmpty = errors.New("hostlist is empty") ErrNotFound = errors.New("hostname not found") )
Functions ¶
Types ¶
type HostGroups ¶
func (HostGroups) AddHost ¶
func (hg HostGroups) AddHost(key, host string) error
func (HostGroups) Keys ¶
func (hg HostGroups) Keys() []string
func (HostGroups) String ¶
func (hg HostGroups) String() string
type HostList ¶
HostList is a list of hostnames optimized for a "prefixXXXX" naming convention, where XXXX is a decimal, numeric suffix.
func (*HostList) Delete ¶
Delete removes all hosts in the supplied string representation of a HostList. Returns the number of hosts successfully deleted.
func (*HostList) DeleteHost ¶
DeleteHost removes the first host that matches the supplied hostname. Returns an error if the HostList is empty or the hostname is not found.
func (*HostList) DeleteNth ¶
DeleteNth removes the host at position N in the HostList. Returns an error if the HostList is empty or the index is incorrect.
func (*HostList) DerangedString ¶
DerangedString returns a string containing the hostnames of every host in the HostList, without any bracketing.
func (*HostList) Find ¶
Find searches the HostList for the given hostname. Returns the index of the host and true if found; -1 and false if not.
func (*HostList) Intersects ¶
Intersects returns a *HostList containing hosts which are in both this HostList and the supplied hosts string.
func (*HostList) Nth ¶
Nth returns the string represenation of the n-th host in the HostList. Returns an error if the index is invalid.
func (*HostList) Pop ¶
Pop returns the string representation of the last host pushed onto the HostList and then removes it from the HostList. Returns an error if the HostList is empty.
func (*HostList) PopRange ¶
PopRange returns the string representation of the last bracketed list of hosts. All hosts in the returned list are removed from the HostList. Returns an error if the HostList is empty.
func (*HostList) RangedString ¶
RangedString returns a string containing a bracketed HostList representation.
func (*HostList) Shift ¶
Shift returns the string representation of the first host pushed onto the HostList and then removes it from the HostList. Returns an error if the HostList is empty.
func (*HostList) ShiftRange ¶
ShiftRange returns the string representation of the first bracketed list of hosts. All hosts in the returned list are removed from the HostList. Returns an error if the HostList is empty.
type HostSet ¶
HostSet is a special case of HostList which never contains duplicates and is always sorted alphanumerically based on prefix.
func (*HostSet) Delete ¶
Delete removes a host or list of hosts from the HostSet. Returns the number of hosts successfully removed.
func (*HostSet) DerangedString ¶
DerangedString returns a string containing the hostnames of every host in the HostSet, without any bracketing.
func (*HostSet) Insert ¶
Insert adds a host or list of hosts to the HostSet. Returns the number of non-duplicate hosts successfully added.
func (*HostSet) Intersects ¶
Intersects returns a *HostSet containing hosts which are in both this HostSet and the supplied hosts string.
func (*HostSet) Pop ¶
Pop returns the string representation of the last host pushed onto the HostSet and then removes it from the HostSet. Returns an error if the HostSet is empty
func (*HostSet) PopRange ¶
PopRange returns the string representation of the last bracketed list of hosts. All hosts in the returned list are removed from the HostSet. Returns an error if the HostSet is empty.
func (*HostSet) RangedString ¶
RangedString returns a string containing a bracketed HostSet representation.
func (*HostSet) Shift ¶
Shift returns the string representation of the first host pushed onto the HostSet and then removes it from the HostSet. Returns an error if the HostSet is empty
func (*HostSet) ShiftRange ¶
ShiftRange returns the string representation of the first bracketed list of hosts. All hosts in the returned list are removed from the HostSet. Returns an error if the HostSet is empty.