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
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
131,000
luci/luci-go
client/cmd/swarming/collect.go
summarizeResultsPython
func summarizeResultsPython(results []taskResult) ([]byte, error) { var shards []map[string]interface{} for _, result := range results { buf, err := json.Marshal(result.result) if err != nil { return nil, err } var jsonResult map[string]interface{} if err := json.Unmarshal(buf, &jsonResult); err != nil...
go
func summarizeResultsPython(results []taskResult) ([]byte, error) { var shards []map[string]interface{} for _, result := range results { buf, err := json.Marshal(result.result) if err != nil { return nil, err } var jsonResult map[string]interface{} if err := json.Unmarshal(buf, &jsonResult); err != nil...
[ "func", "summarizeResultsPython", "(", "results", "[", "]", "taskResult", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "shards", "[", "]", "map", "[", "string", "]", "interface", "{", "}", "\n\n", "for", "_", ",", "result", ":=", "range...
// summarizeResultsPython generates summary JSON file compatible with python's // swarming client.
[ "summarizeResultsPython", "generates", "summary", "JSON", "file", "compatible", "with", "python", "s", "swarming", "client", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/cmd/swarming/collect.go#L317-L340
131,001
luci/luci-go
client/cmd/swarming/collect.go
summarizeResults
func (c *collectRun) summarizeResults(results []taskResult) ([]byte, error) { if c.taskSummaryPython { return summarizeResultsPython(results) } jsonResults := map[string]interface{}{} for _, result := range results { jsonResult := map[string]interface{}{} if result.err != nil { jsonResult["error"] = resul...
go
func (c *collectRun) summarizeResults(results []taskResult) ([]byte, error) { if c.taskSummaryPython { return summarizeResultsPython(results) } jsonResults := map[string]interface{}{} for _, result := range results { jsonResult := map[string]interface{}{} if result.err != nil { jsonResult["error"] = resul...
[ "func", "(", "c", "*", "collectRun", ")", "summarizeResults", "(", "results", "[", "]", "taskResult", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "c", ".", "taskSummaryPython", "{", "return", "summarizeResultsPython", "(", "results", ")", "...
// summarizeResults generate a marshalled JSON summary of the task results.
[ "summarizeResults", "generate", "a", "marshalled", "JSON", "summary", "of", "the", "task", "results", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/cmd/swarming/collect.go#L343-L364
131,002
luci/luci-go
cipd/appengine/impl/model/txn.go
Txn
func Txn(c context.Context, name string, cb func(context.Context) error) error { c = logging.SetField(c, "txn", name) var attempt int var innerErr error err := datastore.RunInTransaction(c, func(c context.Context) error { attempt++ if attempt != 1 { logging.Warningf(c, "Retrying the transaction: failed to ...
go
func Txn(c context.Context, name string, cb func(context.Context) error) error { c = logging.SetField(c, "txn", name) var attempt int var innerErr error err := datastore.RunInTransaction(c, func(c context.Context) error { attempt++ if attempt != 1 { logging.Warningf(c, "Retrying the transaction: failed to ...
[ "func", "Txn", "(", "c", "context", ".", "Context", ",", "name", "string", ",", "cb", "func", "(", "context", ".", "Context", ")", "error", ")", "error", "{", "c", "=", "logging", ".", "SetField", "(", "c", ",", "\"", "\"", ",", "name", ")", "\n\...
// Txn runs the callback in a datastore transaction, marking commit errors with // transient tag. // // The given name will be used for logging and error messages.
[ "Txn", "runs", "the", "callback", "in", "a", "datastore", "transaction", "marking", "commit", "errors", "with", "transient", "tag", ".", "The", "given", "name", "will", "be", "used", "for", "logging", "and", "error", "messages", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/model/txn.go#L30-L49
131,003
luci/luci-go
logdog/server/service/config/poller.go
Run
func (p *ChangePoller) Run(c context.Context) { if p.Period <= 0 { return } for { // If our Context has been canceled, terminate. select { case <-c.Done(): log.WithError(c.Err()).Warningf(c, "Terminating poll loop: context has been cancelled.") return default: // Continue } log.Fields{ "t...
go
func (p *ChangePoller) Run(c context.Context) { if p.Period <= 0 { return } for { // If our Context has been canceled, terminate. select { case <-c.Done(): log.WithError(c.Err()).Warningf(c, "Terminating poll loop: context has been cancelled.") return default: // Continue } log.Fields{ "t...
[ "func", "(", "p", "*", "ChangePoller", ")", "Run", "(", "c", "context", ".", "Context", ")", "{", "if", "p", ".", "Period", "<=", "0", "{", "return", "\n", "}", "\n\n", "for", "{", "// If our Context has been canceled, terminate.", "select", "{", "case", ...
// Run starts polling for changes. It will stop when the Context is cancelled.
[ "Run", "starts", "polling", "for", "changes", ".", "It", "will", "stop", "when", "the", "Context", "is", "cancelled", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/server/service/config/poller.go#L54-L98
131,004
luci/luci-go
logdog/server/service/config/poller.go
Refresh
func (p *ChangePoller) Refresh(c context.Context) error { var meta config.Meta if err := cfgclient.Get(c, cfgclient.AsService, p.ConfigSet, p.Path, nil, &meta); err != nil { return errors.Annotate(err, "failed to reload config %s :: %s", p.ConfigSet, p.Path).Err() } p.ContentHash = meta.ContentHash return nil }
go
func (p *ChangePoller) Refresh(c context.Context) error { var meta config.Meta if err := cfgclient.Get(c, cfgclient.AsService, p.ConfigSet, p.Path, nil, &meta); err != nil { return errors.Annotate(err, "failed to reload config %s :: %s", p.ConfigSet, p.Path).Err() } p.ContentHash = meta.ContentHash return nil }
[ "func", "(", "p", "*", "ChangePoller", ")", "Refresh", "(", "c", "context", ".", "Context", ")", "error", "{", "var", "meta", "config", ".", "Meta", "\n", "if", "err", ":=", "cfgclient", ".", "Get", "(", "c", ",", "cfgclient", ".", "AsService", ",", ...
// Refresh reloads the configuration value, updating ContentHash.
[ "Refresh", "reloads", "the", "configuration", "value", "updating", "ContentHash", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/server/service/config/poller.go#L101-L109
131,005
luci/luci-go
cipd/appengine/impl/settings/settings.go
Get
func Get(ctx context.Context) (*Settings, error) { s := &Settings{} if err := settings.Get(ctx, settingsKey, s); err != nil && err != settings.ErrNoSettings { return nil, errors.Annotate(err, "failed to fetch settings"). Tag(grpcutil.InternalTag, transient.Tag).Err() } if s.StorageGSPath == "" || s.TempGSPath ...
go
func Get(ctx context.Context) (*Settings, error) { s := &Settings{} if err := settings.Get(ctx, settingsKey, s); err != nil && err != settings.ErrNoSettings { return nil, errors.Annotate(err, "failed to fetch settings"). Tag(grpcutil.InternalTag, transient.Tag).Err() } if s.StorageGSPath == "" || s.TempGSPath ...
[ "func", "Get", "(", "ctx", "context", ".", "Context", ")", "(", "*", "Settings", ",", "error", ")", "{", "s", ":=", "&", "Settings", "{", "}", "\n", "if", "err", ":=", "settings", ".", "Get", "(", "ctx", ",", "settingsKey", ",", "s", ")", ";", ...
// Get returns the settings from the local cache, checking they are populated. // // Returns grpc-annotated Internal error if something is wrong.
[ "Get", "returns", "the", "settings", "from", "the", "local", "cache", "checking", "they", "are", "populated", ".", "Returns", "grpc", "-", "annotated", "Internal", "error", "if", "something", "is", "wrong", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/settings/settings.go#L63-L74
131,006
luci/luci-go
cipd/appengine/impl/settings/settings.go
ObjectPath
func (s *Settings) ObjectPath(obj *api.ObjectRef) string { return s.StorageGSPath + "/" + obj.HashAlgo.String() + "/" + obj.HexDigest }
go
func (s *Settings) ObjectPath(obj *api.ObjectRef) string { return s.StorageGSPath + "/" + obj.HashAlgo.String() + "/" + obj.HexDigest }
[ "func", "(", "s", "*", "Settings", ")", "ObjectPath", "(", "obj", "*", "api", ".", "ObjectRef", ")", "string", "{", "return", "s", ".", "StorageGSPath", "+", "\"", "\"", "+", "obj", ".", "HashAlgo", ".", "String", "(", ")", "+", "\"", "\"", "+", ...
// ObjectPath constructs a path to the object in the Google Storage, starting // from StorageGSPath root.
[ "ObjectPath", "constructs", "a", "path", "to", "the", "object", "in", "the", "Google", "Storage", "starting", "from", "StorageGSPath", "root", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/settings/settings.go#L78-L80
131,007
luci/luci-go
auth/client/authcli/authcli.go
Register
func (fl *Flags) Register(f *flag.FlagSet, defaults auth.Options) { fl.defaults = defaults f.StringVar(&fl.serviceAccountJSON, "service-account-json", fl.defaults.ServiceAccountJSONPath, "Path to JSON file with service account credentials to use.") if fl.RegisterScopesFlag { defaultScopes := strings.Join(defaults....
go
func (fl *Flags) Register(f *flag.FlagSet, defaults auth.Options) { fl.defaults = defaults f.StringVar(&fl.serviceAccountJSON, "service-account-json", fl.defaults.ServiceAccountJSONPath, "Path to JSON file with service account credentials to use.") if fl.RegisterScopesFlag { defaultScopes := strings.Join(defaults....
[ "func", "(", "fl", "*", "Flags", ")", "Register", "(", "f", "*", "flag", ".", "FlagSet", ",", "defaults", "auth", ".", "Options", ")", "{", "fl", ".", "defaults", "=", "defaults", "\n", "f", ".", "StringVar", "(", "&", "fl", ".", "serviceAccountJSON"...
// Register adds auth related flags to a FlagSet.
[ "Register", "adds", "auth", "related", "flags", "to", "a", "FlagSet", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/auth/client/authcli/authcli.go#L133-L143
131,008
luci/luci-go
auth/client/authcli/authcli.go
Options
func (fl *Flags) Options() (auth.Options, error) { opts := fl.defaults opts.ServiceAccountJSONPath = fl.serviceAccountJSON if fl.RegisterScopesFlag { opts.Scopes = strings.Split(fl.scopes, " ") sort.Strings(opts.Scopes) } return opts, nil }
go
func (fl *Flags) Options() (auth.Options, error) { opts := fl.defaults opts.ServiceAccountJSONPath = fl.serviceAccountJSON if fl.RegisterScopesFlag { opts.Scopes = strings.Split(fl.scopes, " ") sort.Strings(opts.Scopes) } return opts, nil }
[ "func", "(", "fl", "*", "Flags", ")", "Options", "(", ")", "(", "auth", ".", "Options", ",", "error", ")", "{", "opts", ":=", "fl", ".", "defaults", "\n", "opts", ".", "ServiceAccountJSONPath", "=", "fl", ".", "serviceAccountJSON", "\n", "if", "fl", ...
// Options return instance of auth.Options struct with values set accordingly to // parsed command line flags.
[ "Options", "return", "instance", "of", "auth", ".", "Options", "struct", "with", "values", "set", "accordingly", "to", "parsed", "command", "line", "flags", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/auth/client/authcli/authcli.go#L147-L155
131,009
luci/luci-go
auth/client/authcli/authcli.go
SubcommandLoginWithParams
func SubcommandLoginWithParams(params CommandParams) *subcommands.Command { return &subcommands.Command{ Advanced: params.Advanced, UsageLine: params.Name, ShortDesc: "performs interactive login flow", LongDesc: "Performs interactive login flow and caches obtained credentials", CommandRun: func() subcomman...
go
func SubcommandLoginWithParams(params CommandParams) *subcommands.Command { return &subcommands.Command{ Advanced: params.Advanced, UsageLine: params.Name, ShortDesc: "performs interactive login flow", LongDesc: "Performs interactive login flow and caches obtained credentials", CommandRun: func() subcomman...
[ "func", "SubcommandLoginWithParams", "(", "params", "CommandParams", ")", "*", "subcommands", ".", "Command", "{", "return", "&", "subcommands", ".", "Command", "{", "Advanced", ":", "params", ".", "Advanced", ",", "UsageLine", ":", "params", ".", "Name", ",",...
// SubcommandLoginWithParams returns subcommands.Command that can be used to // perform interactive login.
[ "SubcommandLoginWithParams", "returns", "subcommands", ".", "Command", "that", "can", "be", "used", "to", "perform", "interactive", "login", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/auth/client/authcli/authcli.go#L187-L200
131,010
luci/luci-go
auth/client/authcli/authcli.go
SubcommandLogoutWithParams
func SubcommandLogoutWithParams(params CommandParams) *subcommands.Command { return &subcommands.Command{ Advanced: params.Advanced, UsageLine: params.Name, ShortDesc: "removes cached credentials", LongDesc: "Removes cached credentials from the disk", CommandRun: func() subcommands.CommandRun { c := &lo...
go
func SubcommandLogoutWithParams(params CommandParams) *subcommands.Command { return &subcommands.Command{ Advanced: params.Advanced, UsageLine: params.Name, ShortDesc: "removes cached credentials", LongDesc: "Removes cached credentials from the disk", CommandRun: func() subcommands.CommandRun { c := &lo...
[ "func", "SubcommandLogoutWithParams", "(", "params", "CommandParams", ")", "*", "subcommands", ".", "Command", "{", "return", "&", "subcommands", ".", "Command", "{", "Advanced", ":", "params", ".", "Advanced", ",", "UsageLine", ":", "params", ".", "Name", ","...
// SubcommandLogoutWithParams returns subcommands.Command that can be used to purge cached // credentials.
[ "SubcommandLogoutWithParams", "returns", "subcommands", ".", "Command", "that", "can", "be", "used", "to", "purge", "cached", "credentials", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/auth/client/authcli/authcli.go#L231-L244
131,011
luci/luci-go
auth/client/authcli/authcli.go
SubcommandInfoWithParams
func SubcommandInfoWithParams(params CommandParams) *subcommands.Command { return &subcommands.Command{ Advanced: params.Advanced, UsageLine: params.Name, ShortDesc: "prints an email address associated with currently cached token", LongDesc: "Prints an email address associated with currently cached token", ...
go
func SubcommandInfoWithParams(params CommandParams) *subcommands.Command { return &subcommands.Command{ Advanced: params.Advanced, UsageLine: params.Name, ShortDesc: "prints an email address associated with currently cached token", LongDesc: "Prints an email address associated with currently cached token", ...
[ "func", "SubcommandInfoWithParams", "(", "params", "CommandParams", ")", "*", "subcommands", ".", "Command", "{", "return", "&", "subcommands", ".", "Command", "{", "Advanced", ":", "params", ".", "Advanced", ",", "UsageLine", ":", "params", ".", "Name", ",", ...
// SubcommandInfoWithParams returns subcommand.Command that can be used to print // current cached credentials.
[ "SubcommandInfoWithParams", "returns", "subcommand", ".", "Command", "that", "can", "be", "used", "to", "print", "current", "cached", "credentials", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/auth/client/authcli/authcli.go#L275-L288
131,012
luci/luci-go
auth/client/authcli/authcli.go
SubcommandTokenWithParams
func SubcommandTokenWithParams(params CommandParams) *subcommands.Command { return &subcommands.Command{ Advanced: params.Advanced, UsageLine: params.Name, ShortDesc: "prints an access token", LongDesc: "Generates an access token if requested and prints it.", CommandRun: func() subcommands.CommandRun { ...
go
func SubcommandTokenWithParams(params CommandParams) *subcommands.Command { return &subcommands.Command{ Advanced: params.Advanced, UsageLine: params.Name, ShortDesc: "prints an access token", LongDesc: "Generates an access token if requested and prints it.", CommandRun: func() subcommands.CommandRun { ...
[ "func", "SubcommandTokenWithParams", "(", "params", "CommandParams", ")", "*", "subcommands", ".", "Command", "{", "return", "&", "subcommands", ".", "Command", "{", "Advanced", ":", "params", ".", "Advanced", ",", "UsageLine", ":", "params", ".", "Name", ",",...
// SubcommandTokenWithParams returns subcommand.Command that can be used to // print current access token.
[ "SubcommandTokenWithParams", "returns", "subcommand", ".", "Command", "that", "can", "be", "used", "to", "print", "current", "access", "token", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/auth/client/authcli/authcli.go#L323-L343
131,013
luci/luci-go
auth/client/authcli/authcli.go
SubcommandContextWithParams
func SubcommandContextWithParams(params CommandParams) *subcommands.Command { // By default request all scopes used by authctx.Context. params.AuthOptions.Scopes = []string{ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/firebase", "https://www.googleapis.com/auth/gerritcoder...
go
func SubcommandContextWithParams(params CommandParams) *subcommands.Command { // By default request all scopes used by authctx.Context. params.AuthOptions.Scopes = []string{ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/firebase", "https://www.googleapis.com/auth/gerritcoder...
[ "func", "SubcommandContextWithParams", "(", "params", "CommandParams", ")", "*", "subcommands", ".", "Command", "{", "// By default request all scopes used by authctx.Context.", "params", ".", "AuthOptions", ".", "Scopes", "=", "[", "]", "string", "{", "\"", "\"", ","...
// SubcommandContextWithParams returns subcommand.Command that can be used to // setup new LUCI authentication context for a process tree.
[ "SubcommandContextWithParams", "returns", "subcommand", ".", "Command", "that", "can", "be", "used", "to", "setup", "new", "LUCI", "authentication", "context", "for", "a", "process", "tree", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/auth/client/authcli/authcli.go#L416-L440
131,014
luci/luci-go
milo/api/buildbot/structs.go
ID
func (b *Build) ID() BuildID { return BuildID{ Master: b.Master, Builder: b.Buildername, Number: b.Number, } }
go
func (b *Build) ID() BuildID { return BuildID{ Master: b.Master, Builder: b.Buildername, Number: b.Number, } }
[ "func", "(", "b", "*", "Build", ")", "ID", "(", ")", "BuildID", "{", "return", "BuildID", "{", "Master", ":", "b", ".", "Master", ",", "Builder", ":", "b", ".", "Buildername", ",", "Number", ":", "b", ".", "Number", ",", "}", "\n", "}" ]
// ID returns b's BuildID.
[ "ID", "returns", "b", "s", "BuildID", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/api/buildbot/structs.go#L160-L166
131,015
luci/luci-go
milo/api/buildbot/structs.go
PropertyValue
func (b *Build) PropertyValue(name string) interface{} { for _, prop := range b.Properties { if prop.Name == name { return prop.Value } } // Not returning (nil, false) here because it would complicate all // practical usage of this function, which simply try to cast the // returned value. return PropertyN...
go
func (b *Build) PropertyValue(name string) interface{} { for _, prop := range b.Properties { if prop.Name == name { return prop.Value } } // Not returning (nil, false) here because it would complicate all // practical usage of this function, which simply try to cast the // returned value. return PropertyN...
[ "func", "(", "b", "*", "Build", ")", "PropertyValue", "(", "name", "string", ")", "interface", "{", "}", "{", "for", "_", ",", "prop", ":=", "range", "b", ".", "Properties", "{", "if", "prop", ".", "Name", "==", "name", "{", "return", "prop", ".", ...
// PropertyValue returns the named property value. // If such property does not exist, returns PropertyNotFound.
[ "PropertyValue", "returns", "the", "named", "property", "value", ".", "If", "such", "property", "does", "not", "exist", "returns", "PropertyNotFound", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/api/buildbot/structs.go#L184-L195
131,016
luci/luci-go
milo/api/buildbot/structs.go
Experimental
func (b *Build) Experimental() bool { v, _ := b.PropertyValue("$recipe_engine/runtime").(map[string]interface{}) return v["is_experimental"] == true }
go
func (b *Build) Experimental() bool { v, _ := b.PropertyValue("$recipe_engine/runtime").(map[string]interface{}) return v["is_experimental"] == true }
[ "func", "(", "b", "*", "Build", ")", "Experimental", "(", ")", "bool", "{", "v", ",", "_", ":=", "b", ".", "PropertyValue", "(", "\"", "\"", ")", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "return", "v", "[", "\"", ...
// Experimental returns true if b is experimental.
[ "Experimental", "returns", "true", "if", "b", "is", "experimental", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/api/buildbot/structs.go#L198-L201
131,017
luci/luci-go
lucicfg/graph/graph.go
backtrace
func backtrace(err error, t *builtins.CapturedStacktrace) string { return t.String() + "Error: " + err.Error() }
go
func backtrace(err error, t *builtins.CapturedStacktrace) string { return t.String() + "Error: " + err.Error() }
[ "func", "backtrace", "(", "err", "error", ",", "t", "*", "builtins", ".", "CapturedStacktrace", ")", "string", "{", "return", "t", ".", "String", "(", ")", "+", "\"", "\"", "+", "err", ".", "Error", "(", ")", "\n", "}" ]
// backtrace returns an error message annotated with a backtrace.
[ "backtrace", "returns", "an", "error", "message", "annotated", "with", "a", "backtrace", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/graph/graph.go#L40-L42
131,018
luci/luci-go
lucicfg/graph/graph.go
validateOrder
func validateOrder(orderBy string) error { if orderBy != "key" && orderBy != "def" { return fmt.Errorf("unknown order %q, expecting either \"key\" or \"def\"", orderBy) } return nil }
go
func validateOrder(orderBy string) error { if orderBy != "key" && orderBy != "def" { return fmt.Errorf("unknown order %q, expecting either \"key\" or \"def\"", orderBy) } return nil }
[ "func", "validateOrder", "(", "orderBy", "string", ")", "error", "{", "if", "orderBy", "!=", "\"", "\"", "&&", "orderBy", "!=", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", ",", "orderBy", ")", "\n...
// validateOrder returns an error if the edge traversal order is unrecognized.
[ "validateOrder", "returns", "an", "error", "if", "the", "edge", "traversal", "order", "is", "unrecognized", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/graph/graph.go#L157-L162
131,019
luci/luci-go
lucicfg/graph/graph.go
validateKey
func (g *Graph) validateKey(title string, k *Key) error { if k.set != &g.KeySet { return fmt.Errorf("bad %s: %s is from another graph", title, k) } return nil }
go
func (g *Graph) validateKey(title string, k *Key) error { if k.set != &g.KeySet { return fmt.Errorf("bad %s: %s is from another graph", title, k) } return nil }
[ "func", "(", "g", "*", "Graph", ")", "validateKey", "(", "title", "string", ",", "k", "*", "Key", ")", "error", "{", "if", "k", ".", "set", "!=", "&", "g", ".", "KeySet", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "title", ",", ...
// validateKey returns an error if the key is not from this graph.
[ "validateKey", "returns", "an", "error", "if", "the", "key", "is", "not", "from", "this", "graph", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/graph/graph.go#L165-L170
131,020
luci/luci-go
lucicfg/graph/graph.go
orderedRelatives
func (g *Graph) orderedRelatives(key *Key, attr, orderBy string, cb func(n *Node) []*Node) ([]*Node, error) { if !g.finalized { return nil, ErrNotFinalized } if err := g.validateKey(attr, key); err != nil { return nil, err } if err := validateOrder(orderBy); err != nil { return nil, err } if n := g.nodes[k...
go
func (g *Graph) orderedRelatives(key *Key, attr, orderBy string, cb func(n *Node) []*Node) ([]*Node, error) { if !g.finalized { return nil, ErrNotFinalized } if err := g.validateKey(attr, key); err != nil { return nil, err } if err := validateOrder(orderBy); err != nil { return nil, err } if n := g.nodes[k...
[ "func", "(", "g", "*", "Graph", ")", "orderedRelatives", "(", "key", "*", "Key", ",", "attr", ",", "orderBy", "string", ",", "cb", "func", "(", "n", "*", "Node", ")", "[", "]", "*", "Node", ")", "(", "[", "]", "*", "Node", ",", "error", ")", ...
// orderedRelatives is a common implementation of Children and Parents.
[ "orderedRelatives", "is", "a", "common", "implementation", "of", "Children", "and", "Parents", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/graph/graph.go#L500-L514
131,021
luci/luci-go
lucicfg/graph/graph.go
AttrNames
func (g *Graph) AttrNames() []string { names := make([]string, 0, len(graphAttrs)) for k := range graphAttrs { names = append(names, k) } sort.Strings(names) return names }
go
func (g *Graph) AttrNames() []string { names := make([]string, 0, len(graphAttrs)) for k := range graphAttrs { names = append(names, k) } sort.Strings(names) return names }
[ "func", "(", "g", "*", "Graph", ")", "AttrNames", "(", ")", "[", "]", "string", "{", "names", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "graphAttrs", ")", ")", "\n", "for", "k", ":=", "range", "graphAttrs", "{", "names", ...
// AttrNames is a part of starlark.HasAttrs interface.
[ "AttrNames", "is", "a", "part", "of", "starlark", ".", "HasAttrs", "interface", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/graph/graph.go#L564-L571
131,022
luci/luci-go
common/data/caching/cache/cache.go
NewMemory
func NewMemory(policies Policies, namespace string) Cache { return &memory{ policies: policies, h: isolated.GetHash(namespace), data: map[isolated.HexDigest][]byte{}, lru: makeLRUDict(namespace), } }
go
func NewMemory(policies Policies, namespace string) Cache { return &memory{ policies: policies, h: isolated.GetHash(namespace), data: map[isolated.HexDigest][]byte{}, lru: makeLRUDict(namespace), } }
[ "func", "NewMemory", "(", "policies", "Policies", ",", "namespace", "string", ")", "Cache", "{", "return", "&", "memory", "{", "policies", ":", "policies", ",", "h", ":", "isolated", ".", "GetHash", "(", "namespace", ")", ",", "data", ":", "map", "[", ...
// NewMemory creates a purely in-memory cache.
[ "NewMemory", "creates", "a", "purely", "in", "-", "memory", "cache", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/caching/cache/cache.go#L84-L91
131,023
luci/luci-go
common/data/caching/cache/cache.go
NewDisk
func NewDisk(policies Policies, path, namespace string) (Cache, error) { if !filepath.IsAbs(path) { return nil, errors.New("must use absolute path") } d := &disk{ policies: policies, path: path, h: isolated.GetHash(namespace), lru: makeLRUDict(namespace), } p := d.statePath() f, err := o...
go
func NewDisk(policies Policies, path, namespace string) (Cache, error) { if !filepath.IsAbs(path) { return nil, errors.New("must use absolute path") } d := &disk{ policies: policies, path: path, h: isolated.GetHash(namespace), lru: makeLRUDict(namespace), } p := d.statePath() f, err := o...
[ "func", "NewDisk", "(", "policies", "Policies", ",", "path", ",", "namespace", "string", ")", "(", "Cache", ",", "error", ")", "{", "if", "!", "filepath", ".", "IsAbs", "(", "path", ")", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "...
// NewDisk creates a disk based cache. // // It may return both a valid Cache and an error if it failed to load the // previous cache metadata. It is safe to ignore this error.
[ "NewDisk", "creates", "a", "disk", "based", "cache", ".", "It", "may", "return", "both", "a", "valid", "Cache", "and", "an", "error", "if", "it", "failed", "to", "load", "the", "previous", "cache", "metadata", ".", "It", "is", "safe", "to", "ignore", "...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/caching/cache/cache.go#L97-L117
131,024
luci/luci-go
dm/api/service/v1/graph_data_abnormal_finish.go
CouldRetry
func (s AbnormalFinish_Status) CouldRetry() bool { switch s { case AbnormalFinish_FAILED, AbnormalFinish_CRASHED, AbnormalFinish_EXPIRED, AbnormalFinish_TIMED_OUT: return true } return false }
go
func (s AbnormalFinish_Status) CouldRetry() bool { switch s { case AbnormalFinish_FAILED, AbnormalFinish_CRASHED, AbnormalFinish_EXPIRED, AbnormalFinish_TIMED_OUT: return true } return false }
[ "func", "(", "s", "AbnormalFinish_Status", ")", "CouldRetry", "(", ")", "bool", "{", "switch", "s", "{", "case", "AbnormalFinish_FAILED", ",", "AbnormalFinish_CRASHED", ",", "AbnormalFinish_EXPIRED", ",", "AbnormalFinish_TIMED_OUT", ":", "return", "true", "\n", "}",...
// CouldRetry returns true iff this status code is retryable.
[ "CouldRetry", "returns", "true", "iff", "this", "status", "code", "is", "retryable", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/service/v1/graph_data_abnormal_finish.go#L18-L26
131,025
luci/luci-go
tokenserver/appengine/impl/projectscope/config.go
SetupConfigValidation
func SetupConfigValidation(rules *validation.RuleSet) { rules.Add("services/${config_service_appid}", projectsCfg, func(ctx *validation.Context, configSet, path string, content []byte) error { ctx.SetFile(projectsCfg) cfg := &config.ProjectsCfg{} if err := proto.UnmarshalText(string(content), cfg); err != nil { ...
go
func SetupConfigValidation(rules *validation.RuleSet) { rules.Add("services/${config_service_appid}", projectsCfg, func(ctx *validation.Context, configSet, path string, content []byte) error { ctx.SetFile(projectsCfg) cfg := &config.ProjectsCfg{} if err := proto.UnmarshalText(string(content), cfg); err != nil { ...
[ "func", "SetupConfigValidation", "(", "rules", "*", "validation", ".", "RuleSet", ")", "{", "rules", ".", "Add", "(", "\"", "\"", ",", "projectsCfg", ",", "func", "(", "ctx", "*", "validation", ".", "Context", ",", "configSet", ",", "path", "string", ","...
// SetupConfigValidation registers the tokenserver custom projects.cfg validator.
[ "SetupConfigValidation", "registers", "the", "tokenserver", "custom", "projects", ".", "cfg", "validator", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/projectscope/config.go#L36-L47
131,026
luci/luci-go
tokenserver/appengine/impl/projectscope/config.go
importIdentities
func importIdentities(c context.Context, cfg *config.ProjectsCfg) error { storage := projectidentity.ProjectIdentities(c) // TODO (fmatenaar): Make this transactional and provide some guarantees around cleanup // but do this after we have a stronger story for warning about config changes which are // about to remo...
go
func importIdentities(c context.Context, cfg *config.ProjectsCfg) error { storage := projectidentity.ProjectIdentities(c) // TODO (fmatenaar): Make this transactional and provide some guarantees around cleanup // but do this after we have a stronger story for warning about config changes which are // about to remo...
[ "func", "importIdentities", "(", "c", "context", ".", "Context", ",", "cfg", "*", "config", ".", "ProjectsCfg", ")", "error", "{", "storage", ":=", "projectidentity", ".", "ProjectIdentities", "(", "c", ")", "\n\n", "// TODO (fmatenaar): Make this transactional and ...
// importIdentities analyzes projects.cfg to import or update project scoped service accounts.
[ "importIdentities", "analyzes", "projects", ".", "cfg", "to", "import", "or", "update", "project", "scoped", "service", "accounts", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/projectscope/config.go#L50-L70
131,027
luci/luci-go
tokenserver/appengine/impl/projectscope/config.go
ImportConfigs
func ImportConfigs(c context.Context) (string, error) { cfg, rev, err := fetchConfigs(c) if err != nil { return "", errors.Annotate(err, "failed to fetch project configs").Err() } if err := importIdentities(c, cfg); err != nil { return "", errors.Annotate(err, "failed to import project configs").Err() } retur...
go
func ImportConfigs(c context.Context) (string, error) { cfg, rev, err := fetchConfigs(c) if err != nil { return "", errors.Annotate(err, "failed to fetch project configs").Err() } if err := importIdentities(c, cfg); err != nil { return "", errors.Annotate(err, "failed to import project configs").Err() } retur...
[ "func", "ImportConfigs", "(", "c", "context", ".", "Context", ")", "(", "string", ",", "error", ")", "{", "cfg", ",", "rev", ",", "err", ":=", "fetchConfigs", "(", "c", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "errors", ...
// ImportConfigs fetches projects.cfg and updates datastore copy of it. // // Called from cron.
[ "ImportConfigs", "fetches", "projects", ".", "cfg", "and", "updates", "datastore", "copy", "of", "it", ".", "Called", "from", "cron", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/projectscope/config.go#L96-L105
131,028
luci/luci-go
logdog/client/butlerlib/streamclient/registry.go
Register
func (r *Registry) Register(name string, f ClientFactory) { r.lock.Lock() defer r.lock.Unlock() if _, ok := r.protocols[name]; ok { panic(fmt.Errorf("streamclient: protocol already registered for [%s]", name)) } if r.protocols == nil { r.protocols = make(map[string]ClientFactory) } r.protocols[name] = f }
go
func (r *Registry) Register(name string, f ClientFactory) { r.lock.Lock() defer r.lock.Unlock() if _, ok := r.protocols[name]; ok { panic(fmt.Errorf("streamclient: protocol already registered for [%s]", name)) } if r.protocols == nil { r.protocols = make(map[string]ClientFactory) } r.protocols[name] = f }
[ "func", "(", "r", "*", "Registry", ")", "Register", "(", "name", "string", ",", "f", "ClientFactory", ")", "{", "r", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "r", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "if", "_", ",", "ok", ":=...
// Register registers a new protocol and its ClientFactory. // // This can be invoked by calling NewClient with a path spec referencing that // protocol.
[ "Register", "registers", "a", "new", "protocol", "and", "its", "ClientFactory", ".", "This", "can", "be", "invoked", "by", "calling", "NewClient", "with", "a", "path", "spec", "referencing", "that", "protocol", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/client/butlerlib/streamclient/registry.go#L46-L57
131,029
luci/luci-go
logdog/client/butlerlib/streamclient/registry.go
RegisterDefaultProtocols
func RegisterDefaultProtocols(r *Registry) { registerPlatformProtocols(r) // Register common protocols. r.Register("tcp4", tcpProtocolClientFactory("tcp4")) r.Register("tcp6", tcpProtocolClientFactory("tcp6")) }
go
func RegisterDefaultProtocols(r *Registry) { registerPlatformProtocols(r) // Register common protocols. r.Register("tcp4", tcpProtocolClientFactory("tcp4")) r.Register("tcp6", tcpProtocolClientFactory("tcp6")) }
[ "func", "RegisterDefaultProtocols", "(", "r", "*", "Registry", ")", "{", "registerPlatformProtocols", "(", "r", ")", "\n\n", "// Register common protocols.", "r", ".", "Register", "(", "\"", "\"", ",", "tcpProtocolClientFactory", "(", "\"", "\"", ")", ")", "\n",...
// RegisterDefaultProtocols registers the default set of protocols with a // Registry.
[ "RegisterDefaultProtocols", "registers", "the", "default", "set", "of", "protocols", "with", "a", "Registry", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/client/butlerlib/streamclient/registry.go#L96-L102
131,030
luci/luci-go
config/impl/remote/remote.go
service
func (r *remoteImpl) service(ctx context.Context) (*configApi.Service, error) { client, err := r.clients(ctx) if err != nil { return nil, err } service, err := configApi.New(client) if err != nil { return nil, err } service.BasePath = r.serviceURL return service, nil }
go
func (r *remoteImpl) service(ctx context.Context) (*configApi.Service, error) { client, err := r.clients(ctx) if err != nil { return nil, err } service, err := configApi.New(client) if err != nil { return nil, err } service.BasePath = r.serviceURL return service, nil }
[ "func", "(", "r", "*", "remoteImpl", ")", "service", "(", "ctx", "context", ".", "Context", ")", "(", "*", "configApi", ".", "Service", ",", "error", ")", "{", "client", ",", "err", ":=", "r", ".", "clients", "(", "ctx", ")", "\n", "if", "err", "...
// service returns Cloud Endpoints API client bound to the given context. // // It inherits context's deadline and transport.
[ "service", "returns", "Cloud", "Endpoints", "API", "client", "bound", "to", "the", "given", "context", ".", "It", "inherits", "context", "s", "deadline", "and", "transport", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/config/impl/remote/remote.go#L78-L90
131,031
luci/luci-go
config/impl/remote/remote.go
convertMultiWireConfigs
func convertMultiWireConfigs(ctx context.Context, path string, wireConfigs *configApi.LuciConfigGetConfigMultiResponseMessage, metaOnly bool) ([]config.Config, error) { configs := make([]config.Config, len(wireConfigs.Configs)) for i, c := range wireConfigs.Configs { var decoded []byte var err error if !metaOn...
go
func convertMultiWireConfigs(ctx context.Context, path string, wireConfigs *configApi.LuciConfigGetConfigMultiResponseMessage, metaOnly bool) ([]config.Config, error) { configs := make([]config.Config, len(wireConfigs.Configs)) for i, c := range wireConfigs.Configs { var decoded []byte var err error if !metaOn...
[ "func", "convertMultiWireConfigs", "(", "ctx", "context", ".", "Context", ",", "path", "string", ",", "wireConfigs", "*", "configApi", ".", "LuciConfigGetConfigMultiResponseMessage", ",", "metaOnly", "bool", ")", "(", "[", "]", "config", ".", "Config", ",", "err...
// convertMultiWireConfigs is a utility to convert what we get over the wire // into the structs we use in the config package.
[ "convertMultiWireConfigs", "is", "a", "utility", "to", "convert", "what", "we", "get", "over", "the", "wire", "into", "the", "structs", "we", "use", "in", "the", "config", "package", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/config/impl/remote/remote.go#L283-L311
131,032
luci/luci-go
config/impl/remote/remote.go
parseWireRepoType
func parseWireRepoType(s string) config.RepoType { if s == string(config.GitilesRepo) { return config.GitilesRepo } return config.UnknownRepo }
go
func parseWireRepoType(s string) config.RepoType { if s == string(config.GitilesRepo) { return config.GitilesRepo } return config.UnknownRepo }
[ "func", "parseWireRepoType", "(", "s", "string", ")", "config", ".", "RepoType", "{", "if", "s", "==", "string", "(", "config", ".", "GitilesRepo", ")", "{", "return", "config", ".", "GitilesRepo", "\n", "}", "\n\n", "return", "config", ".", "UnknownRepo",...
// parseWireRepoType parses the string received over the wire from // the luci-config service that represents the repo type.
[ "parseWireRepoType", "parses", "the", "string", "received", "over", "the", "wire", "from", "the", "luci", "-", "config", "service", "that", "represents", "the", "repo", "type", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/config/impl/remote/remote.go#L315-L321
131,033
luci/luci-go
config/impl/remote/remote.go
apiErr
func apiErr(e error) error { err, ok := e.(*googleapi.Error) if !ok { return e } if err.Code == 404 { return config.ErrNoConfig } if err.Code >= 500 { return transient.Tag.Apply(err) } return err }
go
func apiErr(e error) error { err, ok := e.(*googleapi.Error) if !ok { return e } if err.Code == 404 { return config.ErrNoConfig } if err.Code >= 500 { return transient.Tag.Apply(err) } return err }
[ "func", "apiErr", "(", "e", "error", ")", "error", "{", "err", ",", "ok", ":=", "e", ".", "(", "*", "googleapi", ".", "Error", ")", "\n", "if", "!", "ok", "{", "return", "e", "\n", "}", "\n", "if", "err", ".", "Code", "==", "404", "{", "retur...
// apiErr converts googleapi.Error to an appropriate type.
[ "apiErr", "converts", "googleapi", ".", "Error", "to", "an", "appropriate", "type", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/config/impl/remote/remote.go#L324-L336
131,034
luci/luci-go
tokenserver/appengine/impl/serviceaccounts/config.go
makeRule
func makeRule(c context.Context, ruleProto *admin.ServiceAccountRule, defaults *admin.ServiceAccountRuleDefaults, rev string) (*Rule, error) { ctx := &validation.Context{Context: c} validateRule(ctx, ruleProto.Name, ruleProto) if err := ctx.Finalize(); err != nil { return nil, err } allowedScopes := stringset.N...
go
func makeRule(c context.Context, ruleProto *admin.ServiceAccountRule, defaults *admin.ServiceAccountRuleDefaults, rev string) (*Rule, error) { ctx := &validation.Context{Context: c} validateRule(ctx, ruleProto.Name, ruleProto) if err := ctx.Finalize(); err != nil { return nil, err } allowedScopes := stringset.N...
[ "func", "makeRule", "(", "c", "context", ".", "Context", ",", "ruleProto", "*", "admin", ".", "ServiceAccountRule", ",", "defaults", "*", "admin", ".", "ServiceAccountRuleDefaults", ",", "rev", "string", ")", "(", "*", "Rule", ",", "error", ")", "{", "ctx"...
// makeRule converts ServiceAccountRule into queriable Rule. // // Mutates 'ruleProto' in-place filling in defaults.
[ "makeRule", "converts", "ServiceAccountRule", "into", "queriable", "Rule", ".", "Mutates", "ruleProto", "in", "-", "place", "filling", "in", "defaults", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/serviceaccounts/config.go#L411-L454
131,035
luci/luci-go
tokenserver/appengine/impl/serviceaccounts/config.go
CheckScopes
func (r *Rule) CheckScopes(scopes []string) error { var notAllowed []string for _, scope := range scopes { if !r.AllowedScopes.Has(scope) { notAllowed = append(notAllowed, scope) } } if len(notAllowed) != 0 { return fmt.Errorf("following scopes are not allowed by the rule %q - %q", r.Rule.Name, notAllowed)...
go
func (r *Rule) CheckScopes(scopes []string) error { var notAllowed []string for _, scope := range scopes { if !r.AllowedScopes.Has(scope) { notAllowed = append(notAllowed, scope) } } if len(notAllowed) != 0 { return fmt.Errorf("following scopes are not allowed by the rule %q - %q", r.Rule.Name, notAllowed)...
[ "func", "(", "r", "*", "Rule", ")", "CheckScopes", "(", "scopes", "[", "]", "string", ")", "error", "{", "var", "notAllowed", "[", "]", "string", "\n", "for", "_", ",", "scope", ":=", "range", "scopes", "{", "if", "!", "r", ".", "AllowedScopes", "....
// CheckScopes returns no errors if all passed scopes are allowed.
[ "CheckScopes", "returns", "no", "errors", "if", "all", "passed", "scopes", "are", "allowed", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/serviceaccounts/config.go#L457-L468
131,036
luci/luci-go
grpc/grpcmon/server.go
NewUnaryServerInterceptor
func NewUnaryServerInterceptor(next grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor { return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) { started := clock.Now(ctx) panicing := true defer func() { // We don't want to ...
go
func NewUnaryServerInterceptor(next grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor { return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) { started := clock.Now(ctx) panicing := true defer func() { // We don't want to ...
[ "func", "NewUnaryServerInterceptor", "(", "next", "grpc", ".", "UnaryServerInterceptor", ")", "grpc", ".", "UnaryServerInterceptor", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "req", "interface", "{", "}", ",", "info", "*", "grpc", ".",...
// NewUnaryServerInterceptor returns an interceptor that gathers RPC handler // metrics and sends them to tsmon. // // It can be optionally chained with other interceptor. The reported metrics // include time spent in this other interceptor too. // // It assumes the RPC context has tsmon initialized already.
[ "NewUnaryServerInterceptor", "returns", "an", "interceptor", "that", "gathers", "RPC", "handler", "metrics", "and", "sends", "them", "to", "tsmon", ".", "It", "can", "be", "optionally", "chained", "with", "other", "interceptor", ".", "The", "reported", "metrics", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/grpc/grpcmon/server.go#L55-L80
131,037
luci/luci-go
grpc/grpcmon/server.go
reportServerRPCMetrics
func reportServerRPCMetrics(ctx context.Context, method string, code codes.Code, dur time.Duration) { grpcServerCount.Add(ctx, 1, method, int(code)) grpcServerDuration.Add(ctx, float64(dur.Nanoseconds()/1e6), method, int(code)) }
go
func reportServerRPCMetrics(ctx context.Context, method string, code codes.Code, dur time.Duration) { grpcServerCount.Add(ctx, 1, method, int(code)) grpcServerDuration.Add(ctx, float64(dur.Nanoseconds()/1e6), method, int(code)) }
[ "func", "reportServerRPCMetrics", "(", "ctx", "context", ".", "Context", ",", "method", "string", ",", "code", "codes", ".", "Code", ",", "dur", "time", ".", "Duration", ")", "{", "grpcServerCount", ".", "Add", "(", "ctx", ",", "1", ",", "method", ",", ...
// reportServerRPCMetrics sends metrics after RPC handler has finished.
[ "reportServerRPCMetrics", "sends", "metrics", "after", "RPC", "handler", "has", "finished", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/grpc/grpcmon/server.go#L83-L86
131,038
luci/luci-go
grpc/grpcutil/errors.go
WrapIfTransient
func WrapIfTransient(err error) error { if err == nil { return nil } if IsTransientCode(Code(err)) { err = transient.Tag.Apply(err) } return err }
go
func WrapIfTransient(err error) error { if err == nil { return nil } if IsTransientCode(Code(err)) { err = transient.Tag.Apply(err) } return err }
[ "func", "WrapIfTransient", "(", "err", "error", ")", "error", "{", "if", "err", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "if", "IsTransientCode", "(", "Code", "(", "err", ")", ")", "{", "err", "=", "transient", ".", "Tag", ".", "Apply", ...
// WrapIfTransient wraps the supplied gRPC error with a transient wrapper if // it has a transient gRPC code, as determined by IsTransientCode. // // If the supplied error is nil, nil will be returned. // // Note that non-gRPC errors will have code grpc.Unknown, which is considered // transient, and be wrapped. This fu...
[ "WrapIfTransient", "wraps", "the", "supplied", "gRPC", "error", "with", "a", "transient", "wrapper", "if", "it", "has", "a", "transient", "gRPC", "code", "as", "determined", "by", "IsTransientCode", ".", "If", "the", "supplied", "error", "is", "nil", "nil", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/grpc/grpcutil/errors.go#L93-L102
131,039
luci/luci-go
grpc/grpcutil/errors.go
CodeStatus
func CodeStatus(code codes.Code) int { if status, ok := codeToStatus[code]; ok { return status } return http.StatusInternalServerError }
go
func CodeStatus(code codes.Code) int { if status, ok := codeToStatus[code]; ok { return status } return http.StatusInternalServerError }
[ "func", "CodeStatus", "(", "code", "codes", ".", "Code", ")", "int", "{", "if", "status", ",", "ok", ":=", "codeToStatus", "[", "code", "]", ";", "ok", "{", "return", "status", "\n", "}", "\n", "return", "http", ".", "StatusInternalServerError", "\n", ...
// CodeStatus maps gRPC codes to HTTP status codes. // Falls back to http.StatusInternalServerError.
[ "CodeStatus", "maps", "gRPC", "codes", "to", "HTTP", "status", "codes", ".", "Falls", "back", "to", "http", ".", "StatusInternalServerError", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/grpc/grpcutil/errors.go#L169-L174
131,040
luci/luci-go
grpc/grpcutil/errors.go
Code
func Code(err error) codes.Code { if code, ok := Tag.In(err); ok { return code } // TODO(nodir): use status.FromError return grpc.Code(errors.Unwrap(err)) }
go
func Code(err error) codes.Code { if code, ok := Tag.In(err); ok { return code } // TODO(nodir): use status.FromError return grpc.Code(errors.Unwrap(err)) }
[ "func", "Code", "(", "err", "error", ")", "codes", ".", "Code", "{", "if", "code", ",", "ok", ":=", "Tag", ".", "In", "(", "err", ")", ";", "ok", "{", "return", "code", "\n", "}", "\n", "// TODO(nodir): use status.FromError", "return", "grpc", ".", "...
// Code returns the gRPC code for a given error. // // In addition to the functionality of grpc.Code, this will unwrap any wrapped // errors before asking for its code.
[ "Code", "returns", "the", "gRPC", "code", "for", "a", "given", "error", ".", "In", "addition", "to", "the", "functionality", "of", "grpc", ".", "Code", "this", "will", "unwrap", "any", "wrapped", "errors", "before", "asking", "for", "its", "code", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/grpc/grpcutil/errors.go#L180-L186
131,041
luci/luci-go
grpc/grpcutil/errors.go
IsTransientCode
func IsTransientCode(code codes.Code) bool { switch code { case codes.Internal, codes.Unknown, codes.Unavailable: return true default: return false } }
go
func IsTransientCode(code codes.Code) bool { switch code { case codes.Internal, codes.Unknown, codes.Unavailable: return true default: return false } }
[ "func", "IsTransientCode", "(", "code", "codes", ".", "Code", ")", "bool", "{", "switch", "code", "{", "case", "codes", ".", "Internal", ",", "codes", ".", "Unknown", ",", "codes", ".", "Unavailable", ":", "return", "true", "\n\n", "default", ":", "retur...
// IsTransientCode returns true if a given gRPC code is associated with a // transient gRPC error type.
[ "IsTransientCode", "returns", "true", "if", "a", "given", "gRPC", "code", "is", "associated", "with", "a", "transient", "gRPC", "error", "type", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/grpc/grpcutil/errors.go#L195-L203
131,042
luci/luci-go
tumble/add_to_journal.go
AddToJournal
func AddToJournal(c context.Context, m ...Mutation) error { (logging.Fields{"count": len(m)}).Infof(c, "tumble.AddToJournal") if len(m) == 0 { return nil } return RunMutation(c, addToJournalMutation(m)) }
go
func AddToJournal(c context.Context, m ...Mutation) error { (logging.Fields{"count": len(m)}).Infof(c, "tumble.AddToJournal") if len(m) == 0 { return nil } return RunMutation(c, addToJournalMutation(m)) }
[ "func", "AddToJournal", "(", "c", "context", ".", "Context", ",", "m", "...", "Mutation", ")", "error", "{", "(", "logging", ".", "Fields", "{", "\"", "\"", ":", "len", "(", "m", ")", "}", ")", ".", "Infof", "(", "c", ",", "\"", "\"", ")", "\n"...
// AddToJournal records one or more Mutation to the tumble journal, but does not // execute any of them. This does so by running a transaction on a pseudo-random // entity group, and journaling the mutations there.
[ "AddToJournal", "records", "one", "or", "more", "Mutation", "to", "the", "tumble", "journal", "but", "does", "not", "execute", "any", "of", "them", ".", "This", "does", "so", "by", "running", "a", "transaction", "on", "a", "pseudo", "-", "random", "entity"...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tumble/add_to_journal.go#L30-L36
131,043
luci/luci-go
client/flagpb/marshal.go
MarshalUntyped
func MarshalUntyped(msg map[string]interface{}) ([]string, error) { return appendFlags(nil, nil, reflect.ValueOf(msg)) }
go
func MarshalUntyped(msg map[string]interface{}) ([]string, error) { return appendFlags(nil, nil, reflect.ValueOf(msg)) }
[ "func", "MarshalUntyped", "(", "msg", "map", "[", "string", "]", "interface", "{", "}", ")", "(", "[", "]", "string", ",", "error", ")", "{", "return", "appendFlags", "(", "nil", ",", "nil", ",", "reflect", ".", "ValueOf", "(", "msg", ")", ")", "\n...
// MarshalUntyped marshals a key-value map to flags.
[ "MarshalUntyped", "marshals", "a", "key", "-", "value", "map", "to", "flags", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/flagpb/marshal.go#L24-L26
131,044
luci/luci-go
server/pprof/token.go
generateToken
func generateToken(c context.Context) (string, error) { logging.Warningf(c, "%q is generating pprof token", auth.CurrentIdentity(c)) return pprofToken.Generate(c, nil, nil, 0) }
go
func generateToken(c context.Context) (string, error) { logging.Warningf(c, "%q is generating pprof token", auth.CurrentIdentity(c)) return pprofToken.Generate(c, nil, nil, 0) }
[ "func", "generateToken", "(", "c", "context", ".", "Context", ")", "(", "string", ",", "error", ")", "{", "logging", ".", "Warningf", "(", "c", ",", "\"", "\"", ",", "auth", ".", "CurrentIdentity", "(", "c", ")", ")", "\n", "return", "pprofToken", "....
// generateToken generates new pprof token. // // The token is URL safe base64 encoded string. Possession of such token allows // to call pprof endpoints. // // The token expires after 12 hours.
[ "generateToken", "generates", "new", "pprof", "token", ".", "The", "token", "is", "URL", "safe", "base64", "encoded", "string", ".", "Possession", "of", "such", "token", "allows", "to", "call", "pprof", "endpoints", ".", "The", "token", "expires", "after", "...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/server/pprof/token.go#L40-L43
131,045
luci/luci-go
server/pprof/token.go
checkToken
func checkToken(c context.Context, tok string) error { _, err := pprofToken.Validate(c, tok, nil) return err }
go
func checkToken(c context.Context, tok string) error { _, err := pprofToken.Validate(c, tok, nil) return err }
[ "func", "checkToken", "(", "c", "context", ".", "Context", ",", "tok", "string", ")", "error", "{", "_", ",", "err", ":=", "pprofToken", ".", "Validate", "(", "c", ",", "tok", ",", "nil", ")", "\n", "return", "err", "\n", "}" ]
// checkToken succeeds if the given pprof token is valid and non-expired.
[ "checkToken", "succeeds", "if", "the", "given", "pprof", "token", "is", "valid", "and", "non", "-", "expired", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/server/pprof/token.go#L46-L49
131,046
luci/luci-go
milo/frontend/middleware.go
replaceAllInChunks
func replaceAllInChunks(chunks []formatChunk, re *regexp.Regexp, repl func(string) template.HTML) []formatChunk { var ret []formatChunk for _, chunk := range chunks { if len(chunk.html) != 0 { ret = append(ret, chunk) continue } s := chunk.str for len(s) != 0 { loc := re.FindStringIndex(s) if loc ...
go
func replaceAllInChunks(chunks []formatChunk, re *regexp.Regexp, repl func(string) template.HTML) []formatChunk { var ret []formatChunk for _, chunk := range chunks { if len(chunk.html) != 0 { ret = append(ret, chunk) continue } s := chunk.str for len(s) != 0 { loc := re.FindStringIndex(s) if loc ...
[ "func", "replaceAllInChunks", "(", "chunks", "[", "]", "formatChunk", ",", "re", "*", "regexp", ".", "Regexp", ",", "repl", "func", "(", "string", ")", "template", ".", "HTML", ")", "[", "]", "formatChunk", "{", "var", "ret", "[", "]", "formatChunk", "...
// replaceAllInChunks behaves like Regexp.ReplaceAllStringFunc, but it only // acts on unprocessed elements of chunks. Already-processed elements are left // as-is. repl returns trusted HTML, performing any necessary escaping.
[ "replaceAllInChunks", "behaves", "like", "Regexp", ".", "ReplaceAllStringFunc", "but", "it", "only", "acts", "on", "unprocessed", "elements", "of", "chunks", ".", "Already", "-", "processed", "elements", "are", "left", "as", "-", "is", ".", "repl", "returns", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L163-L186
131,047
luci/luci-go
milo/frontend/middleware.go
chunksToHTML
func chunksToHTML(chunks []formatChunk) template.HTML { buf := bytes.Buffer{} for _, chunk := range chunks { if len(chunk.html) != 0 { buf.WriteString(string(chunk.html)) } else { buf.WriteString(template.HTMLEscapeString(chunk.str)) } } return template.HTML(buf.String()) }
go
func chunksToHTML(chunks []formatChunk) template.HTML { buf := bytes.Buffer{} for _, chunk := range chunks { if len(chunk.html) != 0 { buf.WriteString(string(chunk.html)) } else { buf.WriteString(template.HTMLEscapeString(chunk.str)) } } return template.HTML(buf.String()) }
[ "func", "chunksToHTML", "(", "chunks", "[", "]", "formatChunk", ")", "template", ".", "HTML", "{", "buf", ":=", "bytes", ".", "Buffer", "{", "}", "\n", "for", "_", ",", "chunk", ":=", "range", "chunks", "{", "if", "len", "(", "chunk", ".", "html", ...
// chunksToHTML concatenates chunks together, escaping as needed, to return a // final completed HTML string.
[ "chunksToHTML", "concatenates", "chunks", "together", "escaping", "as", "needed", "to", "return", "a", "final", "completed", "HTML", "string", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L190-L200
131,048
luci/luci-go
milo/frontend/middleware.go
recipeLink
func recipeLink(r *buildbucketpb.BuildInfra_Recipe) (result template.HTML) { if r == nil { return } // We don't know location of recipes within the repo and getting that // information is not trivial, so use code search, which is precise enough. csHost := "cs.chromium.org" if strings.HasPrefix(r.CipdPackage, "i...
go
func recipeLink(r *buildbucketpb.BuildInfra_Recipe) (result template.HTML) { if r == nil { return } // We don't know location of recipes within the repo and getting that // information is not trivial, so use code search, which is precise enough. csHost := "cs.chromium.org" if strings.HasPrefix(r.CipdPackage, "i...
[ "func", "recipeLink", "(", "r", "*", "buildbucketpb", ".", "BuildInfra_Recipe", ")", "(", "result", "template", ".", "HTML", ")", "{", "if", "r", "==", "nil", "{", "return", "\n", "}", "\n", "// We don't know location of recipes within the repo and getting that", ...
// recipeLink generates a link to codesearch given a recipe bundle.
[ "recipeLink", "generates", "a", "link", "to", "codesearch", "given", "a", "recipe", "bundle", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L235-L247
131,049
luci/luci-go
milo/frontend/middleware.go
botLink
func botLink(s *buildbucketpb.BuildInfra_Swarming) (result template.HTML) { for _, d := range s.GetBotDimensions() { if d.Key == "id" { return ui.NewLink( d.Value, fmt.Sprintf("https://%s/bot?id=%s", s.Hostname, d.Value), fmt.Sprintf("swarming bot %s", d.Value)).HTML() } } return "N/A" }
go
func botLink(s *buildbucketpb.BuildInfra_Swarming) (result template.HTML) { for _, d := range s.GetBotDimensions() { if d.Key == "id" { return ui.NewLink( d.Value, fmt.Sprintf("https://%s/bot?id=%s", s.Hostname, d.Value), fmt.Sprintf("swarming bot %s", d.Value)).HTML() } } return "N/A" }
[ "func", "botLink", "(", "s", "*", "buildbucketpb", ".", "BuildInfra_Swarming", ")", "(", "result", "template", ".", "HTML", ")", "{", "for", "_", ",", "d", ":=", "range", "s", ".", "GetBotDimensions", "(", ")", "{", "if", "d", ".", "Key", "==", "\"",...
// botLink generates a link to a swarming bot given a buildbucketpb.BuildInfra_Swarming struct.
[ "botLink", "generates", "a", "link", "to", "a", "swarming", "bot", "given", "a", "buildbucketpb", ".", "BuildInfra_Swarming", "struct", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L250-L260
131,050
luci/luci-go
milo/frontend/middleware.go
toTime
func toTime(ts *timestamp.Timestamp) (result time.Time) { // We want a zero-ed out time.Time, not one set to the epoch. if t, err := ptypes.Timestamp(ts); err == nil { result = t } return }
go
func toTime(ts *timestamp.Timestamp) (result time.Time) { // We want a zero-ed out time.Time, not one set to the epoch. if t, err := ptypes.Timestamp(ts); err == nil { result = t } return }
[ "func", "toTime", "(", "ts", "*", "timestamp", ".", "Timestamp", ")", "(", "result", "time", ".", "Time", ")", "{", "// We want a zero-ed out time.Time, not one set to the epoch.", "if", "t", ",", "err", ":=", "ptypes", ".", "Timestamp", "(", "ts", ")", ";", ...
// toTime returns the time.Time format for the proto timestamp. // If the proto timestamp is invalid, we return a zero-ed out time.Time.
[ "toTime", "returns", "the", "time", ".", "Time", "format", "for", "the", "proto", "timestamp", ".", "If", "the", "proto", "timestamp", "is", "invalid", "we", "return", "a", "zero", "-", "ed", "out", "time", ".", "Time", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L291-L297
131,051
luci/luci-go
milo/frontend/middleware.go
obfuscateEmail
func obfuscateEmail(email string) template.HTML { email = template.HTMLEscapeString(email) return template.HTML(strings.Replace( email, "@", "<span style=\"display:none\">ohnoyoudont</span>@", -1)) }
go
func obfuscateEmail(email string) template.HTML { email = template.HTMLEscapeString(email) return template.HTML(strings.Replace( email, "@", "<span style=\"display:none\">ohnoyoudont</span>@", -1)) }
[ "func", "obfuscateEmail", "(", "email", "string", ")", "template", ".", "HTML", "{", "email", "=", "template", ".", "HTMLEscapeString", "(", "email", ")", "\n", "return", "template", ".", "HTML", "(", "strings", ".", "Replace", "(", "email", ",", "\"", "...
// obfuscateEmail converts a string containing email adddress email@address.com // into email<junk>@address.com.
[ "obfuscateEmail", "converts", "a", "string", "containing", "email", "adddress", "email" ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L301-L305
131,052
luci/luci-go
milo/frontend/middleware.go
parseRFC3339
func parseRFC3339(s string) time.Time { t, err := time.Parse(time.RFC3339, s) if err == nil { return t } t, err = time.Parse(time.RFC3339Nano, s) if err == nil { return t } return time.Time{} }
go
func parseRFC3339(s string) time.Time { t, err := time.Parse(time.RFC3339, s) if err == nil { return t } t, err = time.Parse(time.RFC3339Nano, s) if err == nil { return t } return time.Time{} }
[ "func", "parseRFC3339", "(", "s", "string", ")", "time", ".", "Time", "{", "t", ",", "err", ":=", "time", ".", "Parse", "(", "time", ".", "RFC3339", ",", "s", ")", "\n", "if", "err", "==", "nil", "{", "return", "t", "\n", "}", "\n", "t", ",", ...
// parseRFC3339 parses time represented as a RFC3339 or RFC3339Nano string. // If cannot parse, returns zero time.
[ "parseRFC3339", "parses", "time", "represented", "as", "a", "RFC3339", "or", "RFC3339Nano", "string", ".", "If", "cannot", "parse", "returns", "zero", "time", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L309-L319
131,053
luci/luci-go
milo/frontend/middleware.go
GetLimit
func GetLimit(r *http.Request, def int) int { sLimit := r.FormValue("limit") if sLimit == "" { sLimit = r.FormValue("numbuilds") if sLimit == "" { sLimit = r.FormValue("num_builds") if sLimit == "" { return def } } } limit, err := strconv.Atoi(sLimit) if err != nil || limit < 0 { return def }...
go
func GetLimit(r *http.Request, def int) int { sLimit := r.FormValue("limit") if sLimit == "" { sLimit = r.FormValue("numbuilds") if sLimit == "" { sLimit = r.FormValue("num_builds") if sLimit == "" { return def } } } limit, err := strconv.Atoi(sLimit) if err != nil || limit < 0 { return def }...
[ "func", "GetLimit", "(", "r", "*", "http", ".", "Request", ",", "def", "int", ")", "int", "{", "sLimit", ":=", "r", ".", "FormValue", "(", "\"", "\"", ")", "\n", "if", "sLimit", "==", "\"", "\"", "{", "sLimit", "=", "r", ".", "FormValue", "(", ...
// GetLimit extracts the "limit", "numbuilds", or "num_builds" http param from // the request, or returns def implying no limit was specified.
[ "GetLimit", "extracts", "the", "limit", "numbuilds", "or", "num_builds", "http", "param", "from", "the", "request", "or", "returns", "def", "implying", "no", "limit", "was", "specified", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L348-L364
131,054
luci/luci-go
milo/frontend/middleware.go
GetReload
func GetReload(r *http.Request, def int) int { sReload := r.FormValue("reload") if sReload == "" { return def } refresh, err := strconv.Atoi(sReload) if err != nil || refresh < 0 { return def } return refresh }
go
func GetReload(r *http.Request, def int) int { sReload := r.FormValue("reload") if sReload == "" { return def } refresh, err := strconv.Atoi(sReload) if err != nil || refresh < 0 { return def } return refresh }
[ "func", "GetReload", "(", "r", "*", "http", ".", "Request", ",", "def", "int", ")", "int", "{", "sReload", ":=", "r", ".", "FormValue", "(", "\"", "\"", ")", "\n", "if", "sReload", "==", "\"", "\"", "{", "return", "def", "\n", "}", "\n", "refresh...
// GetReload extracts the "reload" http param from the request, // or returns def implying no limit was specified.
[ "GetReload", "extracts", "the", "reload", "http", "param", "from", "the", "request", "or", "returns", "def", "implying", "no", "limit", "was", "specified", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L368-L378
131,055
luci/luci-go
milo/frontend/middleware.go
renderMarkdown
func renderMarkdown(t string) (results template.HTML) { // We don't want auto punctuation, which changes "foo" into “foo” r := blackfriday.NewHTMLRenderer(blackfriday.HTMLRendererParameters{ Flags: blackfriday.CommonHTMLFlags &^ blackfriday.Smartypants, }) buf := bytes.NewBuffer(blackfriday.Run( []byte(t), bl...
go
func renderMarkdown(t string) (results template.HTML) { // We don't want auto punctuation, which changes "foo" into “foo” r := blackfriday.NewHTMLRenderer(blackfriday.HTMLRendererParameters{ Flags: blackfriday.CommonHTMLFlags &^ blackfriday.Smartypants, }) buf := bytes.NewBuffer(blackfriday.Run( []byte(t), bl...
[ "func", "renderMarkdown", "(", "t", "string", ")", "(", "results", "template", ".", "HTML", ")", "{", "// We don't want auto punctuation, which changes \"foo\" into “foo”", "r", ":=", "blackfriday", ".", "NewHTMLRenderer", "(", "blackfriday", ".", "HTMLRendererParameters"...
// renderMarkdown renders the given text as markdown HTML. // This uses blackfriday to convert from markdown to HTML, // and sanitizehtml to allow only a small subset of HTML through.
[ "renderMarkdown", "renders", "the", "given", "text", "as", "markdown", "HTML", ".", "This", "uses", "blackfriday", "to", "convert", "from", "markdown", "to", "HTML", "and", "sanitizehtml", "to", "allow", "only", "a", "small", "subset", "of", "HTML", "through",...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L385-L399
131,056
luci/luci-go
milo/frontend/middleware.go
pagedURL
func pagedURL(r *http.Request, limit int, cursor string) string { if limit == 0 { limit = GetLimit(r, -1) if limit < 0 { limit = 0 } } values := r.URL.Query() switch cursor { case "EMPTY": values.Del("cursor") case "": // Do nothing, just leave the cursor in. default: values.Set("cursor", cursor) ...
go
func pagedURL(r *http.Request, limit int, cursor string) string { if limit == 0 { limit = GetLimit(r, -1) if limit < 0 { limit = 0 } } values := r.URL.Query() switch cursor { case "EMPTY": values.Del("cursor") case "": // Do nothing, just leave the cursor in. default: values.Set("cursor", cursor) ...
[ "func", "pagedURL", "(", "r", "*", "http", ".", "Request", ",", "limit", "int", ",", "cursor", "string", ")", "string", "{", "if", "limit", "==", "0", "{", "limit", "=", "GetLimit", "(", "r", ",", "-", "1", ")", "\n", "if", "limit", "<", "0", "...
// pagedURL returns a self URL with the given cursor and limit paging options. // if limit is set to 0, then inherit whatever limit is set in request. If // both are unspecified, then limit is omitted.
[ "pagedURL", "returns", "a", "self", "URL", "with", "the", "given", "cursor", "and", "limit", "paging", "options", ".", "if", "limit", "is", "set", "to", "0", "then", "inherit", "whatever", "limit", "is", "set", "in", "request", ".", "If", "both", "are", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L404-L429
131,057
luci/luci-go
milo/frontend/middleware.go
percent
func percent(numerator, divisor int) string { p := float64(numerator) * 100.0 / float64(divisor) return fmt.Sprintf("%.1f", p) }
go
func percent(numerator, divisor int) string { p := float64(numerator) * 100.0 / float64(divisor) return fmt.Sprintf("%.1f", p) }
[ "func", "percent", "(", "numerator", ",", "divisor", "int", ")", "string", "{", "p", ":=", "float64", "(", "numerator", ")", "*", "100.0", "/", "float64", "(", "divisor", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "p", ")", "...
// percent divides one number by a divisor and returns the percentage in string form.
[ "percent", "divides", "one", "number", "by", "a", "divisor", "and", "returns", "the", "percentage", "in", "string", "form", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L432-L435
131,058
luci/luci-go
milo/frontend/middleware.go
faviconMIMEType
func faviconMIMEType(fileURL string) string { switch { case strings.HasSuffix(fileURL, ".png"): return "image/png" case strings.HasSuffix(fileURL, ".ico"): return "image/ico" case strings.HasSuffix(fileURL, ".jpeg"): fallthrough case strings.HasSuffix(fileURL, ".jpg"): return "image/jpeg" case strings.Has...
go
func faviconMIMEType(fileURL string) string { switch { case strings.HasSuffix(fileURL, ".png"): return "image/png" case strings.HasSuffix(fileURL, ".ico"): return "image/ico" case strings.HasSuffix(fileURL, ".jpeg"): fallthrough case strings.HasSuffix(fileURL, ".jpg"): return "image/jpeg" case strings.Has...
[ "func", "faviconMIMEType", "(", "fileURL", "string", ")", "string", "{", "switch", "{", "case", "strings", ".", "HasSuffix", "(", "fileURL", ",", "\"", "\"", ")", ":", "return", "\"", "\"", "\n", "case", "strings", ".", "HasSuffix", "(", "fileURL", ",", ...
// faviconMIMEType derives the MIME type from a URL's file extension. Only valid // favicon image formats are supported.
[ "faviconMIMEType", "derives", "the", "MIME", "type", "from", "a", "URL", "s", "file", "extension", ".", "Only", "valid", "favicon", "image", "formats", "are", "supported", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L439-L453
131,059
luci/luci-go
milo/frontend/middleware.go
getTemplateBundle
func getTemplateBundle(templatePath string) *templates.Bundle { return &templates.Bundle{ Loader: templates.FileSystemLoader(templatePath), DebugMode: info.IsDevAppServer, DefaultTemplate: "base", DefaultArgs: func(c context.Context, e *templates.Extra) (templates.Args, error) { loginURL, err...
go
func getTemplateBundle(templatePath string) *templates.Bundle { return &templates.Bundle{ Loader: templates.FileSystemLoader(templatePath), DebugMode: info.IsDevAppServer, DefaultTemplate: "base", DefaultArgs: func(c context.Context, e *templates.Extra) (templates.Args, error) { loginURL, err...
[ "func", "getTemplateBundle", "(", "templatePath", "string", ")", "*", "templates", ".", "Bundle", "{", "return", "&", "templates", ".", "Bundle", "{", "Loader", ":", "templates", ".", "FileSystemLoader", "(", "templatePath", ")", ",", "DebugMode", ":", "info",...
// getTemplateBundles is used to render HTML templates. It provides base args // passed to all templates. It takes a path to the template folder, relative // to the path of the binary during runtime.
[ "getTemplateBundles", "is", "used", "to", "render", "HTML", "templates", ".", "It", "provides", "base", "args", "passed", "to", "all", "templates", ".", "It", "takes", "a", "path", "to", "the", "template", "folder", "relative", "to", "the", "path", "of", "...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L458-L492
131,060
luci/luci-go
milo/frontend/middleware.go
withBuildbucketClient
func withBuildbucketClient(c *router.Context, next router.Handler) { c.Context = buildbucket.WithClientFactory(c.Context, buildbucket.ProdClientFactory) next(c) }
go
func withBuildbucketClient(c *router.Context, next router.Handler) { c.Context = buildbucket.WithClientFactory(c.Context, buildbucket.ProdClientFactory) next(c) }
[ "func", "withBuildbucketClient", "(", "c", "*", "router", ".", "Context", ",", "next", "router", ".", "Handler", ")", "{", "c", ".", "Context", "=", "buildbucket", ".", "WithClientFactory", "(", "c", ".", "Context", ",", "buildbucket", ".", "ProdClientFactor...
// withBuildbucketClient is a middleware that installs a production buildbucket RPC client into the context.
[ "withBuildbucketClient", "is", "a", "middleware", "that", "installs", "a", "production", "buildbucket", "RPC", "client", "into", "the", "context", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L495-L498
131,061
luci/luci-go
milo/frontend/middleware.go
withGitMiddleware
func withGitMiddleware(c *router.Context, next router.Handler) { acls, err := gitacls.FromConfig(c.Context, common.GetSettings(c.Context).SourceAcls) if err != nil { ErrorHandler(c, err) return } c.Context = git.UseACLs(c.Context, acls) next(c) }
go
func withGitMiddleware(c *router.Context, next router.Handler) { acls, err := gitacls.FromConfig(c.Context, common.GetSettings(c.Context).SourceAcls) if err != nil { ErrorHandler(c, err) return } c.Context = git.UseACLs(c.Context, acls) next(c) }
[ "func", "withGitMiddleware", "(", "c", "*", "router", ".", "Context", ",", "next", "router", ".", "Handler", ")", "{", "acls", ",", "err", ":=", "gitacls", ".", "FromConfig", "(", "c", ".", "Context", ",", "common", ".", "GetSettings", "(", "c", ".", ...
// withGitMiddleware is a middleware that installs a prod Gerrit and Gitiles client // factory into the context. Both use Milo's credentials if current user is // has been granted read access in settings.cfg. // // This middleware must be installed after the auth middleware.
[ "withGitMiddleware", "is", "a", "middleware", "that", "installs", "a", "prod", "Gerrit", "and", "Gitiles", "client", "factory", "into", "the", "context", ".", "Both", "use", "Milo", "s", "credentials", "if", "current", "user", "is", "has", "been", "granted", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L505-L513
131,062
luci/luci-go
milo/frontend/middleware.go
withAccessClientMiddleware
func withAccessClientMiddleware(c *router.Context, next router.Handler) { client, err := common.NewAccessClient(c.Context) if err != nil { ErrorHandler(c, err) return } c.Context = common.WithAccessClient(c.Context, client) next(c) }
go
func withAccessClientMiddleware(c *router.Context, next router.Handler) { client, err := common.NewAccessClient(c.Context) if err != nil { ErrorHandler(c, err) return } c.Context = common.WithAccessClient(c.Context, client) next(c) }
[ "func", "withAccessClientMiddleware", "(", "c", "*", "router", ".", "Context", ",", "next", "router", ".", "Handler", ")", "{", "client", ",", "err", ":=", "common", ".", "NewAccessClient", "(", "c", ".", "Context", ")", "\n", "if", "err", "!=", "nil", ...
// withAccessClientMiddleware is a middleware that installs a prod buildbucket // access API client into the context. // // This middleware depends on auth middleware in order to generate the access // client, so it must be called after the auth middleware is installed.
[ "withAccessClientMiddleware", "is", "a", "middleware", "that", "installs", "a", "prod", "buildbucket", "access", "API", "client", "into", "the", "context", ".", "This", "middleware", "depends", "on", "auth", "middleware", "in", "order", "to", "generate", "the", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L520-L528
131,063
luci/luci-go
milo/frontend/middleware.go
projectACLMiddleware
func projectACLMiddleware(c *router.Context, next router.Handler) { luciProject := c.Params.ByName("project") switch allowed, err := common.IsAllowed(c.Context, luciProject); { case err != nil: ErrorHandler(c, err) case !allowed: if auth.CurrentIdentity(c.Context) == identity.AnonymousIdentity { ErrorHandler...
go
func projectACLMiddleware(c *router.Context, next router.Handler) { luciProject := c.Params.ByName("project") switch allowed, err := common.IsAllowed(c.Context, luciProject); { case err != nil: ErrorHandler(c, err) case !allowed: if auth.CurrentIdentity(c.Context) == identity.AnonymousIdentity { ErrorHandler...
[ "func", "projectACLMiddleware", "(", "c", "*", "router", ".", "Context", ",", "next", "router", ".", "Handler", ")", "{", "luciProject", ":=", "c", ".", "Params", ".", "ByName", "(", "\"", "\"", ")", "\n", "switch", "allowed", ",", "err", ":=", "common...
// projectACLMiddleware adds ACL checks on a per-project basis. // Expects c.Params to have project parameter.
[ "projectACLMiddleware", "adds", "ACL", "checks", "on", "a", "per", "-", "project", "basis", ".", "Expects", "c", ".", "Params", "to", "have", "project", "parameter", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L532-L547
131,064
luci/luci-go
milo/frontend/middleware.go
emulationMiddleware
func emulationMiddleware(c *router.Context, next router.Handler) { c.Context = buildstore.WithEmulation(c.Context, c.Request.FormValue("emulation") != "") next(c) }
go
func emulationMiddleware(c *router.Context, next router.Handler) { c.Context = buildstore.WithEmulation(c.Context, c.Request.FormValue("emulation") != "") next(c) }
[ "func", "emulationMiddleware", "(", "c", "*", "router", ".", "Context", ",", "next", "router", ".", "Handler", ")", "{", "c", ".", "Context", "=", "buildstore", ".", "WithEmulation", "(", "c", ".", "Context", ",", "c", ".", "Request", ".", "FormValue", ...
// emulationMiddleware enables buildstore emulation if "emulation" query // string parameter is not empty.
[ "emulationMiddleware", "enables", "buildstore", "emulation", "if", "emulation", "query", "string", "parameter", "is", "not", "empty", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L551-L554
131,065
luci/luci-go
milo/frontend/middleware.go
ProjectLinks
func ProjectLinks(c context.Context, project, group string) []ui.LinkGroup { if project == "" { return nil } projLinks := []*ui.Link{ ui.NewLink( "Builders", fmt.Sprintf("/p/%s/builders", project), fmt.Sprintf("All builders for project %s", project))} links := []ui.LinkGroup{ { Name: ui.NewLink( ...
go
func ProjectLinks(c context.Context, project, group string) []ui.LinkGroup { if project == "" { return nil } projLinks := []*ui.Link{ ui.NewLink( "Builders", fmt.Sprintf("/p/%s/builders", project), fmt.Sprintf("All builders for project %s", project))} links := []ui.LinkGroup{ { Name: ui.NewLink( ...
[ "func", "ProjectLinks", "(", "c", "context", ".", "Context", ",", "project", ",", "group", "string", ")", "[", "]", "ui", ".", "LinkGroup", "{", "if", "project", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n", "projLinks", ":=", "[", "]", ...
// ProjectLinks returns the navigation list surrounding a project and optionally group.
[ "ProjectLinks", "returns", "the", "navigation", "list", "surrounding", "a", "project", "and", "optionally", "group", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/middleware.go#L557-L598
131,066
luci/luci-go
milo/buildsource/buildbucket/client.go
WithClientFactory
func WithClientFactory(c context.Context, factory clientFactory) context.Context { return context.WithValue(c, &clientContextKey, factory) }
go
func WithClientFactory(c context.Context, factory clientFactory) context.Context { return context.WithValue(c, &clientContextKey, factory) }
[ "func", "WithClientFactory", "(", "c", "context", ".", "Context", ",", "factory", "clientFactory", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "c", ",", "&", "clientContextKey", ",", "factory", ")", "\n", "}" ]
// WithClientFactory installs a buildbucket rpc client in the context.
[ "WithClientFactory", "installs", "a", "buildbucket", "rpc", "client", "in", "the", "context", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/buildbucket/client.go#L44-L46
131,067
luci/luci-go
buildbucket/cli/baserun.go
initClients
func (r *baseCommandRun) initClients(ctx context.Context) error { // Create HTTP Client. authOpts, err := r.authFlags.Options() if err != nil { return err } r.httpClient, err = auth.NewAuthenticator(ctx, auth.SilentLogin, authOpts).Client() if err != nil { return err } // Validate -host if r.host == "" { ...
go
func (r *baseCommandRun) initClients(ctx context.Context) error { // Create HTTP Client. authOpts, err := r.authFlags.Options() if err != nil { return err } r.httpClient, err = auth.NewAuthenticator(ctx, auth.SilentLogin, authOpts).Client() if err != nil { return err } // Validate -host if r.host == "" { ...
[ "func", "(", "r", "*", "baseCommandRun", ")", "initClients", "(", "ctx", "context", ".", "Context", ")", "error", "{", "// Create HTTP Client.", "authOpts", ",", "err", ":=", "r", ".", "authFlags", ".", "Options", "(", ")", "\n", "if", "err", "!=", "nil"...
// initClients validates -host flag and initializes r.httpClient and r.client.
[ "initClients", "validates", "-", "host", "flag", "and", "initializes", "r", ".", "httpClient", "and", "r", ".", "client", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/cli/baserun.go#L78-L111
131,068
luci/luci-go
buildbucket/cli/baserun.go
retrieveBuildID
func (r *baseCommandRun) retrieveBuildID(ctx context.Context, build string) (int64, error) { getBuild, err := protoutil.ParseGetBuildRequest(build) if err != nil { return 0, err } if getBuild.Id != 0 { return getBuild.Id, nil } res, err := r.client.GetBuild(ctx, getBuild) if err != nil { return 0, err }...
go
func (r *baseCommandRun) retrieveBuildID(ctx context.Context, build string) (int64, error) { getBuild, err := protoutil.ParseGetBuildRequest(build) if err != nil { return 0, err } if getBuild.Id != 0 { return getBuild.Id, nil } res, err := r.client.GetBuild(ctx, getBuild) if err != nil { return 0, err }...
[ "func", "(", "r", "*", "baseCommandRun", ")", "retrieveBuildID", "(", "ctx", "context", ".", "Context", ",", "build", "string", ")", "(", "int64", ",", "error", ")", "{", "getBuild", ",", "err", ":=", "protoutil", ".", "ParseGetBuildRequest", "(", "build",...
// retrieveBuildID converts a build string into a build id. // May make a GetBuild RPC.
[ "retrieveBuildID", "converts", "a", "build", "string", "into", "a", "build", "id", ".", "May", "make", "a", "GetBuild", "RPC", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/cli/baserun.go#L174-L189
131,069
luci/luci-go
gce/api/config/v1/configs.go
Validate
func (cfgs *Configs) Validate(c *validation.Context) { prefixes := make([]string, 0, len(cfgs.GetVms())) for i, cfg := range cfgs.GetVms() { c.Enter("vms config %d", i) if cfg.Prefix == "" { c.Errorf("prefix is required") } // Ensure no prefix is a prefix of any other prefix. Building a prefix tree // an...
go
func (cfgs *Configs) Validate(c *validation.Context) { prefixes := make([]string, 0, len(cfgs.GetVms())) for i, cfg := range cfgs.GetVms() { c.Enter("vms config %d", i) if cfg.Prefix == "" { c.Errorf("prefix is required") } // Ensure no prefix is a prefix of any other prefix. Building a prefix tree // an...
[ "func", "(", "cfgs", "*", "Configs", ")", "Validate", "(", "c", "*", "validation", ".", "Context", ")", "{", "prefixes", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "cfgs", ".", "GetVms", "(", ")", ")", ")", "\n", "for", "...
// Validate validates these configs. Kinds must already be applied.
[ "Validate", "validates", "these", "configs", ".", "Kinds", "must", "already", "be", "applied", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/gce/api/config/v1/configs.go#L24-L46
131,070
luci/luci-go
common/proto/gerrit/gerrit.mock.pb.go
NewMockGerritClient
func NewMockGerritClient(ctrl *gomock.Controller) *MockGerritClient { mock := &MockGerritClient{ctrl: ctrl} mock.recorder = &MockGerritClientMockRecorder{mock} return mock }
go
func NewMockGerritClient(ctrl *gomock.Controller) *MockGerritClient { mock := &MockGerritClient{ctrl: ctrl} mock.recorder = &MockGerritClientMockRecorder{mock} return mock }
[ "func", "NewMockGerritClient", "(", "ctrl", "*", "gomock", ".", "Controller", ")", "*", "MockGerritClient", "{", "mock", ":=", "&", "MockGerritClient", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockGerritClientMockRecorder", "{",...
// NewMockGerritClient creates a new mock instance
[ "NewMockGerritClient", "creates", "a", "new", "mock", "instance" ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/proto/gerrit/gerrit.mock.pb.go#L27-L31
131,071
luci/luci-go
common/proto/gerrit/gerrit.mock.pb.go
ChangeEditPublish
func (mr *MockGerritClientMockRecorder) ChangeEditPublish(ctx, in interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, in}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChangeEditPublish", reflect.TypeOf((*MockGerritClient)(nil).ChangeEditPu...
go
func (mr *MockGerritClientMockRecorder) ChangeEditPublish(ctx, in interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, in}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChangeEditPublish", reflect.TypeOf((*MockGerritClient)(nil).ChangeEditPu...
[ "func", "(", "mr", "*", "MockGerritClientMockRecorder", ")", "ChangeEditPublish", "(", "ctx", ",", "in", "interface", "{", "}", ",", "opts", "...", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "mr", ".", "mock", ".", "ctrl", ".", "T", ...
// ChangeEditPublish indicates an expected call of ChangeEditPublish
[ "ChangeEditPublish", "indicates", "an", "expected", "call", "of", "ChangeEditPublish" ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/proto/gerrit/gerrit.mock.pb.go#L112-L116
131,072
luci/luci-go
common/proto/gerrit/gerrit.mock.pb.go
NewMockGerritServer
func NewMockGerritServer(ctrl *gomock.Controller) *MockGerritServer { mock := &MockGerritServer{ctrl: ctrl} mock.recorder = &MockGerritServerMockRecorder{mock} return mock }
go
func NewMockGerritServer(ctrl *gomock.Controller) *MockGerritServer { mock := &MockGerritServer{ctrl: ctrl} mock.recorder = &MockGerritServerMockRecorder{mock} return mock }
[ "func", "NewMockGerritServer", "(", "ctrl", "*", "gomock", ".", "Controller", ")", "*", "MockGerritServer", "{", "mock", ":=", "&", "MockGerritServer", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockGerritServerMockRecorder", "{",...
// NewMockGerritServer creates a new mock instance
[ "NewMockGerritServer", "creates", "a", "new", "mock", "instance" ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/proto/gerrit/gerrit.mock.pb.go#L190-L194
131,073
luci/luci-go
common/proto/gerrit/gerrit.mock.pb.go
GetChange
func (mr *MockGerritServerMockRecorder) GetChange(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetChange", reflect.TypeOf((*MockGerritServer)(nil).GetChange), arg0, arg1) }
go
func (mr *MockGerritServerMockRecorder) GetChange(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetChange", reflect.TypeOf((*MockGerritServer)(nil).GetChange), arg0, arg1) }
[ "func", "(", "mr", "*", "MockGerritServerMockRecorder", ")", "GetChange", "(", "arg0", ",", "arg1", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "mr", ".", "mock", ".", "ctrl", ".", "T", ".", "Helper", "(", ")", "\n", "return", "mr", ...
// GetChange indicates an expected call of GetChange
[ "GetChange", "indicates", "an", "expected", "call", "of", "GetChange" ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/proto/gerrit/gerrit.mock.pb.go#L211-L214
131,074
luci/luci-go
cipd/client/cipd/resolver.go
Resolve
func (r *Resolver) Resolve(ctx context.Context, file *ensure.File, expander template.Expander) (*ensure.ResolvedFile, error) { return file.Resolve(func(pkg, ver string) (common.Pin, error) { return r.ResolvePackage(ctx, pkg, ver) }, expander) }
go
func (r *Resolver) Resolve(ctx context.Context, file *ensure.File, expander template.Expander) (*ensure.ResolvedFile, error) { return file.Resolve(func(pkg, ver string) (common.Pin, error) { return r.ResolvePackage(ctx, pkg, ver) }, expander) }
[ "func", "(", "r", "*", "Resolver", ")", "Resolve", "(", "ctx", "context", ".", "Context", ",", "file", "*", "ensure", ".", "File", ",", "expander", "template", ".", "Expander", ")", "(", "*", "ensure", ".", "ResolvedFile", ",", "error", ")", "{", "re...
// Resolve resolves versions of all packages in the ensure file using the // given expander to expand templates. // // Succeeds only if all packages have been successfully resolved and verified. // // Names of packages that failed the resolution are returned as part of the // multi-error.
[ "Resolve", "resolves", "versions", "of", "all", "packages", "in", "the", "ensure", "file", "using", "the", "given", "expander", "to", "expand", "templates", ".", "Succeeds", "only", "if", "all", "packages", "have", "been", "successfully", "resolved", "and", "v...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/resolver.go#L110-L114
131,075
luci/luci-go
cipd/client/cipd/resolver.go
verifyPin
func (r *Resolver) verifyPin(ctx context.Context, pin common.Pin) error { promise := r.verifying.Get(ctx, pin, func(ctx context.Context) (interface{}, error) { logging.Debugf(ctx, "Validating pin %s...", pin) _, err := r.Client.DescribeInstance(ctx, pin, nil) if err == nil { logging.Debugf(ctx, "Pin %s succes...
go
func (r *Resolver) verifyPin(ctx context.Context, pin common.Pin) error { promise := r.verifying.Get(ctx, pin, func(ctx context.Context) (interface{}, error) { logging.Debugf(ctx, "Validating pin %s...", pin) _, err := r.Client.DescribeInstance(ctx, pin, nil) if err == nil { logging.Debugf(ctx, "Pin %s succes...
[ "func", "(", "r", "*", "Resolver", ")", "verifyPin", "(", "ctx", "context", ".", "Context", ",", "pin", "common", ".", "Pin", ")", "error", "{", "promise", ":=", "r", ".", "verifying", ".", "Get", "(", "ctx", ",", "pin", ",", "func", "(", "ctx", ...
// verifyPin returns nil if the given pin exists on the backend.
[ "verifyPin", "returns", "nil", "if", "the", "given", "pin", "exists", "on", "the", "backend", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/resolver.go#L193-L206
131,076
luci/luci-go
machine-db/appengine/rpc/machines.go
CreateMachine
func (*Service) CreateMachine(c context.Context, req *crimson.CreateMachineRequest) (*crimson.Machine, error) { if err := createMachine(c, req.Machine); err != nil { return nil, err } return req.Machine, nil }
go
func (*Service) CreateMachine(c context.Context, req *crimson.CreateMachineRequest) (*crimson.Machine, error) { if err := createMachine(c, req.Machine); err != nil { return nil, err } return req.Machine, nil }
[ "func", "(", "*", "Service", ")", "CreateMachine", "(", "c", "context", ".", "Context", ",", "req", "*", "crimson", ".", "CreateMachineRequest", ")", "(", "*", "crimson", ".", "Machine", ",", "error", ")", "{", "if", "err", ":=", "createMachine", "(", ...
// CreateMachine handles a request to create a new machine.
[ "CreateMachine", "handles", "a", "request", "to", "create", "a", "new", "machine", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/machines.go#L39-L44
131,077
luci/luci-go
machine-db/appengine/rpc/machines.go
DeleteMachine
func (*Service) DeleteMachine(c context.Context, req *crimson.DeleteMachineRequest) (*empty.Empty, error) { if err := deleteMachine(c, req.Name); err != nil { return nil, err } return &empty.Empty{}, nil }
go
func (*Service) DeleteMachine(c context.Context, req *crimson.DeleteMachineRequest) (*empty.Empty, error) { if err := deleteMachine(c, req.Name); err != nil { return nil, err } return &empty.Empty{}, nil }
[ "func", "(", "*", "Service", ")", "DeleteMachine", "(", "c", "context", ".", "Context", ",", "req", "*", "crimson", ".", "DeleteMachineRequest", ")", "(", "*", "empty", ".", "Empty", ",", "error", ")", "{", "if", "err", ":=", "deleteMachine", "(", "c",...
// DeleteMachine handles a request to delete an existing machine.
[ "DeleteMachine", "handles", "a", "request", "to", "delete", "an", "existing", "machine", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/machines.go#L47-L52
131,078
luci/luci-go
machine-db/appengine/rpc/machines.go
ListMachines
func (*Service) ListMachines(c context.Context, req *crimson.ListMachinesRequest) (*crimson.ListMachinesResponse, error) { machines, err := listMachines(c, database.Get(c), req) if err != nil { return nil, err } return &crimson.ListMachinesResponse{ Machines: machines, }, nil }
go
func (*Service) ListMachines(c context.Context, req *crimson.ListMachinesRequest) (*crimson.ListMachinesResponse, error) { machines, err := listMachines(c, database.Get(c), req) if err != nil { return nil, err } return &crimson.ListMachinesResponse{ Machines: machines, }, nil }
[ "func", "(", "*", "Service", ")", "ListMachines", "(", "c", "context", ".", "Context", ",", "req", "*", "crimson", ".", "ListMachinesRequest", ")", "(", "*", "crimson", ".", "ListMachinesResponse", ",", "error", ")", "{", "machines", ",", "err", ":=", "l...
// ListMachines handles a request to list machines.
[ "ListMachines", "handles", "a", "request", "to", "list", "machines", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/machines.go#L55-L63
131,079
luci/luci-go
machine-db/appengine/rpc/machines.go
RenameMachine
func (*Service) RenameMachine(c context.Context, req *crimson.RenameMachineRequest) (*crimson.Machine, error) { return renameMachine(c, req.Name, req.NewName) }
go
func (*Service) RenameMachine(c context.Context, req *crimson.RenameMachineRequest) (*crimson.Machine, error) { return renameMachine(c, req.Name, req.NewName) }
[ "func", "(", "*", "Service", ")", "RenameMachine", "(", "c", "context", ".", "Context", ",", "req", "*", "crimson", ".", "RenameMachineRequest", ")", "(", "*", "crimson", ".", "Machine", ",", "error", ")", "{", "return", "renameMachine", "(", "c", ",", ...
// RenameMachine handles a request to rename an existing machine.
[ "RenameMachine", "handles", "a", "request", "to", "rename", "an", "existing", "machine", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/machines.go#L66-L68
131,080
luci/luci-go
machine-db/appengine/rpc/machines.go
UpdateMachine
func (*Service) UpdateMachine(c context.Context, req *crimson.UpdateMachineRequest) (*crimson.Machine, error) { return updateMachine(c, req.Machine, req.UpdateMask) }
go
func (*Service) UpdateMachine(c context.Context, req *crimson.UpdateMachineRequest) (*crimson.Machine, error) { return updateMachine(c, req.Machine, req.UpdateMask) }
[ "func", "(", "*", "Service", ")", "UpdateMachine", "(", "c", "context", ".", "Context", ",", "req", "*", "crimson", ".", "UpdateMachineRequest", ")", "(", "*", "crimson", ".", "Machine", ",", "error", ")", "{", "return", "updateMachine", "(", "c", ",", ...
// UpdateMachine handles a request to update an existing machine.
[ "UpdateMachine", "handles", "a", "request", "to", "update", "an", "existing", "machine", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/machines.go#L71-L73
131,081
luci/luci-go
machine-db/appengine/rpc/machines.go
createMachine
func createMachine(c context.Context, m *crimson.Machine) error { if err := validateMachineForCreation(m); err != nil { return err } db := database.Get(c) // By setting machines.platform_id and machines.rack_id NOT NULL when setting up the database, we can avoid checking if the given // platform and rack are va...
go
func createMachine(c context.Context, m *crimson.Machine) error { if err := validateMachineForCreation(m); err != nil { return err } db := database.Get(c) // By setting machines.platform_id and machines.rack_id NOT NULL when setting up the database, we can avoid checking if the given // platform and rack are va...
[ "func", "createMachine", "(", "c", "context", ".", "Context", ",", "m", "*", "crimson", ".", "Machine", ")", "error", "{", "if", "err", ":=", "validateMachineForCreation", "(", "m", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n",...
// createMachine creates a new machine in the database.
[ "createMachine", "creates", "a", "new", "machine", "in", "the", "database", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/machines.go#L76-L106
131,082
luci/luci-go
machine-db/appengine/rpc/machines.go
listMachines
func listMachines(c context.Context, q database.QueryerContext, req *crimson.ListMachinesRequest) ([]*crimson.Machine, error) { stmt := squirrel.Select( "m.name", "p.name", "r.name", "d.name", "m.description", "m.asset_tag", "m.service_tag", "m.deployment_ticket", "m.drac_password", "m.state", ) ...
go
func listMachines(c context.Context, q database.QueryerContext, req *crimson.ListMachinesRequest) ([]*crimson.Machine, error) { stmt := squirrel.Select( "m.name", "p.name", "r.name", "d.name", "m.description", "m.asset_tag", "m.service_tag", "m.deployment_ticket", "m.drac_password", "m.state", ) ...
[ "func", "listMachines", "(", "c", "context", ".", "Context", ",", "q", "database", ".", "QueryerContext", ",", "req", "*", "crimson", ".", "ListMachinesRequest", ")", "(", "[", "]", "*", "crimson", ".", "Machine", ",", "error", ")", "{", "stmt", ":=", ...
// listMachines returns a slice of machines in the database.
[ "listMachines", "returns", "a", "slice", "of", "machines", "in", "the", "database", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/machines.go#L138-L188
131,083
luci/luci-go
machine-db/appengine/rpc/machines.go
renameMachine
func renameMachine(c context.Context, name, newName string) (*crimson.Machine, error) { switch { case name == "": return nil, status.Error(codes.InvalidArgument, "machine name is required and must be non-empty") case newName == "": return nil, status.Error(codes.InvalidArgument, "new name is required and must be...
go
func renameMachine(c context.Context, name, newName string) (*crimson.Machine, error) { switch { case name == "": return nil, status.Error(codes.InvalidArgument, "machine name is required and must be non-empty") case newName == "": return nil, status.Error(codes.InvalidArgument, "new name is required and must be...
[ "func", "renameMachine", "(", "c", "context", ".", "Context", ",", "name", ",", "newName", "string", ")", "(", "*", "crimson", ".", "Machine", ",", "error", ")", "{", "switch", "{", "case", "name", "==", "\"", "\"", ":", "return", "nil", ",", "status...
// renameMachine renames an existing machine in the database.
[ "renameMachine", "renames", "an", "existing", "machine", "in", "the", "database", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/machines.go#L191-L240
131,084
luci/luci-go
machine-db/appengine/rpc/machines.go
validateMachineForCreation
func validateMachineForCreation(m *crimson.Machine) error { switch { case m == nil: return status.Error(codes.InvalidArgument, "machine specification is required") case m.Name == "": return status.Error(codes.InvalidArgument, "machine name is required and must be non-empty") case m.Platform == "": return stat...
go
func validateMachineForCreation(m *crimson.Machine) error { switch { case m == nil: return status.Error(codes.InvalidArgument, "machine specification is required") case m.Name == "": return status.Error(codes.InvalidArgument, "machine name is required and must be non-empty") case m.Platform == "": return stat...
[ "func", "validateMachineForCreation", "(", "m", "*", "crimson", ".", "Machine", ")", "error", "{", "switch", "{", "case", "m", "==", "nil", ":", "return", "status", ".", "Error", "(", "codes", ".", "InvalidArgument", ",", "\"", "\"", ")", "\n", "case", ...
// validateMachineForCreation validates a machine for creation.
[ "validateMachineForCreation", "validates", "a", "machine", "for", "creation", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/machines.go#L314-L331
131,085
luci/luci-go
machine-db/appengine/rpc/machines.go
validateMachineForUpdate
func validateMachineForUpdate(m *crimson.Machine, mask *field_mask.FieldMask) error { switch err := validateUpdateMask(mask); { case m == nil: return status.Error(codes.InvalidArgument, "machine specification is required") case m.Name == "": return status.Error(codes.InvalidArgument, "machine name is required an...
go
func validateMachineForUpdate(m *crimson.Machine, mask *field_mask.FieldMask) error { switch err := validateUpdateMask(mask); { case m == nil: return status.Error(codes.InvalidArgument, "machine specification is required") case m.Name == "": return status.Error(codes.InvalidArgument, "machine name is required an...
[ "func", "validateMachineForUpdate", "(", "m", "*", "crimson", ".", "Machine", ",", "mask", "*", "field_mask", ".", "FieldMask", ")", "error", "{", "switch", "err", ":=", "validateUpdateMask", "(", "mask", ")", ";", "{", "case", "m", "==", "nil", ":", "re...
// validateMachineForUpdate validates a machine for update.
[ "validateMachineForUpdate", "validates", "a", "machine", "for", "update", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/machines.go#L334-L376
131,086
luci/luci-go
mmutex/lib/shared.go
RunShared
func RunShared(ctx context.Context, env subcommands.Env, command func(context.Context) error) error { lockFilePath, drainFilePath, err := computeMutexPaths(env) if err != nil { return err } if len(lockFilePath) == 0 { return command(ctx) } blocker := createLockBlocker(ctx) // Use the same retry mechanism f...
go
func RunShared(ctx context.Context, env subcommands.Env, command func(context.Context) error) error { lockFilePath, drainFilePath, err := computeMutexPaths(env) if err != nil { return err } if len(lockFilePath) == 0 { return command(ctx) } blocker := createLockBlocker(ctx) // Use the same retry mechanism f...
[ "func", "RunShared", "(", "ctx", "context", ".", "Context", ",", "env", "subcommands", ".", "Env", ",", "command", "func", "(", "context", ".", "Context", ")", "error", ")", "error", "{", "lockFilePath", ",", "drainFilePath", ",", "err", ":=", "computeMute...
// RunShared runs the command with the specified context and environment while // holding a shared mmutex lock.
[ "RunShared", "runs", "the", "command", "with", "the", "specified", "context", "and", "environment", "while", "holding", "a", "shared", "mmutex", "lock", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/mmutex/lib/shared.go#L26-L46
131,087
luci/luci-go
common/gcloud/pubsub/publisher.go
Publish
func (up *UnbufferedPublisher) Publish(c context.Context, msgs ...*pubsub.Message) ([]string, error) { if len(msgs) == 0 { return nil, nil } messages := make([]*pb.PubsubMessage, len(msgs)) for i, msg := range msgs { messages[i] = &pb.PubsubMessage{ Data: msg.Data, Attributes: msg.Attributes, } ...
go
func (up *UnbufferedPublisher) Publish(c context.Context, msgs ...*pubsub.Message) ([]string, error) { if len(msgs) == 0 { return nil, nil } messages := make([]*pb.PubsubMessage, len(msgs)) for i, msg := range msgs { messages[i] = &pb.PubsubMessage{ Data: msg.Data, Attributes: msg.Attributes, } ...
[ "func", "(", "up", "*", "UnbufferedPublisher", ")", "Publish", "(", "c", "context", ".", "Context", ",", "msgs", "...", "*", "pubsub", ".", "Message", ")", "(", "[", "]", "string", ",", "error", ")", "{", "if", "len", "(", "msgs", ")", "==", "0", ...
// Publish publishes a message immediately, blocking until it completes. // // "c" must be an AppEngine context.
[ "Publish", "publishes", "a", "message", "immediately", "blocking", "until", "it", "completes", ".", "c", "must", "be", "an", "AppEngine", "context", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/gcloud/pubsub/publisher.go#L76-L105
131,088
luci/luci-go
common/gcloud/pubsub/publisher.go
Close
func (up *UnbufferedPublisher) Close() error { client, err := up.ClientFactory.Client(up.AECtx) if err != nil { return err } return client.Close() }
go
func (up *UnbufferedPublisher) Close() error { client, err := up.ClientFactory.Client(up.AECtx) if err != nil { return err } return client.Close() }
[ "func", "(", "up", "*", "UnbufferedPublisher", ")", "Close", "(", ")", "error", "{", "client", ",", "err", ":=", "up", ".", "ClientFactory", ".", "Client", "(", "up", ".", "AECtx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}...
// Close closes the UnbufferedPublisher, notably its Client.
[ "Close", "closes", "the", "UnbufferedPublisher", "notably", "its", "Client", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/gcloud/pubsub/publisher.go#L108-L114
131,089
luci/luci-go
dm/api/service/v1/execution_data.go
NewExecutionFinished
func NewExecutionFinished(result *JsonResult) *Execution { return &Execution{ Data: &Execution_Data{ ExecutionType: &Execution_Data_Finished_{ &Execution_Data_Finished{Data: result}}}} }
go
func NewExecutionFinished(result *JsonResult) *Execution { return &Execution{ Data: &Execution_Data{ ExecutionType: &Execution_Data_Finished_{ &Execution_Data_Finished{Data: result}}}} }
[ "func", "NewExecutionFinished", "(", "result", "*", "JsonResult", ")", "*", "Execution", "{", "return", "&", "Execution", "{", "Data", ":", "&", "Execution_Data", "{", "ExecutionType", ":", "&", "Execution_Data_Finished_", "{", "&", "Execution_Data_Finished", "{",...
// NewExecutionFinished creates an Execution in the FINISHED state.
[ "NewExecutionFinished", "creates", "an", "Execution", "in", "the", "FINISHED", "state", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/service/v1/execution_data.go#L44-L49
131,090
luci/luci-go
dm/api/service/v1/execution_data.go
NewExecutionAbnormalFinish
func NewExecutionAbnormalFinish(af *AbnormalFinish) *Execution { return &Execution{ Data: &Execution_Data{ ExecutionType: &Execution_Data_AbnormalFinish{af}}} }
go
func NewExecutionAbnormalFinish(af *AbnormalFinish) *Execution { return &Execution{ Data: &Execution_Data{ ExecutionType: &Execution_Data_AbnormalFinish{af}}} }
[ "func", "NewExecutionAbnormalFinish", "(", "af", "*", "AbnormalFinish", ")", "*", "Execution", "{", "return", "&", "Execution", "{", "Data", ":", "&", "Execution_Data", "{", "ExecutionType", ":", "&", "Execution_Data_AbnormalFinish", "{", "af", "}", "}", "}", ...
// NewExecutionAbnormalFinish creates an Execution in the ABNORMAL_FINISH state.
[ "NewExecutionAbnormalFinish", "creates", "an", "Execution", "in", "the", "ABNORMAL_FINISH", "state", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/service/v1/execution_data.go#L52-L56
131,091
luci/luci-go
dm/api/service/v1/execution_data.go
State
func (d *Execution_Data) State() Execution_State { if d != nil { switch d.ExecutionType.(type) { case *Execution_Data_Scheduling_: return Execution_SCHEDULING case *Execution_Data_Running_: return Execution_RUNNING case *Execution_Data_Stopping_: return Execution_STOPPING case *Execution_Data_Finish...
go
func (d *Execution_Data) State() Execution_State { if d != nil { switch d.ExecutionType.(type) { case *Execution_Data_Scheduling_: return Execution_SCHEDULING case *Execution_Data_Running_: return Execution_RUNNING case *Execution_Data_Stopping_: return Execution_STOPPING case *Execution_Data_Finish...
[ "func", "(", "d", "*", "Execution_Data", ")", "State", "(", ")", "Execution_State", "{", "if", "d", "!=", "nil", "{", "switch", "d", ".", "ExecutionType", ".", "(", "type", ")", "{", "case", "*", "Execution_Data_Scheduling_", ":", "return", "Execution_SCHE...
// State computes the Execution_State for the current Execution_Data
[ "State", "computes", "the", "Execution_State", "for", "the", "current", "Execution_Data" ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/service/v1/execution_data.go#L59-L75
131,092
luci/luci-go
tokenserver/appengine/impl/certchecker/certchecker.go
CheckCertificate
func CheckCertificate(c context.Context, cert *x509.Certificate) (*certconfig.CA, error) { checker, err := GetCertChecker(c, cert.Issuer.CommonName) if err != nil { return nil, err } return checker.CheckCertificate(c, cert) }
go
func CheckCertificate(c context.Context, cert *x509.Certificate) (*certconfig.CA, error) { checker, err := GetCertChecker(c, cert.Issuer.CommonName) if err != nil { return nil, err } return checker.CheckCertificate(c, cert) }
[ "func", "CheckCertificate", "(", "c", "context", ".", "Context", ",", "cert", "*", "x509", ".", "Certificate", ")", "(", "*", "certconfig", ".", "CA", ",", "error", ")", "{", "checker", ",", "err", ":=", "GetCertChecker", "(", "c", ",", "cert", ".", ...
// CheckCertificate checks validity of a given certificate. // // It looks at the cert issuer, loads corresponding CertChecker and calls its // CheckCertificate method. See CertChecker.CheckCertificate documentation for // explanation of return values.
[ "CheckCertificate", "checks", "validity", "of", "a", "given", "certificate", ".", "It", "looks", "at", "the", "cert", "issuer", "loads", "corresponding", "CertChecker", "and", "calls", "its", "CheckCertificate", "method", ".", "See", "CertChecker", ".", "CheckCert...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/certchecker/certchecker.go#L134-L140
131,093
luci/luci-go
tokenserver/appengine/impl/certchecker/certchecker.go
GetCertChecker
func GetCertChecker(c context.Context, cn string) (*CertChecker, error) { checker, err := certCheckerCache.LRU(c).GetOrCreate(c, cn, func() (interface{}, time.Duration, error) { // To avoid storing CertChecker for non-existent CAs in local memory forever, // we do a datastore check when creating the checker. It ha...
go
func GetCertChecker(c context.Context, cn string) (*CertChecker, error) { checker, err := certCheckerCache.LRU(c).GetOrCreate(c, cn, func() (interface{}, time.Duration, error) { // To avoid storing CertChecker for non-existent CAs in local memory forever, // we do a datastore check when creating the checker. It ha...
[ "func", "GetCertChecker", "(", "c", "context", ".", "Context", ",", "cn", "string", ")", "(", "*", "CertChecker", ",", "error", ")", "{", "checker", ",", "err", ":=", "certCheckerCache", ".", "LRU", "(", "c", ")", ".", "GetOrCreate", "(", "c", ",", "...
// GetCertChecker returns an instance of CertChecker for given CA. // // It caches CertChecker objects in local memory and reuses them between // requests.
[ "GetCertChecker", "returns", "an", "instance", "of", "CertChecker", "for", "given", "CA", ".", "It", "caches", "CertChecker", "objects", "in", "local", "memory", "and", "reuses", "them", "between", "requests", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/certchecker/certchecker.go#L146-L169
131,094
luci/luci-go
tokenserver/appengine/impl/certchecker/certchecker.go
GetCA
func (ch *CertChecker) GetCA(c context.Context) (*certconfig.CA, error) { value, err := ch.ca.Get(c, func(interface{}) (ca interface{}, exp time.Duration, err error) { ca, err = ch.refetchCA(c) if err == nil { exp = refetchCAPeriod(c) } return }) if err != nil { return nil, err } ca, _ := value.(*cert...
go
func (ch *CertChecker) GetCA(c context.Context) (*certconfig.CA, error) { value, err := ch.ca.Get(c, func(interface{}) (ca interface{}, exp time.Duration, err error) { ca, err = ch.refetchCA(c) if err == nil { exp = refetchCAPeriod(c) } return }) if err != nil { return nil, err } ca, _ := value.(*cert...
[ "func", "(", "ch", "*", "CertChecker", ")", "GetCA", "(", "c", "context", ".", "Context", ")", "(", "*", "certconfig", ".", "CA", ",", "error", ")", "{", "value", ",", "err", ":=", "ch", ".", "ca", ".", "Get", "(", "c", ",", "func", "(", "inter...
// GetCA returns CA entity with ParsedConfig and ParsedCert fields set.
[ "GetCA", "returns", "CA", "entity", "with", "ParsedConfig", "and", "ParsedCert", "fields", "set", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/certchecker/certchecker.go#L172-L194
131,095
luci/luci-go
tokenserver/appengine/impl/certchecker/certchecker.go
refetchCAPeriod
func refetchCAPeriod(c context.Context) time.Duration { if info.IsDevAppServer(c) { return 100 * time.Millisecond } return RefetchCAPeriod }
go
func refetchCAPeriod(c context.Context) time.Duration { if info.IsDevAppServer(c) { return 100 * time.Millisecond } return RefetchCAPeriod }
[ "func", "refetchCAPeriod", "(", "c", "context", ".", "Context", ")", "time", ".", "Duration", "{", "if", "info", ".", "IsDevAppServer", "(", "c", ")", "{", "return", "100", "*", "time", ".", "Millisecond", "\n", "}", "\n", "return", "RefetchCAPeriod", "\...
// refetchCAPeriod returns for how long to cache the CA in memory by default. // // On dev server we cache for a very short duration to simplify local testing.
[ "refetchCAPeriod", "returns", "for", "how", "long", "to", "cache", "the", "CA", "in", "memory", "by", "default", ".", "On", "dev", "server", "we", "cache", "for", "a", "very", "short", "duration", "to", "simplify", "local", "testing", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/certchecker/certchecker.go#L260-L265
131,096
luci/luci-go
tokenserver/appengine/impl/certchecker/certchecker.go
refetchCRLPeriod
func refetchCRLPeriod(c context.Context) time.Duration { if info.IsDevAppServer(c) { return 100 * time.Millisecond } return RefetchCRLPeriod }
go
func refetchCRLPeriod(c context.Context) time.Duration { if info.IsDevAppServer(c) { return 100 * time.Millisecond } return RefetchCRLPeriod }
[ "func", "refetchCRLPeriod", "(", "c", "context", ".", "Context", ")", "time", ".", "Duration", "{", "if", "info", ".", "IsDevAppServer", "(", "c", ")", "{", "return", "100", "*", "time", ".", "Millisecond", "\n", "}", "\n", "return", "RefetchCRLPeriod", ...
// refetchCRLPeriod returns for how long to cache the CRL in memory by default. // // On dev server we cache for a very short duration to simplify local testing.
[ "refetchCRLPeriod", "returns", "for", "how", "long", "to", "cache", "the", "CRL", "in", "memory", "by", "default", ".", "On", "dev", "server", "we", "cache", "for", "a", "very", "short", "duration", "to", "simplify", "local", "testing", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/certchecker/certchecker.go#L270-L275
131,097
luci/luci-go
common/logging/logging.go
Get
func Get(c context.Context) Logger { if f := GetFactory(c); f != nil { return f(c) } return Null }
go
func Get(c context.Context) Logger { if f := GetFactory(c); f != nil { return f(c) } return Null }
[ "func", "Get", "(", "c", "context", ".", "Context", ")", "Logger", "{", "if", "f", ":=", "GetFactory", "(", "c", ")", ";", "f", "!=", "nil", "{", "return", "f", "(", "c", ")", "\n", "}", "\n", "return", "Null", "\n", "}" ]
// Get the current Logger, or a logger that ignores all messages if none // is defined.
[ "Get", "the", "current", "Logger", "or", "a", "logger", "that", "ignores", "all", "messages", "if", "none", "is", "defined", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/logging/logging.go#L92-L97
131,098
luci/luci-go
common/cli/profile.go
Run
func (r *wrappedCmdRun) Run(a subcommands.Application, args []string, env subcommands.Env) int { ctx := GetContext(a, r, env) r.prof.Logger = logging.Get(ctx) r.prof.Clock = clock.Get(ctx) if err := r.prof.Start(); err != nil { logging.WithError(err).Errorf(ctx, "Failed to start profiling") return 1 } defer ...
go
func (r *wrappedCmdRun) Run(a subcommands.Application, args []string, env subcommands.Env) int { ctx := GetContext(a, r, env) r.prof.Logger = logging.Get(ctx) r.prof.Clock = clock.Get(ctx) if err := r.prof.Start(); err != nil { logging.WithError(err).Errorf(ctx, "Failed to start profiling") return 1 } defer ...
[ "func", "(", "r", "*", "wrappedCmdRun", ")", "Run", "(", "a", "subcommands", ".", "Application", ",", "args", "[", "]", "string", ",", "env", "subcommands", ".", "Env", ")", "int", "{", "ctx", ":=", "GetContext", "(", "a", ",", "r", ",", "env", ")"...
// Run is part of CommandRun interface.
[ "Run", "is", "part", "of", "CommandRun", "interface", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/cli/profile.go#L56-L68
131,099
luci/luci-go
common/cli/profile.go
ModifyContext
func (r *wrappedCmdRun) ModifyContext(ctx context.Context) context.Context { if m, _ := r.CommandRun.(ContextModificator); m != nil { return m.ModifyContext(ctx) } return ctx }
go
func (r *wrappedCmdRun) ModifyContext(ctx context.Context) context.Context { if m, _ := r.CommandRun.(ContextModificator); m != nil { return m.ModifyContext(ctx) } return ctx }
[ "func", "(", "r", "*", "wrappedCmdRun", ")", "ModifyContext", "(", "ctx", "context", ".", "Context", ")", "context", ".", "Context", "{", "if", "m", ",", "_", ":=", "r", ".", "CommandRun", ".", "(", "ContextModificator", ")", ";", "m", "!=", "nil", "...
// ModifyContext is part of ContextModificator interface. // // Need to explicitly define it, since embedding original CommandRun in // wrappedCmdRun "disables" the sniffing of ContextModificator in GetContext.
[ "ModifyContext", "is", "part", "of", "ContextModificator", "interface", ".", "Need", "to", "explicitly", "define", "it", "since", "embedding", "original", "CommandRun", "in", "wrappedCmdRun", "disables", "the", "sniffing", "of", "ContextModificator", "in", "GetContext...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/cli/profile.go#L74-L79