luci: Index | Files

package protoutil

import ""

Package protoutil provides utility functions for protobuf messages in ../proto package.


Package Files

build.go builder.go common.go doc.go rpc.go search.go tag.go


const BuildMediaType = "application/luci+proto; message=buildbucket.v2.Build"

BuildMediaType is a media type for a binary-encoded Build message.

func BuildSets Uses

func BuildSets(b *pb.Build) []string

BuildSets returns all of the buildsets of the build.

func FormatBuilderID Uses

func FormatBuilderID(id *pb.BuilderID) string

FormatBuilderID returns "{project}/{bucket}/{builder}" string.

func GerritBuildSet Uses

func GerritBuildSet(c *pb.GerritChange) string

GerritBuildSet returns a buildset representation of c, e.g. "patch/gerrit/"

func GerritChangeURL Uses

func GerritChangeURL(c *pb.GerritChange) string

GerritChangeURL returns URL of the change.

func GitilesBuildSet Uses

func GitilesBuildSet(c *pb.GitilesCommit) string

GitilesBuildSet returns a buildset representation of c. e.g. "commit/gitiles/"

func GitilesCommitURL Uses

func GitilesCommitURL(c *pb.GitilesCommit) string

GitilesCommitURL returns the URL for the gitiles commit. e.g. "" or "" if id is not available.

func GitilesRepoURL Uses

func GitilesRepoURL(c *pb.GitilesCommit) string

GitilesRepoURL returns the URL for the gitiles repo. e.g. ""

func IsEnded Uses

func IsEnded(s pb.Status) bool

IsEnded returns true if s is final.

func ParseBuildSet Uses

func ParseBuildSet(buildSet string) proto.Message

ParseBuildSet tries to parse buildset as one of the known formats. May return *pb.GerritChange, *pb.GitilesCommit or nil.

func ParseBuilderID Uses

func ParseBuilderID(s string) (*pb.BuilderID, error)

ParseBuilderID parses a "{project}/{bucket}/{builder}" string. Opposite of FormatBuilderID.

func ParseGetBuildRequest Uses

func ParseGetBuildRequest(s string) (*pb.GetBuildRequest, error)

ParseGetBuildRequest parses a GetBuild request. Supports two forms: - <build-id> - <project>/<bucket>/<builder>/<build-number>

func ParseStringPair Uses

func ParseStringPair(p *pb.StringPair) string

ParseStringPair parses StringPair to "<key>:<value>".

func ParseStringPairs Uses

func ParseStringPairs(p []*pb.StringPair) []string

ParseStringPair parses a list of StringPairs.

func RunDuration Uses

func RunDuration(b *pb.Build) (duration time.Duration, ok bool)

RunDuration returns duration between build start and end.

func SchedulingDuration Uses

func SchedulingDuration(b *pb.Build) (duration time.Duration, ok bool)

SchedulingDuration returns duration between build creation and start.

func Search(ctx context.Context, buildC chan<- *pb.Build, client pb.BuildsClient, requests ...*pb.SearchBuildsRequest) error

Search searches for builds continuously, sending findings to buildC until the search is exhausted or context is canceled. The builds are ordered newest-to-oldest and deduplicated.

If len(requests) > 1, the builds represent a union of the search requests.

Search does not return a next page token because ctx can be canceled in the middle of a page and because Search supports multiple requests.

func SortStringPairs Uses

func SortStringPairs(pairs []*pb.StringPair)

SortStringPairs sorts string pairs.

func StringPairs Uses

func StringPairs(m strpair.Map) []*pb.StringPair

StringPairs converts a strpair.Map to a slice of StringPair messages.

func Tags Uses

func Tags(b *pb.Build) strpair.Map

Tags parses b.Tags as a strpair.Map.

func ValidateBuilderID Uses

func ValidateBuilderID(b *pb.BuilderID) error

ValidateBuilderID validates the given builder ID. Bucket and Builder are optional and only validated if specified.

Package protoutil imports 15 packages (graph) and is imported by 28 packages. Updated 2020-07-03. Refresh now. Tools for package owners.