id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
131,300
luci/luci-go
auth/auth.go
Token
func (s tokenSource) Token() (*oauth2.Token, error) { return s.a.GetAccessToken(minAcceptedLifetime) }
go
func (s tokenSource) Token() (*oauth2.Token, error) { return s.a.GetAccessToken(minAcceptedLifetime) }
[ "func", "(", "s", "tokenSource", ")", "Token", "(", ")", "(", "*", "oauth2", ".", "Token", ",", "error", ")", "{", "return", "s", ".", "a", ".", "GetAccessToken", "(", "minAcceptedLifetime", ")", "\n", "}" ]
// Token is part of oauth2.TokenSource inteface.
[ "Token", "is", "part", "of", "oauth2", ".", "TokenSource", "inteface", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/auth/auth.go#L817-L819
131,301
luci/luci-go
auth/auth.go
ensureInitialized
func (a *Authenticator) ensureInitialized() error { // Already initialized (successfully or not)? if initialized, err := a.checkInitialized(); initialized { return err } // SelectBestMethod may do heavy calls like talking to GCE metadata server, // call it lazily here rather than in NewAuthenticator. if a.opts...
go
func (a *Authenticator) ensureInitialized() error { // Already initialized (successfully or not)? if initialized, err := a.checkInitialized(); initialized { return err } // SelectBestMethod may do heavy calls like talking to GCE metadata server, // call it lazily here rather than in NewAuthenticator. if a.opts...
[ "func", "(", "a", "*", "Authenticator", ")", "ensureInitialized", "(", ")", "error", "{", "// Already initialized (successfully or not)?", "if", "initialized", ",", "err", ":=", "a", ".", "checkInitialized", "(", ")", ";", "initialized", "{", "return", "err", "\...
// ensureInitialized instantiates TokenProvider and reads token from cache. // // It is supposed to be called under the lock.
[ "ensureInitialized", "instantiates", "TokenProvider", "and", "reads", "token", "from", "cache", ".", "It", "is", "supposed", "to", "be", "called", "under", "the", "lock", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/auth/auth.go#L843-L937
131,302
luci/luci-go
auth/auth.go
getBaseTokenLocked
func (a *Authenticator) getBaseTokenLocked(ctx context.Context, lifetime time.Duration) (*internal.Token, error) { if !a.isActing() { panic("impossible") } // Already have a good token? if lifetime > 0 && !internal.TokenExpiresInRnd(ctx, a.baseToken.token, lifetime) { return a.baseToken.token, nil } // Need...
go
func (a *Authenticator) getBaseTokenLocked(ctx context.Context, lifetime time.Duration) (*internal.Token, error) { if !a.isActing() { panic("impossible") } // Already have a good token? if lifetime > 0 && !internal.TokenExpiresInRnd(ctx, a.baseToken.token, lifetime) { return a.baseToken.token, nil } // Need...
[ "func", "(", "a", "*", "Authenticator", ")", "getBaseTokenLocked", "(", "ctx", "context", ".", "Context", ",", "lifetime", "time", ".", "Duration", ")", "(", "*", "internal", ".", "Token", ",", "error", ")", "{", "if", "!", "a", ".", "isActing", "(", ...
// getBaseTokenLocked is used to get an IAM-scoped token when running in // actor mode. // // Passing negative lifetime causes a forced refresh. // // It is called with a.lock locked.
[ "getBaseTokenLocked", "is", "used", "to", "get", "an", "IAM", "-", "scoped", "token", "when", "running", "in", "actor", "mode", ".", "Passing", "negative", "lifetime", "causes", "a", "forced", "refresh", ".", "It", "is", "called", "with", "a", ".", "lock",...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/auth/auth.go#L1078-L1097
131,303
luci/luci-go
auth/auth.go
fetchFromCache
func (t *tokenWithProvider) fetchFromCache(ctx context.Context) error { key, err := t.provider.CacheKey(ctx) if err != nil { return err } tok, err := t.cache.GetToken(key) if err != nil { return err } t.token = tok return nil }
go
func (t *tokenWithProvider) fetchFromCache(ctx context.Context) error { key, err := t.provider.CacheKey(ctx) if err != nil { return err } tok, err := t.cache.GetToken(key) if err != nil { return err } t.token = tok return nil }
[ "func", "(", "t", "*", "tokenWithProvider", ")", "fetchFromCache", "(", "ctx", "context", ".", "Context", ")", "error", "{", "key", ",", "err", ":=", "t", ".", "provider", ".", "CacheKey", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return...
// fetchFromCache updates 't.token' by reading it from the cache.
[ "fetchFromCache", "updates", "t", ".", "token", "by", "reading", "it", "from", "the", "cache", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/auth/auth.go#L1129-L1140
131,304
luci/luci-go
auth/auth.go
putToCache
func (t *tokenWithProvider) putToCache(ctx context.Context) error { key, err := t.provider.CacheKey(ctx) if err != nil { return err } return t.cache.PutToken(key, t.token) }
go
func (t *tokenWithProvider) putToCache(ctx context.Context) error { key, err := t.provider.CacheKey(ctx) if err != nil { return err } return t.cache.PutToken(key, t.token) }
[ "func", "(", "t", "*", "tokenWithProvider", ")", "putToCache", "(", "ctx", "context", ".", "Context", ")", "error", "{", "key", ",", "err", ":=", "t", ".", "provider", ".", "CacheKey", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// putToCache puts 't.token' value into the cache.
[ "putToCache", "puts", "t", ".", "token", "value", "into", "the", "cache", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/auth/auth.go#L1143-L1149
131,305
luci/luci-go
auth/auth.go
purgeToken
func (t *tokenWithProvider) purgeToken(ctx context.Context) error { t.token = nil key, err := t.provider.CacheKey(ctx) if err != nil { return err } return t.cache.DeleteToken(key) }
go
func (t *tokenWithProvider) purgeToken(ctx context.Context) error { t.token = nil key, err := t.provider.CacheKey(ctx) if err != nil { return err } return t.cache.DeleteToken(key) }
[ "func", "(", "t", "*", "tokenWithProvider", ")", "purgeToken", "(", "ctx", "context", ".", "Context", ")", "error", "{", "t", ".", "token", "=", "nil", "\n", "key", ",", "err", ":=", "t", ".", "provider", ".", "CacheKey", "(", "ctx", ")", "\n", "if...
// purgeToken removes the token from both on-disk cache and memory.
[ "purgeToken", "removes", "the", "token", "from", "both", "on", "-", "disk", "cache", "and", "memory", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/auth/auth.go#L1152-L1159
131,306
luci/luci-go
auth/auth.go
renewToken
func (t *tokenWithProvider) renewToken(ctx context.Context, prev, base *internal.Token) (*internal.Token, error) { if prev == nil { if t.provider.RequiresInteraction() { return nil, ErrLoginRequired } logging.Debugf(ctx, "Minting a new token") tok, err := t.mintTokenWithRetries(ctx, base) if err != nil { ...
go
func (t *tokenWithProvider) renewToken(ctx context.Context, prev, base *internal.Token) (*internal.Token, error) { if prev == nil { if t.provider.RequiresInteraction() { return nil, ErrLoginRequired } logging.Debugf(ctx, "Minting a new token") tok, err := t.mintTokenWithRetries(ctx, base) if err != nil { ...
[ "func", "(", "t", "*", "tokenWithProvider", ")", "renewToken", "(", "ctx", "context", ".", "Context", ",", "prev", ",", "base", "*", "internal", ".", "Token", ")", "(", "*", "internal", ".", "Token", ",", "error", ")", "{", "if", "prev", "==", "nil",...
// renewToken is called to mint a new token or update existing one. // // It is called from non-interactive 'refreshToken' method, and thus it can't // use interactive login flow.
[ "renewToken", "is", "called", "to", "mint", "a", "new", "token", "or", "update", "existing", "one", ".", "It", "is", "called", "from", "non", "-", "interactive", "refreshToken", "method", "and", "thus", "it", "can", "t", "use", "interactive", "login", "flo...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/auth/auth.go#L1260-L1281
131,307
luci/luci-go
auth/auth.go
retryParams
func retryParams() retry.Iterator { return &retry.ExponentialBackoff{ Limited: retry.Limited{ Delay: 50 * time.Millisecond, Retries: 50, MaxTotal: 5 * time.Second, }, Multiplier: 2, } }
go
func retryParams() retry.Iterator { return &retry.ExponentialBackoff{ Limited: retry.Limited{ Delay: 50 * time.Millisecond, Retries: 50, MaxTotal: 5 * time.Second, }, Multiplier: 2, } }
[ "func", "retryParams", "(", ")", "retry", ".", "Iterator", "{", "return", "&", "retry", ".", "ExponentialBackoff", "{", "Limited", ":", "retry", ".", "Limited", "{", "Delay", ":", "50", "*", "time", ".", "Millisecond", ",", "Retries", ":", "50", ",", "...
// retryParams defines retry strategy for handling transient errors when minting // or refreshing tokens.
[ "retryParams", "defines", "retry", "strategy", "for", "handling", "transient", "errors", "when", "minting", "or", "refreshing", "tokens", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/auth/auth.go#L1285-L1294
131,308
luci/luci-go
auth/auth.go
makeIAMTokenProvider
func makeIAMTokenProvider(ctx context.Context, opts *Options) (internal.TokenProvider, error) { if opts.testingIAMTokenProvider != nil { return opts.testingIAMTokenProvider, nil } return internal.NewIAMTokenProvider( ctx, opts.ActAsServiceAccount, opts.Scopes, opts.Transport) }
go
func makeIAMTokenProvider(ctx context.Context, opts *Options) (internal.TokenProvider, error) { if opts.testingIAMTokenProvider != nil { return opts.testingIAMTokenProvider, nil } return internal.NewIAMTokenProvider( ctx, opts.ActAsServiceAccount, opts.Scopes, opts.Transport) }
[ "func", "makeIAMTokenProvider", "(", "ctx", "context", ".", "Context", ",", "opts", "*", "Options", ")", "(", "internal", ".", "TokenProvider", ",", "error", ")", "{", "if", "opts", ".", "testingIAMTokenProvider", "!=", "nil", "{", "return", "opts", ".", "...
// makeIAMTokenProvider create TokenProvider to use in Actor mode. // // Called by ensureInitialized in actor mode.
[ "makeIAMTokenProvider", "create", "TokenProvider", "to", "use", "in", "Actor", "mode", ".", "Called", "by", "ensureInitialized", "in", "actor", "mode", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/auth/auth.go#L1363-L1372
131,309
luci/luci-go
logdog/common/storage/bigtable/initialize.go
Initialize
func (s *Storage) Initialize(c context.Context) error { if s.AdminClient == nil { return errors.New("no admin client configured") } exists, err := tableExists(c, s.AdminClient, s.LogTable) if err != nil { return fmt.Errorf("failed to test for table: %s", err) } if !exists { log.Fields{ "table": s.LogTab...
go
func (s *Storage) Initialize(c context.Context) error { if s.AdminClient == nil { return errors.New("no admin client configured") } exists, err := tableExists(c, s.AdminClient, s.LogTable) if err != nil { return fmt.Errorf("failed to test for table: %s", err) } if !exists { log.Fields{ "table": s.LogTab...
[ "func", "(", "s", "*", "Storage", ")", "Initialize", "(", "c", "context", ".", "Context", ")", "error", "{", "if", "s", ".", "AdminClient", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "exists", ",", ...
// Initialize sets up a Storage schema in BigTable. If the schema is already // set up properly, no action will be taken. // // If, however, the table or table's schema doesn't exist, Initialize will // create and configure it. // // If nil is returned, the table is ready for use as a Storage via New.
[ "Initialize", "sets", "up", "a", "Storage", "schema", "in", "BigTable", ".", "If", "the", "schema", "is", "already", "set", "up", "properly", "no", "action", "will", "be", "taken", ".", "If", "however", "the", "table", "or", "table", "s", "schema", "does...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/common/storage/bigtable/initialize.go#L79-L142
131,310
luci/luci-go
config/appengine/backend/datastore/ds.go
Backend
func (dc *Config) Backend(base backend.B) backend.B { return &caching.Backend{ B: base, FailOnError: !dc.FailOpen, CacheGet: dc.cacheGet, } }
go
func (dc *Config) Backend(base backend.B) backend.B { return &caching.Backend{ B: base, FailOnError: !dc.FailOpen, CacheGet: dc.cacheGet, } }
[ "func", "(", "dc", "*", "Config", ")", "Backend", "(", "base", "backend", ".", "B", ")", "backend", ".", "B", "{", "return", "&", "caching", ".", "Backend", "{", "B", ":", "base", ",", "FailOnError", ":", "!", "dc", ".", "FailOpen", ",", "CacheGet"...
// Backend wraps the specified Backend in a datastore-backed cache.
[ "Backend", "wraps", "the", "specified", "Backend", "in", "a", "datastore", "-", "backed", "cache", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/config/appengine/backend/datastore/ds.go#L87-L93
131,311
luci/luci-go
config/appengine/backend/datastore/ds.go
WithHandler
func (dc *Config) WithHandler(c context.Context, l caching.Loader, timeout time.Duration) context.Context { handler := dsCacheHandler{ refreshInterval: dc.RefreshInterval, failOpen: dc.FailOpen, lockerFunc: dc.LockerFunc, loader: l, loaderTimeout: timeout, } return context.WithValue(...
go
func (dc *Config) WithHandler(c context.Context, l caching.Loader, timeout time.Duration) context.Context { handler := dsCacheHandler{ refreshInterval: dc.RefreshInterval, failOpen: dc.FailOpen, lockerFunc: dc.LockerFunc, loader: l, loaderTimeout: timeout, } return context.WithValue(...
[ "func", "(", "dc", "*", "Config", ")", "WithHandler", "(", "c", "context", ".", "Context", ",", "l", "caching", ".", "Loader", ",", "timeout", "time", ".", "Duration", ")", "context", ".", "Context", "{", "handler", ":=", "dsCacheHandler", "{", "refreshI...
// WithHandler installs a datastorecache.Handler into our Context. This is // used during datastore cache's Refresh calls. // // The Handler binds the parameters and Loader to the resolution call. For // service resolution, this will be the Loader that is provided by the caching // layer. For cron refresh, this will be...
[ "WithHandler", "installs", "a", "datastorecache", ".", "Handler", "into", "our", "Context", ".", "This", "is", "used", "during", "datastore", "cache", "s", "Refresh", "calls", ".", "The", "Handler", "binds", "the", "parameters", "and", "Loader", "to", "the", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/config/appengine/backend/datastore/ds.go#L102-L111
131,312
luci/luci-go
config/appengine/backend/datastore/ds.go
CronLoader
func CronLoader(b backend.B) caching.Loader { return func(c context.Context, k caching.Key, v *caching.Value) (*caching.Value, error) { return caching.CacheLoad(c, b, k, v) } }
go
func CronLoader(b backend.B) caching.Loader { return func(c context.Context, k caching.Key, v *caching.Value) (*caching.Value, error) { return caching.CacheLoad(c, b, k, v) } }
[ "func", "CronLoader", "(", "b", "backend", ".", "B", ")", "caching", ".", "Loader", "{", "return", "func", "(", "c", "context", ".", "Context", ",", "k", "caching", ".", "Key", ",", "v", "*", "caching", ".", "Value", ")", "(", "*", "caching", ".", ...
// CronLoader returns a caching.Loader implementation to be used // by the Cron task.
[ "CronLoader", "returns", "a", "caching", ".", "Loader", "implementation", "to", "be", "used", "by", "the", "Cron", "task", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/config/appengine/backend/datastore/ds.go#L307-L311
131,313
luci/luci-go
logdog/client/cli/subcommandCat.go
getDatagramWriter
func getDatagramWriter(c context.Context, desc *logpb.LogStreamDescriptor) renderer.DatagramWriter { return func(w io.Writer, dg []byte) bool { var pb proto.Message switch desc.ContentType { case milo.ContentTypeAnnotations: mp := milo.Step{} if err := proto.Unmarshal(dg, &mp); err != nil { log.WithEr...
go
func getDatagramWriter(c context.Context, desc *logpb.LogStreamDescriptor) renderer.DatagramWriter { return func(w io.Writer, dg []byte) bool { var pb proto.Message switch desc.ContentType { case milo.ContentTypeAnnotations: mp := milo.Step{} if err := proto.Unmarshal(dg, &mp); err != nil { log.WithEr...
[ "func", "getDatagramWriter", "(", "c", "context", ".", "Context", ",", "desc", "*", "logpb", ".", "LogStreamDescriptor", ")", "renderer", ".", "DatagramWriter", "{", "return", "func", "(", "w", "io", ".", "Writer", ",", "dg", "[", "]", "byte", ")", "bool...
// getDatagramWriter returns a datagram writer function that can be used as a // Renderer's DatagramWriter. The writer is bound to desc.
[ "getDatagramWriter", "returns", "a", "datagram", "writer", "function", "that", "can", "be", "used", "as", "a", "Renderer", "s", "DatagramWriter", ".", "The", "writer", "is", "bound", "to", "desc", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/client/cli/subcommandCat.go#L242-L266
131,314
luci/luci-go
cipd/appengine/impl/model/tag.go
Proto
func (t *Tag) Proto() *api.Tag { kv := strings.SplitN(t.Tag, ":", 2) if len(kv) != 2 { panic(fmt.Sprintf("bad tag %q", t.Tag)) } return &api.Tag{ Key: kv[0], Value: kv[1], AttachedBy: t.RegisteredBy, AttachedTs: google.NewTimestamp(t.RegisteredTs), } }
go
func (t *Tag) Proto() *api.Tag { kv := strings.SplitN(t.Tag, ":", 2) if len(kv) != 2 { panic(fmt.Sprintf("bad tag %q", t.Tag)) } return &api.Tag{ Key: kv[0], Value: kv[1], AttachedBy: t.RegisteredBy, AttachedTs: google.NewTimestamp(t.RegisteredTs), } }
[ "func", "(", "t", "*", "Tag", ")", "Proto", "(", ")", "*", "api", ".", "Tag", "{", "kv", ":=", "strings", ".", "SplitN", "(", "t", ".", "Tag", ",", "\"", "\"", ",", "2", ")", "\n", "if", "len", "(", "kv", ")", "!=", "2", "{", "panic", "("...
// Proto returns cipd.Tag proto with information from this entity. // // Assumes the tag is valid.
[ "Proto", "returns", "cipd", ".", "Tag", "proto", "with", "information", "from", "this", "entity", ".", "Assumes", "the", "tag", "is", "valid", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/model/tag.go#L72-L83
131,315
luci/luci-go
common/data/text/indented/writer.go
Write
func (w *Writer) Write(data []byte) (n int, err error) { // Do not print indentation if there is no data. indentBuf := indentationTabs if w.UseSpaces { indentBuf = indentationSpaces } for len(data) > 0 { var printUntil int endsWithNewLine := false lineBeginning := !w.insideLine if data[0] == '\n' && li...
go
func (w *Writer) Write(data []byte) (n int, err error) { // Do not print indentation if there is no data. indentBuf := indentationTabs if w.UseSpaces { indentBuf = indentationSpaces } for len(data) > 0 { var printUntil int endsWithNewLine := false lineBeginning := !w.insideLine if data[0] == '\n' && li...
[ "func", "(", "w", "*", "Writer", ")", "Write", "(", "data", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "// Do not print indentation if there is no data.", "indentBuf", ":=", "indentationTabs", "\n", "if", "w", ".", "UseSpaces", ...
// Write writes data inserting a newline before each line. // Panics if w.Indent is outside of [0, Limit) range.
[ "Write", "writes", "data", "inserting", "a", "newline", "before", "each", "line", ".", "Panics", "if", "w", ".", "Indent", "is", "outside", "of", "[", "0", "Limit", ")", "range", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/text/indented/writer.go#L38-L89
131,316
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
131,317
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
131,318
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
131,319
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
131,320
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
131,321
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
131,322
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
131,323
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
131,324
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
131,325
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
131,326
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
131,327
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
131,328
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
131,329
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
131,330
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
131,331
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
131,332
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
131,333
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
131,334
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
131,335
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
131,336
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
131,337
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
131,338
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
131,339
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
131,340
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
131,341
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
131,342
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
131,343
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
131,344
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
131,345
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
131,346
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
131,347
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
131,348
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
131,349
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
131,350
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
131,351
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
131,352
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
131,353
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
131,354
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
131,355
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
131,356
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
131,357
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
131,358
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
131,359
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
131,360
luci/luci-go
lucicfg/cli/base/base.go
Init
func (c *Subcommand) Init(params Parameters) { c.params = &params 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 = &params 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
131,361
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
131,362
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
131,363
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
131,364
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
131,365
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
131,366
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
131,367
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
131,368
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
131,369
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
131,370
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
131,371
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
131,372
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
131,373
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
131,374
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
131,375
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
131,376
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
131,377
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
131,378
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
131,379
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
131,380
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
131,381
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
131,382
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
131,383
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
131,384
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
131,385
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
131,386
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
131,387
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
131,388
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
131,389
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
131,390
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
131,391
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
131,392
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
131,393
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
131,394
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
131,395
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
131,396
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
131,397
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
131,398
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
131,399
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