artifacts

package
v0.0.0-...-51f9457 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContentHashRe = regexp.MustCompile(fmt.Sprintf(`^%s:%s$`, hashFunc, sha256Pattern))

Functions

func AddHashPrefix

func AddHashPrefix(hash string) string

AddHashPrefix adds HashFunc to a given hash string.

func MustParseName

func MustParseName(name string) (invID invocations.ID, testID, resultID, artifactID string)

MustParseName extracts invocation, test, result and artifactIDs. Test and result IDs are "" if this is a invocation-level artifact. Panics on failure.

func ParentID

func ParentID(testID, resultID string) string

ParentID returns a value for Artifacts.ParentId Spanner column.

func ParseParentID

func ParseParentID(parentID string) (testID, resultID string, err error)

ParseParentID parses parentID into testID and resultID. If the artifact's parent is invocation, then testID and resultID are "".

func Read

func Read(ctx context.Context, name string) (*pb.Artifact, error)

Read reads an artifact from Spanner. If it does not exist, the returned error is annotated with NotFound GRPC code. Does not return artifact content or its location.

func TrimHashPrefix

func TrimHashPrefix(hash string) string

TrimHashPrefix removes HashFunc from a given hash string.

Types

type Artifact

type Artifact struct {
	*pb.Artifact
	RBECASHash string
}

Artifact contains pb.Artifact and its RBECAS hash.

type Query

type Query struct {
	InvocationIDs       invocations.IDSet
	ParentIDRegexp      string
	FollowEdges         *pb.ArtifactPredicate_EdgeTypeSet
	TestResultPredicate *pb.TestResultPredicate
	ContentTypeRegexp   string
	PageSize            int // must be positive
	PageToken           string
	WithRBECASHash      bool
}

Query specifies artifacts to fetch.

func (*Query) FetchProtos

func (q *Query) FetchProtos(ctx context.Context) (arts []*pb.Artifact, nextPageToken string, err error)

FetchProtos returns a page of artifact protos matching q.

Returned artifacts are ordered by level (invocation or test result). Test result artifacts are sorted by parent invocation ID, test ID and artifact ID.

func (*Query) Run

func (q *Query) Run(ctx context.Context, f func(*Artifact) error) error

Run calls f for artifacts matching the query.

Refer to Fetch() for the ordering of returned artifacts.

Jump to

Keyboard shortcuts

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