id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9,300 | luci/luci-go | config/appengine/gaeconfig/validation.go | InstallValidationHandlers | func InstallValidationHandlers(r *router.Router, base router.MiddlewareChain, rules *validation.RuleSet) {
a := auth.Authenticator{
Methods: []auth.Method{
&server.OAuth2Method{Scopes: []string{server.EmailScope}},
},
}
base = base.Extend(a.GetMiddleware(), func(c *router.Context, next router.Handler) {
cc,... | go | func InstallValidationHandlers(r *router.Router, base router.MiddlewareChain, rules *validation.RuleSet) {
a := auth.Authenticator{
Methods: []auth.Method{
&server.OAuth2Method{Scopes: []string{server.EmailScope}},
},
}
base = base.Extend(a.GetMiddleware(), func(c *router.Context, next router.Handler) {
cc,... | [
"func",
"InstallValidationHandlers",
"(",
"r",
"*",
"router",
".",
"Router",
",",
"base",
"router",
".",
"MiddlewareChain",
",",
"rules",
"*",
"validation",
".",
"RuleSet",
")",
"{",
"a",
":=",
"auth",
".",
"Authenticator",
"{",
"Methods",
":",
"[",
"]",
... | // InstallValidationHandlers installs handlers for config validation.
//
// It ensures that caller is either the config service itself or a member of a
// trusted group, both of which are configurable in the appengine app settings.
// It requires that the hostname, the email of config service and the name of
// the tru... | [
"InstallValidationHandlers",
"installs",
"handlers",
"for",
"config",
"validation",
".",
"It",
"ensures",
"that",
"caller",
"is",
"either",
"the",
"config",
"service",
"itself",
"or",
"a",
"member",
"of",
"a",
"trusted",
"group",
"both",
"of",
"which",
"are",
... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/config/appengine/gaeconfig/validation.go#L60-L78 |
9,301 | luci/luci-go | config/appengine/gaeconfig/validation.go | isAuthorizedCall | func isAuthorizedCall(c context.Context, s *Settings) (bool, error) {
// Someone from an admin group (if it is configured)? This is useful locally
// during development.
if s.AdministratorsGroup != "" {
switch yep, err := auth.IsMember(c, s.AdministratorsGroup); {
case err != nil:
return false, err
case yep... | go | func isAuthorizedCall(c context.Context, s *Settings) (bool, error) {
// Someone from an admin group (if it is configured)? This is useful locally
// during development.
if s.AdministratorsGroup != "" {
switch yep, err := auth.IsMember(c, s.AdministratorsGroup); {
case err != nil:
return false, err
case yep... | [
"func",
"isAuthorizedCall",
"(",
"c",
"context",
".",
"Context",
",",
"s",
"*",
"Settings",
")",
"(",
"bool",
",",
"error",
")",
"{",
"// Someone from an admin group (if it is configured)? This is useful locally",
"// during development.",
"if",
"s",
".",
"Administrator... | // isAuthorizedCall returns true if the current caller is allowed to call the
// config validation endpoints.
//
// This is either the service account of the config service, or someone from
// an admin group. | [
"isAuthorizedCall",
"returns",
"true",
"if",
"the",
"current",
"caller",
"is",
"allowed",
"to",
"call",
"the",
"config",
"validation",
"endpoints",
".",
"This",
"is",
"either",
"the",
"service",
"account",
"of",
"the",
"config",
"service",
"or",
"someone",
"fr... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/config/appengine/gaeconfig/validation.go#L96-L123 |
9,302 | luci/luci-go | config/appengine/gaeconfig/validation.go | GetConfigServiceAppID | func GetConfigServiceAppID(c context.Context) (string, error) {
s, err := FetchCachedSettings(c)
switch {
case err != nil:
return "", err
case s.ConfigServiceHost == "":
return "", nil
}
info, err := signing.FetchServiceInfoFromLUCIService(c, "https://"+s.ConfigServiceHost)
if err != nil {
return "", err
... | go | func GetConfigServiceAppID(c context.Context) (string, error) {
s, err := FetchCachedSettings(c)
switch {
case err != nil:
return "", err
case s.ConfigServiceHost == "":
return "", nil
}
info, err := signing.FetchServiceInfoFromLUCIService(c, "https://"+s.ConfigServiceHost)
if err != nil {
return "", err
... | [
"func",
"GetConfigServiceAppID",
"(",
"c",
"context",
".",
"Context",
")",
"(",
"string",
",",
"error",
")",
"{",
"s",
",",
"err",
":=",
"FetchCachedSettings",
"(",
"c",
")",
"\n",
"switch",
"{",
"case",
"err",
"!=",
"nil",
":",
"return",
"\"",
"\"",
... | // GetConfigServiceAppID looks up the app ID of the LUCI Config service, as set
// in the app's settings.
//
// Returns an empty string if the LUCI Config integration is not configured for
// the app. | [
"GetConfigServiceAppID",
"looks",
"up",
"the",
"app",
"ID",
"of",
"the",
"LUCI",
"Config",
"service",
"as",
"set",
"in",
"the",
"app",
"s",
"settings",
".",
"Returns",
"an",
"empty",
"string",
"if",
"the",
"LUCI",
"Config",
"integration",
"is",
"not",
"con... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/config/appengine/gaeconfig/validation.go#L130-L143 |
9,303 | luci/luci-go | cipd/appengine/impl/cas/acled.go | Public | func Public(internal api.StorageServer) api.StorageServer {
return &api.DecoratedStorage{
Service: internal,
Prelude: aclPrelude,
}
} | go | func Public(internal api.StorageServer) api.StorageServer {
return &api.DecoratedStorage{
Service: internal,
Prelude: aclPrelude,
}
} | [
"func",
"Public",
"(",
"internal",
"api",
".",
"StorageServer",
")",
"api",
".",
"StorageServer",
"{",
"return",
"&",
"api",
".",
"DecoratedStorage",
"{",
"Service",
":",
"internal",
",",
"Prelude",
":",
"aclPrelude",
",",
"}",
"\n",
"}"
] | // Public returns publicly exposed implementation of cipd.Storage service that
// wraps the given internal implementation with ACLs. | [
"Public",
"returns",
"publicly",
"exposed",
"implementation",
"of",
"cipd",
".",
"Storage",
"service",
"that",
"wraps",
"the",
"given",
"internal",
"implementation",
"with",
"ACLs",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/cas/acled.go#L34-L39 |
9,304 | luci/luci-go | cipd/appengine/impl/cas/acled.go | aclPrelude | func aclPrelude(c context.Context, methodName string, req proto.Message) (context.Context, error) {
acl, ok := perMethodACL[methodName]
if !ok {
panic(fmt.Sprintf("method %q is not defined in perMethodACL", methodName))
}
if acl.group != "*" {
switch yep, err := auth.IsMember(c, acl.group); {
case err != nil:... | go | func aclPrelude(c context.Context, methodName string, req proto.Message) (context.Context, error) {
acl, ok := perMethodACL[methodName]
if !ok {
panic(fmt.Sprintf("method %q is not defined in perMethodACL", methodName))
}
if acl.group != "*" {
switch yep, err := auth.IsMember(c, acl.group); {
case err != nil:... | [
"func",
"aclPrelude",
"(",
"c",
"context",
".",
"Context",
",",
"methodName",
"string",
",",
"req",
"proto",
".",
"Message",
")",
"(",
"context",
".",
"Context",
",",
"error",
")",
"{",
"acl",
",",
"ok",
":=",
"perMethodACL",
"[",
"methodName",
"]",
"\... | // aclPrelude is called before each RPC to check ACLs. | [
"aclPrelude",
"is",
"called",
"before",
"each",
"RPC",
"to",
"check",
"ACLs",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/cas/acled.go#L42-L62 |
9,305 | luci/luci-go | lucicfg/native.go | unpack | func (c *nativeCall) unpack(min int, vars ...interface{}) error {
return starlark.UnpackPositionalArgs(c.Fn.Name(), c.Args, c.Kwargs, min, vars...)
} | go | func (c *nativeCall) unpack(min int, vars ...interface{}) error {
return starlark.UnpackPositionalArgs(c.Fn.Name(), c.Args, c.Kwargs, min, vars...)
} | [
"func",
"(",
"c",
"*",
"nativeCall",
")",
"unpack",
"(",
"min",
"int",
",",
"vars",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"starlark",
".",
"UnpackPositionalArgs",
"(",
"c",
".",
"Fn",
".",
"Name",
"(",
")",
",",
"c",
".",
"Args... | // unpack unpacks the positional arguments into corresponding variables.
//
// See starlark.UnpackPositionalArgs for more info. | [
"unpack",
"unpacks",
"the",
"positional",
"arguments",
"into",
"corresponding",
"variables",
".",
"See",
"starlark",
".",
"UnpackPositionalArgs",
"for",
"more",
"info",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/native.go#L41-L43 |
9,306 | luci/luci-go | dm/appengine/model/keys.go | QuestKeyFromID | func QuestKeyFromID(c context.Context, qid string) *ds.Key {
return ds.MakeKey(c, "Quest", qid)
} | go | func QuestKeyFromID(c context.Context, qid string) *ds.Key {
return ds.MakeKey(c, "Quest", qid)
} | [
"func",
"QuestKeyFromID",
"(",
"c",
"context",
".",
"Context",
",",
"qid",
"string",
")",
"*",
"ds",
".",
"Key",
"{",
"return",
"ds",
".",
"MakeKey",
"(",
"c",
",",
"\"",
"\"",
",",
"qid",
")",
"\n",
"}"
] | // QuestKeyFromID makes a datastore.Key given the QuestID. | [
"QuestKeyFromID",
"makes",
"a",
"datastore",
".",
"Key",
"given",
"the",
"QuestID",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/appengine/model/keys.go#L27-L29 |
9,307 | luci/luci-go | dm/appengine/model/keys.go | QuestIDFromKey | func QuestIDFromKey(k *ds.Key) string {
if k.Kind() != "Quest" || k.Parent() != nil {
panic(fmt.Errorf("invalid Quest key: %s", k))
}
return k.StringID()
} | go | func QuestIDFromKey(k *ds.Key) string {
if k.Kind() != "Quest" || k.Parent() != nil {
panic(fmt.Errorf("invalid Quest key: %s", k))
}
return k.StringID()
} | [
"func",
"QuestIDFromKey",
"(",
"k",
"*",
"ds",
".",
"Key",
")",
"string",
"{",
"if",
"k",
".",
"Kind",
"(",
")",
"!=",
"\"",
"\"",
"||",
"k",
".",
"Parent",
"(",
")",
"!=",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",... | // QuestIDFromKey makes a QuestID from the given datastore.Key. It panics if the
// Key does not point to a Quest. | [
"QuestIDFromKey",
"makes",
"a",
"QuestID",
"from",
"the",
"given",
"datastore",
".",
"Key",
".",
"It",
"panics",
"if",
"the",
"Key",
"does",
"not",
"point",
"to",
"a",
"Quest",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/appengine/model/keys.go#L38-L43 |
9,308 | luci/luci-go | dm/appengine/model/keys.go | AttemptKeyFromID | func AttemptKeyFromID(c context.Context, aid *dm.Attempt_ID) *ds.Key {
return ds.MakeKey(c, "Attempt", aid.DMEncoded())
} | go | func AttemptKeyFromID(c context.Context, aid *dm.Attempt_ID) *ds.Key {
return ds.MakeKey(c, "Attempt", aid.DMEncoded())
} | [
"func",
"AttemptKeyFromID",
"(",
"c",
"context",
".",
"Context",
",",
"aid",
"*",
"dm",
".",
"Attempt_ID",
")",
"*",
"ds",
".",
"Key",
"{",
"return",
"ds",
".",
"MakeKey",
"(",
"c",
",",
"\"",
"\"",
",",
"aid",
".",
"DMEncoded",
"(",
")",
")",
"\... | // AttemptKeyFromID makes a datastore.Key given the AttemptID. | [
"AttemptKeyFromID",
"makes",
"a",
"datastore",
".",
"Key",
"given",
"the",
"AttemptID",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/appengine/model/keys.go#L46-L48 |
9,309 | luci/luci-go | dm/appengine/model/keys.go | AttemptFromID | func AttemptFromID(aid *dm.Attempt_ID) *Attempt {
ret := &Attempt{}
ret.ID = *aid
return ret
} | go | func AttemptFromID(aid *dm.Attempt_ID) *Attempt {
ret := &Attempt{}
ret.ID = *aid
return ret
} | [
"func",
"AttemptFromID",
"(",
"aid",
"*",
"dm",
".",
"Attempt_ID",
")",
"*",
"Attempt",
"{",
"ret",
":=",
"&",
"Attempt",
"{",
"}",
"\n",
"ret",
".",
"ID",
"=",
"*",
"aid",
"\n",
"return",
"ret",
"\n",
"}"
] | // AttemptFromID produces an empty Attempt model from the AttemptID. | [
"AttemptFromID",
"produces",
"an",
"empty",
"Attempt",
"model",
"from",
"the",
"AttemptID",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/appengine/model/keys.go#L51-L55 |
9,310 | luci/luci-go | dm/appengine/model/keys.go | AttemptIDFromKey | func AttemptIDFromKey(k *ds.Key) *dm.Attempt_ID {
if k.Kind() != "Attempt" || k.Parent() != nil {
panic(fmt.Errorf("invalid Attempt key: %s", k))
}
ret := &dm.Attempt_ID{}
if err := ret.SetDMEncoded(k.StringID()); err != nil {
panic(fmt.Errorf("invalid Attempt key: %s: %s", k, err))
}
return ret
} | go | func AttemptIDFromKey(k *ds.Key) *dm.Attempt_ID {
if k.Kind() != "Attempt" || k.Parent() != nil {
panic(fmt.Errorf("invalid Attempt key: %s", k))
}
ret := &dm.Attempt_ID{}
if err := ret.SetDMEncoded(k.StringID()); err != nil {
panic(fmt.Errorf("invalid Attempt key: %s: %s", k, err))
}
return ret
} | [
"func",
"AttemptIDFromKey",
"(",
"k",
"*",
"ds",
".",
"Key",
")",
"*",
"dm",
".",
"Attempt_ID",
"{",
"if",
"k",
".",
"Kind",
"(",
")",
"!=",
"\"",
"\"",
"||",
"k",
".",
"Parent",
"(",
")",
"!=",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
... | // AttemptIDFromKey makes a AttemptID from the given datastore.Key. It panics if the
// Key does not point to a Attempt. | [
"AttemptIDFromKey",
"makes",
"a",
"AttemptID",
"from",
"the",
"given",
"datastore",
".",
"Key",
".",
"It",
"panics",
"if",
"the",
"Key",
"does",
"not",
"point",
"to",
"a",
"Attempt",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/appengine/model/keys.go#L59-L68 |
9,311 | luci/luci-go | dm/appengine/model/keys.go | ExecutionKeyFromID | func ExecutionKeyFromID(c context.Context, eid *dm.Execution_ID) *ds.Key {
return ds.MakeKey(c, "Attempt", eid.AttemptID().DMEncoded(), "Execution", eid.Id)
} | go | func ExecutionKeyFromID(c context.Context, eid *dm.Execution_ID) *ds.Key {
return ds.MakeKey(c, "Attempt", eid.AttemptID().DMEncoded(), "Execution", eid.Id)
} | [
"func",
"ExecutionKeyFromID",
"(",
"c",
"context",
".",
"Context",
",",
"eid",
"*",
"dm",
".",
"Execution_ID",
")",
"*",
"ds",
".",
"Key",
"{",
"return",
"ds",
".",
"MakeKey",
"(",
"c",
",",
"\"",
"\"",
",",
"eid",
".",
"AttemptID",
"(",
")",
".",
... | // ExecutionKeyFromID makes a datastore.Key given the ExecutionID. | [
"ExecutionKeyFromID",
"makes",
"a",
"datastore",
".",
"Key",
"given",
"the",
"ExecutionID",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/appengine/model/keys.go#L71-L73 |
9,312 | luci/luci-go | dm/appengine/model/keys.go | ExecutionFromID | func ExecutionFromID(c context.Context, eid *dm.Execution_ID) *Execution {
ret := &Execution{}
ret.ID = invertedHexUint32(eid.Id)
ret.Attempt = AttemptKeyFromID(c, eid.AttemptID())
return ret
} | go | func ExecutionFromID(c context.Context, eid *dm.Execution_ID) *Execution {
ret := &Execution{}
ret.ID = invertedHexUint32(eid.Id)
ret.Attempt = AttemptKeyFromID(c, eid.AttemptID())
return ret
} | [
"func",
"ExecutionFromID",
"(",
"c",
"context",
".",
"Context",
",",
"eid",
"*",
"dm",
".",
"Execution_ID",
")",
"*",
"Execution",
"{",
"ret",
":=",
"&",
"Execution",
"{",
"}",
"\n",
"ret",
".",
"ID",
"=",
"invertedHexUint32",
"(",
"eid",
".",
"Id",
... | // ExecutionFromID produces an empty Execution model from the ExecutionID. | [
"ExecutionFromID",
"produces",
"an",
"empty",
"Execution",
"model",
"from",
"the",
"ExecutionID",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/appengine/model/keys.go#L76-L81 |
9,313 | luci/luci-go | dm/appengine/model/keys.go | ExecutionIDFromKey | func ExecutionIDFromKey(k *ds.Key) *dm.Execution_ID {
if k.Kind() != "Execution" || k.Parent() == nil {
panic(fmt.Errorf("invalid Execution key: %s", k))
}
id := k.IntID()
if id <= 0 || id > math.MaxUint32 {
panic(fmt.Errorf("invalid Execution key: %s", k))
}
atmpt := AttemptIDFromKey(k.Parent())
return &dm.... | go | func ExecutionIDFromKey(k *ds.Key) *dm.Execution_ID {
if k.Kind() != "Execution" || k.Parent() == nil {
panic(fmt.Errorf("invalid Execution key: %s", k))
}
id := k.IntID()
if id <= 0 || id > math.MaxUint32 {
panic(fmt.Errorf("invalid Execution key: %s", k))
}
atmpt := AttemptIDFromKey(k.Parent())
return &dm.... | [
"func",
"ExecutionIDFromKey",
"(",
"k",
"*",
"ds",
".",
"Key",
")",
"*",
"dm",
".",
"Execution_ID",
"{",
"if",
"k",
".",
"Kind",
"(",
")",
"!=",
"\"",
"\"",
"||",
"k",
".",
"Parent",
"(",
")",
"==",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Errorf... | // ExecutionIDFromKey makes a ExecutionID from the given datastore.Key. It panics if the
// Key does not point to a Execution. | [
"ExecutionIDFromKey",
"makes",
"a",
"ExecutionID",
"from",
"the",
"given",
"datastore",
".",
"Key",
".",
"It",
"panics",
"if",
"the",
"Key",
"does",
"not",
"point",
"to",
"a",
"Execution",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/appengine/model/keys.go#L85-L95 |
9,314 | luci/luci-go | mmutex/cmd/mmutex/command_helpers.go | runCommand | func runCommand(ctx context.Context, command []string) error {
cmd := exec.Command(command[0], command[1:]...)
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
return cmd.Run()
} | go | func runCommand(ctx context.Context, command []string) error {
cmd := exec.Command(command[0], command[1:]...)
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
return cmd.Run()
} | [
"func",
"runCommand",
"(",
"ctx",
"context",
".",
"Context",
",",
"command",
"[",
"]",
"string",
")",
"error",
"{",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"command",
"[",
"0",
"]",
",",
"command",
"[",
"1",
":",
"]",
"...",
")",
"\n",
"cmd",
"... | // Runs the command in the given context and returns any error that occurred. | [
"Runs",
"the",
"command",
"in",
"the",
"given",
"context",
"and",
"returns",
"any",
"error",
"that",
"occurred",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/mmutex/cmd/mmutex/command_helpers.go#L24-L29 |
9,315 | luci/luci-go | milo/api/buildbot/time.go | MarshalJSON | func (t *Time) MarshalJSON() ([]byte, error) {
var buildbotFormat *float64
if !t.Time.IsZero() {
usec := t.Time.Nanosecond() / 1e3
// avoid dividing big floating numbers
v := float64(t.Time.Unix()) + float64(usec)/1e6
buildbotFormat = &v
}
return json.Marshal(&buildbotFormat)
} | go | func (t *Time) MarshalJSON() ([]byte, error) {
var buildbotFormat *float64
if !t.Time.IsZero() {
usec := t.Time.Nanosecond() / 1e3
// avoid dividing big floating numbers
v := float64(t.Time.Unix()) + float64(usec)/1e6
buildbotFormat = &v
}
return json.Marshal(&buildbotFormat)
} | [
"func",
"(",
"t",
"*",
"Time",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"var",
"buildbotFormat",
"*",
"float64",
"\n",
"if",
"!",
"t",
".",
"Time",
".",
"IsZero",
"(",
")",
"{",
"usec",
":=",
"t",
".",
"Time"... | // MarshalJSON marshals t to JSON at microsecond resolution. | [
"MarshalJSON",
"marshals",
"t",
"to",
"JSON",
"at",
"microsecond",
"resolution",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/api/buildbot/time.go#L29-L38 |
9,316 | luci/luci-go | milo/api/buildbot/time.go | UnmarshalJSON | func (t *Time) UnmarshalJSON(data []byte) error {
var buildbotFormat *float64
err := json.Unmarshal(data, &buildbotFormat)
if err != nil {
return err
}
*t = Time{}
if buildbotFormat != nil {
sec := *buildbotFormat
usec := int64(sec*1e6) % 1e6
t.Time = time.Unix(int64(sec), usec*1e3).UTC()
}
return nil
} | go | func (t *Time) UnmarshalJSON(data []byte) error {
var buildbotFormat *float64
err := json.Unmarshal(data, &buildbotFormat)
if err != nil {
return err
}
*t = Time{}
if buildbotFormat != nil {
sec := *buildbotFormat
usec := int64(sec*1e6) % 1e6
t.Time = time.Unix(int64(sec), usec*1e3).UTC()
}
return nil
} | [
"func",
"(",
"t",
"*",
"Time",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"var",
"buildbotFormat",
"*",
"float64",
"\n",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"buildbotFormat",
")",
"\n",
"if",
"er... | // UnmarshalJSON unmarshals t from JSON at microsecond resolution. | [
"UnmarshalJSON",
"unmarshals",
"t",
"from",
"JSON",
"at",
"microsecond",
"resolution",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/api/buildbot/time.go#L41-L54 |
9,317 | luci/luci-go | common/tsmon/metric/metric.go | NewInt | func NewInt(name string, description string, metadata *types.MetricMetadata, fields ...field.Field) Int {
if metadata == nil {
metadata = &types.MetricMetadata{}
}
m := &intMetric{metric{
MetricInfo: types.MetricInfo{
Name: name,
Description: description,
Fields: fields,
ValueType: type... | go | func NewInt(name string, description string, metadata *types.MetricMetadata, fields ...field.Field) Int {
if metadata == nil {
metadata = &types.MetricMetadata{}
}
m := &intMetric{metric{
MetricInfo: types.MetricInfo{
Name: name,
Description: description,
Fields: fields,
ValueType: type... | [
"func",
"NewInt",
"(",
"name",
"string",
",",
"description",
"string",
",",
"metadata",
"*",
"types",
".",
"MetricMetadata",
",",
"fields",
"...",
"field",
".",
"Field",
")",
"Int",
"{",
"if",
"metadata",
"==",
"nil",
"{",
"metadata",
"=",
"&",
"types",
... | // NewInt returns a new non-cumulative integer gauge metric. | [
"NewInt",
"returns",
"a",
"new",
"non",
"-",
"cumulative",
"integer",
"gauge",
"metric",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/tsmon/metric/metric.go#L114-L129 |
9,318 | luci/luci-go | common/tsmon/metric/metric.go | NewCounter | func NewCounter(name string, description string, metadata *types.MetricMetadata, fields ...field.Field) Counter {
if metadata == nil {
metadata = &types.MetricMetadata{}
}
m := &counter{intMetric{metric{
MetricInfo: types.MetricInfo{
Name: name,
Description: description,
Fields: fields,
V... | go | func NewCounter(name string, description string, metadata *types.MetricMetadata, fields ...field.Field) Counter {
if metadata == nil {
metadata = &types.MetricMetadata{}
}
m := &counter{intMetric{metric{
MetricInfo: types.MetricInfo{
Name: name,
Description: description,
Fields: fields,
V... | [
"func",
"NewCounter",
"(",
"name",
"string",
",",
"description",
"string",
",",
"metadata",
"*",
"types",
".",
"MetricMetadata",
",",
"fields",
"...",
"field",
".",
"Field",
")",
"Counter",
"{",
"if",
"metadata",
"==",
"nil",
"{",
"metadata",
"=",
"&",
"... | // NewCounter returns a new cumulative integer metric. | [
"NewCounter",
"returns",
"a",
"new",
"cumulative",
"integer",
"metric",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/tsmon/metric/metric.go#L132-L147 |
9,319 | luci/luci-go | common/tsmon/metric/metric.go | NewFloat | func NewFloat(name string, description string, metadata *types.MetricMetadata, fields ...field.Field) Float {
if metadata == nil {
metadata = &types.MetricMetadata{}
}
m := &floatMetric{metric{
MetricInfo: types.MetricInfo{
Name: name,
Description: description,
Fields: fields,
ValueType: ... | go | func NewFloat(name string, description string, metadata *types.MetricMetadata, fields ...field.Field) Float {
if metadata == nil {
metadata = &types.MetricMetadata{}
}
m := &floatMetric{metric{
MetricInfo: types.MetricInfo{
Name: name,
Description: description,
Fields: fields,
ValueType: ... | [
"func",
"NewFloat",
"(",
"name",
"string",
",",
"description",
"string",
",",
"metadata",
"*",
"types",
".",
"MetricMetadata",
",",
"fields",
"...",
"field",
".",
"Field",
")",
"Float",
"{",
"if",
"metadata",
"==",
"nil",
"{",
"metadata",
"=",
"&",
"type... | // NewFloat returns a new non-cumulative floating-point gauge metric. | [
"NewFloat",
"returns",
"a",
"new",
"non",
"-",
"cumulative",
"floating",
"-",
"point",
"gauge",
"metric",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/tsmon/metric/metric.go#L150-L165 |
9,320 | luci/luci-go | common/tsmon/metric/metric.go | NewFloatCounter | func NewFloatCounter(name string, description string, metadata *types.MetricMetadata, fields ...field.Field) FloatCounter {
if metadata == nil {
metadata = &types.MetricMetadata{}
}
m := &floatCounter{floatMetric{metric{
MetricInfo: types.MetricInfo{
Name: name,
Description: description,
Fields: ... | go | func NewFloatCounter(name string, description string, metadata *types.MetricMetadata, fields ...field.Field) FloatCounter {
if metadata == nil {
metadata = &types.MetricMetadata{}
}
m := &floatCounter{floatMetric{metric{
MetricInfo: types.MetricInfo{
Name: name,
Description: description,
Fields: ... | [
"func",
"NewFloatCounter",
"(",
"name",
"string",
",",
"description",
"string",
",",
"metadata",
"*",
"types",
".",
"MetricMetadata",
",",
"fields",
"...",
"field",
".",
"Field",
")",
"FloatCounter",
"{",
"if",
"metadata",
"==",
"nil",
"{",
"metadata",
"=",
... | // NewFloatCounter returns a new cumulative floating-point metric. | [
"NewFloatCounter",
"returns",
"a",
"new",
"cumulative",
"floating",
"-",
"point",
"metric",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/tsmon/metric/metric.go#L168-L183 |
9,321 | luci/luci-go | common/tsmon/metric/metric.go | NewString | func NewString(name string, description string, metadata *types.MetricMetadata, fields ...field.Field) String {
if metadata == nil {
metadata = &types.MetricMetadata{}
}
m := &stringMetric{metric{
MetricInfo: types.MetricInfo{
Name: name,
Description: description,
Fields: fields,
ValueTyp... | go | func NewString(name string, description string, metadata *types.MetricMetadata, fields ...field.Field) String {
if metadata == nil {
metadata = &types.MetricMetadata{}
}
m := &stringMetric{metric{
MetricInfo: types.MetricInfo{
Name: name,
Description: description,
Fields: fields,
ValueTyp... | [
"func",
"NewString",
"(",
"name",
"string",
",",
"description",
"string",
",",
"metadata",
"*",
"types",
".",
"MetricMetadata",
",",
"fields",
"...",
"field",
".",
"Field",
")",
"String",
"{",
"if",
"metadata",
"==",
"nil",
"{",
"metadata",
"=",
"&",
"ty... | // NewString returns a new string-valued metric. | [
"NewString",
"returns",
"a",
"new",
"string",
"-",
"valued",
"metric",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/tsmon/metric/metric.go#L186-L201 |
9,322 | luci/luci-go | common/tsmon/metric/metric.go | NewBool | func NewBool(name string, description string, metadata *types.MetricMetadata, fields ...field.Field) Bool {
if metadata == nil {
metadata = &types.MetricMetadata{}
}
m := &boolMetric{metric{
MetricInfo: types.MetricInfo{
Name: name,
Description: description,
Fields: fields,
ValueType: t... | go | func NewBool(name string, description string, metadata *types.MetricMetadata, fields ...field.Field) Bool {
if metadata == nil {
metadata = &types.MetricMetadata{}
}
m := &boolMetric{metric{
MetricInfo: types.MetricInfo{
Name: name,
Description: description,
Fields: fields,
ValueType: t... | [
"func",
"NewBool",
"(",
"name",
"string",
",",
"description",
"string",
",",
"metadata",
"*",
"types",
".",
"MetricMetadata",
",",
"fields",
"...",
"field",
".",
"Field",
")",
"Bool",
"{",
"if",
"metadata",
"==",
"nil",
"{",
"metadata",
"=",
"&",
"types"... | // NewBool returns a new bool-valued metric. | [
"NewBool",
"returns",
"a",
"new",
"bool",
"-",
"valued",
"metric",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/tsmon/metric/metric.go#L204-L219 |
9,323 | luci/luci-go | common/tsmon/metric/metric.go | NewCumulativeDistribution | func NewCumulativeDistribution(name string, description string, metadata *types.MetricMetadata, bucketer *distribution.Bucketer, fields ...field.Field) CumulativeDistribution {
if metadata == nil {
metadata = &types.MetricMetadata{}
}
m := &cumulativeDistributionMetric{
nonCumulativeDistributionMetric{
metric... | go | func NewCumulativeDistribution(name string, description string, metadata *types.MetricMetadata, bucketer *distribution.Bucketer, fields ...field.Field) CumulativeDistribution {
if metadata == nil {
metadata = &types.MetricMetadata{}
}
m := &cumulativeDistributionMetric{
nonCumulativeDistributionMetric{
metric... | [
"func",
"NewCumulativeDistribution",
"(",
"name",
"string",
",",
"description",
"string",
",",
"metadata",
"*",
"types",
".",
"MetricMetadata",
",",
"bucketer",
"*",
"distribution",
".",
"Bucketer",
",",
"fields",
"...",
"field",
".",
"Field",
")",
"CumulativeDi... | // NewCumulativeDistribution returns a new cumulative-distribution-valued
// metric. | [
"NewCumulativeDistribution",
"returns",
"a",
"new",
"cumulative",
"-",
"distribution",
"-",
"valued",
"metric",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/tsmon/metric/metric.go#L223-L243 |
9,324 | luci/luci-go | common/tsmon/metric/metric.go | NewNonCumulativeDistribution | func NewNonCumulativeDistribution(name string, description string, metadata *types.MetricMetadata, bucketer *distribution.Bucketer, fields ...field.Field) NonCumulativeDistribution {
if metadata == nil {
metadata = &types.MetricMetadata{}
}
m := &nonCumulativeDistributionMetric{
metric: metric{
MetricInfo: ty... | go | func NewNonCumulativeDistribution(name string, description string, metadata *types.MetricMetadata, bucketer *distribution.Bucketer, fields ...field.Field) NonCumulativeDistribution {
if metadata == nil {
metadata = &types.MetricMetadata{}
}
m := &nonCumulativeDistributionMetric{
metric: metric{
MetricInfo: ty... | [
"func",
"NewNonCumulativeDistribution",
"(",
"name",
"string",
",",
"description",
"string",
",",
"metadata",
"*",
"types",
".",
"MetricMetadata",
",",
"bucketer",
"*",
"distribution",
".",
"Bucketer",
",",
"fields",
"...",
"field",
".",
"Field",
")",
"NonCumula... | // NewNonCumulativeDistribution returns a new non-cumulative-distribution-valued
// metric. | [
"NewNonCumulativeDistribution",
"returns",
"a",
"new",
"non",
"-",
"cumulative",
"-",
"distribution",
"-",
"valued",
"metric",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/tsmon/metric/metric.go#L247-L265 |
9,325 | luci/luci-go | common/tsmon/metric/metric.go | genericGet | func (m *metric) genericGet(zero interface{}, c context.Context, fieldVals []interface{}) interface{} {
if ret := tsmon.Store(c).Get(c, m, m.fixedResetTime, fieldVals); ret != nil {
return ret
}
return zero
} | go | func (m *metric) genericGet(zero interface{}, c context.Context, fieldVals []interface{}) interface{} {
if ret := tsmon.Store(c).Get(c, m, m.fixedResetTime, fieldVals); ret != nil {
return ret
}
return zero
} | [
"func",
"(",
"m",
"*",
"metric",
")",
"genericGet",
"(",
"zero",
"interface",
"{",
"}",
",",
"c",
"context",
".",
"Context",
",",
"fieldVals",
"[",
"]",
"interface",
"{",
"}",
")",
"interface",
"{",
"}",
"{",
"if",
"ret",
":=",
"tsmon",
".",
"Store... | // genericGet is a convenience function that tries to get a metric value from
// the store and returns the zero value if it didn't exist. | [
"genericGet",
"is",
"a",
"convenience",
"function",
"that",
"tries",
"to",
"get",
"a",
"metric",
"value",
"from",
"the",
"store",
"and",
"returns",
"the",
"zero",
"value",
"if",
"it",
"didn",
"t",
"exist",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/tsmon/metric/metric.go#L269-L274 |
9,326 | luci/luci-go | scheduler/appengine/engine/policy/request_builder.go | DebugLog | func (r *RequestBuilder) DebugLog(format string, args ...interface{}) {
r.Request.DebugLog += fmt.Sprintf(format+"\n", args...)
if r.env != nil {
r.env.DebugLog(format, args...)
}
} | go | func (r *RequestBuilder) DebugLog(format string, args ...interface{}) {
r.Request.DebugLog += fmt.Sprintf(format+"\n", args...)
if r.env != nil {
r.env.DebugLog(format, args...)
}
} | [
"func",
"(",
"r",
"*",
"RequestBuilder",
")",
"DebugLog",
"(",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"r",
".",
"Request",
".",
"DebugLog",
"+=",
"fmt",
".",
"Sprintf",
"(",
"format",
"+",
"\"",
"\\n",
"\"",
",",
"... | // DebugLog adds a line to the request log and the triage log. | [
"DebugLog",
"adds",
"a",
"line",
"to",
"the",
"request",
"log",
"and",
"the",
"triage",
"log",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/policy/request_builder.go#L41-L46 |
9,327 | luci/luci-go | scheduler/appengine/engine/policy/request_builder.go | FromTrigger | func (r *RequestBuilder) FromTrigger(t *internal.Trigger) {
switch p := t.Payload.(type) {
case *internal.Trigger_Cron:
r.FromCronTrigger(p.Cron)
case *internal.Trigger_Webui:
r.FromWebUITrigger(p.Webui)
case *internal.Trigger_Noop:
r.FromNoopTrigger(p.Noop)
case *internal.Trigger_Gitiles:
r.FromGitilesTri... | go | func (r *RequestBuilder) FromTrigger(t *internal.Trigger) {
switch p := t.Payload.(type) {
case *internal.Trigger_Cron:
r.FromCronTrigger(p.Cron)
case *internal.Trigger_Webui:
r.FromWebUITrigger(p.Webui)
case *internal.Trigger_Noop:
r.FromNoopTrigger(p.Noop)
case *internal.Trigger_Gitiles:
r.FromGitilesTri... | [
"func",
"(",
"r",
"*",
"RequestBuilder",
")",
"FromTrigger",
"(",
"t",
"*",
"internal",
".",
"Trigger",
")",
"{",
"switch",
"p",
":=",
"t",
".",
"Payload",
".",
"(",
"type",
")",
"{",
"case",
"*",
"internal",
".",
"Trigger_Cron",
":",
"r",
".",
"Fr... | // FromTrigger derives the request properties from the given trigger. | [
"FromTrigger",
"derives",
"the",
"request",
"properties",
"from",
"the",
"given",
"trigger",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/policy/request_builder.go#L49-L64 |
9,328 | luci/luci-go | scheduler/appengine/engine/policy/request_builder.go | FromNoopTrigger | func (r *RequestBuilder) FromNoopTrigger(t *scheduler.NoopTrigger) {
r.Properties = structFromMap(map[string]string{
"noop_trigger_data": t.Data, // for testing
})
} | go | func (r *RequestBuilder) FromNoopTrigger(t *scheduler.NoopTrigger) {
r.Properties = structFromMap(map[string]string{
"noop_trigger_data": t.Data, // for testing
})
} | [
"func",
"(",
"r",
"*",
"RequestBuilder",
")",
"FromNoopTrigger",
"(",
"t",
"*",
"scheduler",
".",
"NoopTrigger",
")",
"{",
"r",
".",
"Properties",
"=",
"structFromMap",
"(",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"t",
".",
"Data",
... | // FromNoopTrigger derives the request properties from the given noop trigger. | [
"FromNoopTrigger",
"derives",
"the",
"request",
"properties",
"from",
"the",
"given",
"noop",
"trigger",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/policy/request_builder.go#L78-L82 |
9,329 | luci/luci-go | scheduler/appengine/engine/policy/request_builder.go | FromGitilesTrigger | func (r *RequestBuilder) FromGitilesTrigger(t *scheduler.GitilesTrigger) {
repo, err := gitiles.NormalizeRepoURL(t.Repo, false)
if err != nil {
r.DebugLog("Bad repo URL %q in the trigger - %s", t.Repo, err)
return
}
commit := &buildbucketpb.GitilesCommit{
Host: repo.Host,
Project: strings.TrimPrefix(repo... | go | func (r *RequestBuilder) FromGitilesTrigger(t *scheduler.GitilesTrigger) {
repo, err := gitiles.NormalizeRepoURL(t.Repo, false)
if err != nil {
r.DebugLog("Bad repo URL %q in the trigger - %s", t.Repo, err)
return
}
commit := &buildbucketpb.GitilesCommit{
Host: repo.Host,
Project: strings.TrimPrefix(repo... | [
"func",
"(",
"r",
"*",
"RequestBuilder",
")",
"FromGitilesTrigger",
"(",
"t",
"*",
"scheduler",
".",
"GitilesTrigger",
")",
"{",
"repo",
",",
"err",
":=",
"gitiles",
".",
"NormalizeRepoURL",
"(",
"t",
".",
"Repo",
",",
"false",
")",
"\n",
"if",
"err",
... | // FromGitilesTrigger derives the request properties from the given gitiles
// trigger. | [
"FromGitilesTrigger",
"derives",
"the",
"request",
"properties",
"from",
"the",
"given",
"gitiles",
"trigger",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/policy/request_builder.go#L86-L109 |
9,330 | luci/luci-go | scheduler/appengine/engine/policy/request_builder.go | FromBuildbucketTrigger | func (r *RequestBuilder) FromBuildbucketTrigger(t *scheduler.BuildbucketTrigger) {
r.Properties = t.Properties
r.Tags = t.Tags
} | go | func (r *RequestBuilder) FromBuildbucketTrigger(t *scheduler.BuildbucketTrigger) {
r.Properties = t.Properties
r.Tags = t.Tags
} | [
"func",
"(",
"r",
"*",
"RequestBuilder",
")",
"FromBuildbucketTrigger",
"(",
"t",
"*",
"scheduler",
".",
"BuildbucketTrigger",
")",
"{",
"r",
".",
"Properties",
"=",
"t",
".",
"Properties",
"\n",
"r",
".",
"Tags",
"=",
"t",
".",
"Tags",
"\n",
"}"
] | // FromBuildbucketTrigger derives the request properties from the given
// buildbucket trigger. | [
"FromBuildbucketTrigger",
"derives",
"the",
"request",
"properties",
"from",
"the",
"given",
"buildbucket",
"trigger",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/policy/request_builder.go#L113-L116 |
9,331 | luci/luci-go | buildbucket/proto/rpc.mock.pb.go | NewMockisBatchRequest_Request_Request | func NewMockisBatchRequest_Request_Request(ctrl *gomock.Controller) *MockisBatchRequest_Request_Request {
mock := &MockisBatchRequest_Request_Request{ctrl: ctrl}
mock.recorder = &MockisBatchRequest_Request_RequestMockRecorder{mock}
return mock
} | go | func NewMockisBatchRequest_Request_Request(ctrl *gomock.Controller) *MockisBatchRequest_Request_Request {
mock := &MockisBatchRequest_Request_Request{ctrl: ctrl}
mock.recorder = &MockisBatchRequest_Request_RequestMockRecorder{mock}
return mock
} | [
"func",
"NewMockisBatchRequest_Request_Request",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockisBatchRequest_Request_Request",
"{",
"mock",
":=",
"&",
"MockisBatchRequest_Request_Request",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
... | // NewMockisBatchRequest_Request_Request creates a new mock instance | [
"NewMockisBatchRequest_Request_Request",
"creates",
"a",
"new",
"mock",
"instance"
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/proto/rpc.mock.pb.go#L26-L30 |
9,332 | luci/luci-go | buildbucket/proto/rpc.mock.pb.go | isBatchRequest_Request_Request | func (m *MockisBatchRequest_Request_Request) isBatchRequest_Request_Request() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "isBatchRequest_Request_Request")
} | go | func (m *MockisBatchRequest_Request_Request) isBatchRequest_Request_Request() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "isBatchRequest_Request_Request")
} | [
"func",
"(",
"m",
"*",
"MockisBatchRequest_Request_Request",
")",
"isBatchRequest_Request_Request",
"(",
")",
"{",
"m",
".",
"ctrl",
".",
"T",
".",
"Helper",
"(",
")",
"\n",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"}"
] | // isBatchRequest_Request_Request mocks base method | [
"isBatchRequest_Request_Request",
"mocks",
"base",
"method"
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/proto/rpc.mock.pb.go#L38-L41 |
9,333 | luci/luci-go | buildbucket/proto/rpc.mock.pb.go | isBatchRequest_Request_Request | func (mr *MockisBatchRequest_Request_RequestMockRecorder) isBatchRequest_Request_Request() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "isBatchRequest_Request_Request", reflect.TypeOf((*MockisBatchRequest_Request_Request)(nil).isBatchRequest_Request_Request))
} | go | func (mr *MockisBatchRequest_Request_RequestMockRecorder) isBatchRequest_Request_Request() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "isBatchRequest_Request_Request", reflect.TypeOf((*MockisBatchRequest_Request_Request)(nil).isBatchRequest_Request_Request))
} | [
"func",
"(",
"mr",
"*",
"MockisBatchRequest_Request_RequestMockRecorder",
")",
"isBatchRequest_Request_Request",
"(",
")",
"*",
"gomock",
".",
"Call",
"{",
"mr",
".",
"mock",
".",
"ctrl",
".",
"T",
".",
"Helper",
"(",
")",
"\n",
"return",
"mr",
".",
"mock",
... | // isBatchRequest_Request_Request indicates an expected call of isBatchRequest_Request_Request | [
"isBatchRequest_Request_Request",
"indicates",
"an",
"expected",
"call",
"of",
"isBatchRequest_Request_Request"
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/proto/rpc.mock.pb.go#L44-L47 |
9,334 | luci/luci-go | buildbucket/proto/rpc.mock.pb.go | NewMockisBatchResponse_Response_Response | func NewMockisBatchResponse_Response_Response(ctrl *gomock.Controller) *MockisBatchResponse_Response_Response {
mock := &MockisBatchResponse_Response_Response{ctrl: ctrl}
mock.recorder = &MockisBatchResponse_Response_ResponseMockRecorder{mock}
return mock
} | go | func NewMockisBatchResponse_Response_Response(ctrl *gomock.Controller) *MockisBatchResponse_Response_Response {
mock := &MockisBatchResponse_Response_Response{ctrl: ctrl}
mock.recorder = &MockisBatchResponse_Response_ResponseMockRecorder{mock}
return mock
} | [
"func",
"NewMockisBatchResponse_Response_Response",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockisBatchResponse_Response_Response",
"{",
"mock",
":=",
"&",
"MockisBatchResponse_Response_Response",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"re... | // NewMockisBatchResponse_Response_Response creates a new mock instance | [
"NewMockisBatchResponse_Response_Response",
"creates",
"a",
"new",
"mock",
"instance"
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/proto/rpc.mock.pb.go#L61-L65 |
9,335 | luci/luci-go | buildbucket/proto/rpc.mock.pb.go | isBatchResponse_Response_Response | func (m *MockisBatchResponse_Response_Response) isBatchResponse_Response_Response() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "isBatchResponse_Response_Response")
} | go | func (m *MockisBatchResponse_Response_Response) isBatchResponse_Response_Response() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "isBatchResponse_Response_Response")
} | [
"func",
"(",
"m",
"*",
"MockisBatchResponse_Response_Response",
")",
"isBatchResponse_Response_Response",
"(",
")",
"{",
"m",
".",
"ctrl",
".",
"T",
".",
"Helper",
"(",
")",
"\n",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"}"... | // isBatchResponse_Response_Response mocks base method | [
"isBatchResponse_Response_Response",
"mocks",
"base",
"method"
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/proto/rpc.mock.pb.go#L73-L76 |
9,336 | luci/luci-go | buildbucket/proto/rpc.mock.pb.go | isBatchResponse_Response_Response | func (mr *MockisBatchResponse_Response_ResponseMockRecorder) isBatchResponse_Response_Response() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "isBatchResponse_Response_Response", reflect.TypeOf((*MockisBatchResponse_Response_Response)(nil).isBatchResponse_Response_Respo... | go | func (mr *MockisBatchResponse_Response_ResponseMockRecorder) isBatchResponse_Response_Response() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "isBatchResponse_Response_Response", reflect.TypeOf((*MockisBatchResponse_Response_Response)(nil).isBatchResponse_Response_Respo... | [
"func",
"(",
"mr",
"*",
"MockisBatchResponse_Response_ResponseMockRecorder",
")",
"isBatchResponse_Response_Response",
"(",
")",
"*",
"gomock",
".",
"Call",
"{",
"mr",
".",
"mock",
".",
"ctrl",
".",
"T",
".",
"Helper",
"(",
")",
"\n",
"return",
"mr",
".",
"m... | // isBatchResponse_Response_Response indicates an expected call of isBatchResponse_Response_Response | [
"isBatchResponse_Response_Response",
"indicates",
"an",
"expected",
"call",
"of",
"isBatchResponse_Response_Response"
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/proto/rpc.mock.pb.go#L79-L82 |
9,337 | luci/luci-go | buildbucket/proto/rpc.mock.pb.go | NewMockBuildsClient | func NewMockBuildsClient(ctrl *gomock.Controller) *MockBuildsClient {
mock := &MockBuildsClient{ctrl: ctrl}
mock.recorder = &MockBuildsClientMockRecorder{mock}
return mock
} | go | func NewMockBuildsClient(ctrl *gomock.Controller) *MockBuildsClient {
mock := &MockBuildsClient{ctrl: ctrl}
mock.recorder = &MockBuildsClientMockRecorder{mock}
return mock
} | [
"func",
"NewMockBuildsClient",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockBuildsClient",
"{",
"mock",
":=",
"&",
"MockBuildsClient",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockBuildsClientMockRecorder",
"{",... | // NewMockBuildsClient creates a new mock instance | [
"NewMockBuildsClient",
"creates",
"a",
"new",
"mock",
"instance"
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/proto/rpc.mock.pb.go#L96-L100 |
9,338 | luci/luci-go | buildbucket/proto/rpc.mock.pb.go | GetBuild | func (m *MockBuildsClient) GetBuild(ctx context.Context, in *GetBuildRequest, opts ...grpc.CallOption) (*Build, error) {
m.ctrl.T.Helper()
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "GetBuild", varargs...)
ret0, _ := ret[0].(*Build)
ret1, _ :... | go | func (m *MockBuildsClient) GetBuild(ctx context.Context, in *GetBuildRequest, opts ...grpc.CallOption) (*Build, error) {
m.ctrl.T.Helper()
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "GetBuild", varargs...)
ret0, _ := ret[0].(*Build)
ret1, _ :... | [
"func",
"(",
"m",
"*",
"MockBuildsClient",
")",
"GetBuild",
"(",
"ctx",
"context",
".",
"Context",
",",
"in",
"*",
"GetBuildRequest",
",",
"opts",
"...",
"grpc",
".",
"CallOption",
")",
"(",
"*",
"Build",
",",
"error",
")",
"{",
"m",
".",
"ctrl",
"."... | // GetBuild mocks base method | [
"GetBuild",
"mocks",
"base",
"method"
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/proto/rpc.mock.pb.go#L108-L118 |
9,339 | luci/luci-go | buildbucket/proto/rpc.mock.pb.go | GetBuild | func (mr *MockBuildsClientMockRecorder) GetBuild(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, "GetBuild", reflect.TypeOf((*MockBuildsClient)(nil).GetBuild), varargs...)
} | go | func (mr *MockBuildsClientMockRecorder) GetBuild(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, "GetBuild", reflect.TypeOf((*MockBuildsClient)(nil).GetBuild), varargs...)
} | [
"func",
"(",
"mr",
"*",
"MockBuildsClientMockRecorder",
")",
"GetBuild",
"(",
"ctx",
",",
"in",
"interface",
"{",
"}",
",",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"mr",
".",
"mock",
".",
"ctrl",
".",
"T",
".",
"... | // GetBuild indicates an expected call of GetBuild | [
"GetBuild",
"indicates",
"an",
"expected",
"call",
"of",
"GetBuild"
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/proto/rpc.mock.pb.go#L121-L125 |
9,340 | luci/luci-go | buildbucket/proto/rpc.mock.pb.go | NewMockBuildsServer | func NewMockBuildsServer(ctrl *gomock.Controller) *MockBuildsServer {
mock := &MockBuildsServer{ctrl: ctrl}
mock.recorder = &MockBuildsServerMockRecorder{mock}
return mock
} | go | func NewMockBuildsServer(ctrl *gomock.Controller) *MockBuildsServer {
mock := &MockBuildsServer{ctrl: ctrl}
mock.recorder = &MockBuildsServerMockRecorder{mock}
return mock
} | [
"func",
"NewMockBuildsServer",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockBuildsServer",
"{",
"mock",
":=",
"&",
"MockBuildsServer",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockBuildsServerMockRecorder",
"{",... | // NewMockBuildsServer creates a new mock instance | [
"NewMockBuildsServer",
"creates",
"a",
"new",
"mock",
"instance"
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/proto/rpc.mock.pb.go#L239-L243 |
9,341 | luci/luci-go | buildbucket/proto/rpc.mock.pb.go | ScheduleBuild | func (m *MockBuildsServer) ScheduleBuild(arg0 context.Context, arg1 *ScheduleBuildRequest) (*Build, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ScheduleBuild", arg0, arg1)
ret0, _ := ret[0].(*Build)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockBuildsServer) ScheduleBuild(arg0 context.Context, arg1 *ScheduleBuildRequest) (*Build, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ScheduleBuild", arg0, arg1)
ret0, _ := ret[0].(*Build)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockBuildsServer",
")",
"ScheduleBuild",
"(",
"arg0",
"context",
".",
"Context",
",",
"arg1",
"*",
"ScheduleBuildRequest",
")",
"(",
"*",
"Build",
",",
"error",
")",
"{",
"m",
".",
"ctrl",
".",
"T",
".",
"Helper",
"(",
")",
"\... | // ScheduleBuild mocks base method | [
"ScheduleBuild",
"mocks",
"base",
"method"
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/proto/rpc.mock.pb.go#L296-L302 |
9,342 | luci/luci-go | buildbucket/proto/rpc.mock.pb.go | ScheduleBuild | func (mr *MockBuildsServerMockRecorder) ScheduleBuild(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ScheduleBuild", reflect.TypeOf((*MockBuildsServer)(nil).ScheduleBuild), arg0, arg1)
} | go | func (mr *MockBuildsServerMockRecorder) ScheduleBuild(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ScheduleBuild", reflect.TypeOf((*MockBuildsServer)(nil).ScheduleBuild), arg0, arg1)
} | [
"func",
"(",
"mr",
"*",
"MockBuildsServerMockRecorder",
")",
"ScheduleBuild",
"(",
"arg0",
",",
"arg1",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"mr",
".",
"mock",
".",
"ctrl",
".",
"T",
".",
"Helper",
"(",
")",
"\n",
"return",
"m... | // ScheduleBuild indicates an expected call of ScheduleBuild | [
"ScheduleBuild",
"indicates",
"an",
"expected",
"call",
"of",
"ScheduleBuild"
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/proto/rpc.mock.pb.go#L305-L308 |
9,343 | luci/luci-go | lucicfg/cli/base/base.go | NewCLIError | func NewCLIError(msg string, args ...interface{}) error {
return CommandLineError{fmt.Errorf(msg, args...)}
} | go | func NewCLIError(msg string, args ...interface{}) error {
return CommandLineError{fmt.Errorf(msg, args...)}
} | [
"func",
"NewCLIError",
"(",
"msg",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"CommandLineError",
"{",
"fmt",
".",
"Errorf",
"(",
"msg",
",",
"args",
"...",
")",
"}",
"\n",
"}"
] | // NewCLIError returns new CommandLineError. | [
"NewCLIError",
"returns",
"new",
"CommandLineError",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/cli/base/base.go#L46-L48 |
9,344 | luci/luci-go | lucicfg/cli/base/base.go | Init | func (c *Subcommand) Init(params Parameters) {
c.params = ¶ms
c.Meta = c.DefaultMeta()
c.logConfig.Level = logging.Info
c.logConfig.AddFlags(&c.Flags)
c.authFlags.Register(&c.Flags, params.AuthOptions)
c.Flags.StringVar(&c.jsonOutput, "json-output", "", "Path to write operation results to.")
} | go | func (c *Subcommand) Init(params Parameters) {
c.params = ¶ms
c.Meta = c.DefaultMeta()
c.logConfig.Level = logging.Info
c.logConfig.AddFlags(&c.Flags)
c.authFlags.Register(&c.Flags, params.AuthOptions)
c.Flags.StringVar(&c.jsonOutput, "json-output", "", "Path to write operation results to.")
} | [
"func",
"(",
"c",
"*",
"Subcommand",
")",
"Init",
"(",
"params",
"Parameters",
")",
"{",
"c",
".",
"params",
"=",
"&",
"params",
"\n",
"c",
".",
"Meta",
"=",
"c",
".",
"DefaultMeta",
"(",
")",
"\n",
"c",
".",
"logConfig",
".",
"Level",
"=",
"logg... | // Init registers common flags. | [
"Init",
"registers",
"common",
"flags",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/cli/base/base.go#L85-L93 |
9,345 | luci/luci-go | lucicfg/cli/base/base.go | AddMetaFlags | func (c *Subcommand) AddMetaFlags() {
if c.params == nil {
panic("call Init first")
}
c.Meta.AddFlags(&c.Flags)
} | go | func (c *Subcommand) AddMetaFlags() {
if c.params == nil {
panic("call Init first")
}
c.Meta.AddFlags(&c.Flags)
} | [
"func",
"(",
"c",
"*",
"Subcommand",
")",
"AddMetaFlags",
"(",
")",
"{",
"if",
"c",
".",
"params",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"c",
".",
"Meta",
".",
"AddFlags",
"(",
"&",
"c",
".",
"Flags",
")",
"\n",
"}... | // AddMetaFlags registers c.Meta in the FlagSet.
//
// Used by subcommands that end up executing Starlark. | [
"AddMetaFlags",
"registers",
"c",
".",
"Meta",
"in",
"the",
"FlagSet",
".",
"Used",
"by",
"subcommands",
"that",
"end",
"up",
"executing",
"Starlark",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/cli/base/base.go#L110-L115 |
9,346 | luci/luci-go | lucicfg/cli/base/base.go | printError | func (c *Subcommand) printError(err error) {
if _, ok := err.(CommandLineError); ok {
fmt.Fprintf(os.Stderr, "Bad command line: %s.\n\n", err)
c.Flags.Usage()
} else {
os.Stderr.WriteString(strings.Join(CollectErrorMessages(err, nil), "\n"))
os.Stderr.WriteString("\n")
}
} | go | func (c *Subcommand) printError(err error) {
if _, ok := err.(CommandLineError); ok {
fmt.Fprintf(os.Stderr, "Bad command line: %s.\n\n", err)
c.Flags.Usage()
} else {
os.Stderr.WriteString(strings.Join(CollectErrorMessages(err, nil), "\n"))
os.Stderr.WriteString("\n")
}
} | [
"func",
"(",
"c",
"*",
"Subcommand",
")",
"printError",
"(",
"err",
"error",
")",
"{",
"if",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"CommandLineError",
")",
";",
"ok",
"{",
"fmt",
".",
"Fprintf",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\\n",
"\\n",... | // printError prints an error to stderr.
//
// Recognizes various sorts of known errors and reports the appropriately. | [
"printError",
"prints",
"an",
"error",
"to",
"stderr",
".",
"Recognizes",
"various",
"sorts",
"of",
"known",
"errors",
"and",
"reports",
"the",
"appropriately",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/cli/base/base.go#L206-L214 |
9,347 | luci/luci-go | milo/buildsource/buildbot/buildstore/annotations.go | fetchAnnotationProto | func fetchAnnotationProto(c context.Context, addr *types.StreamAddr) (*miloProto.Step, error) {
// The implementation avoids using existing Milo code because the latter is
// likely to change and because it does things that we don't need here e.g.
// caching that wouldn't apply anyway, etc.
// Instead we use LogDog... | go | func fetchAnnotationProto(c context.Context, addr *types.StreamAddr) (*miloProto.Step, error) {
// The implementation avoids using existing Milo code because the latter is
// likely to change and because it does things that we don't need here e.g.
// caching that wouldn't apply anyway, etc.
// Instead we use LogDog... | [
"func",
"fetchAnnotationProto",
"(",
"c",
"context",
".",
"Context",
",",
"addr",
"*",
"types",
".",
"StreamAddr",
")",
"(",
"*",
"miloProto",
".",
"Step",
",",
"error",
")",
"{",
"// The implementation avoids using existing Milo code because the latter is",
"// likel... | // fetchAnnotationProto fetches an annotation proto from LogDog.
// If the stream is not found, returns errAnnotationNotFound. | [
"fetchAnnotationProto",
"fetches",
"an",
"annotation",
"proto",
"from",
"LogDog",
".",
"If",
"the",
"stream",
"is",
"not",
"found",
"returns",
"errAnnotationNotFound",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/buildbot/buildstore/annotations.go#L51-L93 |
9,348 | luci/luci-go | milo/buildsource/buildbot/buildstore/annotations.go | addSteps | func (ac *annotationConverter) addSteps(c context.Context, dest *[]buildbot.Step, src []*miloProto.Step_Substep, stepNamePrefix string) error {
for _, substep := range src {
stepSrc := substep.GetStep()
if stepSrc == nil {
return errors.Reason("unexpected substep type %T", substep.Substep).Err()
}
stepDst,... | go | func (ac *annotationConverter) addSteps(c context.Context, dest *[]buildbot.Step, src []*miloProto.Step_Substep, stepNamePrefix string) error {
for _, substep := range src {
stepSrc := substep.GetStep()
if stepSrc == nil {
return errors.Reason("unexpected substep type %T", substep.Substep).Err()
}
stepDst,... | [
"func",
"(",
"ac",
"*",
"annotationConverter",
")",
"addSteps",
"(",
"c",
"context",
".",
"Context",
",",
"dest",
"*",
"[",
"]",
"buildbot",
".",
"Step",
",",
"src",
"[",
"]",
"*",
"miloProto",
".",
"Step_Substep",
",",
"stepNamePrefix",
"string",
")",
... | // addSteps converts annotation substeps to buildbot steps and appends them
// dest.
// c is used only for logging. | [
"addSteps",
"converts",
"annotation",
"substeps",
"to",
"buildbot",
"steps",
"and",
"appends",
"them",
"dest",
".",
"c",
"is",
"used",
"only",
"for",
"logging",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/buildbot/buildstore/annotations.go#L104-L120 |
9,349 | luci/luci-go | milo/buildsource/buildbot/buildstore/annotations.go | step | func (ac *annotationConverter) step(c context.Context, src *miloProto.Step) (*buildbot.Step, error) {
// This implementation is based on
// https://chromium.googlesource.com/infra/luci/luci-go/+/7ad046489c578e339b873886d6973abbe43cc137/milo/buildsource/rawpresentation/logDogBuild.go#47
res := &buildbot.Step{
Name... | go | func (ac *annotationConverter) step(c context.Context, src *miloProto.Step) (*buildbot.Step, error) {
// This implementation is based on
// https://chromium.googlesource.com/infra/luci/luci-go/+/7ad046489c578e339b873886d6973abbe43cc137/milo/buildsource/rawpresentation/logDogBuild.go#47
res := &buildbot.Step{
Name... | [
"func",
"(",
"ac",
"*",
"annotationConverter",
")",
"step",
"(",
"c",
"context",
".",
"Context",
",",
"src",
"*",
"miloProto",
".",
"Step",
")",
"(",
"*",
"buildbot",
".",
"Step",
",",
"error",
")",
"{",
"// This implementation is based on",
"// https://chro... | // step converts an annotation step to a buildbot step. | [
"step",
"converts",
"an",
"annotation",
"step",
"to",
"a",
"buildbot",
"step",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/buildbot/buildstore/annotations.go#L123-L202 |
9,350 | luci/luci-go | buildbucket/cli/app.go | application | func application(p Params) *cli.Application {
p.Auth.Scopes = []string{
auth.OAuthScopeEmail,
gerrit.OAuthScope,
}
return &cli.Application{
Name: "bb",
Title: "A CLI client for buildbucket.",
Context: func(ctx context.Context) context.Context {
return logCfg.Use(ctx)
},
Commands: []*subcommands.Co... | go | func application(p Params) *cli.Application {
p.Auth.Scopes = []string{
auth.OAuthScopeEmail,
gerrit.OAuthScope,
}
return &cli.Application{
Name: "bb",
Title: "A CLI client for buildbucket.",
Context: func(ctx context.Context) context.Context {
return logCfg.Use(ctx)
},
Commands: []*subcommands.Co... | [
"func",
"application",
"(",
"p",
"Params",
")",
"*",
"cli",
".",
"Application",
"{",
"p",
".",
"Auth",
".",
"Scopes",
"=",
"[",
"]",
"string",
"{",
"auth",
".",
"OAuthScopeEmail",
",",
"gerrit",
".",
"OAuthScope",
",",
"}",
"\n\n",
"return",
"&",
"cl... | // application creates the application and configures its subcommands.
// Ignores p.Auth.Scopes. | [
"application",
"creates",
"the",
"application",
"and",
"configures",
"its",
"subcommands",
".",
"Ignores",
"p",
".",
"Auth",
".",
"Scopes",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/cli/app.go#L43-L73 |
9,351 | luci/luci-go | common/data/caching/cache/lru.go | keys | func (o *orderedDict) keys() isolated.HexDigests {
out := make(isolated.HexDigests, 0, o.length())
for e := o.ll.Front(); e != nil; e = e.Next() {
out = append(out, e.Value.(*entry).key)
}
return out
} | go | func (o *orderedDict) keys() isolated.HexDigests {
out := make(isolated.HexDigests, 0, o.length())
for e := o.ll.Front(); e != nil; e = e.Next() {
out = append(out, e.Value.(*entry).key)
}
return out
} | [
"func",
"(",
"o",
"*",
"orderedDict",
")",
"keys",
"(",
")",
"isolated",
".",
"HexDigests",
"{",
"out",
":=",
"make",
"(",
"isolated",
".",
"HexDigests",
",",
"0",
",",
"o",
".",
"length",
"(",
")",
")",
"\n",
"for",
"e",
":=",
"o",
".",
"ll",
... | // keys returns the keys in order. | [
"keys",
"returns",
"the",
"keys",
"in",
"order",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/caching/cache/lru.go#L75-L81 |
9,352 | luci/luci-go | common/data/caching/cache/lru.go | serialized | func (o *orderedDict) serialized() []entry {
out := make([]entry, 0, o.length())
for e := o.ll.Front(); e != nil; e = e.Next() {
out = append(out, *e.Value.(*entry))
}
return out
} | go | func (o *orderedDict) serialized() []entry {
out := make([]entry, 0, o.length())
for e := o.ll.Front(); e != nil; e = e.Next() {
out = append(out, *e.Value.(*entry))
}
return out
} | [
"func",
"(",
"o",
"*",
"orderedDict",
")",
"serialized",
"(",
")",
"[",
"]",
"entry",
"{",
"out",
":=",
"make",
"(",
"[",
"]",
"entry",
",",
"0",
",",
"o",
".",
"length",
"(",
")",
")",
"\n",
"for",
"e",
":=",
"o",
".",
"ll",
".",
"Front",
... | // serialized returns all the items in order. | [
"serialized",
"returns",
"all",
"the",
"items",
"in",
"order",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/caching/cache/lru.go#L128-L134 |
9,353 | luci/luci-go | cipd/appengine/ui/nav.go | breadcrumbs | func breadcrumbs(path string, ver string) []breadcrumb {
out := []breadcrumb{
{Title: "[root]", Href: prefixPageURL("")},
}
if path != "" {
chunks := strings.Split(path, "/")
for i, ch := range chunks {
out = append(out, breadcrumb{
Title: ch,
Href: prefixPageURL(strings.Join(chunks[:i+1], "/")),
... | go | func breadcrumbs(path string, ver string) []breadcrumb {
out := []breadcrumb{
{Title: "[root]", Href: prefixPageURL("")},
}
if path != "" {
chunks := strings.Split(path, "/")
for i, ch := range chunks {
out = append(out, breadcrumb{
Title: ch,
Href: prefixPageURL(strings.Join(chunks[:i+1], "/")),
... | [
"func",
"breadcrumbs",
"(",
"path",
"string",
",",
"ver",
"string",
")",
"[",
"]",
"breadcrumb",
"{",
"out",
":=",
"[",
"]",
"breadcrumb",
"{",
"{",
"Title",
":",
"\"",
"\"",
",",
"Href",
":",
"prefixPageURL",
"(",
"\"",
"\"",
")",
"}",
",",
"}",
... | // breadcrumbs builds a data for the breadcrumps navigation element.
//
// It contains a prefix path, where each element is clickable. | [
"breadcrumbs",
"builds",
"a",
"data",
"for",
"the",
"breadcrumps",
"navigation",
"element",
".",
"It",
"contains",
"a",
"prefix",
"path",
"where",
"each",
"element",
"is",
"clickable",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/ui/nav.go#L30-L57 |
9,354 | luci/luci-go | cipd/appengine/ui/nav.go | prefixesListing | func prefixesListing(pfx string, prefixes []string) []listingItem {
out := make([]listingItem, 0, len(prefixes)+1)
if pfx != "" {
parent := ""
if idx := strings.LastIndex(pfx, "/"); idx != -1 {
parent = pfx[:idx]
}
out = append(out, listingItem{
Back: true,
Href: prefixPageURL(parent),
})
}
retur... | go | func prefixesListing(pfx string, prefixes []string) []listingItem {
out := make([]listingItem, 0, len(prefixes)+1)
if pfx != "" {
parent := ""
if idx := strings.LastIndex(pfx, "/"); idx != -1 {
parent = pfx[:idx]
}
out = append(out, listingItem{
Back: true,
Href: prefixPageURL(parent),
})
}
retur... | [
"func",
"prefixesListing",
"(",
"pfx",
"string",
",",
"prefixes",
"[",
"]",
"string",
")",
"[",
"]",
"listingItem",
"{",
"out",
":=",
"make",
"(",
"[",
"]",
"listingItem",
",",
"0",
",",
"len",
"(",
"prefixes",
")",
"+",
"1",
")",
"\n",
"if",
"pfx"... | // prefixesListing formats a list of child prefixes of 'pfx'.
//
// The result includes '..' if 'pfx' is not root. | [
"prefixesListing",
"formats",
"a",
"list",
"of",
"child",
"prefixes",
"of",
"pfx",
".",
"The",
"result",
"includes",
"..",
"if",
"pfx",
"is",
"not",
"root",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/ui/nav.go#L83-L100 |
9,355 | luci/luci-go | cipd/appengine/ui/nav.go | packagesListing | func packagesListing(pfx string, pkgs []string, active string) []listingItem {
out := make([]listingItem, 0, len(pkgs))
return pathListing(pfx, pkgs, out, func(p string) listingItem {
return listingItem{
Href: packagePageURL(p, ""),
Active: p == active,
}
})
} | go | func packagesListing(pfx string, pkgs []string, active string) []listingItem {
out := make([]listingItem, 0, len(pkgs))
return pathListing(pfx, pkgs, out, func(p string) listingItem {
return listingItem{
Href: packagePageURL(p, ""),
Active: p == active,
}
})
} | [
"func",
"packagesListing",
"(",
"pfx",
"string",
",",
"pkgs",
"[",
"]",
"string",
",",
"active",
"string",
")",
"[",
"]",
"listingItem",
"{",
"out",
":=",
"make",
"(",
"[",
"]",
"listingItem",
",",
"0",
",",
"len",
"(",
"pkgs",
")",
")",
"\n",
"ret... | // packagesListing formats a list of packages under 'pfx'.
//
// One of them can be hilighted as Active. | [
"packagesListing",
"formats",
"a",
"list",
"of",
"packages",
"under",
"pfx",
".",
"One",
"of",
"them",
"can",
"be",
"hilighted",
"as",
"Active",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/ui/nav.go#L105-L113 |
9,356 | luci/luci-go | client/cmd/swarming/common.go | Init | func (c *commonFlags) Init(authOpts auth.Options) {
c.defaultFlags.Init(&c.Flags)
c.authFlags.Register(&c.Flags, authOpts)
c.Flags.StringVar(&c.serverURL, "server", os.Getenv("SWARMING_SERVER"), "Server URL; required. Set $SWARMING_SERVER to set a default.")
c.Flags.IntVar(&c.worker, "worker", 8, "Number of workers... | go | func (c *commonFlags) Init(authOpts auth.Options) {
c.defaultFlags.Init(&c.Flags)
c.authFlags.Register(&c.Flags, authOpts)
c.Flags.StringVar(&c.serverURL, "server", os.Getenv("SWARMING_SERVER"), "Server URL; required. Set $SWARMING_SERVER to set a default.")
c.Flags.IntVar(&c.worker, "worker", 8, "Number of workers... | [
"func",
"(",
"c",
"*",
"commonFlags",
")",
"Init",
"(",
"authOpts",
"auth",
".",
"Options",
")",
"{",
"c",
".",
"defaultFlags",
".",
"Init",
"(",
"&",
"c",
".",
"Flags",
")",
"\n",
"c",
".",
"authFlags",
".",
"Register",
"(",
"&",
"c",
".",
"Flag... | // Init initializes common flags. | [
"Init",
"initializes",
"common",
"flags",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/cmd/swarming/common.go#L179-L184 |
9,357 | luci/luci-go | client/cmd/swarming/common.go | Parse | func (c *commonFlags) Parse() error {
if err := c.defaultFlags.Parse(); err != nil {
return err
}
if c.serverURL == "" {
return errors.Reason("must provide -server").Err()
}
s, err := lhttp.CheckURL(c.serverURL)
if err != nil {
return err
}
c.serverURL = s
c.parsedAuthOpts, err = c.authFlags.Options()
r... | go | func (c *commonFlags) Parse() error {
if err := c.defaultFlags.Parse(); err != nil {
return err
}
if c.serverURL == "" {
return errors.Reason("must provide -server").Err()
}
s, err := lhttp.CheckURL(c.serverURL)
if err != nil {
return err
}
c.serverURL = s
c.parsedAuthOpts, err = c.authFlags.Options()
r... | [
"func",
"(",
"c",
"*",
"commonFlags",
")",
"Parse",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"c",
".",
"defaultFlags",
".",
"Parse",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"c",
".",
"serverURL",
"==",
... | // Parse parses the common flags. | [
"Parse",
"parses",
"the",
"common",
"flags",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/cmd/swarming/common.go#L187-L201 |
9,358 | luci/luci-go | client/cmd/swarming/common.go | retryGoogleRPC | func retryGoogleRPC(ctx context.Context, rpcName string, rpc func() error) error {
return retry.Retry(ctx, transient.Only(retry.Default), func() error {
err := rpc()
if gerr, ok := err.(*googleapi.Error); ok && gerr.Code >= 500 {
err = transient.Tag.Apply(err)
}
return err
}, retry.LogCallback(ctx, rpcName... | go | func retryGoogleRPC(ctx context.Context, rpcName string, rpc func() error) error {
return retry.Retry(ctx, transient.Only(retry.Default), func() error {
err := rpc()
if gerr, ok := err.(*googleapi.Error); ok && gerr.Code >= 500 {
err = transient.Tag.Apply(err)
}
return err
}, retry.LogCallback(ctx, rpcName... | [
"func",
"retryGoogleRPC",
"(",
"ctx",
"context",
".",
"Context",
",",
"rpcName",
"string",
",",
"rpc",
"func",
"(",
")",
"error",
")",
"error",
"{",
"return",
"retry",
".",
"Retry",
"(",
"ctx",
",",
"transient",
".",
"Only",
"(",
"retry",
".",
"Default... | // retryGoogleRPC retries an RPC on transient errors, such as HTTP 500. | [
"retryGoogleRPC",
"retries",
"an",
"RPC",
"on",
"transient",
"errors",
"such",
"as",
"HTTP",
"500",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/cmd/swarming/common.go#L237-L245 |
9,359 | luci/luci-go | machine-db/appengine/config/platforms.go | importPlatforms | func importPlatforms(c context.Context, configSet config.Set) (map[string]int64, error) {
platform := &configPB.Platforms{}
metadata := &config.Meta{}
if err := cfgclient.Get(c, cfgclient.AsService, configSet, platformsFilename, textproto.Message(platform), metadata); err != nil {
return nil, errors.Annotate(err, ... | go | func importPlatforms(c context.Context, configSet config.Set) (map[string]int64, error) {
platform := &configPB.Platforms{}
metadata := &config.Meta{}
if err := cfgclient.Get(c, cfgclient.AsService, configSet, platformsFilename, textproto.Message(platform), metadata); err != nil {
return nil, errors.Annotate(err, ... | [
"func",
"importPlatforms",
"(",
"c",
"context",
".",
"Context",
",",
"configSet",
"config",
".",
"Set",
")",
"(",
"map",
"[",
"string",
"]",
"int64",
",",
"error",
")",
"{",
"platform",
":=",
"&",
"configPB",
".",
"Platforms",
"{",
"}",
"\n",
"metadata... | // importPlatforms fetches, validates, and applies platform configs.
// Returns a map of platform names to IDs. | [
"importPlatforms",
"fetches",
"validates",
"and",
"applies",
"platform",
"configs",
".",
"Returns",
"a",
"map",
"of",
"platform",
"names",
"to",
"IDs",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/config/platforms.go#L37-L57 |
9,360 | luci/luci-go | machine-db/appengine/config/platforms.go | validatePlatforms | func validatePlatforms(c *validation.Context, cfg *configPB.Platforms) {
// Platform names must be unique.
// Keep records of ones we've already seen.
names := stringset.New(len(cfg.Platform))
for _, p := range cfg.Platform {
switch {
case p.Name == "":
c.Errorf("platform names are required and must be non-e... | go | func validatePlatforms(c *validation.Context, cfg *configPB.Platforms) {
// Platform names must be unique.
// Keep records of ones we've already seen.
names := stringset.New(len(cfg.Platform))
for _, p := range cfg.Platform {
switch {
case p.Name == "":
c.Errorf("platform names are required and must be non-e... | [
"func",
"validatePlatforms",
"(",
"c",
"*",
"validation",
".",
"Context",
",",
"cfg",
"*",
"configPB",
".",
"Platforms",
")",
"{",
"// Platform names must be unique.",
"// Keep records of ones we've already seen.",
"names",
":=",
"stringset",
".",
"New",
"(",
"len",
... | // validatePlatforms validates platforms.cfg. | [
"validatePlatforms",
"validates",
"platforms",
".",
"cfg",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/config/platforms.go#L60-L72 |
9,361 | luci/luci-go | client/archiver/upload_tracker.go | newUploadTracker | func newUploadTracker(checker Checker, uploader Uploader, isol *isolated.Isolated) *UploadTracker {
isol.Files = make(map[string]isolated.File)
return &UploadTracker{
checker: checker,
uploader: uploader,
isol: isol,
fileHashCache: make(map[string]hashResult),
lOS: standardOS{}... | go | func newUploadTracker(checker Checker, uploader Uploader, isol *isolated.Isolated) *UploadTracker {
isol.Files = make(map[string]isolated.File)
return &UploadTracker{
checker: checker,
uploader: uploader,
isol: isol,
fileHashCache: make(map[string]hashResult),
lOS: standardOS{}... | [
"func",
"newUploadTracker",
"(",
"checker",
"Checker",
",",
"uploader",
"Uploader",
",",
"isol",
"*",
"isolated",
".",
"Isolated",
")",
"*",
"UploadTracker",
"{",
"isol",
".",
"Files",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"isolated",
".",
"File",
... | // newUploadTracker constructs an UploadTracker. It tracks uploaded files in isol.Files. | [
"newUploadTracker",
"constructs",
"an",
"UploadTracker",
".",
"It",
"tracks",
"uploaded",
"files",
"in",
"isol",
".",
"Files",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/archiver/upload_tracker.go#L90-L99 |
9,362 | luci/luci-go | client/archiver/upload_tracker.go | UploadDeps | func (ut *UploadTracker) UploadDeps(parts partitionedDeps) error {
if err := ut.populateSymlinks(parts.links.items); err != nil {
return err
}
if err := ut.tarAndUploadFiles(parts.filesToArchive.items); err != nil {
return err
}
if err := ut.uploadFiles(parts.indivFiles.items); err != nil {
return err
}
... | go | func (ut *UploadTracker) UploadDeps(parts partitionedDeps) error {
if err := ut.populateSymlinks(parts.links.items); err != nil {
return err
}
if err := ut.tarAndUploadFiles(parts.filesToArchive.items); err != nil {
return err
}
if err := ut.uploadFiles(parts.indivFiles.items); err != nil {
return err
}
... | [
"func",
"(",
"ut",
"*",
"UploadTracker",
")",
"UploadDeps",
"(",
"parts",
"partitionedDeps",
")",
"error",
"{",
"if",
"err",
":=",
"ut",
".",
"populateSymlinks",
"(",
"parts",
".",
"links",
".",
"items",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"er... | // UploadDeps uploads all of the items in parts. | [
"UploadDeps",
"uploads",
"all",
"of",
"the",
"items",
"in",
"parts",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/archiver/upload_tracker.go#L102-L115 |
9,363 | luci/luci-go | client/archiver/upload_tracker.go | populateSymlinks | func (ut *UploadTracker) populateSymlinks(symlinks []*Item) error {
for _, item := range symlinks {
l, err := ut.lOS.Readlink(item.Path)
if err != nil {
return fmt.Errorf("unable to resolve symlink for %q: %v", item.Path, err)
}
ut.isol.Files[item.RelPath] = isolated.SymLink(l)
}
return nil
} | go | func (ut *UploadTracker) populateSymlinks(symlinks []*Item) error {
for _, item := range symlinks {
l, err := ut.lOS.Readlink(item.Path)
if err != nil {
return fmt.Errorf("unable to resolve symlink for %q: %v", item.Path, err)
}
ut.isol.Files[item.RelPath] = isolated.SymLink(l)
}
return nil
} | [
"func",
"(",
"ut",
"*",
"UploadTracker",
")",
"populateSymlinks",
"(",
"symlinks",
"[",
"]",
"*",
"Item",
")",
"error",
"{",
"for",
"_",
",",
"item",
":=",
"range",
"symlinks",
"{",
"l",
",",
"err",
":=",
"ut",
".",
"lOS",
".",
"Readlink",
"(",
"it... | // populateSymlinks adds an isolated.File to files for each provided symlink | [
"populateSymlinks",
"adds",
"an",
"isolated",
".",
"File",
"to",
"files",
"for",
"each",
"provided",
"symlink"
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/archiver/upload_tracker.go#L125-L134 |
9,364 | luci/luci-go | client/archiver/upload_tracker.go | tarAndUploadFiles | func (ut *UploadTracker) tarAndUploadFiles(smallFiles []*Item) error {
bundles := shardItems(smallFiles, archiveMaxSize)
log.Printf("\t%d TAR archives to be isolated", len(bundles))
for _, bundle := range bundles {
bundle := bundle
digest, tarSize, err := bundle.Digest(ut.checker.Hash())
if err != nil {
re... | go | func (ut *UploadTracker) tarAndUploadFiles(smallFiles []*Item) error {
bundles := shardItems(smallFiles, archiveMaxSize)
log.Printf("\t%d TAR archives to be isolated", len(bundles))
for _, bundle := range bundles {
bundle := bundle
digest, tarSize, err := bundle.Digest(ut.checker.Hash())
if err != nil {
re... | [
"func",
"(",
"ut",
"*",
"UploadTracker",
")",
"tarAndUploadFiles",
"(",
"smallFiles",
"[",
"]",
"*",
"Item",
")",
"error",
"{",
"bundles",
":=",
"shardItems",
"(",
"smallFiles",
",",
"archiveMaxSize",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\\t",
"\... | // tarAndUploadFiles creates bundles of files, uploads them, and adds each bundle to files. | [
"tarAndUploadFiles",
"creates",
"bundles",
"of",
"files",
"uploads",
"them",
"and",
"adds",
"each",
"bundle",
"to",
"files",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/archiver/upload_tracker.go#L137-L176 |
9,365 | luci/luci-go | client/archiver/upload_tracker.go | uploadFiles | func (ut *UploadTracker) uploadFiles(files []*Item) error {
// Handle the large individually-uploaded files.
for _, item := range files {
d, err := ut.hashFile(item.Path)
if err != nil {
return err
}
item.Digest = d
ut.isol.Files[item.RelPath] = isolated.BasicFile(item.Digest, int(item.Mode), item.Size)
... | go | func (ut *UploadTracker) uploadFiles(files []*Item) error {
// Handle the large individually-uploaded files.
for _, item := range files {
d, err := ut.hashFile(item.Path)
if err != nil {
return err
}
item.Digest = d
ut.isol.Files[item.RelPath] = isolated.BasicFile(item.Digest, int(item.Mode), item.Size)
... | [
"func",
"(",
"ut",
"*",
"UploadTracker",
")",
"uploadFiles",
"(",
"files",
"[",
"]",
"*",
"Item",
")",
"error",
"{",
"// Handle the large individually-uploaded files.",
"for",
"_",
",",
"item",
":=",
"range",
"files",
"{",
"d",
",",
"err",
":=",
"ut",
".",... | // uploadFiles uploads each file and adds it to files. | [
"uploadFiles",
"uploads",
"each",
"file",
"and",
"adds",
"it",
"to",
"files",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/archiver/upload_tracker.go#L179-L205 |
9,366 | luci/luci-go | client/archiver/upload_tracker.go | Finalize | func (ut *UploadTracker) Finalize(isolatedPath string) (IsolatedSummary, error) {
isolFile, err := newIsolatedFile(ut.isol, isolatedPath)
if err != nil {
return IsolatedSummary{}, err
}
// Check and upload isolate JSON.
ut.checker.AddItem(isolFile.item(ut.checker.Hash()), true, func(item *Item, ps *isolatedclie... | go | func (ut *UploadTracker) Finalize(isolatedPath string) (IsolatedSummary, error) {
isolFile, err := newIsolatedFile(ut.isol, isolatedPath)
if err != nil {
return IsolatedSummary{}, err
}
// Check and upload isolate JSON.
ut.checker.AddItem(isolFile.item(ut.checker.Hash()), true, func(item *Item, ps *isolatedclie... | [
"func",
"(",
"ut",
"*",
"UploadTracker",
")",
"Finalize",
"(",
"isolatedPath",
"string",
")",
"(",
"IsolatedSummary",
",",
"error",
")",
"{",
"isolFile",
",",
"err",
":=",
"newIsolatedFile",
"(",
"ut",
".",
"isol",
",",
"isolatedPath",
")",
"\n",
"if",
"... | // Finalize creates and uploads the isolate JSON at the isolatePath, and closes the checker and uploader.
// It returns the isolate name and digest.
// Finalize should only be called after UploadDeps. | [
"Finalize",
"creates",
"and",
"uploads",
"the",
"isolate",
"JSON",
"at",
"the",
"isolatePath",
"and",
"closes",
"the",
"checker",
"and",
"uploader",
".",
"It",
"returns",
"the",
"isolate",
"name",
"and",
"digest",
".",
"Finalize",
"should",
"only",
"be",
"ca... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/archiver/upload_tracker.go#L217-L245 |
9,367 | luci/luci-go | client/archiver/upload_tracker.go | hashFile | func (ut *UploadTracker) hashFile(path string) (isolated.HexDigest, error) {
if result, ok := ut.fileHashCache[path]; ok {
return result.digest, result.err
}
digest, err := ut.doHashFile(path)
ut.fileHashCache[path] = hashResult{digest, err}
return digest, err
} | go | func (ut *UploadTracker) hashFile(path string) (isolated.HexDigest, error) {
if result, ok := ut.fileHashCache[path]; ok {
return result.digest, result.err
}
digest, err := ut.doHashFile(path)
ut.fileHashCache[path] = hashResult{digest, err}
return digest, err
} | [
"func",
"(",
"ut",
"*",
"UploadTracker",
")",
"hashFile",
"(",
"path",
"string",
")",
"(",
"isolated",
".",
"HexDigest",
",",
"error",
")",
"{",
"if",
"result",
",",
"ok",
":=",
"ut",
".",
"fileHashCache",
"[",
"path",
"]",
";",
"ok",
"{",
"return",
... | // hashFile returns the hash of the contents of path, memoizing its results. | [
"hashFile",
"returns",
"the",
"hash",
"of",
"the",
"contents",
"of",
"path",
"memoizing",
"its",
"results",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/archiver/upload_tracker.go#L248-L256 |
9,368 | luci/luci-go | client/archiver/upload_tracker.go | doHashFile | func (ut *UploadTracker) doHashFile(path string) (isolated.HexDigest, error) {
f, err := ut.lOS.Open(path)
if err != nil {
return "", err
}
defer f.Close()
return isolated.Hash(ut.checker.Hash(), f)
} | go | func (ut *UploadTracker) doHashFile(path string) (isolated.HexDigest, error) {
f, err := ut.lOS.Open(path)
if err != nil {
return "", err
}
defer f.Close()
return isolated.Hash(ut.checker.Hash(), f)
} | [
"func",
"(",
"ut",
"*",
"UploadTracker",
")",
"doHashFile",
"(",
"path",
"string",
")",
"(",
"isolated",
".",
"HexDigest",
",",
"error",
")",
"{",
"f",
",",
"err",
":=",
"ut",
".",
"lOS",
".",
"Open",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"n... | // doHashFile returns the hash of the contents of path. This should not be
// called directly; call hashFile instead. | [
"doHashFile",
"returns",
"the",
"hash",
"of",
"the",
"contents",
"of",
"path",
".",
"This",
"should",
"not",
"be",
"called",
"directly",
";",
"call",
"hashFile",
"instead",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/archiver/upload_tracker.go#L260-L267 |
9,369 | luci/luci-go | client/archiver/upload_tracker.go | writeJSONFile | func (ij *isolatedFile) writeJSONFile(opener openFiler) error {
f, err := opener.OpenFile(ij.path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
if err != nil {
return err
}
_, err = io.Copy(f, bytes.NewBuffer(ij.json))
err2 := f.Close()
if err != nil {
return err
}
return err2
} | go | func (ij *isolatedFile) writeJSONFile(opener openFiler) error {
f, err := opener.OpenFile(ij.path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
if err != nil {
return err
}
_, err = io.Copy(f, bytes.NewBuffer(ij.json))
err2 := f.Close()
if err != nil {
return err
}
return err2
} | [
"func",
"(",
"ij",
"*",
"isolatedFile",
")",
"writeJSONFile",
"(",
"opener",
"openFiler",
")",
"error",
"{",
"f",
",",
"err",
":=",
"opener",
".",
"OpenFile",
"(",
"ij",
".",
"path",
",",
"os",
".",
"O_RDWR",
"|",
"os",
".",
"O_CREATE",
"|",
"os",
... | // writeJSONFile writes the file contents to the filesystem. | [
"writeJSONFile",
"writes",
"the",
"file",
"contents",
"to",
"the",
"filesystem",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/archiver/upload_tracker.go#L300-L311 |
9,370 | luci/luci-go | client/archiver/upload_tracker.go | name | func (ij *isolatedFile) name() string {
name := filepath.Base(ij.path)
if i := strings.LastIndex(name, "."); i != -1 {
name = name[:i]
}
return name
} | go | func (ij *isolatedFile) name() string {
name := filepath.Base(ij.path)
if i := strings.LastIndex(name, "."); i != -1 {
name = name[:i]
}
return name
} | [
"func",
"(",
"ij",
"*",
"isolatedFile",
")",
"name",
"(",
")",
"string",
"{",
"name",
":=",
"filepath",
".",
"Base",
"(",
"ij",
".",
"path",
")",
"\n",
"if",
"i",
":=",
"strings",
".",
"LastIndex",
"(",
"name",
",",
"\"",
"\"",
")",
";",
"i",
"... | // name returns the base name of the isolated file, extension stripped. | [
"name",
"returns",
"the",
"base",
"name",
"of",
"the",
"isolated",
"file",
"extension",
"stripped",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/archiver/upload_tracker.go#L314-L320 |
9,371 | luci/luci-go | appengine/mapper/job.go | ToDatastoreQuery | func (q *Query) ToDatastoreQuery() *datastore.Query {
dq := datastore.NewQuery(q.Kind)
if q.Ancestor != nil {
dq = dq.Ancestor(q.Ancestor)
}
return dq
} | go | func (q *Query) ToDatastoreQuery() *datastore.Query {
dq := datastore.NewQuery(q.Kind)
if q.Ancestor != nil {
dq = dq.Ancestor(q.Ancestor)
}
return dq
} | [
"func",
"(",
"q",
"*",
"Query",
")",
"ToDatastoreQuery",
"(",
")",
"*",
"datastore",
".",
"Query",
"{",
"dq",
":=",
"datastore",
".",
"NewQuery",
"(",
"q",
".",
"Kind",
")",
"\n",
"if",
"q",
".",
"Ancestor",
"!=",
"nil",
"{",
"dq",
"=",
"dq",
"."... | // ToDatastoreQuery returns corresponding datastore.Query. | [
"ToDatastoreQuery",
"returns",
"corresponding",
"datastore",
".",
"Query",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/appengine/mapper/job.go#L48-L54 |
9,372 | luci/luci-go | appengine/mapper/job.go | Validate | func (jc *JobConfig) Validate() error {
switch {
case jc.ShardCount < 1:
return errors.Reason("ShardCount should be >= 1, try 8").Err()
case jc.PageSize <= 0:
return errors.Reason("PageSize should be > 0, try 256").Err()
case jc.PagesPerTask < 0:
return errors.Reason("PagesPerTask should be >= 0, keep 0 for d... | go | func (jc *JobConfig) Validate() error {
switch {
case jc.ShardCount < 1:
return errors.Reason("ShardCount should be >= 1, try 8").Err()
case jc.PageSize <= 0:
return errors.Reason("PageSize should be > 0, try 256").Err()
case jc.PagesPerTask < 0:
return errors.Reason("PagesPerTask should be >= 0, keep 0 for d... | [
"func",
"(",
"jc",
"*",
"JobConfig",
")",
"Validate",
"(",
")",
"error",
"{",
"switch",
"{",
"case",
"jc",
".",
"ShardCount",
"<",
"1",
":",
"return",
"errors",
".",
"Reason",
"(",
"\"",
"\"",
")",
".",
"Err",
"(",
")",
"\n",
"case",
"jc",
".",
... | // Validate returns an error of the config is invalid.
//
// Mapper existence is not checked. | [
"Validate",
"returns",
"an",
"error",
"of",
"the",
"config",
"is",
"invalid",
".",
"Mapper",
"existence",
"is",
"not",
"checked",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/appengine/mapper/job.go#L98-L110 |
9,373 | luci/luci-go | appengine/mapper/job.go | fetchShardIDs | func (j *Job) fetchShardIDs(c context.Context) ([]int64, error) {
l := shardList{Parent: datastore.KeyForObj(c, j)}
switch err := datastore.Get(c, &l); {
case err == datastore.ErrNoSuchEntity:
return nil, errors.Annotate(err, "broken state, no ShardList entity for job %d", j.ID).Err()
case err != nil:
return ni... | go | func (j *Job) fetchShardIDs(c context.Context) ([]int64, error) {
l := shardList{Parent: datastore.KeyForObj(c, j)}
switch err := datastore.Get(c, &l); {
case err == datastore.ErrNoSuchEntity:
return nil, errors.Annotate(err, "broken state, no ShardList entity for job %d", j.ID).Err()
case err != nil:
return ni... | [
"func",
"(",
"j",
"*",
"Job",
")",
"fetchShardIDs",
"(",
"c",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"int64",
",",
"error",
")",
"{",
"l",
":=",
"shardList",
"{",
"Parent",
":",
"datastore",
".",
"KeyForObj",
"(",
"c",
",",
"j",
")",
"}",... | // fetchShardIDs fetches IDs of the job shards. | [
"fetchShardIDs",
"fetches",
"IDs",
"of",
"the",
"job",
"shards",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/appengine/mapper/job.go#L152-L162 |
9,374 | luci/luci-go | appengine/mapper/job.go | fetchShards | func (j *Job) fetchShards(c context.Context) ([]shard, error) {
ids, err := j.fetchShardIDs(c)
if err != nil {
return nil, err
}
shards := make([]shard, len(ids))
for idx, sid := range ids {
shards[idx].ID = sid
}
if err := datastore.Get(c, shards); err != nil {
return nil, errors.Annotate(err, "failed t... | go | func (j *Job) fetchShards(c context.Context) ([]shard, error) {
ids, err := j.fetchShardIDs(c)
if err != nil {
return nil, err
}
shards := make([]shard, len(ids))
for idx, sid := range ids {
shards[idx].ID = sid
}
if err := datastore.Get(c, shards); err != nil {
return nil, errors.Annotate(err, "failed t... | [
"func",
"(",
"j",
"*",
"Job",
")",
"fetchShards",
"(",
"c",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"shard",
",",
"error",
")",
"{",
"ids",
",",
"err",
":=",
"j",
".",
"fetchShardIDs",
"(",
"c",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // fetchShards fetches all job shards. | [
"fetchShards",
"fetches",
"all",
"job",
"shards",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/appengine/mapper/job.go#L165-L180 |
9,375 | luci/luci-go | appengine/mapper/job.go | getJob | func getJob(c context.Context, id JobID) (*Job, error) {
job := &Job{ID: id}
switch err := datastore.Get(c, job); {
case err == datastore.ErrNoSuchEntity:
return nil, ErrNoSuchJob
case err != nil:
return nil, errors.Annotate(err, "transient datastore error").Tag(transient.Tag).Err()
default:
return job, nil
... | go | func getJob(c context.Context, id JobID) (*Job, error) {
job := &Job{ID: id}
switch err := datastore.Get(c, job); {
case err == datastore.ErrNoSuchEntity:
return nil, ErrNoSuchJob
case err != nil:
return nil, errors.Annotate(err, "transient datastore error").Tag(transient.Tag).Err()
default:
return job, nil
... | [
"func",
"getJob",
"(",
"c",
"context",
".",
"Context",
",",
"id",
"JobID",
")",
"(",
"*",
"Job",
",",
"error",
")",
"{",
"job",
":=",
"&",
"Job",
"{",
"ID",
":",
"id",
"}",
"\n",
"switch",
"err",
":=",
"datastore",
".",
"Get",
"(",
"c",
",",
... | // getJob fetches a Job entity.
//
// Recognizes and tags transient errors. | [
"getJob",
"fetches",
"a",
"Job",
"entity",
".",
"Recognizes",
"and",
"tags",
"transient",
"errors",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/appengine/mapper/job.go#L251-L261 |
9,376 | luci/luci-go | appengine/mapper/job.go | info | func (s *shard) info() *ShardInfo {
var rate float64
var eta *timestamp.Timestamp
if runtime := s.Updated.Sub(s.Created); runtime > 0 {
rate = float64(s.ProcessedCount) / runtime.Seconds()
if s.ExpectedCount != -1 && rate > 0.0001 {
secs := float64(s.ExpectedCount) / rate
eta = google.NewTimestamp(s.Creat... | go | func (s *shard) info() *ShardInfo {
var rate float64
var eta *timestamp.Timestamp
if runtime := s.Updated.Sub(s.Created); runtime > 0 {
rate = float64(s.ProcessedCount) / runtime.Seconds()
if s.ExpectedCount != -1 && rate > 0.0001 {
secs := float64(s.ExpectedCount) / rate
eta = google.NewTimestamp(s.Creat... | [
"func",
"(",
"s",
"*",
"shard",
")",
"info",
"(",
")",
"*",
"ShardInfo",
"{",
"var",
"rate",
"float64",
"\n",
"var",
"eta",
"*",
"timestamp",
".",
"Timestamp",
"\n\n",
"if",
"runtime",
":=",
"s",
".",
"Updated",
".",
"Sub",
"(",
"s",
".",
"Created"... | // info returns a proto message with information about the shard. | [
"info",
"returns",
"a",
"proto",
"message",
"with",
"information",
"about",
"the",
"shard",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/appengine/mapper/job.go#L324-L347 |
9,377 | luci/luci-go | appengine/mapper/job.go | shardTxn | func shardTxn(c context.Context, shardID int64, cb shardTxnCb) error {
return runTxn(c, func(c context.Context) error {
sh := shard{ID: shardID}
switch err := datastore.Get(c, &sh); {
case err == datastore.ErrNoSuchEntity:
return err
case err != nil:
return transient.Tag.Apply(err)
case isFinalState(sh... | go | func shardTxn(c context.Context, shardID int64, cb shardTxnCb) error {
return runTxn(c, func(c context.Context) error {
sh := shard{ID: shardID}
switch err := datastore.Get(c, &sh); {
case err == datastore.ErrNoSuchEntity:
return err
case err != nil:
return transient.Tag.Apply(err)
case isFinalState(sh... | [
"func",
"shardTxn",
"(",
"c",
"context",
".",
"Context",
",",
"shardID",
"int64",
",",
"cb",
"shardTxnCb",
")",
"error",
"{",
"return",
"runTxn",
"(",
"c",
",",
"func",
"(",
"c",
"context",
".",
"Context",
")",
"error",
"{",
"sh",
":=",
"shard",
"{",... | // shardTxn fetches the shard and calls the callback to examine or mutate it.
//
// Silently skips finished shards. | [
"shardTxn",
"fetches",
"the",
"shard",
"and",
"calls",
"the",
"callback",
"to",
"examine",
"or",
"mutate",
"it",
".",
"Silently",
"skips",
"finished",
"shards",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/appengine/mapper/job.go#L384-L405 |
9,378 | luci/luci-go | machine-db/client/cli/racks.go | printRacks | func printRacks(tsv bool, racks ...*crimson.Rack) {
if len(racks) > 0 {
p := newStdoutPrinter(tsv)
defer p.Flush()
if !tsv {
p.Row("Name", "Datacenter", "Description", "State", "KVM")
}
for _, r := range racks {
p.Row(r.Name, r.Datacenter, r.Description, r.State, r.Kvm)
}
}
} | go | func printRacks(tsv bool, racks ...*crimson.Rack) {
if len(racks) > 0 {
p := newStdoutPrinter(tsv)
defer p.Flush()
if !tsv {
p.Row("Name", "Datacenter", "Description", "State", "KVM")
}
for _, r := range racks {
p.Row(r.Name, r.Datacenter, r.Description, r.State, r.Kvm)
}
}
} | [
"func",
"printRacks",
"(",
"tsv",
"bool",
",",
"racks",
"...",
"*",
"crimson",
".",
"Rack",
")",
"{",
"if",
"len",
"(",
"racks",
")",
">",
"0",
"{",
"p",
":=",
"newStdoutPrinter",
"(",
"tsv",
")",
"\n",
"defer",
"p",
".",
"Flush",
"(",
")",
"\n",... | // printRacks prints rack data to stdout in tab-separated columns. | [
"printRacks",
"prints",
"rack",
"data",
"to",
"stdout",
"in",
"tab",
"-",
"separated",
"columns",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/client/cli/racks.go#L28-L39 |
9,379 | luci/luci-go | machine-db/client/cli/racks.go | Run | func (c *GetRacksCmd) Run(app subcommands.Application, args []string, env subcommands.Env) int {
ctx := cli.GetContext(app, c, env)
client := getClient(ctx)
resp, err := client.ListRacks(ctx, &c.req)
if err != nil {
errors.Log(ctx, err)
return 1
}
printRacks(c.f.tsv, resp.Racks...)
return 0
} | go | func (c *GetRacksCmd) Run(app subcommands.Application, args []string, env subcommands.Env) int {
ctx := cli.GetContext(app, c, env)
client := getClient(ctx)
resp, err := client.ListRacks(ctx, &c.req)
if err != nil {
errors.Log(ctx, err)
return 1
}
printRacks(c.f.tsv, resp.Racks...)
return 0
} | [
"func",
"(",
"c",
"*",
"GetRacksCmd",
")",
"Run",
"(",
"app",
"subcommands",
".",
"Application",
",",
"args",
"[",
"]",
"string",
",",
"env",
"subcommands",
".",
"Env",
")",
"int",
"{",
"ctx",
":=",
"cli",
".",
"GetContext",
"(",
"app",
",",
"c",
"... | // Run runs the command to get racks. | [
"Run",
"runs",
"the",
"command",
"to",
"get",
"racks",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/client/cli/racks.go#L48-L58 |
9,380 | luci/luci-go | machine-db/client/cli/racks.go | getRacksCmd | func getRacksCmd(params *Parameters) *subcommands.Command {
return &subcommands.Command{
UsageLine: "get-racks [-name <name>]... [-dc <datacenter>]... [-kvm <kvm>]...",
ShortDesc: "retrieves racks",
LongDesc: "Retrieves racks matching the given names and dcs, or all racks if names and dcs are omitted.\n\nExampl... | go | func getRacksCmd(params *Parameters) *subcommands.Command {
return &subcommands.Command{
UsageLine: "get-racks [-name <name>]... [-dc <datacenter>]... [-kvm <kvm>]...",
ShortDesc: "retrieves racks",
LongDesc: "Retrieves racks matching the given names and dcs, or all racks if names and dcs are omitted.\n\nExampl... | [
"func",
"getRacksCmd",
"(",
"params",
"*",
"Parameters",
")",
"*",
"subcommands",
".",
"Command",
"{",
"return",
"&",
"subcommands",
".",
"Command",
"{",
"UsageLine",
":",
"\"",
"\"",
",",
"ShortDesc",
":",
"\"",
"\"",
",",
"LongDesc",
":",
"\"",
"\\n",
... | // getRacksCmd returns a command to get racks. | [
"getRacksCmd",
"returns",
"a",
"command",
"to",
"get",
"racks",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/client/cli/racks.go#L61-L75 |
9,381 | luci/luci-go | common/tsmon/flags.go | NewFlags | func NewFlags() Flags {
return Flags{
ConfigFile: defaultConfigFilePath(),
Endpoint: "",
Credentials: "",
ActAs: "",
Flush: FlushAuto,
FlushInterval: time.Minute,
Target: target.NewFlags(),
}
} | go | func NewFlags() Flags {
return Flags{
ConfigFile: defaultConfigFilePath(),
Endpoint: "",
Credentials: "",
ActAs: "",
Flush: FlushAuto,
FlushInterval: time.Minute,
Target: target.NewFlags(),
}
} | [
"func",
"NewFlags",
"(",
")",
"Flags",
"{",
"return",
"Flags",
"{",
"ConfigFile",
":",
"defaultConfigFilePath",
"(",
")",
",",
"Endpoint",
":",
"\"",
"\"",
",",
"Credentials",
":",
"\"",
"\"",
",",
"ActAs",
":",
"\"",
"\"",
",",
"Flush",
":",
"FlushAut... | // NewFlags returns a Flags struct with sensible default values. | [
"NewFlags",
"returns",
"a",
"Flags",
"struct",
"with",
"sensible",
"default",
"values",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/tsmon/flags.go#L38-L49 |
9,382 | luci/luci-go | common/tsmon/flags.go | Register | func (fl *Flags) Register(f *flag.FlagSet) {
f.StringVar(&fl.ConfigFile, "ts-mon-config-file", fl.ConfigFile,
"path to a JSON config file that contains suitable values for "+
"\"endpoint\" and \"credentials\" for this machine. This config file is "+
"intended to be shared by all processes on the machine, as th... | go | func (fl *Flags) Register(f *flag.FlagSet) {
f.StringVar(&fl.ConfigFile, "ts-mon-config-file", fl.ConfigFile,
"path to a JSON config file that contains suitable values for "+
"\"endpoint\" and \"credentials\" for this machine. This config file is "+
"intended to be shared by all processes on the machine, as th... | [
"func",
"(",
"fl",
"*",
"Flags",
")",
"Register",
"(",
"f",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"f",
".",
"StringVar",
"(",
"&",
"fl",
".",
"ConfigFile",
",",
"\"",
"\"",
",",
"fl",
".",
"ConfigFile",
",",
"\"",
"\"",
"+",
"\"",
"\\\"",
"\\\... | // Register adds tsmon related flags to a FlagSet. | [
"Register",
"adds",
"tsmon",
"related",
"flags",
"to",
"a",
"FlagSet",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/tsmon/flags.go#L52-L77 |
9,383 | luci/luci-go | common/data/text/pattern/pattern.go | MustParse | func MustParse(s string) Pattern {
pattern, err := Parse(s)
if err != nil {
panic(err)
}
return pattern
} | go | func MustParse(s string) Pattern {
pattern, err := Parse(s)
if err != nil {
panic(err)
}
return pattern
} | [
"func",
"MustParse",
"(",
"s",
"string",
")",
"Pattern",
"{",
"pattern",
",",
"err",
":=",
"Parse",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"pattern",
"\n",
"}"
] | // MustParse parses the pattern according to the specification
// of Parse. In addition, it panics if there is an error in parsing the
// given string as a pattern.
//
// See Parse for more details. | [
"MustParse",
"parses",
"the",
"pattern",
"according",
"to",
"the",
"specification",
"of",
"Parse",
".",
"In",
"addition",
"it",
"panics",
"if",
"there",
"is",
"an",
"error",
"in",
"parsing",
"the",
"given",
"string",
"as",
"a",
"pattern",
".",
"See",
"Pars... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/text/pattern/pattern.go#L91-L97 |
9,384 | luci/luci-go | cipd/client/cipd/reader/reader.go | OpenInstance | func OpenInstance(ctx context.Context, r pkg.Source, opts OpenInstanceOpts) (pkg.Instance, error) {
out := &packageInstance{data: r}
if err := out.open(opts); err != nil {
return nil, err
}
return out, nil
} | go | func OpenInstance(ctx context.Context, r pkg.Source, opts OpenInstanceOpts) (pkg.Instance, error) {
out := &packageInstance{data: r}
if err := out.open(opts); err != nil {
return nil, err
}
return out, nil
} | [
"func",
"OpenInstance",
"(",
"ctx",
"context",
".",
"Context",
",",
"r",
"pkg",
".",
"Source",
",",
"opts",
"OpenInstanceOpts",
")",
"(",
"pkg",
".",
"Instance",
",",
"error",
")",
"{",
"out",
":=",
"&",
"packageInstance",
"{",
"data",
":",
"r",
"}",
... | // OpenInstance opens a package instance by reading it from the given source.
//
// The caller is responsible for closing the instance when done with it.
//
// On success it takes ownership of the source, closing it when the instance
// itself is closed. On errors the source is left open. It's a responsibility of
// th... | [
"OpenInstance",
"opens",
"a",
"package",
"instance",
"by",
"reading",
"it",
"from",
"the",
"given",
"source",
".",
"The",
"caller",
"is",
"responsible",
"for",
"closing",
"the",
"instance",
"when",
"done",
"with",
"it",
".",
"On",
"success",
"it",
"takes",
... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/reader/reader.go#L99-L105 |
9,385 | luci/luci-go | cipd/client/cipd/reader/reader.go | OpenInstanceFile | func OpenInstanceFile(ctx context.Context, path string, opts OpenInstanceOpts) (pkg.Instance, error) {
file, err := os.Open(path)
if err != nil {
return nil, err
}
inst, err := OpenInstance(ctx, fileSource{file}, opts)
if err != nil {
file.Close()
return nil, err
}
return inst, nil
} | go | func OpenInstanceFile(ctx context.Context, path string, opts OpenInstanceOpts) (pkg.Instance, error) {
file, err := os.Open(path)
if err != nil {
return nil, err
}
inst, err := OpenInstance(ctx, fileSource{file}, opts)
if err != nil {
file.Close()
return nil, err
}
return inst, nil
} | [
"func",
"OpenInstanceFile",
"(",
"ctx",
"context",
".",
"Context",
",",
"path",
"string",
",",
"opts",
"OpenInstanceOpts",
")",
"(",
"pkg",
".",
"Instance",
",",
"error",
")",
"{",
"file",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"path",
")",
"\n",
... | // OpenInstanceFile opens a package instance by reading it from a file on disk.
//
// The caller is responsible for closing the instance when done with it. This
// will close the underlying file too. | [
"OpenInstanceFile",
"opens",
"a",
"package",
"instance",
"by",
"reading",
"it",
"from",
"a",
"file",
"on",
"disk",
".",
"The",
"caller",
"is",
"responsible",
"for",
"closing",
"the",
"instance",
"when",
"done",
"with",
"it",
".",
"This",
"will",
"close",
"... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/reader/reader.go#L117-L128 |
9,386 | luci/luci-go | cipd/client/cipd/reader/reader.go | ExtractFilesTxn | func ExtractFilesTxn(ctx context.Context, files []fs.File, dest fs.TransactionalDestination, withManifest pkg.ManifestMode) (extracted []pkg.FileInfo, err error) {
if err := dest.Begin(ctx); err != nil {
return nil, err
}
// Cleanup the garbage even on panics.
defer func() {
endErr := dest.End(ctx, err == nil)... | go | func ExtractFilesTxn(ctx context.Context, files []fs.File, dest fs.TransactionalDestination, withManifest pkg.ManifestMode) (extracted []pkg.FileInfo, err error) {
if err := dest.Begin(ctx); err != nil {
return nil, err
}
// Cleanup the garbage even on panics.
defer func() {
endErr := dest.End(ctx, err == nil)... | [
"func",
"ExtractFilesTxn",
"(",
"ctx",
"context",
".",
"Context",
",",
"files",
"[",
"]",
"fs",
".",
"File",
",",
"dest",
"fs",
".",
"TransactionalDestination",
",",
"withManifest",
"pkg",
".",
"ManifestMode",
")",
"(",
"extracted",
"[",
"]",
"pkg",
".",
... | // ExtractFilesTxn is like ExtractFiles, but it also opens and closes
// the transaction over fs.TransactionalDestination object.
//
// It guarantees that if extraction fails for some reason, there'll be no
// garbage laying around. | [
"ExtractFilesTxn",
"is",
"like",
"ExtractFiles",
"but",
"it",
"also",
"opens",
"and",
"closes",
"the",
"transaction",
"over",
"fs",
".",
"TransactionalDestination",
"object",
".",
"It",
"guarantees",
"that",
"if",
"extraction",
"fails",
"for",
"some",
"reason",
... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/reader/reader.go#L282-L299 |
9,387 | luci/luci-go | cipd/client/cipd/reader/reader.go | advance | func (r *progressReporter) advance(f fs.File) {
if r.totalCount == 0 {
return
}
now := clock.Now(r.ctx)
reportNow := false
progress := 0
// We don't count size of the symlinks toward total.
var size uint64
if !f.Symlink() {
size = f.Size()
}
// Report progress on first and last 'advance' calls and each... | go | func (r *progressReporter) advance(f fs.File) {
if r.totalCount == 0 {
return
}
now := clock.Now(r.ctx)
reportNow := false
progress := 0
// We don't count size of the symlinks toward total.
var size uint64
if !f.Symlink() {
size = f.Size()
}
// Report progress on first and last 'advance' calls and each... | [
"func",
"(",
"r",
"*",
"progressReporter",
")",
"advance",
"(",
"f",
"fs",
".",
"File",
")",
"{",
"if",
"r",
".",
"totalCount",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n\n",
"now",
":=",
"clock",
".",
"Now",
"(",
"r",
".",
"ctx",
")",
"\n",
"rep... | // advance moves the progress indicator, occasionally logging it. | [
"advance",
"moves",
"the",
"progress",
"indicator",
"occasionally",
"logging",
"it",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/reader/reader.go#L332-L365 |
9,388 | luci/luci-go | cipd/client/cipd/reader/reader.go | IsCorruptionError | func IsCorruptionError(err error) bool {
switch err {
case io.ErrUnexpectedEOF, zip.ErrFormat, zip.ErrChecksum, zip.ErrAlgorithm, ErrHashMismatch:
return true
}
return false
} | go | func IsCorruptionError(err error) bool {
switch err {
case io.ErrUnexpectedEOF, zip.ErrFormat, zip.ErrChecksum, zip.ErrAlgorithm, ErrHashMismatch:
return true
}
return false
} | [
"func",
"IsCorruptionError",
"(",
"err",
"error",
")",
"bool",
"{",
"switch",
"err",
"{",
"case",
"io",
".",
"ErrUnexpectedEOF",
",",
"zip",
".",
"ErrFormat",
",",
"zip",
".",
"ErrChecksum",
",",
"zip",
".",
"ErrAlgorithm",
",",
"ErrHashMismatch",
":",
"re... | // IsCorruptionError returns true iff err indicates corruption. | [
"IsCorruptionError",
"returns",
"true",
"iff",
"err",
"indicates",
"corruption",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/reader/reader.go#L527-L533 |
9,389 | luci/luci-go | cipd/client/cipd/reader/reader.go | readManifestFile | func readManifestFile(f fs.File) (pkg.Manifest, error) {
r, err := f.Open()
if err != nil {
return pkg.Manifest{}, err
}
defer r.Close()
return pkg.ReadManifest(r)
} | go | func readManifestFile(f fs.File) (pkg.Manifest, error) {
r, err := f.Open()
if err != nil {
return pkg.Manifest{}, err
}
defer r.Close()
return pkg.ReadManifest(r)
} | [
"func",
"readManifestFile",
"(",
"f",
"fs",
".",
"File",
")",
"(",
"pkg",
".",
"Manifest",
",",
"error",
")",
"{",
"r",
",",
"err",
":=",
"f",
".",
"Open",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"pkg",
".",
"Manifest",
"{",
"}... | // readManifestFile decodes manifest file zipped inside the package. | [
"readManifestFile",
"decodes",
"manifest",
"file",
"zipped",
"inside",
"the",
"package",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/reader/reader.go#L552-L559 |
9,390 | luci/luci-go | cipd/client/cipd/reader/reader.go | makeVersionFile | func makeVersionFile(relPath string, versionFile pkg.VersionFile) (fs.File, error) {
if !fs.IsCleanSlashPath(relPath) {
return nil, fmt.Errorf("invalid version_file: %s", relPath)
}
blob, err := json.MarshalIndent(versionFile, "", " ")
if err != nil {
return nil, err
}
return &blobFile{
name: relPath,
bl... | go | func makeVersionFile(relPath string, versionFile pkg.VersionFile) (fs.File, error) {
if !fs.IsCleanSlashPath(relPath) {
return nil, fmt.Errorf("invalid version_file: %s", relPath)
}
blob, err := json.MarshalIndent(versionFile, "", " ")
if err != nil {
return nil, err
}
return &blobFile{
name: relPath,
bl... | [
"func",
"makeVersionFile",
"(",
"relPath",
"string",
",",
"versionFile",
"pkg",
".",
"VersionFile",
")",
"(",
"fs",
".",
"File",
",",
"error",
")",
"{",
"if",
"!",
"fs",
".",
"IsCleanSlashPath",
"(",
"relPath",
")",
"{",
"return",
"nil",
",",
"fmt",
".... | // makeVersionFile returns File representing a JSON blob with info about package
// version. It's what's deployed at path specified in 'version_file' stanza in
// package definition YAML. | [
"makeVersionFile",
"returns",
"File",
"representing",
"a",
"JSON",
"blob",
"with",
"info",
"about",
"package",
"version",
".",
"It",
"s",
"what",
"s",
"deployed",
"at",
"path",
"specified",
"in",
"version_file",
"stanza",
"in",
"package",
"definition",
"YAML",
... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/reader/reader.go#L564-L576 |
9,391 | luci/luci-go | cipd/client/cipd/reader/reader.go | prefetch | func (f *fileInZip) prefetch() error {
if f.body != nil {
return nil
}
r, err := f.z.Open()
if err != nil {
return err
}
defer r.Close()
f.body, err = ioutil.ReadAll(r)
return err
} | go | func (f *fileInZip) prefetch() error {
if f.body != nil {
return nil
}
r, err := f.z.Open()
if err != nil {
return err
}
defer r.Close()
f.body, err = ioutil.ReadAll(r)
return err
} | [
"func",
"(",
"f",
"*",
"fileInZip",
")",
"prefetch",
"(",
")",
"error",
"{",
"if",
"f",
".",
"body",
"!=",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"r",
",",
"err",
":=",
"f",
".",
"z",
".",
"Open",
"(",
")",
"\n",
"if",
"err",
"!=",
"... | // prefetch loads the body of file into memory to speed up later calls. | [
"prefetch",
"loads",
"the",
"body",
"of",
"file",
"into",
"memory",
"to",
"speed",
"up",
"later",
"calls",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/reader/reader.go#L606-L617 |
9,392 | luci/luci-go | milo/git/combined_logs.go | pop | func (rc *refCommits) pop() (commit *gitpb.Commit, empty bool) {
commit, rc.commits = rc.commits[0], rc.commits[1:]
return commit, len(rc.commits) == 0
} | go | func (rc *refCommits) pop() (commit *gitpb.Commit, empty bool) {
commit, rc.commits = rc.commits[0], rc.commits[1:]
return commit, len(rc.commits) == 0
} | [
"func",
"(",
"rc",
"*",
"refCommits",
")",
"pop",
"(",
")",
"(",
"commit",
"*",
"gitpb",
".",
"Commit",
",",
"empty",
"bool",
")",
"{",
"commit",
",",
"rc",
".",
"commits",
"=",
"rc",
".",
"commits",
"[",
"0",
"]",
",",
"rc",
".",
"commits",
"[... | // The pop method removes and returns first commit. Second return value is true
// if this was the last commit. Caller must ensure refCommits has commits when
// calling the method. | [
"The",
"pop",
"method",
"removes",
"and",
"returns",
"first",
"commit",
".",
"Second",
"return",
"value",
"is",
"true",
"if",
"this",
"was",
"the",
"last",
"commit",
".",
"Caller",
"must",
"ensure",
"refCommits",
"has",
"commits",
"when",
"calling",
"the",
... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/git/combined_logs.go#L46-L49 |
9,393 | luci/luci-go | milo/git/combined_logs.go | CombinedLogs | func (impl *implementation) CombinedLogs(c context.Context, host, project, excludeRef string, refs []string, limit int) (commits []*gitpb.Commit, err error) {
defer func() { err = errors.Annotate(common.TagGRPC(c, err), "gitiles.CombinedLogs").Err() }()
// Check if the user is allowed to access this project.
allowe... | go | func (impl *implementation) CombinedLogs(c context.Context, host, project, excludeRef string, refs []string, limit int) (commits []*gitpb.Commit, err error) {
defer func() { err = errors.Annotate(common.TagGRPC(c, err), "gitiles.CombinedLogs").Err() }()
// Check if the user is allowed to access this project.
allowe... | [
"func",
"(",
"impl",
"*",
"implementation",
")",
"CombinedLogs",
"(",
"c",
"context",
".",
"Context",
",",
"host",
",",
"project",
",",
"excludeRef",
"string",
",",
"refs",
"[",
"]",
"string",
",",
"limit",
"int",
")",
"(",
"commits",
"[",
"]",
"*",
... | // CombinedLogs implements Client interface. | [
"CombinedLogs",
"implements",
"Client",
"interface",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/git/combined_logs.go#L261-L321 |
9,394 | luci/luci-go | machine-db/appengine/model/racks.go | fetch | func (t *RacksTable) fetch(c context.Context) error {
db := database.Get(c)
rows, err := db.QueryContext(c, `
SELECT id, name, description, state, datacenter_id
FROM racks
`)
if err != nil {
return errors.Annotate(err, "failed to select racks").Err()
}
defer rows.Close()
for rows.Next() {
rack := &Rack{}... | go | func (t *RacksTable) fetch(c context.Context) error {
db := database.Get(c)
rows, err := db.QueryContext(c, `
SELECT id, name, description, state, datacenter_id
FROM racks
`)
if err != nil {
return errors.Annotate(err, "failed to select racks").Err()
}
defer rows.Close()
for rows.Next() {
rack := &Rack{}... | [
"func",
"(",
"t",
"*",
"RacksTable",
")",
"fetch",
"(",
"c",
"context",
".",
"Context",
")",
"error",
"{",
"db",
":=",
"database",
".",
"Get",
"(",
"c",
")",
"\n",
"rows",
",",
"err",
":=",
"db",
".",
"QueryContext",
"(",
"c",
",",
"`\n\t\tSELECT i... | // fetch fetches the racks from the database. | [
"fetch",
"fetches",
"the",
"racks",
"from",
"the",
"database",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/model/racks.go#L50-L68 |
9,395 | luci/luci-go | machine-db/appengine/model/racks.go | remove | func (t *RacksTable) remove(c context.Context) error {
// Avoid using the database connection to prepare unnecessary statements.
if len(t.removals) == 0 {
return nil
}
db := database.Get(c)
stmt, err := db.PrepareContext(c, `
DELETE FROM racks
WHERE id = ?
`)
if err != nil {
return errors.Annotate(err, ... | go | func (t *RacksTable) remove(c context.Context) error {
// Avoid using the database connection to prepare unnecessary statements.
if len(t.removals) == 0 {
return nil
}
db := database.Get(c)
stmt, err := db.PrepareContext(c, `
DELETE FROM racks
WHERE id = ?
`)
if err != nil {
return errors.Annotate(err, ... | [
"func",
"(",
"t",
"*",
"RacksTable",
")",
"remove",
"(",
"c",
"context",
".",
"Context",
")",
"error",
"{",
"// Avoid using the database connection to prepare unnecessary statements.",
"if",
"len",
"(",
"t",
".",
"removals",
")",
"==",
"0",
"{",
"return",
"nil",... | // remove removes all racks pending removal from the database, clearing pending removals.
// No-op unless computeChanges was called first. Idempotent until computeChanges is called again. | [
"remove",
"removes",
"all",
"racks",
"pending",
"removal",
"from",
"the",
"database",
"clearing",
"pending",
"removals",
".",
"No",
"-",
"op",
"unless",
"computeChanges",
"was",
"called",
"first",
".",
"Idempotent",
"until",
"computeChanges",
"is",
"called",
"ag... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/model/racks.go#L161-L200 |
9,396 | luci/luci-go | machine-db/appengine/model/racks.go | ids | func (t *RacksTable) ids(c context.Context) map[string]int64 {
racks := make(map[string]int64, len(t.current))
for _, rack := range t.current {
racks[rack.Name] = rack.Id
}
return racks
} | go | func (t *RacksTable) ids(c context.Context) map[string]int64 {
racks := make(map[string]int64, len(t.current))
for _, rack := range t.current {
racks[rack.Name] = rack.Id
}
return racks
} | [
"func",
"(",
"t",
"*",
"RacksTable",
")",
"ids",
"(",
"c",
"context",
".",
"Context",
")",
"map",
"[",
"string",
"]",
"int64",
"{",
"racks",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"int64",
",",
"len",
"(",
"t",
".",
"current",
")",
")",
... | // ids returns a map of rack names to IDs. | [
"ids",
"returns",
"a",
"map",
"of",
"rack",
"names",
"to",
"IDs",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/model/racks.go#L246-L252 |
9,397 | luci/luci-go | machine-db/appengine/model/racks.go | EnsureRacks | func EnsureRacks(c context.Context, cfgs []*config.Datacenter, datacenterIds map[string]int64) (map[string]int64, error) {
t := &RacksTable{}
t.datacenters = datacenterIds
if err := t.fetch(c); err != nil {
return nil, errors.Annotate(err, "failed to fetch racks").Err()
}
if err := t.computeChanges(c, cfgs); err... | go | func EnsureRacks(c context.Context, cfgs []*config.Datacenter, datacenterIds map[string]int64) (map[string]int64, error) {
t := &RacksTable{}
t.datacenters = datacenterIds
if err := t.fetch(c); err != nil {
return nil, errors.Annotate(err, "failed to fetch racks").Err()
}
if err := t.computeChanges(c, cfgs); err... | [
"func",
"EnsureRacks",
"(",
"c",
"context",
".",
"Context",
",",
"cfgs",
"[",
"]",
"*",
"config",
".",
"Datacenter",
",",
"datacenterIds",
"map",
"[",
"string",
"]",
"int64",
")",
"(",
"map",
"[",
"string",
"]",
"int64",
",",
"error",
")",
"{",
"t",
... | // EnsureRacks ensures the database contains exactly the given racks.
// Returns a map of rack names to IDs in the database. | [
"EnsureRacks",
"ensures",
"the",
"database",
"contains",
"exactly",
"the",
"given",
"racks",
".",
"Returns",
"a",
"map",
"of",
"rack",
"names",
"to",
"IDs",
"in",
"the",
"database",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/model/racks.go#L256-L275 |
9,398 | luci/luci-go | luci_notify/notify/pubsub.go | sortEmailNotify | func sortEmailNotify(en []EmailNotify) {
sort.Slice(en, func(i, j int) bool {
first := en[i]
second := en[j]
emailResult := strings.Compare(first.Email, second.Email)
if emailResult == 0 {
return strings.Compare(first.Template, second.Template) < 0
}
return emailResult < 0
})
} | go | func sortEmailNotify(en []EmailNotify) {
sort.Slice(en, func(i, j int) bool {
first := en[i]
second := en[j]
emailResult := strings.Compare(first.Email, second.Email)
if emailResult == 0 {
return strings.Compare(first.Template, second.Template) < 0
}
return emailResult < 0
})
} | [
"func",
"sortEmailNotify",
"(",
"en",
"[",
"]",
"EmailNotify",
")",
"{",
"sort",
".",
"Slice",
"(",
"en",
",",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"first",
":=",
"en",
"[",
"i",
"]",
"\n",
"second",
":=",
"en",
"[",
"j",
"]",
... | // sortEmailNotify sorts a list of EmailNotify by Email, then Template. | [
"sortEmailNotify",
"sorts",
"a",
"list",
"of",
"EmailNotify",
"by",
"Email",
"then",
"Template",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/luci_notify/notify/pubsub.go#L85-L95 |
9,399 | luci/luci-go | luci_notify/notify/pubsub.go | BuildbucketPubSubHandler | func BuildbucketPubSubHandler(ctx *router.Context, d *tq.Dispatcher) error {
c := ctx.Context
build, err := extractBuild(c, ctx.Request)
switch {
case err != nil:
return errors.Annotate(err, "failed to extract build").Err()
case build == nil:
// Ignore.
return nil
default:
return handleBuild(c, d, build... | go | func BuildbucketPubSubHandler(ctx *router.Context, d *tq.Dispatcher) error {
c := ctx.Context
build, err := extractBuild(c, ctx.Request)
switch {
case err != nil:
return errors.Annotate(err, "failed to extract build").Err()
case build == nil:
// Ignore.
return nil
default:
return handleBuild(c, d, build... | [
"func",
"BuildbucketPubSubHandler",
"(",
"ctx",
"*",
"router",
".",
"Context",
",",
"d",
"*",
"tq",
".",
"Dispatcher",
")",
"error",
"{",
"c",
":=",
"ctx",
".",
"Context",
"\n",
"build",
",",
"err",
":=",
"extractBuild",
"(",
"c",
",",
"ctx",
".",
"R... | // BuildbucketPubSubHandler is the main entrypoint for a new update from buildbucket's pubsub.
//
// This handler delegates the actual processing of the build to handleBuild.
// Its primary purpose is to unwrap context boilerplate and deal with progress-stopping errors. | [
"BuildbucketPubSubHandler",
"is",
"the",
"main",
"entrypoint",
"for",
"a",
"new",
"update",
"from",
"buildbucket",
"s",
"pubsub",
".",
"This",
"handler",
"delegates",
"the",
"actual",
"processing",
"of",
"the",
"build",
"to",
"handleBuild",
".",
"Its",
"primary"... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/luci_notify/notify/pubsub.go#L344-L358 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.