stash

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: MIT Imports: 20 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stasher

type Stasher interface {
	Stash(ctx context.Context, mod string, ver string) (string, error)
}

Stasher has the job of taking a module from an upstream entity and stashing it to a Storage Backend. It also returns a string that represents a semver version of what was requested, this is helpful if what was requested was a descriptive version such as a branch name or a full commit sha.

func New

func New(f module.Fetcher, s storage.Backend, wrappers ...Wrapper) Stasher

New returns a plain stasher that takes a module from a download.Protocol and stashes it into a backend.Storage.

func WithGCSLock added in v0.4.0

func WithGCSLock(s Stasher) Stasher

WithGCSLock returns a distributed singleflight using a GCS backend. See the config.toml documentation for details.

func WithSingleflight

func WithSingleflight(s Stasher) Stasher

WithSingleflight returns a singleflight stasher. This two clients make two subsequent requests to stash a module, then it will only do it once and give the first response to both the first and the second client.

type Wrapper

type Wrapper func(Stasher) Stasher

Wrapper helps extend the main stasher's functionality with addons.

func WithAzureBlobLock added in v0.4.0

func WithAzureBlobLock(conf *config.AzureBlobConfig, timeout time.Duration, checker storage.Checker) (Wrapper, error)

WithAzureBlobLock returns a distributed singleflight using a Azure Blob Storage backend. See the config.toml documentation for details.

func WithEtcd added in v0.3.0

func WithEtcd(endpoints []string, checker storage.Checker) (Wrapper, error)

WithEtcd returns a distributed singleflight using an etcd cluster. If it cannot connect, to any of the endpoints, it will return an error.

func WithPool

func WithPool(numWorkers int) Wrapper

WithPool returns a stasher that runs a stash operation {numWorkers} at a time.

func WithRedisLock added in v0.4.0

func WithRedisLock(endpoint string, checker storage.Checker) (Wrapper, error)

WithRedisLock returns a distributed singleflight using an redis cluster. If it cannot connect, it will return an error.

Jump to

Keyboard shortcuts

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