nodeset

package module
v0.0.0-...-113acf0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expand

func Expand(pattern string, iter func(s string) error) error

Expand takes a node set pattern like 'node[1-2]', and a function with the signature func(s string). It will parse the pattern string and calculate the numerical ranges from the pattern. It will then create the Cartesian product for the pattern, for example: rack[1-2]node[3-4] -> rack1node3, rack1node4, rack2node3, rack2node4. Addition pattern syntax supported: Union ranges - node[1-2,5-9] Step ranges - node[1-4/2] The supplied iter function is called per Cartesian product.

func Fold

func Fold(inputs []string) []string

func SplitOnComma

func SplitOnComma(s string) []string

SplitOnComma will split the input string on commas except for when within square brackets. Used for pre-processing input strings for Expand when such input has multiple node patterns seperated by comma like 'node[1-2],node[5-6]'

Types

type MatchGroup

type MatchGroup struct {
	Length            int                      // Length of original string
	NonDigitPositions map[int]string           // Key is position index with the non-digit component as a value
	DigitPadding      map[int]int              // Key is position index of digit elements, value is length of digit elements.
	DigitPositions    map[int]map[int]struct{} // Using a map of maps to only include unique digits: map[<pos. index>]map[<unique value>]struct{}
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL