object

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// GcsPrefix url prefix for google cloud storage buckets
	GcsPrefix = "gs://"
)

Functions

This section is empty.

Types

type GCS

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

func NewGCS

func NewGCS() *GCS

func (*GCS) AllowMissing

func (g *GCS) AllowMissing() bool

func (*GCS) Concurrent

func (g *GCS) Concurrent() bool

func (*GCS) CopyBucketToBucket

func (g *GCS) CopyBucketToBucket(src, dst string) error

CopyBucketToBucket copies between two GCS paths.

func (*GCS) CopyToLocal

func (g *GCS) CopyToLocal(gcsPath, dst string) error

CopyToLocal copies a GCS path to the specified local directory

func (*GCS) CopyToRemote

func (g *GCS) CopyToRemote(src, gcsPath string) error

CopyToGCS copies a local directory to the specified GCS path

func (*GCS) DeletePath

func (g *GCS) DeletePath(path string) error

DeletePath deletes a bucket location recursevly

func (*GCS) GetMarkerPath

func (g *GCS) GetMarkerPath(
	bucket, gcsRoot string) (string, error)

GetMarkerPath returns a GCS path where version markers should be stored

Expected destination format:

gs://<bucket>/<gcsRoot>

func (*GCS) GetReleasePath

func (g *GCS) GetReleasePath(
	bucket, gcsRoot, version string,
	fast bool) (string, error)

GetReleasePath returns a GCS path to retrieve builds from or push builds to

Expected destination format:

gs://<bucket>/<gcsRoot>[/fast][/<version>]

func (*GCS) IsPathNormalized

func (g *GCS) IsPathNormalized(gcsPath string) bool

IsPathNormalized determines if a GCS path is prefixed with `gs://`. Use this function as pre-check for any gsutil/GCS functions that manipulate GCS bucket contents.

func (*GCS) NoClobber

func (g *GCS) NoClobber() bool

func (*GCS) NormalizePath

func (g *GCS) NormalizePath(gcsPathParts ...string) (string, error)

NormalizeGCSPath takes a GCS path and ensures that the `GcsPrefix` is prepended to it. TODO: Should there be an append function for paths to prevent multiple calls

like in build.checkBuildExists()?

func (*GCS) PathExists

func (g *GCS) PathExists(gcsPath string) (bool, error)

PathExists returns true if the specified GCS path exists.

func (*GCS) Recursive

func (g *GCS) Recursive() bool

func (*GCS) RsyncRecursive

func (g *GCS) RsyncRecursive(src, dst string) error

RsyncRecursive runs `gsutil rsync` in recursive mode. The caller of this function has to ensure that the provided paths are prefixed with gs:// if necessary (see `NormalizePath()`).

func (*GCS) SetOptions

func (g *GCS) SetOptions(opts ...OptFn)

func (*GCS) WithAllowMissing

func (g *GCS) WithAllowMissing(allowMissing bool) OptFn

func (*GCS) WithConcurrent

func (g *GCS) WithConcurrent(concurrent bool) OptFn

func (*GCS) WithNoClobber

func (g *GCS) WithNoClobber(noClobber bool) OptFn

func (*GCS) WithRecursive

func (g *GCS) WithRecursive(recursive bool) OptFn

type OptFn

type OptFn func(Store)

type Store

type Store interface {
	// Configure options
	SetOptions(opts ...OptFn)

	// Path operations
	NormalizePath(pathParts ...string) (string, error)
	IsPathNormalized(path string) bool
	PathExists(path string) (bool, error)

	// Copy operations
	// TODO: Determine if these methods should even be part of the interface
	// TODO: Maybe overly specific. Consider reducing these down to Copy()
	CopyToRemote(local, remote string) error
	CopyToLocal(remote, local string) error
	CopyBucketToBucket(src, dst string) error
	RsyncRecursive(src, dst string) error

	// TODO: Overly specific. We should only care these methods during a release.
	GetReleasePath(bucket, gcsRoot, version string, fast bool) (string, error)
	GetMarkerPath(bucket, gcsRoot string) (string, error)
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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