skipper: github.com/zalando/skipper/routing/pathgen Index | Files

package pathgen

import "github.com/zalando/skipper/routing/pathgen"

Index

Package Files

pathgen.go

type PathGenerator Uses

type PathGenerator struct {
    Rnd *rand.Rand
    // contains filtered or unexported fields
}

Generates paths, separated with a slash or custom separator. The paths have a random number of filenames in them, and the filenames consist of random characters of random length. The generated sequences are reproducible, controlled by the RandSeed option.

func New Uses

func New(o PathGeneratorOptions) *PathGenerator

Creates a path generator with the provided options, falling back to the default value for each non-specified option field.

func (*PathGenerator) Between Uses

func (pg *PathGenerator) Between(min, max int) int

takes a random number positioned between [min, max)

func (*PathGenerator) Name Uses

func (pg *PathGenerator) Name() string

generates a random name using the available characters and of length within the defined boundaries

func (*PathGenerator) Names Uses

func (pg *PathGenerator) Names() []string

generates random names of count between the defined boundaries

func (*PathGenerator) Next Uses

func (pg *PathGenerator) Next() string

Generates a random path.

The path will be always absolute.

The path may contain a closing slash, with a probability based on the `ClosingSlashInEveryN`. If `ClosingSlashInEveryN < 0`, the path won't contain a closing slash. If `ClosingSlashInEveryN == 0`, the path will always contain a closing slash. If `ClosingSlashInEveryN == n`, where `n > 0`, then the generated path will contain a closing slash with a chance of `1 / n`.

The path will contain a random number of names (the thing between the slashes), equally distributed between `MinNamesInPath` and `MaxNamesInPath`.

The names in the path will have a random length, equally distributed between `MinFilenameLength` and `MaxFilenameLength`.

The sequence followed by `Next` is reproducible, to get a different sequence, a new PathGenerator instance is required, with a different `RandSeed` value.

func (*PathGenerator) Str Uses

func (pg *PathGenerator) Str(min, max int) string

func (*PathGenerator) Strs Uses

func (pg *PathGenerator) Strs(min, max, minLength, maxLength int) []string

type PathGeneratorOptions Uses

type PathGeneratorOptions struct {
    FilenameChars        string
    MinFilenameLength    int
    MaxFilenameLength    int
    MinNamesInPath       int
    MaxNamesInPath       int
    ClosingSlashInEveryN int
    RandSeed             int64
    Separator            string
}

Package pathgen imports 2 packages (graph). Updated 2017-08-28. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).