Documentation ¶
Overview ¶
Package par implements parallel execution helpers.
Index ¶
- func Bash(script string) (string, error)
- func BuildRequest(path string) *gorequest.SuperAgent
- func CloneRepo(srcUrl, srcVer string) (string, error)
- func CopyDir(src string, dst string) error
- func CopyFile(src, dst string) error
- func Exec(args []string) (string, error)
- func FindIdFromName(basePath, name, listOutput string, res interface{}) (string, error)
- func GetAcctAndName() (string, string)
- func IsValidUUID(uuid string) bool
- func Mkdir(filename string) error
- func OldTarFiles(files []string, src string, writers ...io.Writer) error
- func OldUntarFiles(files []string, dst string, r io.Reader) error
- func PrintCueError(err error)
- func RenderDir(src string, dst string, data interface{}) error
- func RenderDirNameSub(src string, dst string, data interface{}) error
- func RenderFile(src, dst string, data interface{}) error
- func RenderFileNameSub(src, dst string, data interface{}) error
- func RenderString(template string, data interface{}) (string, error)
- func SendRequest(queryTemplate string, vars interface{}) (interface{}, error)
- func ServerHost() string
- func SimpleGet(path string) error
- func SwapDelimits(content, fromLL, fromLR, fromSL, fromSR, toLL, toLR, toSL, toSR string) string
- func TarBallFiles(files []string, src, tarFile string) (err error)
- func TarFiles(files []string, src string) (data []byte, err error)
- func TestConfigAuth() error
- func UntarFiles(files []string, dst string, content []byte) error
- func UnzlibFiles(files []string, dst string, r io.Reader) error
- type Cache
- type Work
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildRequest ¶
func BuildRequest(path string) *gorequest.SuperAgent
func FindIdFromName ¶
func GetAcctAndName ¶
func IsValidUUID ¶
func PrintCueError ¶ added in v0.3.4
func PrintCueError(err error)
func RenderDirNameSub ¶
Dir copies a whole directory recursively
func RenderFile ¶
File copies a single file from src to dst
func RenderFileNameSub ¶
func RenderString ¶
func SendRequest ¶
func ServerHost ¶
func ServerHost() string
func SwapDelimits ¶
func TarBallFiles ¶
func TestConfigAuth ¶
func TestConfigAuth() error
Types ¶
type Cache ¶ added in v0.3.1
type Cache struct {
// contains filtered or unexported fields
}
Cache runs an action once per key and caches the result.
func (*Cache) Clear ¶ added in v0.3.1
func (c *Cache) Clear()
Clear removes all entries in the cache.
Concurrent calls to Get may return old values. Concurrent calls to Do may return old values or store results in entries that have been deleted.
TODO(jayconrod): Delete this after the package cache clearing functions in internal/load have been removed.
func (*Cache) Delete ¶ added in v0.3.1
func (c *Cache) Delete(key interface{})
Delete removes an entry from the map. It is safe to call Delete for an entry that does not exist. Delete will return quickly, even if the result for a key is still being computed; the computation will finish, but the result won't be accessible through the cache.
TODO(jayconrod): Delete this after the package cache clearing functions in internal/load have been removed.
func (*Cache) DeleteIf ¶ added in v0.3.1
DeleteIf calls pred for each key in the map. If pred returns true for a key, DeleteIf removes the corresponding entry. If the result for a key is still being computed, DeleteIf will remove the entry without waiting for the computation to finish. The result won't be accessible through the cache.
TODO(jayconrod): Delete this after the package cache clearing functions in internal/load have been removed.
func (*Cache) Do ¶ added in v0.3.1
func (c *Cache) Do(key interface{}, f func() interface{}) interface{}
Do calls the function f if and only if Do is being called for the first time with this key. No call to Do with a given key returns until the one call to f returns. Do returns the value returned by the one call to f.
type Work ¶ added in v0.3.1
type Work struct {
// contains filtered or unexported fields
}
Work manages a set of work items to be executed in parallel, at most once each. The items in the set must all be valid map keys.
func (*Work) Add ¶ added in v0.3.1
func (w *Work) Add(item interface{})
Add adds item to the work set, if it hasn't already been added.
func (*Work) Do ¶ added in v0.3.1
Do runs f in parallel on items from the work set, with at most n invocations of f running at a time. It returns when everything added to the work set has been processed. At least one item should have been added to the work set before calling Do (or else Do returns immediately), but it is allowed for f(item) to add new items to the set. Do should only be used once on a given Work.