singleflight

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ERR_INVALID_VENDOR = errors.New("invalid vendor")
	ERR_MISSING_CONFIG = errors.New("config is missing")
)

Errors

Functions

This section is empty.

Types

type Config

type Config struct {
	Golang *Golang
}

Config provides list of singleflight's vendor that can be used. It will prioritize from top to bottom and only choose one.

type Golang

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

Golang is config for golang's singleflight.

func (*Golang) Do

func (sf *Golang) Do(key string, workFn func() (interface{}, error)) (interface{}, error)

Do from Golang.

type Singleflight

type Singleflight interface {
	// Do runs the workFn with singleflight.
	Do(key string, workFn func() (interface{}, error)) (interface{}, error)
}

Singleflight provides list of standard's singleflight functions.

func New

func New(v Vendor, conf Config) (Singleflight, error)

New creates a singleflight base on selected vendor.

type Vendor

type Vendor string

Alias

const (
	GOLANG Vendor = "golang"
)

Vendors

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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