misc

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultLimit is the default concurrency limit
	DefaultLimit = 100
)

Variables

This section is empty.

Functions

func FindAllGroups added in v0.24.1

func FindAllGroups(a string, url string) (paramsMap map[string]string)

FindAllGroups FindAllGroups example: Pack(?P<DeviceID>\d{1,})(_S(?P<SlaveID>\d{1,})_C(?P<CellID>\d{1,}))?

func InsertSortFindIndex added in v0.22.3

func InsertSortFindIndex(s []float64, v float64) int

Inserts a float into a slice, sorts the slice and returns the index of first appearance of given float after sorting

Types

type ConcurrencyLimiter added in v0.12.0

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

ConcurrencyLimiter object

func NewConcurrencyLimiter added in v0.12.0

func NewConcurrencyLimiter(limit int) *ConcurrencyLimiter

NewConcurrencyLimiter allocates a new ConcurrencyLimiter

func (*ConcurrencyLimiter) Execute added in v0.12.0

func (c *ConcurrencyLimiter) Execute(job func())

Execute adds a function to the execution queue. if num of go routines allocated by this instance is < limit launch a new go routine to execute job else wait until a go routine becomes available

func (*ConcurrencyLimiter) ExecuteIndex added in v0.12.0

func (c *ConcurrencyLimiter) ExecuteIndex(index int, job func(numb int))

ExecuteIndex ExecuteIndex

func (*ConcurrencyLimiter) Loop added in v0.12.0

func (c *ConcurrencyLimiter) Loop(n int, job func(o int))

func (*ConcurrencyLimiter) Wait added in v0.12.0

func (c *ConcurrencyLimiter) Wait()

Wait will block all the previously Executed jobs completed running.

IMPORTANT: calling the Wait function while keep calling Execute leads to

un-desired race conditions

type Timeout added in v0.9.0

type Timeout struct {
	Released bool
	Occured  bool
}

func (*Timeout) Release added in v0.9.0

func (t *Timeout) Release()

func (*Timeout) Run added in v0.9.0

func (t *Timeout) Run(seconds int, callback func())

Jump to

Keyboard shortcuts

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