id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
9,400
luci/luci-go
luci_notify/notify/pubsub.go
extractBuild
func extractBuild(c context.Context, r *http.Request) (*Build, error) { // sent by pubsub. // This struct is just convenient for unwrapping the json message var msg struct { Message struct { Data []byte } Attributes map[string]interface{} } if err := json.NewDecoder(r.Body).Decode(&msg); err != nil { re...
go
func extractBuild(c context.Context, r *http.Request) (*Build, error) { // sent by pubsub. // This struct is just convenient for unwrapping the json message var msg struct { Message struct { Data []byte } Attributes map[string]interface{} } if err := json.NewDecoder(r.Body).Decode(&msg); err != nil { re...
[ "func", "extractBuild", "(", "c", "context", ".", "Context", ",", "r", "*", "http", ".", "Request", ")", "(", "*", "Build", ",", "error", ")", "{", "// sent by pubsub.", "// This struct is just convenient for unwrapping the json message", "var", "msg", "struct", "...
// extractBuild constructs a Build from the PubSub HTTP request.
[ "extractBuild", "constructs", "a", "Build", "from", "the", "PubSub", "HTTP", "request", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/luci_notify/notify/pubsub.go#L367-L428
9,401
luci/luci-go
cipd/appengine/impl/repo/acl.go
rolesInPrefix
func rolesInPrefix(c context.Context, metas []*api.PrefixMetadata) ([]api.Role, error) { roles := roleSet() for _, meta := range metas { for _, acl := range meta.Acls { if _, ok := roles[acl.Role]; ok { continue // seen this role already } switch yes, err := isInACL(c, acl); { case err != nil: r...
go
func rolesInPrefix(c context.Context, metas []*api.PrefixMetadata) ([]api.Role, error) { roles := roleSet() for _, meta := range metas { for _, acl := range meta.Acls { if _, ok := roles[acl.Role]; ok { continue // seen this role already } switch yes, err := isInACL(c, acl); { case err != nil: r...
[ "func", "rolesInPrefix", "(", "c", "context", ".", "Context", ",", "metas", "[", "]", "*", "api", ".", "PrefixMetadata", ")", "(", "[", "]", "api", ".", "Role", ",", "error", ")", "{", "roles", ":=", "roleSet", "(", ")", "\n", "for", "_", ",", "m...
// rolesInPrefix returns a union of roles the caller has in given supplied // PrefixMetadata objects. // // It understands the role inheritance defined by impliedRoles map. // // Returns only transient errors.
[ "rolesInPrefix", "returns", "a", "union", "of", "roles", "the", "caller", "has", "in", "given", "supplied", "PrefixMetadata", "objects", ".", "It", "understands", "the", "role", "inheritance", "defined", "by", "impliedRoles", "map", ".", "Returns", "only", "tran...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/repo/acl.go#L121-L148
9,402
luci/luci-go
cipd/appengine/impl/repo/acl.go
isInACL
func isInACL(c context.Context, acl *api.PrefixMetadata_ACL) (bool, error) { caller := string(auth.CurrentIdentity(c)) // e.g. "user:abc@example.com" var groups []string for _, p := range acl.Principals { if p == caller { return true, nil // the caller was specified in ACLs explicitly } if s := strings.Spl...
go
func isInACL(c context.Context, acl *api.PrefixMetadata_ACL) (bool, error) { caller := string(auth.CurrentIdentity(c)) // e.g. "user:abc@example.com" var groups []string for _, p := range acl.Principals { if p == caller { return true, nil // the caller was specified in ACLs explicitly } if s := strings.Spl...
[ "func", "isInACL", "(", "c", "context", ".", "Context", ",", "acl", "*", "api", ".", "PrefixMetadata_ACL", ")", "(", "bool", ",", "error", ")", "{", "caller", ":=", "string", "(", "auth", ".", "CurrentIdentity", "(", "c", ")", ")", "// e.g. \"user:abc@ex...
// isInACL is true if the caller is in the given access control list.
[ "isInACL", "is", "true", "if", "the", "caller", "is", "in", "the", "given", "access", "control", "list", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/repo/acl.go#L151-L169
9,403
luci/luci-go
logdog/common/viewer/url.go
GetURL
func GetURL(host string, project types.ProjectName, paths ...types.StreamPath) string { values := make([]string, len(paths)) for i, p := range paths { values[i] = fmt.Sprintf("%s/%s", project, p) } u := url.URL{ Scheme: "https", Host: host, } if len(values) == 1 { u.Path = "logs/" + values[0] } else { ...
go
func GetURL(host string, project types.ProjectName, paths ...types.StreamPath) string { values := make([]string, len(paths)) for i, p := range paths { values[i] = fmt.Sprintf("%s/%s", project, p) } u := url.URL{ Scheme: "https", Host: host, } if len(values) == 1 { u.Path = "logs/" + values[0] } else { ...
[ "func", "GetURL", "(", "host", "string", ",", "project", "types", ".", "ProjectName", ",", "paths", "...", "types", ".", "StreamPath", ")", "string", "{", "values", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "paths", ")", ")", "\n", "for...
// GetURL generates a LogDog app viewer URL for the specified streams. // Uses the plain-text endpoint for single stream paths, and the client-side endpoint for multi-stream paths.
[ "GetURL", "generates", "a", "LogDog", "app", "viewer", "URL", "for", "the", "specified", "streams", ".", "Uses", "the", "plain", "-", "text", "endpoint", "for", "single", "stream", "paths", "and", "the", "client", "-", "side", "endpoint", "for", "multi", "...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/common/viewer/url.go#L28-L46
9,404
luci/luci-go
gce/cmd/agent/assets.gen.go
GetAssetSHA256
func GetAssetSHA256(name string) []byte { data := fileSha256s[name] if data == nil { return nil } return append([]byte(nil), data...) }
go
func GetAssetSHA256(name string) []byte { data := fileSha256s[name] if data == nil { return nil } return append([]byte(nil), data...) }
[ "func", "GetAssetSHA256", "(", "name", "string", ")", "[", "]", "byte", "{", "data", ":=", "fileSha256s", "[", "name", "]", "\n", "if", "data", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "append", "(", "[", "]", "byte", "(", "nil...
// GetAssetSHA256 returns the asset checksum. Returns nil if no such asset // exists.
[ "GetAssetSHA256", "returns", "the", "asset", "checksum", ".", "Returns", "nil", "if", "no", "such", "asset", "exists", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/gce/cmd/agent/assets.gen.go#L35-L41
9,405
luci/luci-go
gce/cmd/agent/assets.gen.go
Assets
func Assets() map[string]string { cpy := make(map[string]string, len(files)) for k, v := range files { cpy[k] = v } return cpy }
go
func Assets() map[string]string { cpy := make(map[string]string, len(files)) for k, v := range files { cpy[k] = v } return cpy }
[ "func", "Assets", "(", ")", "map", "[", "string", "]", "string", "{", "cpy", ":=", "make", "(", "map", "[", "string", "]", "string", ",", "len", "(", "files", ")", ")", "\n", "for", "k", ",", "v", ":=", "range", "files", "{", "cpy", "[", "k", ...
// Assets returns a map of all assets.
[ "Assets", "returns", "a", "map", "of", "all", "assets", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/gce/cmd/agent/assets.gen.go#L44-L50
9,406
luci/luci-go
machine-db/appengine/rpc/vlans.go
ListVLANs
func (*Service) ListVLANs(c context.Context, req *crimson.ListVLANsRequest) (*crimson.ListVLANsResponse, error) { ids := make(map[int64]struct{}, len(req.Ids)) for _, id := range req.Ids { ids[id] = struct{}{} } vlans, err := listVLANs(c, ids, stringset.NewFromSlice(req.Aliases...)) if err != nil { return nil,...
go
func (*Service) ListVLANs(c context.Context, req *crimson.ListVLANsRequest) (*crimson.ListVLANsResponse, error) { ids := make(map[int64]struct{}, len(req.Ids)) for _, id := range req.Ids { ids[id] = struct{}{} } vlans, err := listVLANs(c, ids, stringset.NewFromSlice(req.Aliases...)) if err != nil { return nil,...
[ "func", "(", "*", "Service", ")", "ListVLANs", "(", "c", "context", ".", "Context", ",", "req", "*", "crimson", ".", "ListVLANsRequest", ")", "(", "*", "crimson", ".", "ListVLANsResponse", ",", "error", ")", "{", "ids", ":=", "make", "(", "map", "[", ...
// ListVLANs handles a request to retrieve VLANs.
[ "ListVLANs", "handles", "a", "request", "to", "retrieve", "VLANs", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/vlans.go#L28-L40
9,407
luci/luci-go
machine-db/appengine/rpc/vlans.go
listVLANs
func listVLANs(c context.Context, ids map[int64]struct{}, aliases stringset.Set) ([]*crimson.VLAN, error) { db := database.Get(c) rows, err := db.QueryContext(c, ` SELECT id, alias, state, cidr_block FROM vlans `) if err != nil { return nil, errors.Annotate(err, "failed to fetch VLANs").Err() } defer rows.C...
go
func listVLANs(c context.Context, ids map[int64]struct{}, aliases stringset.Set) ([]*crimson.VLAN, error) { db := database.Get(c) rows, err := db.QueryContext(c, ` SELECT id, alias, state, cidr_block FROM vlans `) if err != nil { return nil, errors.Annotate(err, "failed to fetch VLANs").Err() } defer rows.C...
[ "func", "listVLANs", "(", "c", "context", ".", "Context", ",", "ids", "map", "[", "int64", "]", "struct", "{", "}", ",", "aliases", "stringset", ".", "Set", ")", "(", "[", "]", "*", "crimson", ".", "VLAN", ",", "error", ")", "{", "db", ":=", "dat...
// listVLANs returns a slice of VLANs in the database. // VLANs matching either a given ID or a given alias are returned. Specify no IDs or aliases to return all VLANs.
[ "listVLANs", "returns", "a", "slice", "of", "VLANs", "in", "the", "database", ".", "VLANs", "matching", "either", "a", "given", "ID", "or", "a", "given", "alias", "are", "returned", ".", "Specify", "no", "IDs", "or", "aliases", "to", "return", "all", "VL...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/vlans.go#L44-L68
9,408
luci/luci-go
milo/frontend/view_build.go
handleLUCIBuild
func handleLUCIBuild(c *router.Context) error { bucket := c.Params.ByName("bucket") buildername := c.Params.ByName("builder") numberOrId := c.Params.ByName("numberOrId") forceBlamelist := c.Request.FormValue("blamelist") != "" if _, v2Bucket := deprecated.BucketNameToV2(bucket); v2Bucket != "" { // Params bucke...
go
func handleLUCIBuild(c *router.Context) error { bucket := c.Params.ByName("bucket") buildername := c.Params.ByName("builder") numberOrId := c.Params.ByName("numberOrId") forceBlamelist := c.Request.FormValue("blamelist") != "" if _, v2Bucket := deprecated.BucketNameToV2(bucket); v2Bucket != "" { // Params bucke...
[ "func", "handleLUCIBuild", "(", "c", "*", "router", ".", "Context", ")", "error", "{", "bucket", ":=", "c", ".", "Params", ".", "ByName", "(", "\"", "\"", ")", "\n", "buildername", ":=", "c", ".", "Params", ".", "ByName", "(", "\"", "\"", ")", "\n"...
// handleLUCIBuild renders a LUCI build.
[ "handleLUCIBuild", "renders", "a", "LUCI", "build", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/view_build.go#L48-L82
9,409
luci/luci-go
milo/frontend/view_build.go
renderBuild
func renderBuild(c *router.Context, bp *ui.BuildPage, err error) error { if err != nil { return err } bp.StepDisplayPref = getStepDisplayPrefCookie(c) templates.MustRender(c.Context, c.Writer, "pages/build.html", templates.Args{ "BuildPage": bp, }) return nil }
go
func renderBuild(c *router.Context, bp *ui.BuildPage, err error) error { if err != nil { return err } bp.StepDisplayPref = getStepDisplayPrefCookie(c) templates.MustRender(c.Context, c.Writer, "pages/build.html", templates.Args{ "BuildPage": bp, }) return nil }
[ "func", "renderBuild", "(", "c", "*", "router", ".", "Context", ",", "bp", "*", "ui", ".", "BuildPage", ",", "err", "error", ")", "error", "{", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "bp", ".", "StepDisplayPref", "=", "g...
// renderBuild is a shortcut for rendering build or returning err if it is not nil.
[ "renderBuild", "is", "a", "shortcut", "for", "rendering", "build", "or", "returning", "err", "if", "it", "is", "not", "nil", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/view_build.go#L85-L96
9,410
luci/luci-go
server/auth/openid/json_web_keys.go
NewJSONWebKeySet
func NewJSONWebKeySet(parsed *JSONWebKeySetStruct) (*JSONWebKeySet, error) { // Pick keys used to verify RS256 signatures. keys := make(map[string]rsa.PublicKey, len(parsed.Keys)) for _, k := range parsed.Keys { if k.Kty != "RSA" || k.Alg != "RS256" || k.Use != "sig" { continue // not an RSA public key } if...
go
func NewJSONWebKeySet(parsed *JSONWebKeySetStruct) (*JSONWebKeySet, error) { // Pick keys used to verify RS256 signatures. keys := make(map[string]rsa.PublicKey, len(parsed.Keys)) for _, k := range parsed.Keys { if k.Kty != "RSA" || k.Alg != "RS256" || k.Use != "sig" { continue // not an RSA public key } if...
[ "func", "NewJSONWebKeySet", "(", "parsed", "*", "JSONWebKeySetStruct", ")", "(", "*", "JSONWebKeySet", ",", "error", ")", "{", "// Pick keys used to verify RS256 signatures.", "keys", ":=", "make", "(", "map", "[", "string", "]", "rsa", ".", "PublicKey", ",", "l...
// NewJSONWebKeySet makes the keyset from raw JSON Web Key set struct.
[ "NewJSONWebKeySet", "makes", "the", "keyset", "from", "raw", "JSON", "Web", "Key", "set", "struct", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/server/auth/openid/json_web_keys.go#L60-L84
9,411
luci/luci-go
server/auth/openid/json_web_keys.go
VerifyJWT
func (k *JSONWebKeySet) VerifyJWT(jwt string) (body []byte, err error) { chunks := strings.Split(jwt, ".") if len(chunks) != 3 { return nil, fmt.Errorf("bad JWT - expected 3 components separated by '.'") } // Check the header, grab the corresponding public key. var hdr struct { Alg string `json:"alg"` Kid s...
go
func (k *JSONWebKeySet) VerifyJWT(jwt string) (body []byte, err error) { chunks := strings.Split(jwt, ".") if len(chunks) != 3 { return nil, fmt.Errorf("bad JWT - expected 3 components separated by '.'") } // Check the header, grab the corresponding public key. var hdr struct { Alg string `json:"alg"` Kid s...
[ "func", "(", "k", "*", "JSONWebKeySet", ")", "VerifyJWT", "(", "jwt", "string", ")", "(", "body", "[", "]", "byte", ",", "err", "error", ")", "{", "chunks", ":=", "strings", ".", "Split", "(", "jwt", ",", "\"", "\"", ")", "\n", "if", "len", "(", ...
// VerifyJWT checks JWT signature and returns the token body. // // Supports only non-encrypted RS256-signed JWTs. See RFC7519.
[ "VerifyJWT", "checks", "JWT", "signature", "and", "returns", "the", "token", "body", ".", "Supports", "only", "non", "-", "encrypted", "RS256", "-", "signed", "JWTs", ".", "See", "RFC7519", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/server/auth/openid/json_web_keys.go#L89-L136
9,412
luci/luci-go
common/logging/gkelogger/logger.go
GetFactory
func GetFactory(out io.Writer) func(context.Context) logging.Logger { lock := sync.Mutex{} return func(c context.Context) logging.Logger { return &jsonLogger{ ctx: c, lock: &lock, out: out, } } }
go
func GetFactory(out io.Writer) func(context.Context) logging.Logger { lock := sync.Mutex{} return func(c context.Context) logging.Logger { return &jsonLogger{ ctx: c, lock: &lock, out: out, } } }
[ "func", "GetFactory", "(", "out", "io", ".", "Writer", ")", "func", "(", "context", ".", "Context", ")", "logging", ".", "Logger", "{", "lock", ":=", "sync", ".", "Mutex", "{", "}", "\n", "return", "func", "(", "c", "context", ".", "Context", ")", ...
// GetFactory creates a goroutine safe gkelogger that writes into out.
[ "GetFactory", "creates", "a", "goroutine", "safe", "gkelogger", "that", "writes", "into", "out", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/logging/gkelogger/logger.go#L30-L39
9,413
luci/luci-go
common/iotools/chainreader.go
Remaining
func (cr ChainReader) Remaining() int64 { result, err := cr.RemainingErr() if err != nil { panic(err) } return result }
go
func (cr ChainReader) Remaining() int64 { result, err := cr.RemainingErr() if err != nil { panic(err) } return result }
[ "func", "(", "cr", "ChainReader", ")", "Remaining", "(", ")", "int64", "{", "result", ",", "err", ":=", "cr", ".", "RemainingErr", "(", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "result", "\n", ...
// Remaining calculates the amount of data left in the ChainReader. It will // panic if an error condition in RemainingErr is encountered.
[ "Remaining", "calculates", "the", "amount", "of", "data", "left", "in", "the", "ChainReader", ".", "It", "will", "panic", "if", "an", "error", "condition", "in", "RemainingErr", "is", "encountered", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/iotools/chainreader.go#L77-L83
9,414
luci/luci-go
common/iotools/chainreader.go
RemainingErr
func (cr ChainReader) RemainingErr() (int64, error) { result := int64(0) for _, source := range cr { if source == nil { continue } r, ok := source.(interface { Len() int }) if !ok { return 0, errors.New("chainreader: can only calculate Remaining for instances implementing Len()") } result += in...
go
func (cr ChainReader) RemainingErr() (int64, error) { result := int64(0) for _, source := range cr { if source == nil { continue } r, ok := source.(interface { Len() int }) if !ok { return 0, errors.New("chainreader: can only calculate Remaining for instances implementing Len()") } result += in...
[ "func", "(", "cr", "ChainReader", ")", "RemainingErr", "(", ")", "(", "int64", ",", "error", ")", "{", "result", ":=", "int64", "(", "0", ")", "\n", "for", "_", ",", "source", ":=", "range", "cr", "{", "if", "source", "==", "nil", "{", "continue", ...
// RemainingErr returns the amount of data left in the ChainReader. An error is // returned if any reader in the chain is not either nil or a bytes.Reader. // // Note that this method iterates over all readers in the chain each time that // it's called.
[ "RemainingErr", "returns", "the", "amount", "of", "data", "left", "in", "the", "ChainReader", ".", "An", "error", "is", "returned", "if", "any", "reader", "in", "the", "chain", "is", "not", "either", "nil", "or", "a", "bytes", ".", "Reader", ".", "Note",...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/iotools/chainreader.go#L90-L105
9,415
luci/luci-go
logdog/client/butler/streamserver/namedPipe_posix.go
NewUNIXDomainSocketServer
func NewUNIXDomainSocketServer(ctx context.Context, path string) (StreamServer, error) { switch l := len(path); { case l == 0: return nil, errors.New("cannot have empty path") case l > maxPOSIXNamedSocketLength: return nil, errors.Reason("path exceeds maximum length %d", maxPOSIXNamedSocketLength). InternalRe...
go
func NewUNIXDomainSocketServer(ctx context.Context, path string) (StreamServer, error) { switch l := len(path); { case l == 0: return nil, errors.New("cannot have empty path") case l > maxPOSIXNamedSocketLength: return nil, errors.Reason("path exceeds maximum length %d", maxPOSIXNamedSocketLength). InternalRe...
[ "func", "NewUNIXDomainSocketServer", "(", "ctx", "context", ".", "Context", ",", "path", "string", ")", "(", "StreamServer", ",", "error", ")", "{", "switch", "l", ":=", "len", "(", "path", ")", ";", "{", "case", "l", "==", "0", ":", "return", "nil", ...
// NewUNIXDomainSocketServer instantiates a new POSIX domain soecket server // instance. // // No resources are actually created until methods are called on the returned // server.
[ "NewUNIXDomainSocketServer", "instantiates", "a", "new", "POSIX", "domain", "soecket", "server", "instance", ".", "No", "resources", "are", "actually", "created", "until", "methods", "are", "called", "on", "the", "returned", "server", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/client/butler/streamserver/namedPipe_posix.go#L39-L83
9,416
luci/luci-go
grpc/internal/svctool/tool.go
ParseArgs
func (t *Tool) ParseArgs(args []string) { args = t.parseFlags(args) switch len(args) { case 0: args = []string{"."} fallthrough case 1: info, err := os.Stat(args[0]) if err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(2) } if info.IsDir() { t.Dir = args[0] t.FileNames, err = goFilesIn(arg...
go
func (t *Tool) ParseArgs(args []string) { args = t.parseFlags(args) switch len(args) { case 0: args = []string{"."} fallthrough case 1: info, err := os.Stat(args[0]) if err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(2) } if info.IsDir() { t.Dir = args[0] t.FileNames, err = goFilesIn(arg...
[ "func", "(", "t", "*", "Tool", ")", "ParseArgs", "(", "args", "[", "]", "string", ")", "{", "args", "=", "t", ".", "parseFlags", "(", "args", ")", "\n\n", "switch", "len", "(", "args", ")", "{", "case", "0", ":", "args", "=", "[", "]", "string"...
// ParseArgs parses command arguments. Exits if they are invalid.
[ "ParseArgs", "parses", "command", "arguments", ".", "Exits", "if", "they", "are", "invalid", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/grpc/internal/svctool/tool.go#L107-L136
9,417
luci/luci-go
grpc/internal/svctool/tool.go
Run
func (t *Tool) Run(c context.Context, f Generator) error { // Validate arguments. if len(t.FileNames) == 0 { return fmt.Errorf("files not specified") } if len(t.Types) == 0 { return fmt.Errorf("types not specified") } // Determine output file name. outputName := t.Output if outputName == "" { if t.Dir ==...
go
func (t *Tool) Run(c context.Context, f Generator) error { // Validate arguments. if len(t.FileNames) == 0 { return fmt.Errorf("files not specified") } if len(t.Types) == 0 { return fmt.Errorf("types not specified") } // Determine output file name. outputName := t.Output if outputName == "" { if t.Dir ==...
[ "func", "(", "t", "*", "Tool", ")", "Run", "(", "c", "context", ".", "Context", ",", "f", "Generator", ")", "error", "{", "// Validate arguments.", "if", "len", "(", "t", ".", "FileNames", ")", "==", "0", "{", "return", "fmt", ".", "Errorf", "(", "...
// Run parses Go files and generates a new file using f.
[ "Run", "parses", "Go", "files", "and", "generates", "a", "new", "file", "using", "f", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/grpc/internal/svctool/tool.go#L162-L214
9,418
luci/luci-go
grpc/internal/svctool/tool.go
goFilesIn
func goFilesIn(dir string) ([]string, error) { pkg, err := build.ImportDir(dir, 0) if err != nil { return nil, fmt.Errorf("cannot process directory %s: %s", dir, err) } var names []string names = append(names, pkg.GoFiles...) names = append(names, pkg.CgoFiles...) names = prefixDirectory(dir, names) return na...
go
func goFilesIn(dir string) ([]string, error) { pkg, err := build.ImportDir(dir, 0) if err != nil { return nil, fmt.Errorf("cannot process directory %s: %s", dir, err) } var names []string names = append(names, pkg.GoFiles...) names = append(names, pkg.CgoFiles...) names = prefixDirectory(dir, names) return na...
[ "func", "goFilesIn", "(", "dir", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "pkg", ",", "err", ":=", "build", ".", "ImportDir", "(", "dir", ",", "0", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", "....
// goFilesIn lists .go files in dir.
[ "goFilesIn", "lists", ".", "go", "files", "in", "dir", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/grpc/internal/svctool/tool.go#L230-L240
9,419
luci/luci-go
appengine/gaemiddleware/settings.go
reportDSCacheDisabled
func reportDSCacheDisabled(c context.Context) { dsCacheDisabled.Set(c, bool(fetchCachedSettings(c).DisableDSCache)) }
go
func reportDSCacheDisabled(c context.Context) { dsCacheDisabled.Set(c, bool(fetchCachedSettings(c).DisableDSCache)) }
[ "func", "reportDSCacheDisabled", "(", "c", "context", ".", "Context", ")", "{", "dsCacheDisabled", ".", "Set", "(", "c", ",", "bool", "(", "fetchCachedSettings", "(", "c", ")", ".", "DisableDSCache", ")", ")", "\n", "}" ]
// reportDSCacheDisabled reports the value of DSCacheDisabled in settings to // tsmon.
[ "reportDSCacheDisabled", "reports", "the", "value", "of", "DSCacheDisabled", "in", "settings", "to", "tsmon", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/appengine/gaemiddleware/settings.go#L87-L89
9,420
luci/luci-go
logdog/server/archivist/archivist.go
ArchiveTask
func (a *Archivist) ArchiveTask(c context.Context, task *logdog.ArchiveTask) error { c = log.SetFields(c, log.Fields{ "project": task.Project, "id": task.Id, }) log.Debugf(c, "Received archival task.") err := a.archiveTaskImpl(c, task) failure := isFailure(err) log.Fields{ log.ErrorKey: err, "failu...
go
func (a *Archivist) ArchiveTask(c context.Context, task *logdog.ArchiveTask) error { c = log.SetFields(c, log.Fields{ "project": task.Project, "id": task.Id, }) log.Debugf(c, "Received archival task.") err := a.archiveTaskImpl(c, task) failure := isFailure(err) log.Fields{ log.ErrorKey: err, "failu...
[ "func", "(", "a", "*", "Archivist", ")", "ArchiveTask", "(", "c", "context", ".", "Context", ",", "task", "*", "logdog", ".", "ArchiveTask", ")", "error", "{", "c", "=", "log", ".", "SetFields", "(", "c", ",", "log", ".", "Fields", "{", "\"", "\"",...
// ArchiveTask processes and executes a single log stream archive task. // // If the supplied Context is Done, operation may terminate before completion, // returning the Context's error.
[ "ArchiveTask", "processes", "and", "executes", "a", "single", "log", "stream", "archive", "task", ".", "If", "the", "supplied", "Context", "is", "Done", "operation", "may", "terminate", "before", "completion", "returning", "the", "Context", "s", "error", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/server/archivist/archivist.go#L163-L182
9,421
luci/luci-go
logdog/server/archivist/archivist.go
loadSettings
func (a *Archivist) loadSettings(c context.Context, project types.ProjectName) (*Settings, error) { if a.SettingsLoader == nil { panic("no settings loader configured") } st, err := a.SettingsLoader(c, project) switch { case err != nil: return nil, err case st.GSBase.Bucket() == "": log.Fields{ log.Erro...
go
func (a *Archivist) loadSettings(c context.Context, project types.ProjectName) (*Settings, error) { if a.SettingsLoader == nil { panic("no settings loader configured") } st, err := a.SettingsLoader(c, project) switch { case err != nil: return nil, err case st.GSBase.Bucket() == "": log.Fields{ log.Erro...
[ "func", "(", "a", "*", "Archivist", ")", "loadSettings", "(", "c", "context", ".", "Context", ",", "project", "types", ".", "ProjectName", ")", "(", "*", "Settings", ",", "error", ")", "{", "if", "a", ".", "SettingsLoader", "==", "nil", "{", "panic", ...
// loadSettings loads and validates archival settings.
[ "loadSettings", "loads", "and", "validates", "archival", "settings", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/server/archivist/archivist.go#L323-L350
9,422
luci/luci-go
logdog/server/archivist/archivist.go
checkComplete
func (sa *stagedArchival) checkComplete(c context.Context) error { if sa.terminalIndex < 0 { log.Warningf(c, "Cannot archive complete stream with no terminal index.") return statusErr(errors.New("completeness required, but stream has no terminal index")) } sreq := storage.GetRequest{ Project: sa.project, P...
go
func (sa *stagedArchival) checkComplete(c context.Context) error { if sa.terminalIndex < 0 { log.Warningf(c, "Cannot archive complete stream with no terminal index.") return statusErr(errors.New("completeness required, but stream has no terminal index")) } sreq := storage.GetRequest{ Project: sa.project, P...
[ "func", "(", "sa", "*", "stagedArchival", ")", "checkComplete", "(", "c", "context", ".", "Context", ")", "error", "{", "if", "sa", ".", "terminalIndex", "<", "0", "{", "log", ".", "Warningf", "(", "c", ",", "\"", "\"", ")", "\n", "return", "statusEr...
// checkComplete performs a quick scan of intermediate storage to ensure that // all of the log stream's records are available.
[ "checkComplete", "performs", "a", "quick", "scan", "of", "intermediate", "storage", "to", "ensure", "that", "all", "of", "the", "log", "stream", "s", "records", "are", "available", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/server/archivist/archivist.go#L437-L479
9,423
luci/luci-go
common/tsmon/target/target.go
NewFromFlags
func NewFromFlags(fl *Flags) (types.Target, error) { if fl.TargetType == "task" { if fl.TaskServiceName == "" { return nil, errors.New( "--ts-mon-task-service-name must be provided when using --ts-mon-target-type=task") } if fl.TaskJobName == "" { return nil, errors.New( "--ts-mon-task-job-name mus...
go
func NewFromFlags(fl *Flags) (types.Target, error) { if fl.TargetType == "task" { if fl.TaskServiceName == "" { return nil, errors.New( "--ts-mon-task-service-name must be provided when using --ts-mon-target-type=task") } if fl.TaskJobName == "" { return nil, errors.New( "--ts-mon-task-job-name mus...
[ "func", "NewFromFlags", "(", "fl", "*", "Flags", ")", "(", "types", ".", "Target", ",", "error", ")", "{", "if", "fl", ".", "TargetType", "==", "\"", "\"", "{", "if", "fl", ".", "TaskServiceName", "==", "\"", "\"", "{", "return", "nil", ",", "error...
// NewFromFlags returns a Target configured from commandline flags.
[ "NewFromFlags", "returns", "a", "Target", "configured", "from", "commandline", "flags", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/tsmon/target/target.go#L83-L111
9,424
luci/luci-go
common/data/stringset/stringset.go
NewFromSlice
func NewFromSlice(vals ...string) Set { ret := make(Set, len(vals)) for _, k := range vals { ret[k] = struct{}{} } return ret }
go
func NewFromSlice(vals ...string) Set { ret := make(Set, len(vals)) for _, k := range vals { ret[k] = struct{}{} } return ret }
[ "func", "NewFromSlice", "(", "vals", "...", "string", ")", "Set", "{", "ret", ":=", "make", "(", "Set", ",", "len", "(", "vals", ")", ")", "\n", "for", "_", ",", "k", ":=", "range", "vals", "{", "ret", "[", "k", "]", "=", "struct", "{", "}", ...
// NewFromSlice returns a new string Set implementation, // initialized with the values in the provided slice.
[ "NewFromSlice", "returns", "a", "new", "string", "Set", "implementation", "initialized", "with", "the", "values", "in", "the", "provided", "slice", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/stringset/stringset.go#L27-L33
9,425
luci/luci-go
common/data/stringset/stringset.go
Has
func (s Set) Has(value string) bool { _, ret := s[value] return ret }
go
func (s Set) Has(value string) bool { _, ret := s[value] return ret }
[ "func", "(", "s", "Set", ")", "Has", "(", "value", "string", ")", "bool", "{", "_", ",", "ret", ":=", "s", "[", "value", "]", "\n", "return", "ret", "\n", "}" ]
// Has returns true iff the Set contains value.
[ "Has", "returns", "true", "iff", "the", "Set", "contains", "value", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/stringset/stringset.go#L36-L39
9,426
luci/luci-go
common/data/stringset/stringset.go
HasAll
func (s Set) HasAll(values ...string) bool { for _, v := range values { if !s.Has(v) { return false } } return true }
go
func (s Set) HasAll(values ...string) bool { for _, v := range values { if !s.Has(v) { return false } } return true }
[ "func", "(", "s", "Set", ")", "HasAll", "(", "values", "...", "string", ")", "bool", "{", "for", "_", ",", "v", ":=", "range", "values", "{", "if", "!", "s", ".", "Has", "(", "v", ")", "{", "return", "false", "\n", "}", "\n", "}", "\n", "retu...
// HasAll returns true iff the Set contains all the given values.
[ "HasAll", "returns", "true", "iff", "the", "Set", "contains", "all", "the", "given", "values", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/stringset/stringset.go#L42-L49
9,427
luci/luci-go
common/data/stringset/stringset.go
Iter
func (s Set) Iter(cb func(string) bool) { for k := range s { if !cb(k) { break } } }
go
func (s Set) Iter(cb func(string) bool) { for k := range s { if !cb(k) { break } } }
[ "func", "(", "s", "Set", ")", "Iter", "(", "cb", "func", "(", "string", ")", "bool", ")", "{", "for", "k", ":=", "range", "s", "{", "if", "!", "cb", "(", "k", ")", "{", "break", "\n", "}", "\n", "}", "\n", "}" ]
// Iter calls `cb` for each item in the set. If `cb` returns false, the // iteration stops.
[ "Iter", "calls", "cb", "for", "each", "item", "in", "the", "set", ".", "If", "cb", "returns", "false", "the", "iteration", "stops", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/stringset/stringset.go#L92-L98
9,428
luci/luci-go
common/data/stringset/stringset.go
Dup
func (s Set) Dup() Set { ret := make(Set, len(s)) for k := range s { ret[k] = struct{}{} } return ret }
go
func (s Set) Dup() Set { ret := make(Set, len(s)) for k := range s { ret[k] = struct{}{} } return ret }
[ "func", "(", "s", "Set", ")", "Dup", "(", ")", "Set", "{", "ret", ":=", "make", "(", "Set", ",", "len", "(", "s", ")", ")", "\n", "for", "k", ":=", "range", "s", "{", "ret", "[", "k", "]", "=", "struct", "{", "}", "{", "}", "\n", "}", "...
// Dup returns a duplicate set.
[ "Dup", "returns", "a", "duplicate", "set", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/stringset/stringset.go#L106-L112
9,429
luci/luci-go
common/data/stringset/stringset.go
ToSlice
func (s Set) ToSlice() []string { ret := make([]string, 0, len(s)) for k := range s { ret = append(ret, k) } return ret }
go
func (s Set) ToSlice() []string { ret := make([]string, 0, len(s)) for k := range s { ret = append(ret, k) } return ret }
[ "func", "(", "s", "Set", ")", "ToSlice", "(", ")", "[", "]", "string", "{", "ret", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "s", ")", ")", "\n", "for", "k", ":=", "range", "s", "{", "ret", "=", "append", "(", "ret",...
// ToSlice renders this set to a slice of all values.
[ "ToSlice", "renders", "this", "set", "to", "a", "slice", "of", "all", "values", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/stringset/stringset.go#L115-L121
9,430
luci/luci-go
common/data/stringset/stringset.go
Intersect
func (s Set) Intersect(other Set) Set { smallLen := len(s) if lo := len(other); lo < smallLen { smallLen = lo } ret := make(Set, smallLen) for k := range s { if _, ok := other[k]; ok { ret[k] = struct{}{} } } return ret }
go
func (s Set) Intersect(other Set) Set { smallLen := len(s) if lo := len(other); lo < smallLen { smallLen = lo } ret := make(Set, smallLen) for k := range s { if _, ok := other[k]; ok { ret[k] = struct{}{} } } return ret }
[ "func", "(", "s", "Set", ")", "Intersect", "(", "other", "Set", ")", "Set", "{", "smallLen", ":=", "len", "(", "s", ")", "\n", "if", "lo", ":=", "len", "(", "other", ")", ";", "lo", "<", "smallLen", "{", "smallLen", "=", "lo", "\n", "}", "\n", ...
// Intersect returns a new Set which is the intersection of this set with the // other set. // // `other` must have the same underlying type as the current set, or this will // panic.
[ "Intersect", "returns", "a", "new", "Set", "which", "is", "the", "intersection", "of", "this", "set", "with", "the", "other", "set", ".", "other", "must", "have", "the", "same", "underlying", "type", "as", "the", "current", "set", "or", "this", "will", "...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/stringset/stringset.go#L128-L140
9,431
luci/luci-go
common/data/stringset/stringset.go
Union
func (s Set) Union(other Set) Set { ret := make(Set, len(s)) for k := range s { ret[k] = struct{}{} } for k := range other { ret[k] = struct{}{} } return ret }
go
func (s Set) Union(other Set) Set { ret := make(Set, len(s)) for k := range s { ret[k] = struct{}{} } for k := range other { ret[k] = struct{}{} } return ret }
[ "func", "(", "s", "Set", ")", "Union", "(", "other", "Set", ")", "Set", "{", "ret", ":=", "make", "(", "Set", ",", "len", "(", "s", ")", ")", "\n", "for", "k", ":=", "range", "s", "{", "ret", "[", "k", "]", "=", "struct", "{", "}", "{", "...
// Union returns a new Set which contains all element from this set, as well // as all elements from the other set. // // `other` must have the same underlying type as the current set, or this will // panic.
[ "Union", "returns", "a", "new", "Set", "which", "contains", "all", "element", "from", "this", "set", "as", "well", "as", "all", "elements", "from", "the", "other", "set", ".", "other", "must", "have", "the", "same", "underlying", "type", "as", "the", "cu...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/stringset/stringset.go#L162-L171
9,432
luci/luci-go
common/data/stringset/stringset.go
Contains
func (s Set) Contains(other Set) bool { for k := range other { if !s.Has(k) { return false } } return true }
go
func (s Set) Contains(other Set) bool { for k := range other { if !s.Has(k) { return false } } return true }
[ "func", "(", "s", "Set", ")", "Contains", "(", "other", "Set", ")", "bool", "{", "for", "k", ":=", "range", "other", "{", "if", "!", "s", ".", "Has", "(", "k", ")", "{", "return", "false", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "...
// Contains returns true iff the given set contains all elements from the other set.
[ "Contains", "returns", "true", "iff", "the", "given", "set", "contains", "all", "elements", "from", "the", "other", "set", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/stringset/stringset.go#L174-L181
9,433
luci/luci-go
cipd/appengine/impl/repo/processing/client_extractor.go
GetClientPackage
func GetClientPackage(platform string) (string, error) { pkg := clientPkgPrefix + platform if err := common.ValidatePackageName(pkg); err != nil { return "", err } return pkg, nil }
go
func GetClientPackage(platform string) (string, error) { pkg := clientPkgPrefix + platform if err := common.ValidatePackageName(pkg); err != nil { return "", err } return pkg, nil }
[ "func", "GetClientPackage", "(", "platform", "string", ")", "(", "string", ",", "error", ")", "{", "pkg", ":=", "clientPkgPrefix", "+", "platform", "\n", "if", "err", ":=", "common", ".", "ValidatePackageName", "(", "pkg", ")", ";", "err", "!=", "nil", "...
// GetClientPackage returns the name of the client package for CIPD client for // the given platform. // // Returns an error if the platform name is invalid.
[ "GetClientPackage", "returns", "the", "name", "of", "the", "client", "package", "for", "CIPD", "client", "for", "the", "given", "platform", ".", "Returns", "an", "error", "if", "the", "platform", "name", "is", "invalid", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/repo/processing/client_extractor.go#L47-L53
9,434
luci/luci-go
cipd/appengine/impl/repo/processing/client_extractor.go
ToObjectRef
func (r *ClientExtractorResult) ToObjectRef() (*api.ObjectRef, error) { algo := api.HashAlgo_value[r.ClientBinary.HashAlgo] if algo == 0 { // Note: this means OLD version of the server may not be able to serve // NEW ClientExtractorResult entries due to unknown hash algo. Many other // things will also break in...
go
func (r *ClientExtractorResult) ToObjectRef() (*api.ObjectRef, error) { algo := api.HashAlgo_value[r.ClientBinary.HashAlgo] if algo == 0 { // Note: this means OLD version of the server may not be able to serve // NEW ClientExtractorResult entries due to unknown hash algo. Many other // things will also break in...
[ "func", "(", "r", "*", "ClientExtractorResult", ")", "ToObjectRef", "(", ")", "(", "*", "api", ".", "ObjectRef", ",", "error", ")", "{", "algo", ":=", "api", ".", "HashAlgo_value", "[", "r", ".", "ClientBinary", ".", "HashAlgo", "]", "\n", "if", "algo"...
// ToObjectRef returns a reference to the extracted client binary in CAS. // // The returned ObjectRef is validated to be syntactically correct already.
[ "ToObjectRef", "returns", "a", "reference", "to", "the", "extracted", "client", "binary", "in", "CAS", ".", "The", "returned", "ObjectRef", "is", "validated", "to", "be", "syntactically", "correct", "already", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/repo/processing/client_extractor.go#L99-L117
9,435
luci/luci-go
cipd/appengine/impl/repo/processing/client_extractor.go
ObjectRefAliases
func (r *ClientExtractorResult) ObjectRefAliases() []*api.ObjectRef { all := r.ClientBinary.AllHashDigests // Older entries do not have AllHashDigests field at all. if len(all) == 0 { ref := &api.ObjectRef{ HashAlgo: api.HashAlgo(api.HashAlgo_value[r.ClientBinary.HashAlgo]), HexDigest: r.ClientBinary.HashD...
go
func (r *ClientExtractorResult) ObjectRefAliases() []*api.ObjectRef { all := r.ClientBinary.AllHashDigests // Older entries do not have AllHashDigests field at all. if len(all) == 0 { ref := &api.ObjectRef{ HashAlgo: api.HashAlgo(api.HashAlgo_value[r.ClientBinary.HashAlgo]), HexDigest: r.ClientBinary.HashD...
[ "func", "(", "r", "*", "ClientExtractorResult", ")", "ObjectRefAliases", "(", ")", "[", "]", "*", "api", ".", "ObjectRef", "{", "all", ":=", "r", ".", "ClientBinary", ".", "AllHashDigests", "\n\n", "// Older entries do not have AllHashDigests field at all.", "if", ...
// ObjectRefAliases is list of ObjectRefs calculated using all hash algos known // to the server when the client binary was extracted. // // Additionally all algos not understood by the server right NOW are skipped // too. This may arise if the server was rolled back, but some files have // already been uploaded with a...
[ "ObjectRefAliases", "is", "list", "of", "ObjectRefs", "calculated", "using", "all", "hash", "algos", "known", "to", "the", "server", "when", "the", "client", "binary", "was", "extracted", ".", "Additionally", "all", "algos", "not", "understood", "by", "the", "...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/repo/processing/client_extractor.go#L125-L153
9,436
luci/luci-go
cipd/appengine/impl/repo/processing/client_extractor.go
Applicable
func (e *ClientExtractor) Applicable(inst *model.Instance) bool { return IsClientPackage(inst.Package.StringID()) }
go
func (e *ClientExtractor) Applicable(inst *model.Instance) bool { return IsClientPackage(inst.Package.StringID()) }
[ "func", "(", "e", "*", "ClientExtractor", ")", "Applicable", "(", "inst", "*", "model", ".", "Instance", ")", "bool", "{", "return", "IsClientPackage", "(", "inst", ".", "Package", ".", "StringID", "(", ")", ")", "\n", "}" ]
// Applicable is part of Processor interface.
[ "Applicable", "is", "part", "of", "Processor", "interface", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/repo/processing/client_extractor.go#L178-L180
9,437
luci/luci-go
cipd/appengine/impl/cas/cas.go
Internal
func Internal(d *tq.Dispatcher) StorageServer { impl := &storageImpl{ tq: d, getGS: gs.Get, settings: settings.Get, getSignedURL: getSignedURL, } impl.registerTasks() return impl }
go
func Internal(d *tq.Dispatcher) StorageServer { impl := &storageImpl{ tq: d, getGS: gs.Get, settings: settings.Get, getSignedURL: getSignedURL, } impl.registerTasks() return impl }
[ "func", "Internal", "(", "d", "*", "tq", ".", "Dispatcher", ")", "StorageServer", "{", "impl", ":=", "&", "storageImpl", "{", "tq", ":", "d", ",", "getGS", ":", "gs", ".", "Get", ",", "settings", ":", "settings", ".", "Get", ",", "getSignedURL", ":",...
// Internal returns non-ACLed implementation of StorageService. // // It can be used internally by the backend. Assumes ACL checks are already // done. // // Registers some task queue tasks in the given dispatcher.
[ "Internal", "returns", "non", "-", "ACLed", "implementation", "of", "StorageService", ".", "It", "can", "be", "used", "internally", "by", "the", "backend", ".", "Assumes", "ACL", "checks", "are", "already", "done", ".", "Registers", "some", "task", "queue", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/cas/cas.go#L71-L80
9,438
luci/luci-go
cipd/appengine/impl/cas/cas.go
GetReader
func (s *storageImpl) GetReader(c context.Context, ref *api.ObjectRef) (r gs.Reader, err error) { defer func() { err = grpcutil.GRPCifyAndLogErr(c, err) }() if err = common.ValidateObjectRef(ref, common.KnownHash); err != nil { return nil, errors.Annotate(err, "bad ref").Err() } cfg, err := s.settings(c) if er...
go
func (s *storageImpl) GetReader(c context.Context, ref *api.ObjectRef) (r gs.Reader, err error) { defer func() { err = grpcutil.GRPCifyAndLogErr(c, err) }() if err = common.ValidateObjectRef(ref, common.KnownHash); err != nil { return nil, errors.Annotate(err, "bad ref").Err() } cfg, err := s.settings(c) if er...
[ "func", "(", "s", "*", "storageImpl", ")", "GetReader", "(", "c", "context", ".", "Context", ",", "ref", "*", "api", ".", "ObjectRef", ")", "(", "r", "gs", ".", "Reader", ",", "err", "error", ")", "{", "defer", "func", "(", ")", "{", "err", "=", ...
// GetReader is part of StorageServer interface.
[ "GetReader", "is", "part", "of", "StorageServer", "interface", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/cas/cas.go#L106-L127
9,439
luci/luci-go
cipd/appengine/impl/cas/cas.go
GetObjectURL
func (s *storageImpl) GetObjectURL(c context.Context, r *api.GetObjectURLRequest) (resp *api.ObjectURL, err error) { defer func() { err = grpcutil.GRPCifyAndLogErr(c, err) }() if err := common.ValidateObjectRef(r.Object, common.KnownHash); err != nil { return nil, errors.Annotate(err, "bad 'object' field").Err() ...
go
func (s *storageImpl) GetObjectURL(c context.Context, r *api.GetObjectURLRequest) (resp *api.ObjectURL, err error) { defer func() { err = grpcutil.GRPCifyAndLogErr(c, err) }() if err := common.ValidateObjectRef(r.Object, common.KnownHash); err != nil { return nil, errors.Annotate(err, "bad 'object' field").Err() ...
[ "func", "(", "s", "*", "storageImpl", ")", "GetObjectURL", "(", "c", "context", ".", "Context", ",", "r", "*", "api", ".", "GetObjectURLRequest", ")", "(", "resp", "*", "api", ".", "ObjectURL", ",", "err", "error", ")", "{", "defer", "func", "(", ")"...
// GetObjectURL implements the corresponding RPC method, see the proto doc.
[ "GetObjectURL", "implements", "the", "corresponding", "RPC", "method", "see", "the", "proto", "doc", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/cas/cas.go#L130-L161
9,440
luci/luci-go
cipd/appengine/impl/cas/cas.go
FinishUpload
func (s *storageImpl) FinishUpload(c context.Context, r *api.FinishUploadRequest) (resp *api.UploadOperation, err error) { defer func() { err = grpcutil.GRPCifyAndLogErr(c, err) }() if r.ForceHash != nil { if err := common.ValidateObjectRef(r.ForceHash, common.KnownHash); err != nil { return nil, errors.Annotat...
go
func (s *storageImpl) FinishUpload(c context.Context, r *api.FinishUploadRequest) (resp *api.UploadOperation, err error) { defer func() { err = grpcutil.GRPCifyAndLogErr(c, err) }() if r.ForceHash != nil { if err := common.ValidateObjectRef(r.ForceHash, common.KnownHash); err != nil { return nil, errors.Annotat...
[ "func", "(", "s", "*", "storageImpl", ")", "FinishUpload", "(", "c", "context", ".", "Context", ",", "r", "*", "api", ".", "FinishUploadRequest", ")", "(", "resp", "*", "api", ".", "UploadOperation", ",", "err", "error", ")", "{", "defer", "func", "(",...
// FinishUpload implements the corresponding RPC method, see the proto doc.
[ "FinishUpload", "implements", "the", "corresponding", "RPC", "method", "see", "the", "proto", "doc", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/cas/cas.go#L260-L303
9,441
luci/luci-go
cipd/appengine/impl/cas/cas.go
CancelUpload
func (s *storageImpl) CancelUpload(c context.Context, r *api.CancelUploadRequest) (resp *api.UploadOperation, err error) { defer func() { err = grpcutil.GRPCifyAndLogErr(c, err) }() handleOpStatus := func(op *upload.Operation) (*api.UploadOperation, error) { if op.Status == api.UploadStatus_ERRORED || op.Status ==...
go
func (s *storageImpl) CancelUpload(c context.Context, r *api.CancelUploadRequest) (resp *api.UploadOperation, err error) { defer func() { err = grpcutil.GRPCifyAndLogErr(c, err) }() handleOpStatus := func(op *upload.Operation) (*api.UploadOperation, error) { if op.Status == api.UploadStatus_ERRORED || op.Status ==...
[ "func", "(", "s", "*", "storageImpl", ")", "CancelUpload", "(", "c", "context", ".", "Context", ",", "r", "*", "api", ".", "CancelUploadRequest", ")", "(", "resp", "*", "api", ".", "UploadOperation", ",", "err", "error", ")", "{", "defer", "func", "(",...
// CancelUpload implements the corresponding RPC method, see the proto doc.
[ "CancelUpload", "implements", "the", "corresponding", "RPC", "method", "see", "the", "proto", "doc", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/cas/cas.go#L306-L342
9,442
luci/luci-go
cipd/appengine/impl/cas/cas.go
fetchOp
func fetchOp(c context.Context, wrappedOpID string) (*upload.Operation, error) { opID, err := upload.UnwrapOpID(c, wrappedOpID, auth.CurrentIdentity(c)) if err != nil { if transient.Tag.In(err) { return nil, errors.Annotate(err, "failed to check HMAC on upload_operation_id").Err() } return nil, errors.Reason...
go
func fetchOp(c context.Context, wrappedOpID string) (*upload.Operation, error) { opID, err := upload.UnwrapOpID(c, wrappedOpID, auth.CurrentIdentity(c)) if err != nil { if transient.Tag.In(err) { return nil, errors.Annotate(err, "failed to check HMAC on upload_operation_id").Err() } return nil, errors.Reason...
[ "func", "fetchOp", "(", "c", "context", ".", "Context", ",", "wrappedOpID", "string", ")", "(", "*", "upload", ".", "Operation", ",", "error", ")", "{", "opID", ",", "err", ":=", "upload", ".", "UnwrapOpID", "(", "c", ",", "wrappedOpID", ",", "auth", ...
// fethcOp unwraps upload operation ID and fetches upload.Operation entity. // // Returns an grpc-tagged error on failure that can be returned to the RPC // caller right away.
[ "fethcOp", "unwraps", "upload", "operation", "ID", "and", "fetches", "upload", ".", "Operation", "entity", ".", "Returns", "an", "grpc", "-", "tagged", "error", "on", "failure", "that", "can", "be", "returned", "to", "the", "RPC", "caller", "right", "away", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/cas/cas.go#L348-L370
9,443
luci/luci-go
cipd/appengine/impl/cas/cas.go
finishAndForcedHash
func (s *storageImpl) finishAndForcedHash(c context.Context, op *upload.Operation, hash *api.ObjectRef) (*upload.Operation, error) { gs := s.getGS(c) cfg, err := s.settings(c) if err != nil { return nil, err } // Try to move the object into the final location. This may fail // transiently, in which case we ask...
go
func (s *storageImpl) finishAndForcedHash(c context.Context, op *upload.Operation, hash *api.ObjectRef) (*upload.Operation, error) { gs := s.getGS(c) cfg, err := s.settings(c) if err != nil { return nil, err } // Try to move the object into the final location. This may fail // transiently, in which case we ask...
[ "func", "(", "s", "*", "storageImpl", ")", "finishAndForcedHash", "(", "c", "context", ".", "Context", ",", "op", "*", "upload", ".", "Operation", ",", "hash", "*", "api", ".", "ObjectRef", ")", "(", "*", "upload", ".", "Operation", ",", "error", ")", ...
// finishAndForcedHash finalizes uploads that use ForceHash field. // // It publishes the object immediately, skipping the verification.
[ "finishAndForcedHash", "finalizes", "uploads", "that", "use", "ForceHash", "field", ".", "It", "publishes", "the", "object", "immediately", "skipping", "the", "verification", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/cas/cas.go#L375-L410
9,444
luci/luci-go
cipd/appengine/impl/cas/cas.go
cleanupUploadTask
func (s *storageImpl) cleanupUploadTask(c context.Context, task *tasks.CleanupUpload) (err error) { gs := s.getGS(c) if err := gs.CancelUpload(c, task.UploadUrl); err != nil { if transient.Tag.In(err) { return errors.Annotate(err, "transient error when canceling the resumable upload").Err() } logging.WithEr...
go
func (s *storageImpl) cleanupUploadTask(c context.Context, task *tasks.CleanupUpload) (err error) { gs := s.getGS(c) if err := gs.CancelUpload(c, task.UploadUrl); err != nil { if transient.Tag.In(err) { return errors.Annotate(err, "transient error when canceling the resumable upload").Err() } logging.WithEr...
[ "func", "(", "s", "*", "storageImpl", ")", "cleanupUploadTask", "(", "c", "context", ".", "Context", ",", "task", "*", "tasks", ".", "CleanupUpload", ")", "(", "err", "error", ")", "{", "gs", ":=", "s", ".", "getGS", "(", "c", ")", "\n\n", "if", "e...
// cleanupUploadTask is called to clean up after a canceled upload. // // Best effort. If the temporary file can't be deleted from GS due to some // non-transient error, logs the error and ignores it, since retrying won't // help.
[ "cleanupUploadTask", "is", "called", "to", "clean", "up", "after", "a", "canceled", "upload", ".", "Best", "effort", ".", "If", "the", "temporary", "file", "can", "t", "be", "deleted", "from", "GS", "due", "to", "some", "non", "-", "transient", "error", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/cas/cas.go#L555-L573
9,445
luci/luci-go
milo/common/config.go
ProjectID
func (c *Console) ProjectID() string { if c.Parent == nil { return "" } return c.Parent.StringID() }
go
func (c *Console) ProjectID() string { if c.Parent == nil { return "" } return c.Parent.StringID() }
[ "func", "(", "c", "*", "Console", ")", "ProjectID", "(", ")", "string", "{", "if", "c", ".", "Parent", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "c", ".", "Parent", ".", "StringID", "(", ")", "\n", "}" ]
// ProjectID retrieves the project ID string of the console out of the Console's // parent key.
[ "ProjectID", "retrieves", "the", "project", "ID", "string", "of", "the", "console", "out", "of", "the", "Console", "s", "parent", "key", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L93-L98
9,446
luci/luci-go
milo/common/config.go
FilterBuilders
func (c *Console) FilterBuilders(perms access.Permissions) { okBuilderIDs := make([]string, 0, len(c.Builders)) for _, id := range c.Builders { if bucket := extractBucket(id); bucket != "" && !perms.Can(bucket, access.AccessBucket) { continue } okBuilderIDs = append(okBuilderIDs, id) } c.Builders = okBuild...
go
func (c *Console) FilterBuilders(perms access.Permissions) { okBuilderIDs := make([]string, 0, len(c.Builders)) for _, id := range c.Builders { if bucket := extractBucket(id); bucket != "" && !perms.Can(bucket, access.AccessBucket) { continue } okBuilderIDs = append(okBuilderIDs, id) } c.Builders = okBuild...
[ "func", "(", "c", "*", "Console", ")", "FilterBuilders", "(", "perms", "access", ".", "Permissions", ")", "{", "okBuilderIDs", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "c", ".", "Builders", ")", ")", "\n", "for", "_", ",", ...
// FilterBuilders uses an access.Permissions to filter out builder IDs and builders // from the definition, and builders in the definition's header, which are not // allowed by the permissions.
[ "FilterBuilders", "uses", "an", "access", ".", "Permissions", "to", "filter", "out", "builder", "IDs", "and", "builders", "from", "the", "definition", "and", "builders", "in", "the", "definition", "s", "header", "which", "are", "not", "allowed", "by", "the", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L103-L128
9,447
luci/luci-go
milo/common/config.go
Buckets
func (c *Console) Buckets() stringset.Set { buckets := stringset.New(1) for _, id := range c.Builders { if bucket := extractBucket(id); bucket != "" { buckets.Add(bucket) } } return buckets }
go
func (c *Console) Buckets() stringset.Set { buckets := stringset.New(1) for _, id := range c.Builders { if bucket := extractBucket(id); bucket != "" { buckets.Add(bucket) } } return buckets }
[ "func", "(", "c", "*", "Console", ")", "Buckets", "(", ")", "stringset", ".", "Set", "{", "buckets", ":=", "stringset", ".", "New", "(", "1", ")", "\n", "for", "_", ",", "id", ":=", "range", "c", ".", "Builders", "{", "if", "bucket", ":=", "extra...
// Buckets returns all buckets referenced by this Console's Builders.
[ "Buckets", "returns", "all", "buckets", "referenced", "by", "this", "Console", "s", "Builders", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L131-L139
9,448
luci/luci-go
milo/common/config.go
SetID
func (id *ConsoleID) SetID(c context.Context, console *Console) *Console { if console == nil { console = &Console{} } console.Parent = datastore.MakeKey(c, "Project", id.Project) console.ID = id.ID return console }
go
func (id *ConsoleID) SetID(c context.Context, console *Console) *Console { if console == nil { console = &Console{} } console.Parent = datastore.MakeKey(c, "Project", id.Project) console.ID = id.ID return console }
[ "func", "(", "id", "*", "ConsoleID", ")", "SetID", "(", "c", "context", ".", "Context", ",", "console", "*", "Console", ")", "*", "Console", "{", "if", "console", "==", "nil", "{", "console", "=", "&", "Console", "{", "}", "\n", "}", "\n", "console...
// NewEntity returns an empty Console datastore entity keyed with itself.
[ "NewEntity", "returns", "an", "empty", "Console", "datastore", "entity", "keyed", "with", "itself", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L180-L187
9,449
luci/luci-go
milo/common/config.go
LuciConfigURL
func LuciConfigURL(c context.Context, configSet, path, revision string) string { // TODO(hinoka): This shouldn't be hardcoded, instead we should get the // luci-config instance from the context. But we only use this instance at // the moment so it is okay for now. // TODO(hinoka): The UI doesn't allow specifying p...
go
func LuciConfigURL(c context.Context, configSet, path, revision string) string { // TODO(hinoka): This shouldn't be hardcoded, instead we should get the // luci-config instance from the context. But we only use this instance at // the moment so it is okay for now. // TODO(hinoka): The UI doesn't allow specifying p...
[ "func", "LuciConfigURL", "(", "c", "context", ".", "Context", ",", "configSet", ",", "path", ",", "revision", "string", ")", "string", "{", "// TODO(hinoka): This shouldn't be hardcoded, instead we should get the", "// luci-config instance from the context. But we only use this ...
// LuciConfigURL returns a user friendly URL that specifies where to view // this console definition.
[ "LuciConfigURL", "returns", "a", "user", "friendly", "URL", "that", "specifies", "where", "to", "view", "this", "console", "definition", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L200-L207
9,450
luci/luci-go
milo/common/config.go
GetCurrentServiceConfig
func GetCurrentServiceConfig(c context.Context) (*ServiceConfig, error) { // This maker function is used to do the actual fetch of the ServiceConfig // from datastore. It is called if the ServiceConfig is not in proc cache. item, err := serviceCfgCache.Fetch(c, func(interface{}) (interface{}, time.Duration, error) ...
go
func GetCurrentServiceConfig(c context.Context) (*ServiceConfig, error) { // This maker function is used to do the actual fetch of the ServiceConfig // from datastore. It is called if the ServiceConfig is not in proc cache. item, err := serviceCfgCache.Fetch(c, func(interface{}) (interface{}, time.Duration, error) ...
[ "func", "GetCurrentServiceConfig", "(", "c", "context", ".", "Context", ")", "(", "*", "ServiceConfig", ",", "error", ")", "{", "// This maker function is used to do the actual fetch of the ServiceConfig", "// from datastore. It is called if the ServiceConfig is not in proc cache.",...
// GetCurrentServiceConfig gets the service config for the instance from either // process cache or datastore cache.
[ "GetCurrentServiceConfig", "gets", "the", "service", "config", "for", "the", "instance", "from", "either", "process", "cache", "or", "datastore", "cache", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L278-L298
9,451
luci/luci-go
milo/common/config.go
UpdateServiceConfig
func UpdateServiceConfig(c context.Context) (*config.Settings, error) { // Load the settings from luci-config. cs := cfgclient.CurrentServiceConfigSet(c) // Acquire the raw config client. lucicfg := backend.Get(c).GetConfigInterface(c, backend.AsService) cfg, err := lucicfg.GetConfig(c, cs, globalConfigFilename, f...
go
func UpdateServiceConfig(c context.Context) (*config.Settings, error) { // Load the settings from luci-config. cs := cfgclient.CurrentServiceConfigSet(c) // Acquire the raw config client. lucicfg := backend.Get(c).GetConfigInterface(c, backend.AsService) cfg, err := lucicfg.GetConfig(c, cs, globalConfigFilename, f...
[ "func", "UpdateServiceConfig", "(", "c", "context", ".", "Context", ")", "(", "*", "config", ".", "Settings", ",", "error", ")", "{", "// Load the settings from luci-config.", "cs", ":=", "cfgclient", ".", "CurrentServiceConfigSet", "(", "c", ")", "\n", "// Acqu...
// UpdateServiceConfig fetches the service config from luci-config // and then stores a snapshot of the configuration in datastore.
[ "UpdateServiceConfig", "fetches", "the", "service", "config", "from", "luci", "-", "config", "and", "then", "stores", "a", "snapshot", "of", "the", "configuration", "in", "datastore", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L304-L359
9,452
luci/luci-go
milo/common/config.go
updateProjectConsoles
func updateProjectConsoles(c context.Context, projectID string, cfg *configInterface.Config) (stringset.Set, error) { proj := config.Project{} if err := protoutil.UnmarshalTextML(cfg.Content, &proj); err != nil { return nil, errors.Annotate(err, "unmarshalling proto").Err() } // Extract the headers into a map fo...
go
func updateProjectConsoles(c context.Context, projectID string, cfg *configInterface.Config) (stringset.Set, error) { proj := config.Project{} if err := protoutil.UnmarshalTextML(cfg.Content, &proj); err != nil { return nil, errors.Annotate(err, "unmarshalling proto").Err() } // Extract the headers into a map fo...
[ "func", "updateProjectConsoles", "(", "c", "context", ".", "Context", ",", "projectID", "string", ",", "cfg", "*", "configInterface", ".", "Config", ")", "(", "stringset", ".", "Set", ",", "error", ")", "{", "proj", ":=", "config", ".", "Project", "{", "...
// updateProjectConsoles updates all of the consoles for a given project, // and then returns a set of known console names.
[ "updateProjectConsoles", "updates", "all", "of", "the", "consoles", "for", "a", "given", "project", "and", "then", "returns", "a", "set", "of", "known", "console", "names", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L363-L427
9,453
luci/luci-go
milo/common/config.go
UpdateConsoles
func UpdateConsoles(c context.Context) error { cfgName := info.AppID(c) + ".cfg" logging.Debugf(c, "fetching configs for %s", cfgName) // Acquire the raw config client. lucicfg := backend.Get(c).GetConfigInterface(c, backend.AsService) // Project configs for Milo contains console definitions. configs, err := luc...
go
func UpdateConsoles(c context.Context) error { cfgName := info.AppID(c) + ".cfg" logging.Debugf(c, "fetching configs for %s", cfgName) // Acquire the raw config client. lucicfg := backend.Get(c).GetConfigInterface(c, backend.AsService) // Project configs for Milo contains console definitions. configs, err := luc...
[ "func", "UpdateConsoles", "(", "c", "context", ".", "Context", ")", "error", "{", "cfgName", ":=", "info", ".", "AppID", "(", "c", ")", "+", "\"", "\"", "\n\n", "logging", ".", "Debugf", "(", "c", ",", "\"", "\"", ",", "cfgName", ")", "\n", "// Acq...
// UpdateConsoles updates internal console definitions entities based off luci-config.
[ "UpdateConsoles", "updates", "internal", "console", "definitions", "entities", "based", "off", "luci", "-", "config", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L430-L507
9,454
luci/luci-go
milo/common/config.go
GetAllProjects
func GetAllProjects(c context.Context) ([]Project, error) { q := datastore.NewQuery("Project") projs := []Project{} if err := datastore.GetAll(c, q, &projs); err != nil { return nil, errors.Annotate(err, "getting projects").Err() } result := []Project{} for _, proj := range projs { switch allowed, err := IsA...
go
func GetAllProjects(c context.Context) ([]Project, error) { q := datastore.NewQuery("Project") projs := []Project{} if err := datastore.GetAll(c, q, &projs); err != nil { return nil, errors.Annotate(err, "getting projects").Err() } result := []Project{} for _, proj := range projs { switch allowed, err := IsA...
[ "func", "GetAllProjects", "(", "c", "context", ".", "Context", ")", "(", "[", "]", "Project", ",", "error", ")", "{", "q", ":=", "datastore", ".", "NewQuery", "(", "\"", "\"", ")", "\n", "projs", ":=", "[", "]", "Project", "{", "}", "\n\n", "if", ...
// GetAllProjects returns all projects the current user has access to.
[ "GetAllProjects", "returns", "all", "projects", "the", "current", "user", "has", "access", "to", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L551-L568
9,455
luci/luci-go
milo/common/config.go
GetProjectConsoles
func GetProjectConsoles(c context.Context, projectID string) ([]*Console, error) { // Query datastore for consoles related to the project. q := datastore.NewQuery("Console") parentKey := datastore.MakeKey(c, "Project", projectID) q = q.Ancestor(parentKey) con := []*Console{} err := datastore.GetAll(c, q, &con) s...
go
func GetProjectConsoles(c context.Context, projectID string) ([]*Console, error) { // Query datastore for consoles related to the project. q := datastore.NewQuery("Console") parentKey := datastore.MakeKey(c, "Project", projectID) q = q.Ancestor(parentKey) con := []*Console{} err := datastore.GetAll(c, q, &con) s...
[ "func", "GetProjectConsoles", "(", "c", "context", ".", "Context", ",", "projectID", "string", ")", "(", "[", "]", "*", "Console", ",", "error", ")", "{", "// Query datastore for consoles related to the project.", "q", ":=", "datastore", ".", "NewQuery", "(", "\...
// GetProjectConsoles returns all consoles for the given project ordered as in config.
[ "GetProjectConsoles", "returns", "all", "consoles", "for", "the", "given", "project", "ordered", "as", "in", "config", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L571-L580
9,456
luci/luci-go
milo/common/config.go
init
func init() { // Milo is only responsible for validating the config matching the instance's // appID in a project config. validation.Rules.Add("regex:projects/.*", "${appid}.cfg", validateProjectCfg) validation.Rules.Add("services/${appid}", globalConfigFilename, validateServiceCfg) }
go
func init() { // Milo is only responsible for validating the config matching the instance's // appID in a project config. validation.Rules.Add("regex:projects/.*", "${appid}.cfg", validateProjectCfg) validation.Rules.Add("services/${appid}", globalConfigFilename, validateServiceCfg) }
[ "func", "init", "(", ")", "{", "// Milo is only responsible for validating the config matching the instance's", "// appID in a project config.", "validation", ".", "Rules", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "validateProjectCfg", ")", "\n", "validation", ...
// Config validation rules go here.
[ "Config", "validation", "rules", "go", "here", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L617-L622
9,457
luci/luci-go
lucictx/local_auth.go
GetLocalAuth
func GetLocalAuth(ctx context.Context) *LocalAuth { ret := LocalAuth{} ok, err := Lookup(ctx, "local_auth", &ret) if err != nil { panic(err) } if !ok { return nil } return &ret }
go
func GetLocalAuth(ctx context.Context) *LocalAuth { ret := LocalAuth{} ok, err := Lookup(ctx, "local_auth", &ret) if err != nil { panic(err) } if !ok { return nil } return &ret }
[ "func", "GetLocalAuth", "(", "ctx", "context", ".", "Context", ")", "*", "LocalAuth", "{", "ret", ":=", "LocalAuth", "{", "}", "\n", "ok", ",", "err", ":=", "Lookup", "(", "ctx", ",", "\"", "\"", ",", "&", "ret", ")", "\n", "if", "err", "!=", "ni...
// GetLocalAuth calls Lookup and returns a copy of the current LocalAuth from // LUCI_CONTEXT if it was present. If no LocalAuth is in the context, this // returns nil.
[ "GetLocalAuth", "calls", "Lookup", "and", "returns", "a", "copy", "of", "the", "current", "LocalAuth", "from", "LUCI_CONTEXT", "if", "it", "was", "present", ".", "If", "no", "LocalAuth", "is", "in", "the", "context", "this", "returns", "nil", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucictx/local_auth.go#L52-L62
9,458
luci/luci-go
lucictx/local_auth.go
SetLocalAuth
func SetLocalAuth(ctx context.Context, la *LocalAuth) context.Context { var raw interface{} if la != nil { raw = la } ctx, err := Set(ctx, "local_auth", raw) if err != nil { panic(fmt.Errorf("impossible: %s", err)) } return ctx }
go
func SetLocalAuth(ctx context.Context, la *LocalAuth) context.Context { var raw interface{} if la != nil { raw = la } ctx, err := Set(ctx, "local_auth", raw) if err != nil { panic(fmt.Errorf("impossible: %s", err)) } return ctx }
[ "func", "SetLocalAuth", "(", "ctx", "context", ".", "Context", ",", "la", "*", "LocalAuth", ")", "context", ".", "Context", "{", "var", "raw", "interface", "{", "}", "\n", "if", "la", "!=", "nil", "{", "raw", "=", "la", "\n", "}", "\n", "ctx", ",",...
// SetLocalAuth sets the LocalAuth in the LUCI_CONTEXT.
[ "SetLocalAuth", "sets", "the", "LocalAuth", "in", "the", "LUCI_CONTEXT", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucictx/local_auth.go#L65-L75
9,459
luci/luci-go
logdog/client/bootstrapResult/result.go
WriteJSON
func (r *Result) WriteJSON(path string) error { fd, err := os.Create(path) if err != nil { return err } defer fd.Close() return json.NewEncoder(fd).Encode(r) }
go
func (r *Result) WriteJSON(path string) error { fd, err := os.Create(path) if err != nil { return err } defer fd.Close() return json.NewEncoder(fd).Encode(r) }
[ "func", "(", "r", "*", "Result", ")", "WriteJSON", "(", "path", "string", ")", "error", "{", "fd", ",", "err", ":=", "os", ".", "Create", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "fd", "....
// WriteJSON writes Result as a JSON document to the specified path.
[ "WriteJSON", "writes", "Result", "as", "a", "JSON", "document", "to", "the", "specified", "path", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/client/bootstrapResult/result.go#L33-L40
9,460
luci/luci-go
tokenserver/appengine/impl/utils/policy/entities.go
updateImportedPolicy
func updateImportedPolicy(c context.Context, name, rev, sha256 string, serialized []byte) error { header := &importedPolicyHeader{ Name: name, Revision: rev, SHA256: sha256, } body := &importedPolicyBody{ Parent: datastore.KeyForObj(c, header), Revision: rev, SHA256: sha256, Data: seriali...
go
func updateImportedPolicy(c context.Context, name, rev, sha256 string, serialized []byte) error { header := &importedPolicyHeader{ Name: name, Revision: rev, SHA256: sha256, } body := &importedPolicyBody{ Parent: datastore.KeyForObj(c, header), Revision: rev, SHA256: sha256, Data: seriali...
[ "func", "updateImportedPolicy", "(", "c", "context", ".", "Context", ",", "name", ",", "rev", ",", "sha256", "string", ",", "serialized", "[", "]", "byte", ")", "error", "{", "header", ":=", "&", "importedPolicyHeader", "{", "Name", ":", "name", ",", "Re...
// updateImportedPolicy replaces the currently stored policy. // // It transactionally updates both importedPolicyHeader and importedPolicyBody.
[ "updateImportedPolicy", "replaces", "the", "currently", "stored", "policy", ".", "It", "transactionally", "updates", "both", "importedPolicyHeader", "and", "importedPolicyBody", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/utils/policy/entities.go#L56-L71
9,461
luci/luci-go
common/flag/multiflag/multiflag.go
GetOutput
func (mf *MultiFlag) GetOutput() io.Writer { if w := mf.Output; w != nil { return w } return os.Stderr }
go
func (mf *MultiFlag) GetOutput() io.Writer { if w := mf.Output; w != nil { return w } return os.Stderr }
[ "func", "(", "mf", "*", "MultiFlag", ")", "GetOutput", "(", ")", "io", ".", "Writer", "{", "if", "w", ":=", "mf", ".", "Output", ";", "w", "!=", "nil", "{", "return", "w", "\n", "}", "\n", "return", "os", ".", "Stderr", "\n", "}" ]
// GetOutput returns the output Writer used for help output.
[ "GetOutput", "returns", "the", "output", "Writer", "used", "for", "help", "output", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/flag/multiflag/multiflag.go#L92-L97
9,462
luci/luci-go
common/flag/multiflag/multiflag.go
GetOptionFor
func (mf *MultiFlag) GetOptionFor(name string) Option { for _, option := range mf.Options { if option.Descriptor().Name == name { return option } } return nil }
go
func (mf *MultiFlag) GetOptionFor(name string) Option { for _, option := range mf.Options { if option.Descriptor().Name == name { return option } } return nil }
[ "func", "(", "mf", "*", "MultiFlag", ")", "GetOptionFor", "(", "name", "string", ")", "Option", "{", "for", "_", ",", "option", ":=", "range", "mf", ".", "Options", "{", "if", "option", ".", "Descriptor", "(", ")", ".", "Name", "==", "name", "{", "...
// GetOptionFor returns the Option associated with the specified name, or nil // if one isn't defined.
[ "GetOptionFor", "returns", "the", "Option", "associated", "with", "the", "specified", "name", "or", "nil", "if", "one", "isn", "t", "defined", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/flag/multiflag/multiflag.go#L131-L138
9,463
luci/luci-go
common/flag/multiflag/multiflag.go
OptionNames
func (mf MultiFlag) OptionNames() []string { optionNames := make([]string, 0, len(mf.Options)) for _, opt := range mf.Options { optionNames = append(optionNames, opt.Descriptor().Name) } return optionNames }
go
func (mf MultiFlag) OptionNames() []string { optionNames := make([]string, 0, len(mf.Options)) for _, opt := range mf.Options { optionNames = append(optionNames, opt.Descriptor().Name) } return optionNames }
[ "func", "(", "mf", "MultiFlag", ")", "OptionNames", "(", ")", "[", "]", "string", "{", "optionNames", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "mf", ".", "Options", ")", ")", "\n", "for", "_", ",", "opt", ":=", "range", ...
// OptionNames returns a list of the option names registered with a MultiFlag.
[ "OptionNames", "returns", "a", "list", "of", "the", "option", "names", "registered", "with", "a", "MultiFlag", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/flag/multiflag/multiflag.go#L141-L147
9,464
luci/luci-go
common/flag/multiflag/multiflag.go
PrintHelp
func (mf *MultiFlag) PrintHelp() error { descriptors := make(optionDescriptorSlice, len(mf.Options)) for idx, opt := range mf.Options { descriptors[idx] = opt.Descriptor() } sort.Sort(descriptors) fmt.Fprintln(mf.Output, mf.Description) return writeAlignedOptionDescriptors(mf.Output, []*OptionDescriptor(descri...
go
func (mf *MultiFlag) PrintHelp() error { descriptors := make(optionDescriptorSlice, len(mf.Options)) for idx, opt := range mf.Options { descriptors[idx] = opt.Descriptor() } sort.Sort(descriptors) fmt.Fprintln(mf.Output, mf.Description) return writeAlignedOptionDescriptors(mf.Output, []*OptionDescriptor(descri...
[ "func", "(", "mf", "*", "MultiFlag", ")", "PrintHelp", "(", ")", "error", "{", "descriptors", ":=", "make", "(", "optionDescriptorSlice", ",", "len", "(", "mf", ".", "Options", ")", ")", "\n", "for", "idx", ",", "opt", ":=", "range", "mf", ".", "Opti...
// PrintHelp prints a formatted help string for a MultiFlag. This help string // details the Options registered with the MultiFlag.
[ "PrintHelp", "prints", "a", "formatted", "help", "string", "for", "a", "MultiFlag", ".", "This", "help", "string", "details", "the", "Options", "registered", "with", "the", "MultiFlag", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/flag/multiflag/multiflag.go#L151-L160
9,465
luci/luci-go
common/flag/multiflag/multiflag.go
Descriptor
func (o *FlagOption) Descriptor() *OptionDescriptor { return &OptionDescriptor{ Name: o.Name, Description: o.Description, Pinned: o.Pinned, } }
go
func (o *FlagOption) Descriptor() *OptionDescriptor { return &OptionDescriptor{ Name: o.Name, Description: o.Description, Pinned: o.Pinned, } }
[ "func", "(", "o", "*", "FlagOption", ")", "Descriptor", "(", ")", "*", "OptionDescriptor", "{", "return", "&", "OptionDescriptor", "{", "Name", ":", "o", ".", "Name", ",", "Description", ":", "o", ".", "Description", ",", "Pinned", ":", "o", ".", "Pinn...
// Descriptor implements Option.
[ "Descriptor", "implements", "Option", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/flag/multiflag/multiflag.go#L180-L186
9,466
luci/luci-go
common/flag/multiflag/multiflag.go
PrintHelp
func (o *FlagOption) PrintHelp(output io.Writer) { flags := o.Flags() flags.SetOutput(output) flags.PrintDefaults() }
go
func (o *FlagOption) PrintHelp(output io.Writer) { flags := o.Flags() flags.SetOutput(output) flags.PrintDefaults() }
[ "func", "(", "o", "*", "FlagOption", ")", "PrintHelp", "(", "output", "io", ".", "Writer", ")", "{", "flags", ":=", "o", ".", "Flags", "(", ")", "\n", "flags", ".", "SetOutput", "(", "output", ")", "\n", "flags", ".", "PrintDefaults", "(", ")", "\n...
// PrintHelp implements Option.
[ "PrintHelp", "implements", "Option", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/flag/multiflag/multiflag.go#L189-L193
9,467
luci/luci-go
common/flag/multiflag/multiflag.go
Run
func (o *FlagOption) Run(value string) error { if err := o.flags.Parse(value); err != nil { return err } return nil }
go
func (o *FlagOption) Run(value string) error { if err := o.flags.Parse(value); err != nil { return err } return nil }
[ "func", "(", "o", "*", "FlagOption", ")", "Run", "(", "value", "string", ")", "error", "{", "if", "err", ":=", "o", ".", "flags", ".", "Parse", "(", "value", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", ...
// Run implements Option.
[ "Run", "implements", "Option", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/flag/multiflag/multiflag.go#L201-L206
9,468
luci/luci-go
common/flag/multiflag/multiflag.go
writeAlignedOptionDescriptors
func writeAlignedOptionDescriptors(w io.Writer, descriptors []*OptionDescriptor) error { tw := tabwriter.NewWriter(w, 0, 4, 2, ' ', 0) for _, desc := range descriptors { fmt.Fprintf(tw, "%s\t%s\n", desc.Name, desc.Description) } if err := tw.Flush(); err != nil { return err } return nil }
go
func writeAlignedOptionDescriptors(w io.Writer, descriptors []*OptionDescriptor) error { tw := tabwriter.NewWriter(w, 0, 4, 2, ' ', 0) for _, desc := range descriptors { fmt.Fprintf(tw, "%s\t%s\n", desc.Name, desc.Description) } if err := tw.Flush(); err != nil { return err } return nil }
[ "func", "writeAlignedOptionDescriptors", "(", "w", "io", ".", "Writer", ",", "descriptors", "[", "]", "*", "OptionDescriptor", ")", "error", "{", "tw", ":=", "tabwriter", ".", "NewWriter", "(", "w", ",", "0", ",", "4", ",", "2", ",", "' '", ",", "0", ...
// writeAlignedOptionDescriptors writes help entries for a series of Options.
[ "writeAlignedOptionDescriptors", "writes", "help", "entries", "for", "a", "series", "of", "Options", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/flag/multiflag/multiflag.go#L297-L308
9,469
luci/luci-go
milo/buildsource/buildbot/grpc.go
GetBuildbotBuildJSON
func (s *Service) GetBuildbotBuildJSON(c context.Context, req *milo.BuildbotBuildRequest) ( *milo.BuildbotBuildJSON, error) { apiUsage.Add(c, 1, "GetBuildbotBuildJSON", req.Master, req.Builder, req.ExcludeDeprecated, false) if req.Master == "" { return nil, status.Errorf(codes.InvalidArgument, "No master specifi...
go
func (s *Service) GetBuildbotBuildJSON(c context.Context, req *milo.BuildbotBuildRequest) ( *milo.BuildbotBuildJSON, error) { apiUsage.Add(c, 1, "GetBuildbotBuildJSON", req.Master, req.Builder, req.ExcludeDeprecated, false) if req.Master == "" { return nil, status.Errorf(codes.InvalidArgument, "No master specifi...
[ "func", "(", "s", "*", "Service", ")", "GetBuildbotBuildJSON", "(", "c", "context", ".", "Context", ",", "req", "*", "milo", ".", "BuildbotBuildRequest", ")", "(", "*", "milo", ".", "BuildbotBuildJSON", ",", "error", ")", "{", "apiUsage", ".", "Add", "("...
// GetBuildbotBuildJSON implements milo.BuildbotServer.
[ "GetBuildbotBuildJSON", "implements", "milo", ".", "BuildbotServer", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/buildbot/grpc.go#L55-L99
9,470
luci/luci-go
milo/buildsource/buildbot/grpc.go
GetBuildbotBuildsJSON
func (s *Service) GetBuildbotBuildsJSON(c context.Context, req *milo.BuildbotBuildsRequest) ( *milo.BuildbotBuildsJSON, error) { apiUsage.Add(c, 1, "GetBuildbotBuildsJSON", req.Master, req.Builder, req.ExcludeDeprecated, req.NoEmulation) if req.Master == "" { return nil, status.Errorf(codes.InvalidArgument, "No ...
go
func (s *Service) GetBuildbotBuildsJSON(c context.Context, req *milo.BuildbotBuildsRequest) ( *milo.BuildbotBuildsJSON, error) { apiUsage.Add(c, 1, "GetBuildbotBuildsJSON", req.Master, req.Builder, req.ExcludeDeprecated, req.NoEmulation) if req.Master == "" { return nil, status.Errorf(codes.InvalidArgument, "No ...
[ "func", "(", "s", "*", "Service", ")", "GetBuildbotBuildsJSON", "(", "c", "context", ".", "Context", ",", "req", "*", "milo", ".", "BuildbotBuildsRequest", ")", "(", "*", "milo", ".", "BuildbotBuildsJSON", ",", "error", ")", "{", "apiUsage", ".", "Add", ...
// GetBuildbotBuildsJSON implements milo.BuildbotServer.
[ "GetBuildbotBuildsJSON", "implements", "milo", ".", "BuildbotServer", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/buildbot/grpc.go#L102-L157
9,471
luci/luci-go
milo/buildsource/buildbot/grpc.go
GetCompressedMasterJSON
func (s *Service) GetCompressedMasterJSON(c context.Context, req *milo.MasterRequest) ( *milo.CompressedMasterJSON, error) { if req.Name == "" { return nil, status.Errorf(codes.InvalidArgument, "No master specified") } apiUsage.Add(c, 1, "GetCompressedMasterJSON", req.Name, "", req.ExcludeDeprecated, req.NoEmul...
go
func (s *Service) GetCompressedMasterJSON(c context.Context, req *milo.MasterRequest) ( *milo.CompressedMasterJSON, error) { if req.Name == "" { return nil, status.Errorf(codes.InvalidArgument, "No master specified") } apiUsage.Add(c, 1, "GetCompressedMasterJSON", req.Name, "", req.ExcludeDeprecated, req.NoEmul...
[ "func", "(", "s", "*", "Service", ")", "GetCompressedMasterJSON", "(", "c", "context", ".", "Context", ",", "req", "*", "milo", ".", "MasterRequest", ")", "(", "*", "milo", ".", "CompressedMasterJSON", ",", "error", ")", "{", "if", "req", ".", "Name", ...
// GetCompressedMasterJSON assembles a CompressedMasterJSON object from the // provided MasterRequest.
[ "GetCompressedMasterJSON", "assembles", "a", "CompressedMasterJSON", "object", "from", "the", "provided", "MasterRequest", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/buildbot/grpc.go#L161-L215
9,472
luci/luci-go
buildbucket/cli/collect.go
dedupInt64s
func dedupInt64s(nums []int64) []int64 { seen := make(map[int64]struct{}, len(nums)) res := make([]int64, 0, len(nums)) for _, x := range nums { if _, ok := seen[x]; !ok { seen[x] = struct{}{} res = append(res, x) } } return res }
go
func dedupInt64s(nums []int64) []int64 { seen := make(map[int64]struct{}, len(nums)) res := make([]int64, 0, len(nums)) for _, x := range nums { if _, ok := seen[x]; !ok { seen[x] = struct{}{} res = append(res, x) } } return res }
[ "func", "dedupInt64s", "(", "nums", "[", "]", "int64", ")", "[", "]", "int64", "{", "seen", ":=", "make", "(", "map", "[", "int64", "]", "struct", "{", "}", ",", "len", "(", "nums", ")", ")", "\n", "res", ":=", "make", "(", "[", "]", "int64", ...
// dedupInt64s dedups int64s.
[ "dedupInt64s", "dedups", "int64s", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/cli/collect.go#L94-L104
9,473
luci/luci-go
buildbucket/access/acl.go
Can
func (p Permissions) Can(bucket string, action Action) bool { return (p[bucket] & action) == action }
go
func (p Permissions) Can(bucket string, action Action) bool { return (p[bucket] & action) == action }
[ "func", "(", "p", "Permissions", ")", "Can", "(", "bucket", "string", ",", "action", "Action", ")", "bool", "{", "return", "(", "p", "[", "bucket", "]", "&", "action", ")", "==", "action", "\n", "}" ]
// Can checks whether an Action is allowed for a given bucket.
[ "Can", "checks", "whether", "an", "Action", "is", "allowed", "for", "a", "given", "bucket", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/access/acl.go#L36-L38
9,474
luci/luci-go
buildbucket/access/acl.go
FromProto
func (p Permissions) FromProto(resp *access.PermittedActionsResponse) error { // Clean up p before we populate it. for bucket := range p { delete(p, bucket) } for bucket, actions := range resp.Permitted { newActions := Action(0) for _, action := range actions.Actions { newAction, err := ParseAction(action)...
go
func (p Permissions) FromProto(resp *access.PermittedActionsResponse) error { // Clean up p before we populate it. for bucket := range p { delete(p, bucket) } for bucket, actions := range resp.Permitted { newActions := Action(0) for _, action := range actions.Actions { newAction, err := ParseAction(action)...
[ "func", "(", "p", "Permissions", ")", "FromProto", "(", "resp", "*", "access", ".", "PermittedActionsResponse", ")", "error", "{", "// Clean up p before we populate it.", "for", "bucket", ":=", "range", "p", "{", "delete", "(", "p", ",", "bucket", ")", "\n", ...
// FromProto populates a Permissions from an access.PermittedActionsResponse.
[ "FromProto", "populates", "a", "Permissions", "from", "an", "access", ".", "PermittedActionsResponse", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/access/acl.go#L41-L58
9,475
luci/luci-go
buildbucket/access/acl.go
ToProto
func (p Permissions) ToProto(validTime time.Duration) *access.PermittedActionsResponse { perms := make(map[string]*access.PermittedActionsResponse_ResourcePermissions, len(p)) for bucket, action := range p { var actions []string for a, name := range actionToName { if action&a == a { actions = append(action...
go
func (p Permissions) ToProto(validTime time.Duration) *access.PermittedActionsResponse { perms := make(map[string]*access.PermittedActionsResponse_ResourcePermissions, len(p)) for bucket, action := range p { var actions []string for a, name := range actionToName { if action&a == a { actions = append(action...
[ "func", "(", "p", "Permissions", ")", "ToProto", "(", "validTime", "time", ".", "Duration", ")", "*", "access", ".", "PermittedActionsResponse", "{", "perms", ":=", "make", "(", "map", "[", "string", "]", "*", "access", ".", "PermittedActionsResponse_ResourceP...
// ToProto converts a Permissions into a PermittedActionsResponse.
[ "ToProto", "converts", "a", "Permissions", "into", "a", "PermittedActionsResponse", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/access/acl.go#L61-L77
9,476
luci/luci-go
buildbucket/access/acl.go
NewClient
func NewClient(host string, client *http.Client) access.AccessClient { return access.NewAccessPRPCClient(&prpc.Client{ Host: host, C: client, }) }
go
func NewClient(host string, client *http.Client) access.AccessClient { return access.NewAccessPRPCClient(&prpc.Client{ Host: host, C: client, }) }
[ "func", "NewClient", "(", "host", "string", ",", "client", "*", "http", ".", "Client", ")", "access", ".", "AccessClient", "{", "return", "access", ".", "NewAccessPRPCClient", "(", "&", "prpc", ".", "Client", "{", "Host", ":", "host", ",", "C", ":", "c...
// NewClient returns a new AccessClient which can be used to talk to // buildbucket's access API.
[ "NewClient", "returns", "a", "new", "AccessClient", "which", "can", "be", "used", "to", "talk", "to", "buildbucket", "s", "access", "API", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/access/acl.go#L81-L86
9,477
luci/luci-go
buildbucket/access/acl.go
BucketPermissions
func BucketPermissions(c context.Context, client access.AccessClient, buckets []string) (Permissions, time.Duration, error) { // Make permitted actions call. req := access.PermittedActionsRequest{ ResourceKind: "bucket", ResourceIds: buckets, } resp, err := client.PermittedActions(c, &req) if err != nil { r...
go
func BucketPermissions(c context.Context, client access.AccessClient, buckets []string) (Permissions, time.Duration, error) { // Make permitted actions call. req := access.PermittedActionsRequest{ ResourceKind: "bucket", ResourceIds: buckets, } resp, err := client.PermittedActions(c, &req) if err != nil { r...
[ "func", "BucketPermissions", "(", "c", "context", ".", "Context", ",", "client", "access", ".", "AccessClient", ",", "buckets", "[", "]", "string", ")", "(", "Permissions", ",", "time", ".", "Duration", ",", "error", ")", "{", "// Make permitted actions call."...
// BucketPermissions retrieves permitted actions for a set of buckets, for the // identity specified in the client. It also returns the duration for which the // client is allowed to cache the permissions.
[ "BucketPermissions", "retrieves", "permitted", "actions", "for", "a", "set", "of", "buckets", "for", "the", "identity", "specified", "in", "the", "client", ".", "It", "also", "returns", "the", "duration", "for", "which", "the", "client", "is", "allowed", "to",...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/access/acl.go#L91-L112
9,478
luci/luci-go
logdog/client/butlerlib/streamproto/tee.go
Writer
func (t TeeType) Writer() io.Writer { switch t { case TeeNone: return nil case TeeStdout: return os.Stdout case TeeStderr: return os.Stderr default: panic(fmt.Errorf("streamproto: unknown tee type [%v]", t)) } }
go
func (t TeeType) Writer() io.Writer { switch t { case TeeNone: return nil case TeeStdout: return os.Stdout case TeeStderr: return os.Stderr default: panic(fmt.Errorf("streamproto: unknown tee type [%v]", t)) } }
[ "func", "(", "t", "TeeType", ")", "Writer", "(", ")", "io", ".", "Writer", "{", "switch", "t", "{", "case", "TeeNone", ":", "return", "nil", "\n\n", "case", "TeeStdout", ":", "return", "os", ".", "Stdout", "\n\n", "case", "TeeStderr", ":", "return", ...
// Writer returns the io.Writer object
[ "Writer", "returns", "the", "io", ".", "Writer", "object" ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/client/butlerlib/streamproto/tee.go#L46-L60
9,479
luci/luci-go
vpython/options.go
ResolveSpec
func (o *Options) ResolveSpec(c context.Context) error { if o.CommandLine == nil { panic("a CommandLine must be specified") } // If a spec is explicitly provided, we're done. if o.EnvConfig.Spec != nil { return nil } o.EnvConfig.Spec = &o.DefaultSpec // If we're running a Python script, assert that the ta...
go
func (o *Options) ResolveSpec(c context.Context) error { if o.CommandLine == nil { panic("a CommandLine must be specified") } // If a spec is explicitly provided, we're done. if o.EnvConfig.Spec != nil { return nil } o.EnvConfig.Spec = &o.DefaultSpec // If we're running a Python script, assert that the ta...
[ "func", "(", "o", "*", "Options", ")", "ResolveSpec", "(", "c", "context", ".", "Context", ")", "error", "{", "if", "o", ".", "CommandLine", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// If a spec is explicitly provided, we're don...
// ResolveSpec resolves the configured environment specification. The resulting // spec is installed into o's EnvConfig.Spec field.
[ "ResolveSpec", "resolves", "the", "configured", "environment", "specification", ".", "The", "resulting", "spec", "is", "installed", "into", "o", "s", "EnvConfig", ".", "Spec", "field", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/vpython/options.go#L111-L168
9,480
luci/luci-go
milo/frontend/view_logs.go
HandleSwarmingLog
func HandleSwarmingLog(c *router.Context) error { log, closed, err := swarming.GetLog( c.Context, c.Request.FormValue("server"), c.Params.ByName("id"), c.Params.ByName("logname")) if err != nil { return err } templates.MustRender(c.Context, c.Writer, "pages/log.html", templates.Args{ "Log": log, "...
go
func HandleSwarmingLog(c *router.Context) error { log, closed, err := swarming.GetLog( c.Context, c.Request.FormValue("server"), c.Params.ByName("id"), c.Params.ByName("logname")) if err != nil { return err } templates.MustRender(c.Context, c.Writer, "pages/log.html", templates.Args{ "Log": log, "...
[ "func", "HandleSwarmingLog", "(", "c", "*", "router", ".", "Context", ")", "error", "{", "log", ",", "closed", ",", "err", ":=", "swarming", ".", "GetLog", "(", "c", ".", "Context", ",", "c", ".", "Request", ".", "FormValue", "(", "\"", "\"", ")", ...
// HandleSwarmingLog renders a step log from a swarming build.
[ "HandleSwarmingLog", "renders", "a", "step", "log", "from", "a", "swarming", "build", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/view_logs.go#L15-L30
9,481
luci/luci-go
lucicfg/normalize/buildbucket.go
Buildbucket
func Buildbucket(c context.Context, cfg *pb.BuildbucketCfg) error { // Install or update 'flatten_buildbucket_cfg' tool. bin, err := installFlattenBuildbucketCfg(c) if err != nil { return fmt.Errorf("failed to install buildbucket config flattener: %s", err) } // 'flatten_buildbucket_cfg' wants a real file as in...
go
func Buildbucket(c context.Context, cfg *pb.BuildbucketCfg) error { // Install or update 'flatten_buildbucket_cfg' tool. bin, err := installFlattenBuildbucketCfg(c) if err != nil { return fmt.Errorf("failed to install buildbucket config flattener: %s", err) } // 'flatten_buildbucket_cfg' wants a real file as in...
[ "func", "Buildbucket", "(", "c", "context", ".", "Context", ",", "cfg", "*", "pb", ".", "BuildbucketCfg", ")", "error", "{", "// Install or update 'flatten_buildbucket_cfg' tool.", "bin", ",", "err", ":=", "installFlattenBuildbucketCfg", "(", "c", ")", "\n", "if",...
// Buildbucket normalizes cr-buildbucket.cfg config.
[ "Buildbucket", "normalizes", "cr", "-", "buildbucket", ".", "cfg", "config", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/normalize/buildbucket.go#L38-L76
9,482
luci/luci-go
common/data/chunkstream/buffer.go
Append
func (b *Buffer) Append(c ...Chunk) { for _, chunk := range c { b.appendChunk(chunk) } }
go
func (b *Buffer) Append(c ...Chunk) { for _, chunk := range c { b.appendChunk(chunk) } }
[ "func", "(", "b", "*", "Buffer", ")", "Append", "(", "c", "...", "Chunk", ")", "{", "for", "_", ",", "chunk", ":=", "range", "c", "{", "b", ".", "appendChunk", "(", "chunk", ")", "\n", "}", "\n", "}" ]
// Append adds additional Chunks to the buffer. // // After completion, the Chunk is now owned by the Buffer and should not be used // anymore externally.
[ "Append", "adds", "additional", "Chunks", "to", "the", "buffer", ".", "After", "completion", "the", "Chunk", "is", "now", "owned", "by", "the", "Buffer", "and", "should", "not", "be", "used", "anymore", "externally", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/chunkstream/buffer.go#L46-L50
9,483
luci/luci-go
common/data/chunkstream/buffer.go
Bytes
func (b *Buffer) Bytes() []byte { if b.Len() == 0 { return nil } m := make([]byte, 0, b.Len()) idx := b.fidx for cur := b.first; cur != nil; cur = cur.next { m = append(m, cur.Bytes()[idx:]...) idx = 0 } return m }
go
func (b *Buffer) Bytes() []byte { if b.Len() == 0 { return nil } m := make([]byte, 0, b.Len()) idx := b.fidx for cur := b.first; cur != nil; cur = cur.next { m = append(m, cur.Bytes()[idx:]...) idx = 0 } return m }
[ "func", "(", "b", "*", "Buffer", ")", "Bytes", "(", ")", "[", "]", "byte", "{", "if", "b", ".", "Len", "(", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "m", ":=", "make", "(", "[", "]", "byte", ",", "0", ",", "b", ".", "Len",...
// Bytes constructs a byte slice containing the contents of the Buffer. // // This is a potentially expensive operation, and should generally be used only // for debugging and tests, as it defeats most of the purpose of this package.
[ "Bytes", "constructs", "a", "byte", "slice", "containing", "the", "contents", "of", "the", "Buffer", ".", "This", "is", "a", "potentially", "expensive", "operation", "and", "should", "generally", "be", "used", "only", "for", "debugging", "and", "tests", "as", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/chunkstream/buffer.go#L75-L87
9,484
luci/luci-go
common/data/chunkstream/buffer.go
FirstChunk
func (b *Buffer) FirstChunk() Chunk { if b.first == nil { return nil } return b.first.Chunk }
go
func (b *Buffer) FirstChunk() Chunk { if b.first == nil { return nil } return b.first.Chunk }
[ "func", "(", "b", "*", "Buffer", ")", "FirstChunk", "(", ")", "Chunk", "{", "if", "b", ".", "first", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "b", ".", "first", ".", "Chunk", "\n", "}" ]
// FirstChunk returns the first Chunk in the Buffer, or nil if the Buffer has // no Chunks.
[ "FirstChunk", "returns", "the", "first", "Chunk", "in", "the", "Buffer", "or", "nil", "if", "the", "Buffer", "has", "no", "Chunks", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/chunkstream/buffer.go#L96-L101
9,485
luci/luci-go
common/data/chunkstream/buffer.go
ViewLimit
func (b *Buffer) ViewLimit(limit int64) *View { if limit > b.size { limit = b.size } return &View{ cur: b.first, cidx: b.fidx, size: limit, b: b, } }
go
func (b *Buffer) ViewLimit(limit int64) *View { if limit > b.size { limit = b.size } return &View{ cur: b.first, cidx: b.fidx, size: limit, b: b, } }
[ "func", "(", "b", "*", "Buffer", ")", "ViewLimit", "(", "limit", "int64", ")", "*", "View", "{", "if", "limit", ">", "b", ".", "size", "{", "limit", "=", "b", ".", "size", "\n", "}", "\n\n", "return", "&", "View", "{", "cur", ":", "b", ".", "...
// ViewLimit constructs a View instance, but artificially constrains it to // read at most the specified number of bytes. // // This is useful when reading a subset of the data into a Buffer, as ReadFrom // does not allow a size to be specified.
[ "ViewLimit", "constructs", "a", "View", "instance", "but", "artificially", "constrains", "it", "to", "read", "at", "most", "the", "specified", "number", "of", "bytes", ".", "This", "is", "useful", "when", "reading", "a", "subset", "of", "the", "data", "into"...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/chunkstream/buffer.go#L116-L128
9,486
luci/luci-go
common/gcloud/pubsub/topic.go
SplitErr
func (t Topic) SplitErr() (p, n string, err error) { p, n, err = resourceProjectName(string(t)) return }
go
func (t Topic) SplitErr() (p, n string, err error) { p, n, err = resourceProjectName(string(t)) return }
[ "func", "(", "t", "Topic", ")", "SplitErr", "(", ")", "(", "p", ",", "n", "string", ",", "err", "error", ")", "{", "p", ",", "n", ",", "err", "=", "resourceProjectName", "(", "string", "(", "t", ")", ")", "\n", "return", "\n", "}" ]
// SplitErr returns the Topic's project and name components.
[ "SplitErr", "returns", "the", "Topic", "s", "project", "and", "name", "components", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/gcloud/pubsub/topic.go#L58-L61
9,487
luci/luci-go
tools/internal/apigen/filesystem.go
getPackagePath
func getPackagePath(p string) (string, error) { pkg := strings.Split(p, "/") for i := len(pkg) - 1; i > 0; i-- { p, err := build.Import(strings.Join(pkg[:i], "/"), "", build.FindOnly) if err != nil { continue } return augPath(p.Dir, pkg[i:]...), nil } return "", errors.New("could not find package path")...
go
func getPackagePath(p string) (string, error) { pkg := strings.Split(p, "/") for i := len(pkg) - 1; i > 0; i-- { p, err := build.Import(strings.Join(pkg[:i], "/"), "", build.FindOnly) if err != nil { continue } return augPath(p.Dir, pkg[i:]...), nil } return "", errors.New("could not find package path")...
[ "func", "getPackagePath", "(", "p", "string", ")", "(", "string", ",", "error", ")", "{", "pkg", ":=", "strings", ".", "Split", "(", "p", ",", "\"", "\"", ")", "\n\n", "for", "i", ":=", "len", "(", "pkg", ")", "-", "1", ";", "i", ">", "0", ";...
// getPackagePath searches through GOPATH to find the filesystem path of the // named package. // // This is complicated by the fact that the named package might not exist. In // this case, the package's path will be traversed until one of its parent's // paths is found.
[ "getPackagePath", "searches", "through", "GOPATH", "to", "find", "the", "filesystem", "path", "of", "the", "named", "package", ".", "This", "is", "complicated", "by", "the", "fact", "that", "the", "named", "package", "might", "not", "exist", ".", "In", "this...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tools/internal/apigen/filesystem.go#L40-L51
9,488
luci/luci-go
tools/internal/apigen/filesystem.go
augPath
func augPath(base string, parts ...string) string { cpath := make([]string, 0, len(parts)+1) cpath = append(cpath, base) cpath = append(cpath, parts...) return filepath.Join(cpath...) }
go
func augPath(base string, parts ...string) string { cpath := make([]string, 0, len(parts)+1) cpath = append(cpath, base) cpath = append(cpath, parts...) return filepath.Join(cpath...) }
[ "func", "augPath", "(", "base", "string", ",", "parts", "...", "string", ")", "string", "{", "cpath", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "parts", ")", "+", "1", ")", "\n", "cpath", "=", "append", "(", "cpath", ",", ...
// augPath joins a series of path elements to a base path.
[ "augPath", "joins", "a", "series", "of", "path", "elements", "to", "a", "base", "path", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tools/internal/apigen/filesystem.go#L54-L59
9,489
luci/luci-go
tools/internal/apigen/filesystem.go
installSource
func installSource(src, dst string, edit editFunc) error { return filepath.Walk(src, func(path string, info os.FileInfo, err error) error { if err != nil { return err } relpath, err := filepath.Rel(src, path) if err != nil { return fmt.Errorf("failed to get relative path [%s]: %s", path, err) } dst...
go
func installSource(src, dst string, edit editFunc) error { return filepath.Walk(src, func(path string, info os.FileInfo, err error) error { if err != nil { return err } relpath, err := filepath.Rel(src, path) if err != nil { return fmt.Errorf("failed to get relative path [%s]: %s", path, err) } dst...
[ "func", "installSource", "(", "src", ",", "dst", "string", ",", "edit", "editFunc", ")", "error", "{", "return", "filepath", ".", "Walk", "(", "src", ",", "func", "(", "path", "string", ",", "info", "os", ".", "FileInfo", ",", "err", "error", ")", "e...
// installSource recursively copies an API generator output directory to a // package location.
[ "installSource", "recursively", "copies", "an", "API", "generator", "output", "directory", "to", "a", "package", "location", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tools/internal/apigen/filesystem.go#L63-L95
9,490
luci/luci-go
tools/internal/apigen/filesystem.go
copyFile
func copyFile(src, dst string, relPath string, edit editFunc) error { data, err := ioutil.ReadFile(src) if err != nil { return fmt.Errorf("failed to read source: %s", err) } if edit != nil { data, err = edit(relPath, data) if err != nil { return fmt.Errorf("edit error: %s", err) } } if data == nil { ...
go
func copyFile(src, dst string, relPath string, edit editFunc) error { data, err := ioutil.ReadFile(src) if err != nil { return fmt.Errorf("failed to read source: %s", err) } if edit != nil { data, err = edit(relPath, data) if err != nil { return fmt.Errorf("edit error: %s", err) } } if data == nil { ...
[ "func", "copyFile", "(", "src", ",", "dst", "string", ",", "relPath", "string", ",", "edit", "editFunc", ")", "error", "{", "data", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "src", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ...
// copyFile copies the contents of a single file to a destination.
[ "copyFile", "copies", "the", "contents", "of", "a", "single", "file", "to", "a", "destination", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tools/internal/apigen/filesystem.go#L104-L121
9,491
luci/luci-go
tokenserver/appengine/impl/utils/pem.go
ParsePEM
func ParsePEM(data, header string) ([]byte, error) { block, rest := pem.Decode([]byte(data)) if len(rest) != 0 || block == nil { return nil, fmt.Errorf("not a valid %q PEM", header) } if block.Type != header { return nil, fmt.Errorf("expecting %q, got %q", header, block.Type) } return block.Bytes, nil }
go
func ParsePEM(data, header string) ([]byte, error) { block, rest := pem.Decode([]byte(data)) if len(rest) != 0 || block == nil { return nil, fmt.Errorf("not a valid %q PEM", header) } if block.Type != header { return nil, fmt.Errorf("expecting %q, got %q", header, block.Type) } return block.Bytes, nil }
[ "func", "ParsePEM", "(", "data", ",", "header", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "block", ",", "rest", ":=", "pem", ".", "Decode", "(", "[", "]", "byte", "(", "data", ")", ")", "\n", "if", "len", "(", "rest", ")", ...
// ParsePEM takes pem-encoded block and decodes it, checking the header.
[ "ParsePEM", "takes", "pem", "-", "encoded", "block", "and", "decodes", "it", "checking", "the", "header", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/utils/pem.go#L23-L32
9,492
luci/luci-go
tokenserver/appengine/impl/utils/pem.go
DumpPEM
func DumpPEM(data []byte, header string) string { return string(pem.EncodeToMemory(&pem.Block{ Type: header, Bytes: data, })) }
go
func DumpPEM(data []byte, header string) string { return string(pem.EncodeToMemory(&pem.Block{ Type: header, Bytes: data, })) }
[ "func", "DumpPEM", "(", "data", "[", "]", "byte", ",", "header", "string", ")", "string", "{", "return", "string", "(", "pem", ".", "EncodeToMemory", "(", "&", "pem", ".", "Block", "{", "Type", ":", "header", ",", "Bytes", ":", "data", ",", "}", ")...
// DumpPEM transforms block to pem-encoding. // // Reverse of ParsePEM.
[ "DumpPEM", "transforms", "block", "to", "pem", "-", "encoding", ".", "Reverse", "of", "ParsePEM", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/utils/pem.go#L37-L42
9,493
luci/luci-go
dm/api/distributor/jobsim/iterate.go
ToSlice
func (s *SparseRange) ToSlice() (ret []uint32) { for _, itm := range s.Items { switch x := itm.RangeItem.(type) { case *RangeItem_Single: ret = append(ret, x.Single) case *RangeItem_Range: for i := x.Range.Low; i <= x.Range.High; i++ { ret = append(ret, i) } } } return }
go
func (s *SparseRange) ToSlice() (ret []uint32) { for _, itm := range s.Items { switch x := itm.RangeItem.(type) { case *RangeItem_Single: ret = append(ret, x.Single) case *RangeItem_Range: for i := x.Range.Low; i <= x.Range.High; i++ { ret = append(ret, i) } } } return }
[ "func", "(", "s", "*", "SparseRange", ")", "ToSlice", "(", ")", "(", "ret", "[", "]", "uint32", ")", "{", "for", "_", ",", "itm", ":=", "range", "s", ".", "Items", "{", "switch", "x", ":=", "itm", ".", "RangeItem", ".", "(", "type", ")", "{", ...
// ToSlice returns this SparseRange as an expanded slice of uint32s.
[ "ToSlice", "returns", "this", "SparseRange", "as", "an", "expanded", "slice", "of", "uint32s", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/distributor/jobsim/iterate.go#L26-L38
9,494
luci/luci-go
dm/api/distributor/jobsim/iterate.go
ExpandShards
func (s *DepsStage) ExpandShards() { newSlice := make([]*Dependency, 0, len(s.Deps)) for _, dep := range s.Deps { if dep.Shards != 0 { for i := uint64(0); i < dep.Shards; i++ { depCopy := *dep depCopy.Shards = 0 phraseCopy := *depCopy.Phrase phraseCopy.Name = fmt.Sprintf("%s_%d", phraseCopy.Name,...
go
func (s *DepsStage) ExpandShards() { newSlice := make([]*Dependency, 0, len(s.Deps)) for _, dep := range s.Deps { if dep.Shards != 0 { for i := uint64(0); i < dep.Shards; i++ { depCopy := *dep depCopy.Shards = 0 phraseCopy := *depCopy.Phrase phraseCopy.Name = fmt.Sprintf("%s_%d", phraseCopy.Name,...
[ "func", "(", "s", "*", "DepsStage", ")", "ExpandShards", "(", ")", "{", "newSlice", ":=", "make", "(", "[", "]", "*", "Dependency", ",", "0", ",", "len", "(", "s", ".", "Deps", ")", ")", "\n", "for", "_", ",", "dep", ":=", "range", "s", ".", ...
// ExpandShards expands any dependencies that have non-zero Shards values.
[ "ExpandShards", "expands", "any", "dependencies", "that", "have", "non", "-", "zero", "Shards", "values", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/distributor/jobsim/iterate.go#L41-L58
9,495
luci/luci-go
dm/api/distributor/jobsim/iterate.go
fastHash
func fastHash(a int64, bs ...int64) int64 { buf := make([]byte, 8) hasher := fnv.New64a() w := func(v int64) { binary.LittleEndian.PutUint64(buf, uint64(v)) if _, err := hasher.Write(buf); err != nil { panic(err) } } w(a) for _, b := range bs { w(b) } return int64(hasher.Sum64()) }
go
func fastHash(a int64, bs ...int64) int64 { buf := make([]byte, 8) hasher := fnv.New64a() w := func(v int64) { binary.LittleEndian.PutUint64(buf, uint64(v)) if _, err := hasher.Write(buf); err != nil { panic(err) } } w(a) for _, b := range bs { w(b) } return int64(hasher.Sum64()) }
[ "func", "fastHash", "(", "a", "int64", ",", "bs", "...", "int64", ")", "int64", "{", "buf", ":=", "make", "(", "[", "]", "byte", ",", "8", ")", "\n", "hasher", ":=", "fnv", ".", "New64a", "(", ")", "\n", "w", ":=", "func", "(", "v", "int64", ...
// fastHash is a non-cryptographic NxN -> N hash function. It's used to // deterministically blend seeds for subjobs.
[ "fastHash", "is", "a", "non", "-", "cryptographic", "NxN", "-", ">", "N", "hash", "function", ".", "It", "s", "used", "to", "deterministically", "blend", "seeds", "for", "subjobs", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/distributor/jobsim/iterate.go#L62-L76
9,496
luci/luci-go
dm/api/distributor/jobsim/iterate.go
Seed
func (d *Dependency) Seed(rnd *rand.Rand, seed, round int64) { if d.MixSeed { if d.Phrase.Seed == 0 { d.Phrase.Seed = rnd.Int63() } else { d.Phrase.Seed = fastHash(seed*(math.MaxInt32), d.Phrase.Seed, round) } } else if d.Phrase.Seed == 0 { d.Phrase.Seed = seed } }
go
func (d *Dependency) Seed(rnd *rand.Rand, seed, round int64) { if d.MixSeed { if d.Phrase.Seed == 0 { d.Phrase.Seed = rnd.Int63() } else { d.Phrase.Seed = fastHash(seed*(math.MaxInt32), d.Phrase.Seed, round) } } else if d.Phrase.Seed == 0 { d.Phrase.Seed = seed } }
[ "func", "(", "d", "*", "Dependency", ")", "Seed", "(", "rnd", "*", "rand", ".", "Rand", ",", "seed", ",", "round", "int64", ")", "{", "if", "d", ".", "MixSeed", "{", "if", "d", ".", "Phrase", ".", "Seed", "==", "0", "{", "d", ".", "Phrase", "...
// Seed rewrites this dependency's Seed value
[ "Seed", "rewrites", "this", "dependency", "s", "Seed", "value" ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/distributor/jobsim/iterate.go#L79-L89
9,497
luci/luci-go
common/logging/config.go
AddFlagsPrefix
func (c *Config) AddFlagsPrefix(fs *flag.FlagSet, prefix string) { fs.Var(&c.Level, prefix+"log-level", "The logging level. Valid options are: debug, info, warning, error.") }
go
func (c *Config) AddFlagsPrefix(fs *flag.FlagSet, prefix string) { fs.Var(&c.Level, prefix+"log-level", "The logging level. Valid options are: debug, info, warning, error.") }
[ "func", "(", "c", "*", "Config", ")", "AddFlagsPrefix", "(", "fs", "*", "flag", ".", "FlagSet", ",", "prefix", "string", ")", "{", "fs", ".", "Var", "(", "&", "c", ".", "Level", ",", "prefix", "+", "\"", "\"", ",", "\"", "\"", ")", "\n", "}" ]
// AddFlagsPrefix adds common flags to a supplied FlagSet with a prefix. // // A string prefix must be supplied which will be prepended to // each added flag verbatim.
[ "AddFlagsPrefix", "adds", "common", "flags", "to", "a", "supplied", "FlagSet", "with", "a", "prefix", ".", "A", "string", "prefix", "must", "be", "supplied", "which", "will", "be", "prepended", "to", "each", "added", "flag", "verbatim", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/logging/config.go#L36-L39
9,498
luci/luci-go
common/logging/config.go
Set
func (c *Config) Set(ctx context.Context) context.Context { return SetLevel(ctx, c.Level) }
go
func (c *Config) Set(ctx context.Context) context.Context { return SetLevel(ctx, c.Level) }
[ "func", "(", "c", "*", "Config", ")", "Set", "(", "ctx", "context", ".", "Context", ")", "context", ".", "Context", "{", "return", "SetLevel", "(", "ctx", ",", "c", ".", "Level", ")", "\n", "}" ]
// Set returns a new context configured to use logging level passed via the // command-line level flag.
[ "Set", "returns", "a", "new", "context", "configured", "to", "use", "logging", "level", "passed", "via", "the", "command", "-", "line", "level", "flag", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/logging/config.go#L43-L45
9,499
luci/luci-go
machine-db/api/crimson/v1/pb.discovery.go
FileDescriptorSet
func FileDescriptorSet() *descriptor.FileDescriptorSet { // We just need ONE of the service names to look up the FileDescriptorSet. ret, err := discovery.GetDescriptorSet("crimson.Crimson") if err != nil { panic(err) } return ret }
go
func FileDescriptorSet() *descriptor.FileDescriptorSet { // We just need ONE of the service names to look up the FileDescriptorSet. ret, err := discovery.GetDescriptorSet("crimson.Crimson") if err != nil { panic(err) } return ret }
[ "func", "FileDescriptorSet", "(", ")", "*", "descriptor", ".", "FileDescriptorSet", "{", "// We just need ONE of the service names to look up the FileDescriptorSet.", "ret", ",", "err", ":=", "discovery", ".", "GetDescriptorSet", "(", "\"", "\"", ")", "\n", "if", "err",...
// FileDescriptorSet returns a descriptor set for this proto package, which // includes all defined services, and all transitive dependencies. // // Will not return nil. // // Do NOT modify the returned descriptor.
[ "FileDescriptorSet", "returns", "a", "descriptor", "set", "for", "this", "proto", "package", "which", "includes", "all", "defined", "services", "and", "all", "transitive", "dependencies", ".", "Will", "not", "return", "nil", ".", "Do", "NOT", "modify", "the", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/api/crimson/v1/pb.discovery.go#L1119-L1126