util

package
v2.7.13 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Overview

SizedWaitGroup adds the feature of limiting the maximum number of concurrently started routines. It could for example be used to start multiples routines querying a database but without sending too much queries in order to not overload the given database.

Rémy Mathieu © 2016

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectToK8sArgoClientSet

func ConnectToK8sArgoClientSet() *appclientset.Clientset

func ConnectToK8sClientSet

func ConnectToK8sClientSet() *kubernetes.Clientset

func ConnectToK8sConfig

func ConnectToK8sConfig() *rest.Config

func GetRandomString

func GetRandomString() string

func Parse

func Parse(opts *GenerateOpts, file string) error

Types

type ApplicationOpts

type ApplicationOpts struct {
	Samples         int             `yaml:"samples"`
	SourceOpts      SourceOpts      `yaml:"source"`
	DestinationOpts DestinationOpts `yaml:"destination"`
}

type Bar

type Bar struct {
	// contains filtered or unexported fields
}

Bar ...

func (*Bar) Finish

func (bar *Bar) Finish()

func (*Bar) Increment

func (bar *Bar) Increment()

func (*Bar) NewOption

func (bar *Bar) NewOption(start, total int64)

func (*Bar) Play

func (bar *Bar) Play()

type ClusterOpts

type ClusterOpts struct {
	Samples              int    `yaml:"samples"`
	NamespacePrefix      string `yaml:"namespacePrefix"`
	ValuesFilePath       string `yaml:"valuesFilePath"`
	DestinationNamespace string `yaml:"destinationNamespace"`
	ClusterNamePrefix    string `yaml:"clusterNamePrefix"`
	Concurrency          int    `yaml:"parallel"`
}

type DestinationOpts

type DestinationOpts struct {
	Strategy string `yaml:"strategy"`
}

type GenerateOpts

type GenerateOpts struct {
	ApplicationOpts ApplicationOpts `yaml:"application"`
	ClusterOpts     ClusterOpts     `yaml:"cluster"`
	RepositoryOpts  RepositoryOpts  `yaml:"repository"`
	ProjectOpts     ProjectOpts     `yaml:"project"`
	GithubToken     string
	Namespace       string `yaml:"namespace"`
}

type Kube

type Kube struct {
	Namespace string
	Context   string
}

type ProjectOpts

type ProjectOpts struct {
	Samples int `yaml:"samples"`
}

type RepositoryOpts

type RepositoryOpts struct {
	Samples int `yaml:"samples"`
}

type SizedWaitGroup added in v2.6.0

type SizedWaitGroup struct {
	Size int
	// contains filtered or unexported fields
}

SizedWaitGroup has the same role and close to the same API as the Golang sync.WaitGroup but adds a limit of the amount of goroutines started concurrently.

func New added in v2.6.0

func New(limit int) SizedWaitGroup

New creates a SizedWaitGroup. The limit parameter is the maximum amount of goroutines which can be started concurrently.

func (*SizedWaitGroup) Add added in v2.6.0

func (s *SizedWaitGroup) Add()

Add increments the internal WaitGroup counter. It can be blocking if the limit of spawned goroutines has been reached. It will stop blocking when Done is been called.

See sync.WaitGroup documentation for more information.

func (*SizedWaitGroup) AddWithContext added in v2.6.0

func (s *SizedWaitGroup) AddWithContext(ctx context.Context) error

AddWithContext increments the internal WaitGroup counter. It can be blocking if the limit of spawned goroutines has been reached. It will stop blocking when Done is been called, or when the context is canceled. Returns nil on success or an error if the context is canceled before the lock is acquired.

See sync.WaitGroup documentation for more information.

func (*SizedWaitGroup) Done added in v2.6.0

func (s *SizedWaitGroup) Done()

Done decrements the SizedWaitGroup counter. See sync.WaitGroup documentation for more information.

func (*SizedWaitGroup) Wait added in v2.6.0

func (s *SizedWaitGroup) Wait()

Wait blocks until the SizedWaitGroup counter is zero. See sync.WaitGroup documentation for more information.

type SourceOpts

type SourceOpts struct {
	Strategy string `yaml:"strategy"`
}

Jump to

Keyboard shortcuts

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