internal

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: Unlicense Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRetryAfter = errors.New("sha.groupcache: retry after")
View Source
var ErrorStatusByValue = map[error]int{}
View Source
var RbacInited = false

Functions

func ChangeField added in v0.0.6

func ChangeField(dist interface{}, fn string, fv interface{}) bool

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

ParseDuration parses a duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d", "w".

func ParseFloatRange

func ParseFloatRange(s string) (float64, float64, bool, bool)

func ParseIntRange

func ParseIntRange(s string) (int64, int64, bool, bool)

0-10: [0, 10] 0: [0,0] 0-: [0,) -10: (,10]

func ParseUintRange

func ParseUintRange(s string) (uint64, uint64, bool, bool)

func ShowSilenceError added in v0.0.5

func ShowSilenceError(v bool)

func Silence

func Silence(fn func())

func Stacks

func Stacks(v interface{}, skip int, size int) string

func StrSliceContains

func StrSliceContains(ss []string, s string) bool

Types

type SingleflightGroup

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

SingleflightGroup represents a class of work and forms a namespace in which units of work can be executed with duplicate suppression.

func NewSingleflightGroup

func NewSingleflightGroup(maxWait int32) *SingleflightGroup

func (*SingleflightGroup) Do

func (g *SingleflightGroup) Do(key string, fn func() (interface{}, error)) (interface{}, error)

Do executes and returns the results of the given function, making sure that only one execution is in-flight for a given key at a time. If a duplicate comes in, the duplicate caller waits for the original to complete and receives the same results.

Jump to

Keyboard shortcuts

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