gcs

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: Apache-2.0 Imports: 19 Imported by: 16

Documentation

Index

Constants

View Source
const (
	// Default ACLs for this upload
	DefaultAcl = false
	// PublicRead ACL for this upload.
	PublicRead = true
)

Variables

This section is empty.

Functions

func ClientWithCreds

func ClientWithCreds(ctx context.Context, creds ...string) (*storage.Client, error)

ClientWithCreds returns a storage client, optionally authenticated with the specified .json creds

func Upload

func Upload(ctx context.Context, client *storage.Client, path Path, buf []byte, worldReadable bool, cacheControl string) error

Upload writes bytes to the specified Path

Types

type Build

type Build struct {
	Path Path
	// contains filtered or unexported fields
}

Build points to a build stored under a particular gcs prefix.

func ListBuilds

func ListBuilds(parent context.Context, lister Lister, path Path, after *Path) ([]Build, error)

ListBuilds returns the array of builds under path, sorted in monotonically decreasing order.

func (Build) Artifacts

func (build Build) Artifacts(ctx context.Context, lister Lister, artifacts chan<- string) error

Artifacts writes the object name of all paths under the build's artifact dir to the output channel.

func (Build) Finished

func (build Build) Finished(ctx context.Context, opener Opener) (*Finished, error)

Finished parses the build's finished metadata.

func (Build) Started

func (build Build) Started(ctx context.Context, opener Opener) (*Started, error)

Started parses the build's started metadata.

func (Build) String

func (build Build) String() string

func (Build) Suites

func (build Build) Suites(parent context.Context, opener Opener, artifacts <-chan string, suites chan<- SuitesMeta) error

Suites takes a channel of artifact names, parses those representing junit suites, writing the result to the suites channel.

Note that junit suites are parsed in parallel, so there are no guarantees about suites ordering.

type Client added in v0.0.16

type Client interface {
	Uploader
	Downloader
}

func NewClient added in v0.0.16

func NewClient(client *storage.Client) Client

NewClient returns a GCSUploadClient for the storage.Client.

type Downloader added in v0.0.16

type Downloader interface {
	Lister
	Opener
}

Downloader can list files and open them for reading.

type Finished

type Finished struct {
	metadata.Finished
	// Running when the job hasn't finished and finished.json doesn't exist
	Running bool
}

Finished holds finished.json data.

type Iterator added in v0.0.16

type Iterator interface {
	Next() (*storage.ObjectAttrs, error)
}

An iterator returns the attributes of the listed objects or an iterator.Done error.

type Lister added in v0.0.16

type Lister interface {
	Objects(ctx context.Context, prefix Path, delimiter, start string) Iterator
}

A Lister returns objects under a prefix.

type Opener added in v0.0.16

type Opener interface {
	Open(ctx context.Context, path Path) (io.ReadCloser, error)
}

An Opener opens a path for reading.

type Path

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

Path parses gs://bucket/obj urls

func NewPath

func NewPath(path string) (*Path, error)

func (Path) Bucket

func (g Path) Bucket() string

Bucket returns bucket in gs://bucket/obj

func (Path) Object

func (g Path) Object() string

Object returns path/to/something in gs://bucket/path/to/something

func (Path) ResolveReference

func (g Path) ResolveReference(ref *url.URL) (*Path, error)

ResolveReference returns the path relative to the current path

func (*Path) Set

func (g *Path) Set(v string) error

Set updates value from a gs://bucket/obj string, validating errors.

func (*Path) SetURL

func (g *Path) SetURL(u *url.URL) error

SetURL updates value to the passed in gs://bucket/obj url

func (Path) String

func (g Path) String() string

String returns the gs://bucket/obj url

type Started

type Started struct {
	metadata.Started
	// Pending when the job has not started yet
	Pending bool
}

Started holds started.json data.

type SuitesMeta

type SuitesMeta struct {
	Suites   junit.Suites      // suites data extracted from file contents
	Metadata map[string]string // metadata extracted from path name
	Path     string
}

SuitesMeta holds testsuites xml and metadata from the filename

type Uploader added in v0.0.16

type Uploader interface {
	Upload(context.Context, Path, []byte, bool, string) error
}

Uploader adds upload capabilities to a GCS client.

Jump to

Keyboard shortcuts

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