gcs

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package gcs handles uploading files and raw data to GCS and determines where in the GCS bucket data should go given a specific job specification

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AliasForSpec

func AliasForSpec(spec *downwardapi.JobSpec) string

AliasForSpec determines the GCS path aliases for a job spec

func LatestBuildForSpec

func LatestBuildForSpec(spec *downwardapi.JobSpec, pathSegment RepoPathBuilder) []string

LatestBuildForSpec determines the GCS path for storing the latest build id for a job. pathSegment can be nil so callers of this helper are not required to choose a path strategy but can still get back a result.

func PathForSpec

func PathForSpec(spec *downwardapi.JobSpec, pathSegment RepoPathBuilder) string

PathForSpec determines the GCS path prefix for files uploaded for a specific job spec

func RootForSpec

func RootForSpec(spec *downwardapi.JobSpec) string

RootForSpec determines the root GCS path for storing artifacts about the provided job.

func Upload

func Upload(bucket *storage.BucketHandle, uploadTargets map[string]UploadFunc) error

Upload uploads all of the data in the uploadTargets map to GCS in parallel. The map is keyed on GCS path under the bucket

Types

type RepoPathBuilder

type RepoPathBuilder func(org, repo string) string

RepoPathBuilder builds GCS path segments and embeds defaulting behavior

func NewExplicitRepoPathBuilder

func NewExplicitRepoPathBuilder() RepoPathBuilder

NewExplicitRepoPathBuilder returns a builder that handles the path encoding where a path will always have an explicit "org_repo" path segment

func NewLegacyRepoPathBuilder

func NewLegacyRepoPathBuilder(defaultOrg, defaultRepo string) RepoPathBuilder

NewLegacyRepoPathBuilder returns a builder that handles the legacy path encoding where a path will only contain an org or repo if they are non-default

func NewSingleDefaultRepoPathBuilder

func NewSingleDefaultRepoPathBuilder(defaultOrg, defaultRepo string) RepoPathBuilder

NewSingleDefaultRepoPathBuilder returns a builder that handles the legacy path encoding where a path will contain org and repo for all but one default repo

type UploadFunc

type UploadFunc func(obj *storage.ObjectHandle) error

UploadFunc knows how to upload into an object

func DataUpload

func DataUpload(src io.Reader) UploadFunc

DataUpload returns an UploadFunc which copies all data from src reader into GCS

func FileUpload

func FileUpload(file string) UploadFunc

FileUpload returns an UploadFunc which copies all data from the file on disk to the GCS object

Jump to

Keyboard shortcuts

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