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
129,000
luci/luci-go
common/data/treapstore/store.go
CreateCollection
func (s *Store) CreateCollection(name string, compare gtreap.Compare) *Collection { s.assertNotReadOnly() s.collLock.Lock() defer s.collLock.Unlock() // Try to get the existing Collection again now that we hold the write lock. if _, ok := s.colls[name]; ok { panic(fmt.Errorf("collection %q already exists", nam...
go
func (s *Store) CreateCollection(name string, compare gtreap.Compare) *Collection { s.assertNotReadOnly() s.collLock.Lock() defer s.collLock.Unlock() // Try to get the existing Collection again now that we hold the write lock. if _, ok := s.colls[name]; ok { panic(fmt.Errorf("collection %q already exists", nam...
[ "func", "(", "s", "*", "Store", ")", "CreateCollection", "(", "name", "string", ",", "compare", "gtreap", ".", "Compare", ")", "*", "Collection", "{", "s", ".", "assertNotReadOnly", "(", ")", "\n\n", "s", ".", "collLock", ".", "Lock", "(", ")", "\n", ...
// CreateCollection returns a Collection with the specified name. If the // collection already exists, or if s is read-only, CreateCollection will panic.
[ "CreateCollection", "returns", "a", "Collection", "with", "the", "specified", "name", ".", "If", "the", "collection", "already", "exists", "or", "if", "s", "is", "read", "-", "only", "CreateCollection", "will", "panic", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/treapstore/store.go#L124-L148
129,001
luci/luci-go
common/data/treapstore/store.go
insertCollectionName
func (s *Store) insertCollectionName(name string) []string { sidx := sort.SearchStrings(s.collNames, name) r := make([]string, 0, len(s.collNames)+1) return append(append(append(r, s.collNames[:sidx]...), name), s.collNames[sidx:]...) }
go
func (s *Store) insertCollectionName(name string) []string { sidx := sort.SearchStrings(s.collNames, name) r := make([]string, 0, len(s.collNames)+1) return append(append(append(r, s.collNames[:sidx]...), name), s.collNames[sidx:]...) }
[ "func", "(", "s", "*", "Store", ")", "insertCollectionName", "(", "name", "string", ")", "[", "]", "string", "{", "sidx", ":=", "sort", ".", "SearchStrings", "(", "s", ".", "collNames", ",", "name", ")", "\n", "r", ":=", "make", "(", "[", "]", "str...
// insertCollectionName returns a copy of s.collNames with name inserted // in its appropriate sorted position.
[ "insertCollectionName", "returns", "a", "copy", "of", "s", ".", "collNames", "with", "name", "inserted", "in", "its", "appropriate", "sorted", "position", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/treapstore/store.go#L152-L156
129,002
luci/luci-go
common/data/treapstore/store.go
Min
func (c *Collection) Min() gtreap.Item { root := c.currentRoot() if root == nil { return nil } return root.Min() }
go
func (c *Collection) Min() gtreap.Item { root := c.currentRoot() if root == nil { return nil } return root.Min() }
[ "func", "(", "c", "*", "Collection", ")", "Min", "(", ")", "gtreap", ".", "Item", "{", "root", ":=", "c", ".", "currentRoot", "(", ")", "\n", "if", "root", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "root", ".", "Min", "(", "...
// Min returns the smallest item in the collection.
[ "Min", "returns", "the", "smallest", "item", "in", "the", "collection", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/treapstore/store.go#L185-L191
129,003
luci/luci-go
common/data/treapstore/store.go
Max
func (c *Collection) Max() gtreap.Item { root := c.currentRoot() if root == nil { return nil } return root.Max() }
go
func (c *Collection) Max() gtreap.Item { root := c.currentRoot() if root == nil { return nil } return root.Max() }
[ "func", "(", "c", "*", "Collection", ")", "Max", "(", ")", "gtreap", ".", "Item", "{", "root", ":=", "c", ".", "currentRoot", "(", ")", "\n", "if", "root", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "root", ".", "Max", "(", "...
// Max returns the largest item in the collection.
[ "Max", "returns", "the", "largest", "item", "in", "the", "collection", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/treapstore/store.go#L194-L200
129,004
luci/luci-go
common/data/treapstore/store.go
Get
func (c *Collection) Get(i gtreap.Item) gtreap.Item { root := c.currentRoot() if root == nil { return nil } return root.Get(i) }
go
func (c *Collection) Get(i gtreap.Item) gtreap.Item { root := c.currentRoot() if root == nil { return nil } return root.Get(i) }
[ "func", "(", "c", "*", "Collection", ")", "Get", "(", "i", "gtreap", ".", "Item", ")", "gtreap", ".", "Item", "{", "root", ":=", "c", ".", "currentRoot", "(", ")", "\n", "if", "root", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", ...
// Get returns the item in the Store that matches i, or nil if no such item // exists.
[ "Get", "returns", "the", "item", "in", "the", "Store", "that", "matches", "i", "or", "nil", "if", "no", "such", "item", "exists", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/treapstore/store.go#L204-L210
129,005
luci/luci-go
common/data/treapstore/store.go
Put
func (c *Collection) Put(i gtreap.Item) { c.assertNotReadOnly() // Lock around the entire Upsert operation to serialize Puts. priority := rand.Int() c.rootLock.Lock() c.root = c.root.Upsert(i, priority) c.rootLock.Unlock() }
go
func (c *Collection) Put(i gtreap.Item) { c.assertNotReadOnly() // Lock around the entire Upsert operation to serialize Puts. priority := rand.Int() c.rootLock.Lock() c.root = c.root.Upsert(i, priority) c.rootLock.Unlock() }
[ "func", "(", "c", "*", "Collection", ")", "Put", "(", "i", "gtreap", ".", "Item", ")", "{", "c", ".", "assertNotReadOnly", "(", ")", "\n\n", "// Lock around the entire Upsert operation to serialize Puts.", "priority", ":=", "rand", ".", "Int", "(", ")", "\n", ...
// Put adds an item to the Store. // // If the Store is read-only, Put will panic.
[ "Put", "adds", "an", "item", "to", "the", "Store", ".", "If", "the", "Store", "is", "read", "-", "only", "Put", "will", "panic", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/treapstore/store.go#L215-L223
129,006
luci/luci-go
common/data/treapstore/store.go
Delete
func (c *Collection) Delete(i gtreap.Item) { c.assertNotReadOnly() c.rootLock.Lock() c.root = c.root.Delete(i) c.rootLock.Unlock() }
go
func (c *Collection) Delete(i gtreap.Item) { c.assertNotReadOnly() c.rootLock.Lock() c.root = c.root.Delete(i) c.rootLock.Unlock() }
[ "func", "(", "c", "*", "Collection", ")", "Delete", "(", "i", "gtreap", ".", "Item", ")", "{", "c", ".", "assertNotReadOnly", "(", ")", "\n\n", "c", ".", "rootLock", ".", "Lock", "(", ")", "\n", "c", ".", "root", "=", "c", ".", "root", ".", "De...
// Delete deletes an item from the Collection, if such an item exists.
[ "Delete", "deletes", "an", "item", "from", "the", "Collection", "if", "such", "an", "item", "exists", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/treapstore/store.go#L226-L232
129,007
luci/luci-go
common/data/treapstore/store.go
VisitAscend
func (c *Collection) VisitAscend(pivot gtreap.Item, visitor gtreap.ItemVisitor) { c.currentRoot().VisitAscend(pivot, visitor) }
go
func (c *Collection) VisitAscend(pivot gtreap.Item, visitor gtreap.ItemVisitor) { c.currentRoot().VisitAscend(pivot, visitor) }
[ "func", "(", "c", "*", "Collection", ")", "VisitAscend", "(", "pivot", "gtreap", ".", "Item", ",", "visitor", "gtreap", ".", "ItemVisitor", ")", "{", "c", ".", "currentRoot", "(", ")", ".", "VisitAscend", "(", "pivot", ",", "visitor", ")", "\n", "}" ]
// VisitAscend traverses the Collection ascendingly, invoking visitor for each // visited item. // // If visitor returns false, iteration will stop prematurely. // // VisitAscend is a more efficient traversal than using an Iterator, and is // useful in times when entry-by-entry iteration is not required.
[ "VisitAscend", "traverses", "the", "Collection", "ascendingly", "invoking", "visitor", "for", "each", "visited", "item", ".", "If", "visitor", "returns", "false", "iteration", "will", "stop", "prematurely", ".", "VisitAscend", "is", "a", "more", "efficient", "trav...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/treapstore/store.go#L257-L259
129,008
luci/luci-go
common/data/treapstore/store.go
Iterator
func (c *Collection) Iterator(pivot gtreap.Item) *gtreap.Iterator { root := c.currentRoot() if root == nil { root = emptyTreap } return root.Iterator(pivot) }
go
func (c *Collection) Iterator(pivot gtreap.Item) *gtreap.Iterator { root := c.currentRoot() if root == nil { root = emptyTreap } return root.Iterator(pivot) }
[ "func", "(", "c", "*", "Collection", ")", "Iterator", "(", "pivot", "gtreap", ".", "Item", ")", "*", "gtreap", ".", "Iterator", "{", "root", ":=", "c", ".", "currentRoot", "(", ")", "\n", "if", "root", "==", "nil", "{", "root", "=", "emptyTreap", "...
// Iterator returns an iterator over the Collection, starting at the supplied // pivot item.
[ "Iterator", "returns", "an", "iterator", "over", "the", "Collection", "starting", "at", "the", "supplied", "pivot", "item", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/treapstore/store.go#L263-L269
129,009
luci/luci-go
lucicfg/docgen/symbols/loader.go
init
func (l *Loader) init() { if l.loading == nil { l.loading = stringset.New(1) l.sources = make(map[string]string, 1) l.symbols = make(map[string]*Struct, 1) } }
go
func (l *Loader) init() { if l.loading == nil { l.loading = stringset.New(1) l.sources = make(map[string]string, 1) l.symbols = make(map[string]*Struct, 1) } }
[ "func", "(", "l", "*", "Loader", ")", "init", "(", ")", "{", "if", "l", ".", "loading", "==", "nil", "{", "l", ".", "loading", "=", "stringset", ".", "New", "(", "1", ")", "\n", "l", ".", "sources", "=", "make", "(", "map", "[", "string", "]"...
// init lazily initializes loader's guts.
[ "init", "lazily", "initializes", "loader", "s", "guts", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/docgen/symbols/loader.go#L64-L70
129,010
luci/luci-go
lucicfg/docgen/symbols/loader.go
Load
func (l *Loader) Load(module string) (syms *Struct, err error) { defer func() { err = errors.Annotate(err, "in %s", module).Err() }() l.init() if !l.loading.Add(module) { return nil, errors.New("recursive dependency") } defer l.loading.Del(module) // Already processed it? if syms, ok := l.symbols[module];...
go
func (l *Loader) Load(module string) (syms *Struct, err error) { defer func() { err = errors.Annotate(err, "in %s", module).Err() }() l.init() if !l.loading.Add(module) { return nil, errors.New("recursive dependency") } defer l.loading.Del(module) // Already processed it? if syms, ok := l.symbols[module];...
[ "func", "(", "l", "*", "Loader", ")", "Load", "(", "module", "string", ")", "(", "syms", "*", "Struct", ",", "err", "error", ")", "{", "defer", "func", "(", ")", "{", "err", "=", "errors", ".", "Annotate", "(", "err", ",", "\"", "\"", ",", "mod...
// Loads loads the module and all modules it references, populating the // loader's state with information about exported symbols. // // Returns a struct with a list of symbols defined in the module. // // Can be called multiple times with different modules.
[ "Loads", "loads", "the", "module", "and", "all", "modules", "it", "references", "populating", "the", "loader", "s", "state", "with", "information", "about", "exported", "symbols", ".", "Returns", "a", "struct", "with", "a", "list", "of", "symbols", "defined", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/docgen/symbols/loader.go#L78-L114
129,011
luci/luci-go
tokenserver/appengine/impl/serviceaccounts/config_validation.go
validateServiceAccountsCfg
func validateServiceAccountsCfg(ctx *validation.Context, cfg *admin.ServiceAccountsPermissions) { if cfg.Defaults != nil { validateDefaults(ctx, "defaults", cfg.Defaults) } names := stringset.New(0) accounts := map[string]string{} // service account -> rule name where its defined groups := map[string]string{} ...
go
func validateServiceAccountsCfg(ctx *validation.Context, cfg *admin.ServiceAccountsPermissions) { if cfg.Defaults != nil { validateDefaults(ctx, "defaults", cfg.Defaults) } names := stringset.New(0) accounts := map[string]string{} // service account -> rule name where its defined groups := map[string]string{} ...
[ "func", "validateServiceAccountsCfg", "(", "ctx", "*", "validation", ".", "Context", ",", "cfg", "*", "admin", ".", "ServiceAccountsPermissions", ")", "{", "if", "cfg", ".", "Defaults", "!=", "nil", "{", "validateDefaults", "(", "ctx", ",", "\"", "\"", ",", ...
// validateServiceAccountsCfg checks deserialized service_accounts.cfg.
[ "validateServiceAccountsCfg", "checks", "deserialized", "service_accounts", ".", "cfg", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/serviceaccounts/config_validation.go#L42-L81
129,012
luci/luci-go
tokenserver/appengine/impl/serviceaccounts/config_validation.go
validateDefaults
func validateDefaults(ctx *validation.Context, title string, d *admin.ServiceAccountRuleDefaults) { ctx.Enter(title) defer ctx.Exit() validateScopes(ctx, "allowed_scope", d.AllowedScope) validateMaxGrantValidityDuration(ctx, d.MaxGrantValidityDuration) }
go
func validateDefaults(ctx *validation.Context, title string, d *admin.ServiceAccountRuleDefaults) { ctx.Enter(title) defer ctx.Exit() validateScopes(ctx, "allowed_scope", d.AllowedScope) validateMaxGrantValidityDuration(ctx, d.MaxGrantValidityDuration) }
[ "func", "validateDefaults", "(", "ctx", "*", "validation", ".", "Context", ",", "title", "string", ",", "d", "*", "admin", ".", "ServiceAccountRuleDefaults", ")", "{", "ctx", ".", "Enter", "(", "title", ")", "\n", "defer", "ctx", ".", "Exit", "(", ")", ...
// validateDefaults checks ServiceAccountRuleDefaults proto.
[ "validateDefaults", "checks", "ServiceAccountRuleDefaults", "proto", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/serviceaccounts/config_validation.go#L84-L89
129,013
luci/luci-go
tokenserver/appengine/impl/serviceaccounts/config_validation.go
validateRule
func validateRule(ctx *validation.Context, title string, r *admin.ServiceAccountRule) { ctx.Enter(title) defer ctx.Exit() if r.Name == "" { ctx.Errorf(`"name" is required`) } // Note: we allow any of the sets to be empty. The rule will just not match // anything in this case, this is fine. validateEmails(ctx...
go
func validateRule(ctx *validation.Context, title string, r *admin.ServiceAccountRule) { ctx.Enter(title) defer ctx.Exit() if r.Name == "" { ctx.Errorf(`"name" is required`) } // Note: we allow any of the sets to be empty. The rule will just not match // anything in this case, this is fine. validateEmails(ctx...
[ "func", "validateRule", "(", "ctx", "*", "validation", ".", "Context", ",", "title", "string", ",", "r", "*", "admin", ".", "ServiceAccountRule", ")", "{", "ctx", ".", "Enter", "(", "title", ")", "\n", "defer", "ctx", ".", "Exit", "(", ")", "\n\n", "...
// validateRule checks single ServiceAccountRule proto.
[ "validateRule", "checks", "single", "ServiceAccountRule", "proto", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/serviceaccounts/config_validation.go#L92-L109
129,014
luci/luci-go
grpc/prpc/error.go
withStatus
func withStatus(err error, status int) *protocolError { if _, ok := err.(*protocolError); ok { panic("protocolError in protocolError") } if err == nil { return nil } return &protocolError{err, status} }
go
func withStatus(err error, status int) *protocolError { if _, ok := err.(*protocolError); ok { panic("protocolError in protocolError") } if err == nil { return nil } return &protocolError{err, status} }
[ "func", "withStatus", "(", "err", "error", ",", "status", "int", ")", "*", "protocolError", "{", "if", "_", ",", "ok", ":=", "err", ".", "(", "*", "protocolError", ")", ";", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "err", ...
// withStatus wraps an error with an HTTP status. // If err is nil, returns nil.
[ "withStatus", "wraps", "an", "error", "with", "an", "HTTP", "status", ".", "If", "err", "is", "nil", "returns", "nil", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/grpc/prpc/error.go#L33-L41
129,015
luci/luci-go
grpc/prpc/error.go
errorf
func errorf(status int, format string, a ...interface{}) *protocolError { return withStatus(fmt.Errorf(format, a...), status) }
go
func errorf(status int, format string, a ...interface{}) *protocolError { return withStatus(fmt.Errorf(format, a...), status) }
[ "func", "errorf", "(", "status", "int", ",", "format", "string", ",", "a", "...", "interface", "{", "}", ")", "*", "protocolError", "{", "return", "withStatus", "(", "fmt", ".", "Errorf", "(", "format", ",", "a", "...", ")", ",", "status", ")", "\n",...
// errorf creates a new protocol error.
[ "errorf", "creates", "a", "new", "protocol", "error", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/grpc/prpc/error.go#L44-L46
129,016
luci/luci-go
cq/appengine/config/config.go
validateRef
func validateRef(ctx *validation.Context, configSet, path string, content []byte) error { ctx.SetFile(path) // cq.cfg has been disallowed since Feb 1, 2019. // keep this error in place till Apr 1, 2019, to encourage clients remove this // config file from their repo. ctx.Errorf("cq.cfg is no longer used and has no...
go
func validateRef(ctx *validation.Context, configSet, path string, content []byte) error { ctx.SetFile(path) // cq.cfg has been disallowed since Feb 1, 2019. // keep this error in place till Apr 1, 2019, to encourage clients remove this // config file from their repo. ctx.Errorf("cq.cfg is no longer used and has no...
[ "func", "validateRef", "(", "ctx", "*", "validation", ".", "Context", ",", "configSet", ",", "path", "string", ",", "content", "[", "]", "byte", ")", "error", "{", "ctx", ".", "SetFile", "(", "path", ")", "\n", "// cq.cfg has been disallowed since Feb 1, 2019....
// validateRefCfg validates legacy ref-specific cq.cfg. // Validation result is returned via validation ctx, // while error returned directly implies only a bug in this code.
[ "validateRefCfg", "validates", "legacy", "ref", "-", "specific", "cq", ".", "cfg", ".", "Validation", "result", "is", "returned", "via", "validation", "ctx", "while", "error", "returned", "directly", "implies", "only", "a", "bug", "in", "this", "code", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cq/appengine/config/config.go#L50-L58
129,017
luci/luci-go
cq/appengine/config/config.go
validateProject
func validateProject(ctx *validation.Context, configSet, path string, content []byte) error { ctx.SetFile(path) cfg := v2.Config{} if err := proto.UnmarshalText(string(content), &cfg); err != nil { ctx.Error(err) } else { validateProjectConfig(ctx, &cfg) } return nil }
go
func validateProject(ctx *validation.Context, configSet, path string, content []byte) error { ctx.SetFile(path) cfg := v2.Config{} if err := proto.UnmarshalText(string(content), &cfg); err != nil { ctx.Error(err) } else { validateProjectConfig(ctx, &cfg) } return nil }
[ "func", "validateProject", "(", "ctx", "*", "validation", ".", "Context", ",", "configSet", ",", "path", "string", ",", "content", "[", "]", "byte", ")", "error", "{", "ctx", ".", "SetFile", "(", "path", ")", "\n", "cfg", ":=", "v2", ".", "Config", "...
// validateProjectCfg validates project-level cq.cfg. // Validation result is returned via validation ctx, // while error returned directly implies only a bug in this code.
[ "validateProjectCfg", "validates", "project", "-", "level", "cq", ".", "cfg", ".", "Validation", "result", "is", "returned", "via", "validation", "ctx", "while", "error", "returned", "directly", "implies", "only", "a", "bug", "in", "this", "code", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cq/appengine/config/config.go#L63-L72
129,018
luci/luci-go
cq/appengine/config/config.go
bestEffortDisjointGroups
func bestEffortDisjointGroups(ctx *validation.Context, cfg *v2.Config) { defaultRefRegexps := []string{"refs/heads/master"} // Multimap gerrit URL => project => refRegexp => config group index. seen := map[refKey]int{} for grIdx, gr := range cfg.ConfigGroups { for gIdx, g := range gr.Gerrit { for pIdx, p := r...
go
func bestEffortDisjointGroups(ctx *validation.Context, cfg *v2.Config) { defaultRefRegexps := []string{"refs/heads/master"} // Multimap gerrit URL => project => refRegexp => config group index. seen := map[refKey]int{} for grIdx, gr := range cfg.ConfigGroups { for gIdx, g := range gr.Gerrit { for pIdx, p := r...
[ "func", "bestEffortDisjointGroups", "(", "ctx", "*", "validation", ".", "Context", ",", "cfg", "*", "v2", ".", "Config", ")", "{", "defaultRefRegexps", ":=", "[", "]", "string", "{", "\"", "\"", "}", "\n", "// Multimap gerrit URL => project => refRegexp => config ...
// bestEffortDisjointGroups errors out on easy to spot overlaps between // configGroups. // // It is non-trivial if it all possible to ensure that regexp across // config_groups don't overlap. But, we can catch typical copy-pasta mistakes // early on by checking for equality of regexps.
[ "bestEffortDisjointGroups", "errors", "out", "on", "easy", "to", "spot", "overlaps", "between", "configGroups", ".", "It", "is", "non", "-", "trivial", "if", "it", "all", "possible", "to", "ensure", "that", "regexp", "across", "config_groups", "don", "t", "ove...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cq/appengine/config/config.go#L127-L191
129,019
luci/luci-go
logdog/appengine/coordinator/project.go
ProjectFromNamespace
func ProjectFromNamespace(ns string) types.ProjectName { if !strings.HasPrefix(ns, ProjectNamespacePrefix) { return "" } return types.ProjectName(ns[len(ProjectNamespacePrefix):]) }
go
func ProjectFromNamespace(ns string) types.ProjectName { if !strings.HasPrefix(ns, ProjectNamespacePrefix) { return "" } return types.ProjectName(ns[len(ProjectNamespacePrefix):]) }
[ "func", "ProjectFromNamespace", "(", "ns", "string", ")", "types", ".", "ProjectName", "{", "if", "!", "strings", ".", "HasPrefix", "(", "ns", ",", "ProjectNamespacePrefix", ")", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "types", ".", "ProjectN...
// ProjectFromNamespace returns the current project installed in the supplied // Context's namespace. // // If the namespace does not have a project namespace prefix, this function // will return an empty string.
[ "ProjectFromNamespace", "returns", "the", "current", "project", "installed", "in", "the", "supplied", "Context", "s", "namespace", ".", "If", "the", "namespace", "does", "not", "have", "a", "project", "namespace", "prefix", "this", "function", "will", "return", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/appengine/coordinator/project.go#L43-L48
129,020
luci/luci-go
logdog/appengine/coordinator/project.go
CurrentProject
func CurrentProject(c context.Context) types.ProjectName { if ns := info.GetNamespace(c); ns != "" { return ProjectFromNamespace(ns) } return "" }
go
func CurrentProject(c context.Context) types.ProjectName { if ns := info.GetNamespace(c); ns != "" { return ProjectFromNamespace(ns) } return "" }
[ "func", "CurrentProject", "(", "c", "context", ".", "Context", ")", "types", ".", "ProjectName", "{", "if", "ns", ":=", "info", ".", "GetNamespace", "(", "c", ")", ";", "ns", "!=", "\"", "\"", "{", "return", "ProjectFromNamespace", "(", "ns", ")", "\n"...
// CurrentProject returns the current project based on the currently-loaded // namespace. // // If there is no current namespace, or if the current namespace is not a valid // project namespace, an empty string will be returned.
[ "CurrentProject", "returns", "the", "current", "project", "based", "on", "the", "currently", "-", "loaded", "namespace", ".", "If", "there", "is", "no", "current", "namespace", "or", "if", "the", "current", "namespace", "is", "not", "a", "valid", "project", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/appengine/coordinator/project.go#L55-L60
129,021
luci/luci-go
logdog/appengine/coordinator/project.go
CurrentProjectConfig
func CurrentProjectConfig(c context.Context) (*svcconfig.ProjectConfig, error) { return GetConfigProvider(c).ProjectConfig(c, CurrentProject(c)) }
go
func CurrentProjectConfig(c context.Context) (*svcconfig.ProjectConfig, error) { return GetConfigProvider(c).ProjectConfig(c, CurrentProject(c)) }
[ "func", "CurrentProjectConfig", "(", "c", "context", ".", "Context", ")", "(", "*", "svcconfig", ".", "ProjectConfig", ",", "error", ")", "{", "return", "GetConfigProvider", "(", "c", ")", ".", "ProjectConfig", "(", "c", ",", "CurrentProject", "(", "c", ")...
// CurrentProjectConfig returns the project-specific configuration for the // current project. // // If there is no current project namespace, or if the current project has no // configuration, config.ErrInvalidConfig will be returned.
[ "CurrentProjectConfig", "returns", "the", "project", "-", "specific", "configuration", "for", "the", "current", "project", ".", "If", "there", "is", "no", "current", "project", "namespace", "or", "if", "the", "current", "project", "has", "no", "configuration", "...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/appengine/coordinator/project.go#L67-L69
129,022
luci/luci-go
common/iotools/deadlinereader.go
SetReadTimeout
func (r *DeadlineReader) SetReadTimeout(d time.Duration) error { r.Deadline = d return nil }
go
func (r *DeadlineReader) SetReadTimeout(d time.Duration) error { r.Deadline = d return nil }
[ "func", "(", "r", "*", "DeadlineReader", ")", "SetReadTimeout", "(", "d", "time", ".", "Duration", ")", "error", "{", "r", ".", "Deadline", "=", "d", "\n", "return", "nil", "\n", "}" ]
// SetReadTimeout implements ReadDeadlineSetter.
[ "SetReadTimeout", "implements", "ReadDeadlineSetter", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/iotools/deadlinereader.go#L69-L72
129,023
luci/luci-go
logdog/common/types/tag.go
ValidateTag
func ValidateTag(k, v string) error { if err := StreamName(k).Validate(); err != nil { return fmt.Errorf("invalid tag key: %s", err) } if len(k) > MaxTagKeySize { return fmt.Errorf("tag key exceeds maximum size (%d > %d)", len(k), MaxTagKeySize) } if len(v) > MaxTagValueSize { return fmt.Errorf("tag value ex...
go
func ValidateTag(k, v string) error { if err := StreamName(k).Validate(); err != nil { return fmt.Errorf("invalid tag key: %s", err) } if len(k) > MaxTagKeySize { return fmt.Errorf("tag key exceeds maximum size (%d > %d)", len(k), MaxTagKeySize) } if len(v) > MaxTagValueSize { return fmt.Errorf("tag value ex...
[ "func", "ValidateTag", "(", "k", ",", "v", "string", ")", "error", "{", "if", "err", ":=", "StreamName", "(", "k", ")", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "...
// ValidateTag returns an error if a tag contains a nonconfirming value.
[ "ValidateTag", "returns", "an", "error", "if", "a", "tag", "contains", "a", "nonconfirming", "value", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/common/types/tag.go#L32-L43
129,024
luci/luci-go
machine-db/appengine/rpc/nics.go
CreateNIC
func (*Service) CreateNIC(c context.Context, req *crimson.CreateNICRequest) (*crimson.NIC, error) { if err := createNIC(c, req.Nic); err != nil { return nil, err } return req.Nic, nil }
go
func (*Service) CreateNIC(c context.Context, req *crimson.CreateNICRequest) (*crimson.NIC, error) { if err := createNIC(c, req.Nic); err != nil { return nil, err } return req.Nic, nil }
[ "func", "(", "*", "Service", ")", "CreateNIC", "(", "c", "context", ".", "Context", ",", "req", "*", "crimson", ".", "CreateNICRequest", ")", "(", "*", "crimson", ".", "NIC", ",", "error", ")", "{", "if", "err", ":=", "createNIC", "(", "c", ",", "r...
// CreateNIC handles a request to create a new network interface.
[ "CreateNIC", "handles", "a", "request", "to", "create", "a", "new", "network", "interface", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/nics.go#L41-L46
129,025
luci/luci-go
machine-db/appengine/rpc/nics.go
DeleteNIC
func (*Service) DeleteNIC(c context.Context, req *crimson.DeleteNICRequest) (*empty.Empty, error) { if err := deleteNIC(c, req.Name, req.Machine); err != nil { return nil, err } return &empty.Empty{}, nil }
go
func (*Service) DeleteNIC(c context.Context, req *crimson.DeleteNICRequest) (*empty.Empty, error) { if err := deleteNIC(c, req.Name, req.Machine); err != nil { return nil, err } return &empty.Empty{}, nil }
[ "func", "(", "*", "Service", ")", "DeleteNIC", "(", "c", "context", ".", "Context", ",", "req", "*", "crimson", ".", "DeleteNICRequest", ")", "(", "*", "empty", ".", "Empty", ",", "error", ")", "{", "if", "err", ":=", "deleteNIC", "(", "c", ",", "r...
// DeleteNIC handles a request to delete an existing network interface.
[ "DeleteNIC", "handles", "a", "request", "to", "delete", "an", "existing", "network", "interface", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/nics.go#L49-L54
129,026
luci/luci-go
machine-db/appengine/rpc/nics.go
ListNICs
func (*Service) ListNICs(c context.Context, req *crimson.ListNICsRequest) (*crimson.ListNICsResponse, error) { nics, err := listNICs(c, database.Get(c), req) if err != nil { return nil, err } return &crimson.ListNICsResponse{ Nics: nics, }, nil }
go
func (*Service) ListNICs(c context.Context, req *crimson.ListNICsRequest) (*crimson.ListNICsResponse, error) { nics, err := listNICs(c, database.Get(c), req) if err != nil { return nil, err } return &crimson.ListNICsResponse{ Nics: nics, }, nil }
[ "func", "(", "*", "Service", ")", "ListNICs", "(", "c", "context", ".", "Context", ",", "req", "*", "crimson", ".", "ListNICsRequest", ")", "(", "*", "crimson", ".", "ListNICsResponse", ",", "error", ")", "{", "nics", ",", "err", ":=", "listNICs", "(",...
// ListNICs handles a request to list network interfaces.
[ "ListNICs", "handles", "a", "request", "to", "list", "network", "interfaces", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/nics.go#L57-L65
129,027
luci/luci-go
machine-db/appengine/rpc/nics.go
UpdateNIC
func (*Service) UpdateNIC(c context.Context, req *crimson.UpdateNICRequest) (*crimson.NIC, error) { return updateNIC(c, req.Nic, req.UpdateMask) }
go
func (*Service) UpdateNIC(c context.Context, req *crimson.UpdateNICRequest) (*crimson.NIC, error) { return updateNIC(c, req.Nic, req.UpdateMask) }
[ "func", "(", "*", "Service", ")", "UpdateNIC", "(", "c", "context", ".", "Context", ",", "req", "*", "crimson", ".", "UpdateNICRequest", ")", "(", "*", "crimson", ".", "NIC", ",", "error", ")", "{", "return", "updateNIC", "(", "c", ",", "req", ".", ...
// UpdateNIC handles a request to update an existing network interface.
[ "UpdateNIC", "handles", "a", "request", "to", "update", "an", "existing", "network", "interface", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/nics.go#L68-L70
129,028
luci/luci-go
machine-db/appengine/rpc/nics.go
createNIC
func createNIC(c context.Context, n *crimson.NIC) error { if err := validateNICForCreation(n); err != nil { return err } mac, _ := common.ParseMAC48(n.MacAddress) tx, err := database.Begin(c) if err != nil { return errors.Annotate(err, "failed to begin transaction").Err() } defer tx.MaybeRollback(c) var ho...
go
func createNIC(c context.Context, n *crimson.NIC) error { if err := validateNICForCreation(n); err != nil { return err } mac, _ := common.ParseMAC48(n.MacAddress) tx, err := database.Begin(c) if err != nil { return errors.Annotate(err, "failed to begin transaction").Err() } defer tx.MaybeRollback(c) var ho...
[ "func", "createNIC", "(", "c", "context", ".", "Context", ",", "n", "*", "crimson", ".", "NIC", ")", "error", "{", "if", "err", ":=", "validateNICForCreation", "(", "n", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "mac", ",...
// createNIC creates a new NIC in the database.
[ "createNIC", "creates", "a", "new", "NIC", "in", "the", "database", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/nics.go#L73-L125
129,029
luci/luci-go
machine-db/appengine/rpc/nics.go
getHostnameForNIC
func getHostnameForNIC(c context.Context, q database.QueryerContext, name, machine string) (*int64, error) { rows, err := q.QueryContext(c, ` SELECT h.id FROM nics n, machines m, hostnames h WHERE n.machine_id = m.id AND n.hostname_id = h.id AND n.name = ? AND m.name = ? `, name, machine) if err != nil { retur...
go
func getHostnameForNIC(c context.Context, q database.QueryerContext, name, machine string) (*int64, error) { rows, err := q.QueryContext(c, ` SELECT h.id FROM nics n, machines m, hostnames h WHERE n.machine_id = m.id AND n.hostname_id = h.id AND n.name = ? AND m.name = ? `, name, machine) if err != nil { retur...
[ "func", "getHostnameForNIC", "(", "c", "context", ".", "Context", ",", "q", "database", ".", "QueryerContext", ",", "name", ",", "machine", "string", ")", "(", "*", "int64", ",", "error", ")", "{", "rows", ",", "err", ":=", "q", ".", "QueryContext", "(...
// getHostnameForNIC gets the ID of the hostname associated with an existing NIC.
[ "getHostnameForNIC", "gets", "the", "ID", "of", "the", "hostname", "associated", "with", "an", "existing", "NIC", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/nics.go#L128-L145
129,030
luci/luci-go
machine-db/appengine/rpc/nics.go
deleteNIC
func deleteNIC(c context.Context, name, machine string) error { switch { case name == "": return status.Error(codes.InvalidArgument, "NIC name is required and must be non-empty") case machine == "": return status.Error(codes.InvalidArgument, "machine is required and must be non-empty") } tx, err := database.Be...
go
func deleteNIC(c context.Context, name, machine string) error { switch { case name == "": return status.Error(codes.InvalidArgument, "NIC name is required and must be non-empty") case machine == "": return status.Error(codes.InvalidArgument, "machine is required and must be non-empty") } tx, err := database.Be...
[ "func", "deleteNIC", "(", "c", "context", ".", "Context", ",", "name", ",", "machine", "string", ")", "error", "{", "switch", "{", "case", "name", "==", "\"", "\"", ":", "return", "status", ".", "Error", "(", "codes", ".", "InvalidArgument", ",", "\"",...
// deleteNIC deletes an existing NIC from the database.
[ "deleteNIC", "deletes", "an", "existing", "NIC", "from", "the", "database", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/nics.go#L148-L203
129,031
luci/luci-go
machine-db/appengine/rpc/nics.go
listNICs
func listNICs(c context.Context, q database.QueryerContext, req *crimson.ListNICsRequest) ([]*crimson.NIC, error) { mac48s, err := parseMAC48s(req.MacAddresses) if err != nil { return nil, err } stmt := squirrel.Select("n.name", "m.name", "n.mac_address", "s.name", "n.switchport"). From("nics n, machines m, sw...
go
func listNICs(c context.Context, q database.QueryerContext, req *crimson.ListNICsRequest) ([]*crimson.NIC, error) { mac48s, err := parseMAC48s(req.MacAddresses) if err != nil { return nil, err } stmt := squirrel.Select("n.name", "m.name", "n.mac_address", "s.name", "n.switchport"). From("nics n, machines m, sw...
[ "func", "listNICs", "(", "c", "context", ".", "Context", ",", "q", "database", ".", "QueryerContext", ",", "req", "*", "crimson", ".", "ListNICsRequest", ")", "(", "[", "]", "*", "crimson", ".", "NIC", ",", "error", ")", "{", "mac48s", ",", "err", ":...
// listNICs returns a slice of NICs in the database.
[ "listNICs", "returns", "a", "slice", "of", "NICs", "in", "the", "database", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/nics.go#L206-L240
129,032
luci/luci-go
machine-db/appengine/rpc/nics.go
parseMAC48s
func parseMAC48s(macs []string) ([]uint64, error) { mac48s := make([]uint64, len(macs)) for i, mac := range macs { mac48, err := common.ParseMAC48(mac) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid MAC-48 address %q", mac) } mac48s[i] = uint64(mac48) } return mac48s, nil }
go
func parseMAC48s(macs []string) ([]uint64, error) { mac48s := make([]uint64, len(macs)) for i, mac := range macs { mac48, err := common.ParseMAC48(mac) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid MAC-48 address %q", mac) } mac48s[i] = uint64(mac48) } return mac48s, nil }
[ "func", "parseMAC48s", "(", "macs", "[", "]", "string", ")", "(", "[", "]", "uint64", ",", "error", ")", "{", "mac48s", ":=", "make", "(", "[", "]", "uint64", ",", "len", "(", "macs", ")", ")", "\n", "for", "i", ",", "mac", ":=", "range", "macs...
// parseMAC48s returns a slice of uint64 MAC addresses.
[ "parseMAC48s", "returns", "a", "slice", "of", "uint64", "MAC", "addresses", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/nics.go#L243-L253
129,033
luci/luci-go
machine-db/appengine/rpc/nics.go
validateNICForCreation
func validateNICForCreation(n *crimson.NIC) error { switch { case n == nil: return status.Error(codes.InvalidArgument, "NIC specification is required") case n.Name == "": return status.Error(codes.InvalidArgument, "NIC name is required and must be non-empty") case n.Machine == "": return status.Error(codes.In...
go
func validateNICForCreation(n *crimson.NIC) error { switch { case n == nil: return status.Error(codes.InvalidArgument, "NIC specification is required") case n.Name == "": return status.Error(codes.InvalidArgument, "NIC name is required and must be non-empty") case n.Machine == "": return status.Error(codes.In...
[ "func", "validateNICForCreation", "(", "n", "*", "crimson", ".", "NIC", ")", "error", "{", "switch", "{", "case", "n", "==", "nil", ":", "return", "status", ".", "Error", "(", "codes", ".", "InvalidArgument", ",", "\"", "\"", ")", "\n", "case", "n", ...
// validateNICForCreation validates a NIC for creation.
[ "validateNICForCreation", "validates", "a", "NIC", "for", "creation", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/nics.go#L319-L351
129,034
luci/luci-go
machine-db/appengine/rpc/nics.go
validateNICForUpdate
func validateNICForUpdate(n *crimson.NIC, mask *field_mask.FieldMask) error { switch err := validateUpdateMask(mask); { case n == nil: return status.Error(codes.InvalidArgument, "NIC specification is required") case n.Name == "": return status.Error(codes.InvalidArgument, "NIC name is required and must be non-em...
go
func validateNICForUpdate(n *crimson.NIC, mask *field_mask.FieldMask) error { switch err := validateUpdateMask(mask); { case n == nil: return status.Error(codes.InvalidArgument, "NIC specification is required") case n.Name == "": return status.Error(codes.InvalidArgument, "NIC name is required and must be non-em...
[ "func", "validateNICForUpdate", "(", "n", "*", "crimson", ".", "NIC", ",", "mask", "*", "field_mask", ".", "FieldMask", ")", "error", "{", "switch", "err", ":=", "validateUpdateMask", "(", "mask", ")", ";", "{", "case", "n", "==", "nil", ":", "return", ...
// validateNICForUpdate validates a NIC for update.
[ "validateNICForUpdate", "validates", "a", "NIC", "for", "update", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/nics.go#L354-L393
129,035
luci/luci-go
buildbucket/protoutil/search.go
searchBuilds
func searchBuilds(ctx context.Context, buildC chan<- *pb.Build, client pb.BuildsClient, req *pb.SearchBuildsRequest) error { // Prepare a channel of responses, s.t. we make an RPC as soon as we started // consuming the response, as opposed to after the response is completely // consumed. resC := make(chan *pb.Searc...
go
func searchBuilds(ctx context.Context, buildC chan<- *pb.Build, client pb.BuildsClient, req *pb.SearchBuildsRequest) error { // Prepare a channel of responses, s.t. we make an RPC as soon as we started // consuming the response, as opposed to after the response is completely // consumed. resC := make(chan *pb.Searc...
[ "func", "searchBuilds", "(", "ctx", "context", ".", "Context", ",", "buildC", "chan", "<-", "*", "pb", ".", "Build", ",", "client", "pb", ".", "BuildsClient", ",", "req", "*", "pb", ".", "SearchBuildsRequest", ")", "error", "{", "// Prepare a channel of resp...
// searchBuilds is like Search, but does not implement union of search results. // Sent builds have ids.
[ "searchBuilds", "is", "like", "Search", "but", "does", "not", "implement", "union", "of", "search", "results", ".", "Sent", "builds", "have", "ids", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/protoutil/search.go#L110-L137
129,036
luci/luci-go
buildbucket/protoutil/search.go
searchResponses
func searchResponses(ctx context.Context, resC chan<- *pb.SearchBuildsResponse, client pb.BuildsClient, req *pb.SearchBuildsRequest) error { req = proto.Clone(req).(*pb.SearchBuildsRequest) // Ensure next_page_token and build id are requested. if len(req.GetFields().GetPaths()) > 0 { req.Fields.Paths = append(req...
go
func searchResponses(ctx context.Context, resC chan<- *pb.SearchBuildsResponse, client pb.BuildsClient, req *pb.SearchBuildsRequest) error { req = proto.Clone(req).(*pb.SearchBuildsRequest) // Ensure next_page_token and build id are requested. if len(req.GetFields().GetPaths()) > 0 { req.Fields.Paths = append(req...
[ "func", "searchResponses", "(", "ctx", "context", ".", "Context", ",", "resC", "chan", "<-", "*", "pb", ".", "SearchBuildsResponse", ",", "client", "pb", ".", "BuildsClient", ",", "req", "*", "pb", ".", "SearchBuildsRequest", ")", "error", "{", "req", "=",...
// searchResponses pages through search results and sends search responses to // resC. // Builds in resC have ids.
[ "searchResponses", "pages", "through", "search", "results", "and", "sends", "search", "responses", "to", "resC", ".", "Builds", "in", "resC", "have", "ids", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/protoutil/search.go#L142-L170
129,037
luci/luci-go
buildbucket/protoutil/search.go
Swap
func (h streamHeap) Swap(i, j int) { h[i], h[j] = h[j], h[i] }
go
func (h streamHeap) Swap(i, j int) { h[i], h[j] = h[j], h[i] }
[ "func", "(", "h", "streamHeap", ")", "Swap", "(", "i", ",", "j", "int", ")", "{", "h", "[", "i", "]", ",", "h", "[", "j", "]", "=", "h", "[", "j", "]", ",", "h", "[", "i", "]", "\n", "}" ]
// Swap implements sort.Interface.
[ "Swap", "implements", "sort", ".", "Interface", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/protoutil/search.go#L189-L191
129,038
luci/luci-go
buildbucket/protoutil/search.go
Pop
func (h *streamHeap) Pop() interface{} { old := *h n := len(old) x := old[n-1] *h = old[0 : n-1] return x }
go
func (h *streamHeap) Pop() interface{} { old := *h n := len(old) x := old[n-1] *h = old[0 : n-1] return x }
[ "func", "(", "h", "*", "streamHeap", ")", "Pop", "(", ")", "interface", "{", "}", "{", "old", ":=", "*", "h", "\n", "n", ":=", "len", "(", "old", ")", "\n", "x", ":=", "old", "[", "n", "-", "1", "]", "\n", "*", "h", "=", "old", "[", "0", ...
// Pop implements heap.Interface.
[ "Pop", "implements", "heap", ".", "Interface", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/protoutil/search.go#L201-L207
129,039
luci/luci-go
machine-db/api/common/v1/prefixes.go
Name
func (s State) Name() string { switch s { case State_STATE_UNSPECIFIED: return "" case State_FREE: return "free" case State_PRERELEASE: return "prerelease" case State_SERVING: return "serving" case State_TEST: return "test" case State_REPAIR: return "repair" case State_DECOMMISSIONED: return "deco...
go
func (s State) Name() string { switch s { case State_STATE_UNSPECIFIED: return "" case State_FREE: return "free" case State_PRERELEASE: return "prerelease" case State_SERVING: return "serving" case State_TEST: return "test" case State_REPAIR: return "repair" case State_DECOMMISSIONED: return "deco...
[ "func", "(", "s", "State", ")", "Name", "(", ")", "string", "{", "switch", "s", "{", "case", "State_STATE_UNSPECIFIED", ":", "return", "\"", "\"", "\n", "case", "State_FREE", ":", "return", "\"", "\"", "\n", "case", "State_PRERELEASE", ":", "return", "\"...
// Name returns a string which can be used as the human-readable representation expected by GetState.
[ "Name", "returns", "a", "string", "which", "can", "be", "used", "as", "the", "human", "-", "readable", "representation", "expected", "by", "GetState", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/api/common/v1/prefixes.go#L24-L43
129,040
luci/luci-go
machine-db/api/common/v1/prefixes.go
GetState
func GetState(s string) (State, error) { lower := strings.ToLower(s) switch { case lower == "": return State_STATE_UNSPECIFIED, nil case strings.HasPrefix("free", lower): return State_FREE, nil case strings.HasPrefix("prerelease", lower): return State_PRERELEASE, nil case strings.HasPrefix("serving", lower)...
go
func GetState(s string) (State, error) { lower := strings.ToLower(s) switch { case lower == "": return State_STATE_UNSPECIFIED, nil case strings.HasPrefix("free", lower): return State_FREE, nil case strings.HasPrefix("prerelease", lower): return State_PRERELEASE, nil case strings.HasPrefix("serving", lower)...
[ "func", "GetState", "(", "s", "string", ")", "(", "State", ",", "error", ")", "{", "lower", ":=", "strings", ".", "ToLower", "(", "s", ")", "\n", "switch", "{", "case", "lower", "==", "\"", "\"", ":", "return", "State_STATE_UNSPECIFIED", ",", "nil", ...
// GetState returns a State given its name. Supports prefix matching.
[ "GetState", "returns", "a", "State", "given", "its", "name", ".", "Supports", "prefix", "matching", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/api/common/v1/prefixes.go#L46-L66
129,041
luci/luci-go
cipd/client/cipd/ensure/package_def.go
Expand
func (p *PackageDef) Expand(expander template.Expander) (pkg string, err error) { switch pkg, err = expander.Expand(p.PackageTemplate); { case err == template.ErrSkipTemplate: return "", err case err != nil: return "", errors.Annotate(err, "failed to expand package template (line %d)", p.LineNo).Err() } if err...
go
func (p *PackageDef) Expand(expander template.Expander) (pkg string, err error) { switch pkg, err = expander.Expand(p.PackageTemplate); { case err == template.ErrSkipTemplate: return "", err case err != nil: return "", errors.Annotate(err, "failed to expand package template (line %d)", p.LineNo).Err() } if err...
[ "func", "(", "p", "*", "PackageDef", ")", "Expand", "(", "expander", "template", ".", "Expander", ")", "(", "pkg", "string", ",", "err", "error", ")", "{", "switch", "pkg", ",", "err", "=", "expander", ".", "Expand", "(", "p", ".", "PackageTemplate", ...
// Expand expands the package name template and checks that resulting package // name and version are syntactically correct. // // May return template.ErrSkipTemplate is this package definition should be // skipped given the current expansion variables values.
[ "Expand", "expands", "the", "package", "name", "template", "and", "checks", "that", "resulting", "package", "name", "and", "version", "are", "syntactically", "correct", ".", "May", "return", "template", ".", "ErrSkipTemplate", "is", "this", "package", "definition"...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/ensure/package_def.go#L52-L66
129,042
luci/luci-go
client/archiver/tar_archiver.go
shardItems
func shardItems(items []*Item, threshold int64) []*itemBundle { // For deterministic isolated hashes, sort the items by path. sort.Sort(itemByPath(items)) var bundles []*itemBundle for len(items) > 0 { var bundle *itemBundle bundle, items = oneBundle(items, threshold) bundles = append(bundles, bundle) } re...
go
func shardItems(items []*Item, threshold int64) []*itemBundle { // For deterministic isolated hashes, sort the items by path. sort.Sort(itemByPath(items)) var bundles []*itemBundle for len(items) > 0 { var bundle *itemBundle bundle, items = oneBundle(items, threshold) bundles = append(bundles, bundle) } re...
[ "func", "shardItems", "(", "items", "[", "]", "*", "Item", ",", "threshold", "int64", ")", "[", "]", "*", "itemBundle", "{", "// For deterministic isolated hashes, sort the items by path.", "sort", ".", "Sort", "(", "itemByPath", "(", "items", ")", ")", "\n\n", ...
// shardItems shards the provided items into itemBundles, using the provided // threshold as the maximum size the resultant tars should be. // // shardItems does not access the filesystem.
[ "shardItems", "shards", "the", "provided", "items", "into", "itemBundles", "using", "the", "provided", "threshold", "as", "the", "maximum", "size", "the", "resultant", "tars", "should", "be", ".", "shardItems", "does", "not", "access", "the", "filesystem", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/archiver/tar_archiver.go#L45-L56
129,043
luci/luci-go
client/archiver/tar_archiver.go
Digest
func (b *itemBundle) Digest(h crypto.Hash) (isolated.HexDigest, int64, error) { a := h.New() cw := &iotools.CountingWriter{Writer: a} if err := b.writeTar(cw); err != nil { return "", 0, err } return isolated.Sum(a), cw.Count, nil }
go
func (b *itemBundle) Digest(h crypto.Hash) (isolated.HexDigest, int64, error) { a := h.New() cw := &iotools.CountingWriter{Writer: a} if err := b.writeTar(cw); err != nil { return "", 0, err } return isolated.Sum(a), cw.Count, nil }
[ "func", "(", "b", "*", "itemBundle", ")", "Digest", "(", "h", "crypto", ".", "Hash", ")", "(", "isolated", ".", "HexDigest", ",", "int64", ",", "error", ")", "{", "a", ":=", "h", ".", "New", "(", ")", "\n", "cw", ":=", "&", "iotools", ".", "Cou...
// Digest returns the hash and total size of the tar constructed from the // bundle's items.
[ "Digest", "returns", "the", "hash", "and", "total", "size", "of", "the", "tar", "constructed", "from", "the", "bundle", "s", "items", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/archiver/tar_archiver.go#L79-L86
129,044
luci/luci-go
client/archiver/tar_archiver.go
Contents
func (b *itemBundle) Contents() (io.ReadCloser, error) { pr, pw := io.Pipe() go func() { pw.CloseWithError(b.writeTar(pw)) }() return pr, nil }
go
func (b *itemBundle) Contents() (io.ReadCloser, error) { pr, pw := io.Pipe() go func() { pw.CloseWithError(b.writeTar(pw)) }() return pr, nil }
[ "func", "(", "b", "*", "itemBundle", ")", "Contents", "(", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", "{", "pr", ",", "pw", ":=", "io", ".", "Pipe", "(", ")", "\n", "go", "func", "(", ")", "{", "pw", ".", "CloseWithError", "(", "b", ...
// Contents returns an io.ReadCloser containing the tar's contents.
[ "Contents", "returns", "an", "io", ".", "ReadCloser", "containing", "the", "tar", "s", "contents", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/archiver/tar_archiver.go#L89-L95
129,045
luci/luci-go
common/errors/annotate.go
dumpWrappersTo
func (r *renderedFrame) dumpWrappersTo(w io.Writer, from, to int) (n int, err error) { return iotools.WriteTracker(w, func(rawWriter io.Writer) error { w := &indented.Writer{Writer: rawWriter, UseSpaces: true} fmt.Fprintf(w, "From frame %d to %d, the following wrappers were found:\n", from, to) for i, wrp := ran...
go
func (r *renderedFrame) dumpWrappersTo(w io.Writer, from, to int) (n int, err error) { return iotools.WriteTracker(w, func(rawWriter io.Writer) error { w := &indented.Writer{Writer: rawWriter, UseSpaces: true} fmt.Fprintf(w, "From frame %d to %d, the following wrappers were found:\n", from, to) for i, wrp := ran...
[ "func", "(", "r", "*", "renderedFrame", ")", "dumpWrappersTo", "(", "w", "io", ".", "Writer", ",", "from", ",", "to", "int", ")", "(", "n", "int", ",", "err", "error", ")", "{", "return", "iotools", ".", "WriteTracker", "(", "w", ",", "func", "(", ...
// dumpWrappersTo formats the wrappers portion of this renderedFrame.
[ "dumpWrappersTo", "formats", "the", "wrappers", "portion", "of", "this", "renderedFrame", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/errors/annotate.go#L270-L290
129,046
luci/luci-go
common/errors/annotate.go
dumpTo
func (r *renderedFrame) dumpTo(w io.Writer, idx int) (n int, err error) { return iotools.WriteTracker(w, func(rawWriter io.Writer) error { w := &indented.Writer{Writer: rawWriter, UseSpaces: true} fmt.Fprintf(w, "#%d %s/%s:%d - %s()\n", idx, r.pkg, r.file, r.lineNum, r.funcName) w.Level += 2 switch len(r.a...
go
func (r *renderedFrame) dumpTo(w io.Writer, idx int) (n int, err error) { return iotools.WriteTracker(w, func(rawWriter io.Writer) error { w := &indented.Writer{Writer: rawWriter, UseSpaces: true} fmt.Fprintf(w, "#%d %s/%s:%d - %s()\n", idx, r.pkg, r.file, r.lineNum, r.funcName) w.Level += 2 switch len(r.a...
[ "func", "(", "r", "*", "renderedFrame", ")", "dumpTo", "(", "w", "io", ".", "Writer", ",", "idx", "int", ")", "(", "n", "int", ",", "err", "error", ")", "{", "return", "iotools", ".", "WriteTracker", "(", "w", ",", "func", "(", "rawWriter", "io", ...
// dumpTo formats the Header and annotations for this renderedFrame.
[ "dumpTo", "formats", "the", "Header", "and", "annotations", "for", "this", "renderedFrame", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/errors/annotate.go#L293-L319
129,047
luci/luci-go
common/errors/annotate.go
dumpTo
func (r *renderedStack) dumpTo(w io.Writer, excludePkgs ...string) (n int, err error) { excludeSet := stringset.NewFromSlice(excludePkgs...) return iotools.WriteTracker(w, func(w io.Writer) error { fmt.Fprintf(w, "goroutine %d:\n", r.goID) lastIdx := 0 needNL := false skipCount := 0 skipPkg := "" flushS...
go
func (r *renderedStack) dumpTo(w io.Writer, excludePkgs ...string) (n int, err error) { excludeSet := stringset.NewFromSlice(excludePkgs...) return iotools.WriteTracker(w, func(w io.Writer) error { fmt.Fprintf(w, "goroutine %d:\n", r.goID) lastIdx := 0 needNL := false skipCount := 0 skipPkg := "" flushS...
[ "func", "(", "r", "*", "renderedStack", ")", "dumpTo", "(", "w", "io", ".", "Writer", ",", "excludePkgs", "...", "string", ")", "(", "n", "int", ",", "err", "error", ")", "{", "excludeSet", ":=", "stringset", ".", "NewFromSlice", "(", "excludePkgs", "....
// dumpTo formats the full stack.
[ "dumpTo", "formats", "the", "full", "stack", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/errors/annotate.go#L328-L379
129,048
luci/luci-go
common/errors/annotate.go
toLines
func (r *renderedError) toLines(excludePkgs ...string) lines { buf := bytes.Buffer{} r.dumpTo(&buf, excludePkgs...) return strings.Split(strings.TrimSuffix(buf.String(), "\n"), "\n") }
go
func (r *renderedError) toLines(excludePkgs ...string) lines { buf := bytes.Buffer{} r.dumpTo(&buf, excludePkgs...) return strings.Split(strings.TrimSuffix(buf.String(), "\n"), "\n") }
[ "func", "(", "r", "*", "renderedError", ")", "toLines", "(", "excludePkgs", "...", "string", ")", "lines", "{", "buf", ":=", "bytes", ".", "Buffer", "{", "}", "\n", "r", ".", "dumpTo", "(", "&", "buf", ",", "excludePkgs", "...", ")", "\n", "return", ...
// toLines renders a full-information stack trace as a series of lines.
[ "toLines", "renders", "a", "full", "-", "information", "stack", "trace", "as", "a", "series", "of", "lines", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/errors/annotate.go#L389-L393
129,049
luci/luci-go
common/errors/annotate.go
dumpTo
func (r *renderedError) dumpTo(w io.Writer, excludePkgs ...string) (n int, err error) { return iotools.WriteTracker(w, func(w io.Writer) error { if r.originalError != "" { fmt.Fprintf(w, "original error: %s\n\n", r.originalError) } for i := len(r.stacks) - 1; i >= 0; i-- { if i != len(r.stacks)-1 { w....
go
func (r *renderedError) dumpTo(w io.Writer, excludePkgs ...string) (n int, err error) { return iotools.WriteTracker(w, func(w io.Writer) error { if r.originalError != "" { fmt.Fprintf(w, "original error: %s\n\n", r.originalError) } for i := len(r.stacks) - 1; i >= 0; i-- { if i != len(r.stacks)-1 { w....
[ "func", "(", "r", "*", "renderedError", ")", "dumpTo", "(", "w", "io", ".", "Writer", ",", "excludePkgs", "...", "string", ")", "(", "n", "int", ",", "err", "error", ")", "{", "return", "iotools", ".", "WriteTracker", "(", "w", ",", "func", "(", "w...
// dumpTo writes the full-information stack trace to the writer.
[ "dumpTo", "writes", "the", "full", "-", "information", "stack", "trace", "to", "the", "writer", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/errors/annotate.go#L396-L410
129,050
luci/luci-go
common/errors/annotate.go
RenderStack
func RenderStack(err error, excludePkgs ...string) []string { return renderStack(err).toLines(excludePkgs...) }
go
func RenderStack(err error, excludePkgs ...string) []string { return renderStack(err).toLines(excludePkgs...) }
[ "func", "RenderStack", "(", "err", "error", ",", "excludePkgs", "...", "string", ")", "[", "]", "string", "{", "return", "renderStack", "(", "err", ")", ".", "toLines", "(", "excludePkgs", "...", ")", "\n", "}" ]
// RenderStack renders the error to a list of lines.
[ "RenderStack", "renders", "the", "error", "to", "a", "list", "of", "lines", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/errors/annotate.go#L437-L439
129,051
luci/luci-go
common/errors/annotate.go
New
func New(msg string, tags ...TagValueGenerator) error { tse := &terminalStackError{ errors.New(msg), stackFrameInfo{forStack: captureStack(1)}, nil} if len(tags) > 0 { tse.tags = make(map[TagKey]interface{}, len(tags)) for _, t := range tags { v := t.GenerateErrorTagValue() tse.tags[v.Key] = v.Value } ...
go
func New(msg string, tags ...TagValueGenerator) error { tse := &terminalStackError{ errors.New(msg), stackFrameInfo{forStack: captureStack(1)}, nil} if len(tags) > 0 { tse.tags = make(map[TagKey]interface{}, len(tags)) for _, t := range tags { v := t.GenerateErrorTagValue() tse.tags[v.Key] = v.Value } ...
[ "func", "New", "(", "msg", "string", ",", "tags", "...", "TagValueGenerator", ")", "error", "{", "tse", ":=", "&", "terminalStackError", "{", "errors", ".", "New", "(", "msg", ")", ",", "stackFrameInfo", "{", "forStack", ":", "captureStack", "(", "1", ")...
// New is an API-compatible version of the standard errors.New function. Unlike // the stdlib errors.New, this will capture the current stack information at the // place this error was created.
[ "New", "is", "an", "API", "-", "compatible", "version", "of", "the", "standard", "errors", ".", "New", "function", ".", "Unlike", "the", "stdlib", "errors", ".", "New", "this", "will", "capture", "the", "current", "stack", "information", "at", "the", "plac...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/errors/annotate.go#L555-L566
129,052
luci/luci-go
starlark/starlarkproto/functions.go
toTextPb
func toTextPb(_ *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { var msg *Message if err := starlark.UnpackArgs("to_textpb", args, kwargs, "msg", &msg); err != nil { return nil, err } pb, err := msg.ToProto() if err != nil { return nil, err } retu...
go
func toTextPb(_ *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { var msg *Message if err := starlark.UnpackArgs("to_textpb", args, kwargs, "msg", &msg); err != nil { return nil, err } pb, err := msg.ToProto() if err != nil { return nil, err } retu...
[ "func", "toTextPb", "(", "_", "*", "starlark", ".", "Thread", ",", "_", "*", "starlark", ".", "Builtin", ",", "args", "starlark", ".", "Tuple", ",", "kwargs", "[", "]", "starlark", ".", "Tuple", ")", "(", "starlark", ".", "Value", ",", "error", ")", ...
// toTextPb takes a single protobuf message and serializes it using text // protobuf serialization.
[ "toTextPb", "takes", "a", "single", "protobuf", "message", "and", "serializes", "it", "using", "text", "protobuf", "serialization", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/starlark/starlarkproto/functions.go#L92-L102
129,053
luci/luci-go
starlark/starlarkproto/functions.go
toJSONPb
func toJSONPb(_ *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { var msg *Message var emitDefaults starlark.Bool if err := starlark.UnpackArgs("to_jsonpb", args, kwargs, "msg", &msg, "emit_defaults?", &emitDefaults); err != nil { return nil, err } pb,...
go
func toJSONPb(_ *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { var msg *Message var emitDefaults starlark.Bool if err := starlark.UnpackArgs("to_jsonpb", args, kwargs, "msg", &msg, "emit_defaults?", &emitDefaults); err != nil { return nil, err } pb,...
[ "func", "toJSONPb", "(", "_", "*", "starlark", ".", "Thread", ",", "_", "*", "starlark", ".", "Builtin", ",", "args", "starlark", ".", "Tuple", ",", "kwargs", "[", "]", "starlark", ".", "Tuple", ")", "(", "starlark", ".", "Value", ",", "error", ")", ...
// toJSONPb takes a single protobuf message and serializes it using JSONPB // serialization.
[ "toJSONPb", "takes", "a", "single", "protobuf", "message", "and", "serializes", "it", "using", "JSONPB", "serialization", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/starlark/starlarkproto/functions.go#L106-L123
129,054
luci/luci-go
milo/buildsource/swarming/buildinfo.go
GetBuildInfo
func (p *BuildInfoProvider) GetBuildInfo(c context.Context, req *milo.BuildInfoRequest_Swarming, projectHint string) (*milo.BuildInfoResponse, error) { // Load the Swarming task (no log content). sf, err := p.newSwarmingService(c, req.Host) if err != nil { logging.WithError(err).Errorf(c, "Failed to create Swarm...
go
func (p *BuildInfoProvider) GetBuildInfo(c context.Context, req *milo.BuildInfoRequest_Swarming, projectHint string) (*milo.BuildInfoResponse, error) { // Load the Swarming task (no log content). sf, err := p.newSwarmingService(c, req.Host) if err != nil { logging.WithError(err).Errorf(c, "Failed to create Swarm...
[ "func", "(", "p", "*", "BuildInfoProvider", ")", "GetBuildInfo", "(", "c", "context", ".", "Context", ",", "req", "*", "milo", ".", "BuildInfoRequest_Swarming", ",", "projectHint", "string", ")", "(", "*", "milo", ".", "BuildInfoResponse", ",", "error", ")",...
// GetBuildInfo resolves a Milo protobuf Step for a given Swarming task.
[ "GetBuildInfo", "resolves", "a", "Milo", "protobuf", "Step", "for", "a", "given", "Swarming", "task", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/swarming/buildinfo.go#L49-L109
129,055
luci/luci-go
milo/buildsource/swarming/buildinfo.go
resolveLogDogAnnotations
func resolveLogDogAnnotations(c context.Context, tagsRaw []string) (*types.StreamAddr, error) { addr, err := resolveLogDogStreamAddrFromTags(swarmingTags(tagsRaw)) if err != nil { logging.WithError(err).Debugf(c, "Could not resolve stream address from tags.") return nil, grpcutil.NotFound } return addr, nil }
go
func resolveLogDogAnnotations(c context.Context, tagsRaw []string) (*types.StreamAddr, error) { addr, err := resolveLogDogStreamAddrFromTags(swarmingTags(tagsRaw)) if err != nil { logging.WithError(err).Debugf(c, "Could not resolve stream address from tags.") return nil, grpcutil.NotFound } return addr, nil }
[ "func", "resolveLogDogAnnotations", "(", "c", "context", ".", "Context", ",", "tagsRaw", "[", "]", "string", ")", "(", "*", "types", ".", "StreamAddr", ",", "error", ")", "{", "addr", ",", "err", ":=", "resolveLogDogStreamAddrFromTags", "(", "swarmingTags", ...
// resolveLogDogAnnotations returns a configured AnnotationStream given the input // parameters. // // This will return a gRPC error on failure.
[ "resolveLogDogAnnotations", "returns", "a", "configured", "AnnotationStream", "given", "the", "input", "parameters", ".", "This", "will", "return", "a", "gRPC", "error", "on", "failure", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/swarming/buildinfo.go#L115-L122
129,056
luci/luci-go
tokenserver/client/x509signer.go
LoadX509Signer
func LoadX509Signer(privateKeyPath, certPath string) (*X509Signer, error) { pkey, err := ioutil.ReadFile(privateKeyPath) if err != nil { return nil, err } cert, err := ioutil.ReadFile(certPath) if err != nil { return nil, err } signer := &X509Signer{ PrivateKeyPEM: pkey, CertificatePEM: cert, } if err...
go
func LoadX509Signer(privateKeyPath, certPath string) (*X509Signer, error) { pkey, err := ioutil.ReadFile(privateKeyPath) if err != nil { return nil, err } cert, err := ioutil.ReadFile(certPath) if err != nil { return nil, err } signer := &X509Signer{ PrivateKeyPEM: pkey, CertificatePEM: cert, } if err...
[ "func", "LoadX509Signer", "(", "privateKeyPath", ",", "certPath", "string", ")", "(", "*", "X509Signer", ",", "error", ")", "{", "pkey", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "privateKeyPath", ")", "\n", "if", "err", "!=", "nil", "{", "return...
// LoadX509Signer parses and validates private key and certificate PEM files. // // Returns X509Signer that is ready for work.
[ "LoadX509Signer", "parses", "and", "validates", "private", "key", "and", "certificate", "PEM", "files", ".", "Returns", "X509Signer", "that", "is", "ready", "for", "work", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/client/x509signer.go#L66-L83
129,057
luci/luci-go
tokenserver/client/x509signer.go
Algo
func (s *X509Signer) Algo(ctx context.Context) (x509.SignatureAlgorithm, error) { if err := s.Validate(); err != nil { return 0, err } return s.algo, nil }
go
func (s *X509Signer) Algo(ctx context.Context) (x509.SignatureAlgorithm, error) { if err := s.Validate(); err != nil { return 0, err } return s.algo, nil }
[ "func", "(", "s", "*", "X509Signer", ")", "Algo", "(", "ctx", "context", ".", "Context", ")", "(", "x509", ".", "SignatureAlgorithm", ",", "error", ")", "{", "if", "err", ":=", "s", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return",...
// Algo returns an algorithm that the signer implements.
[ "Algo", "returns", "an", "algorithm", "that", "the", "signer", "implements", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/client/x509signer.go#L86-L91
129,058
luci/luci-go
tokenserver/client/x509signer.go
Certificate
func (s *X509Signer) Certificate(ctx context.Context) ([]byte, error) { if err := s.Validate(); err != nil { return nil, err } return s.certDer, nil }
go
func (s *X509Signer) Certificate(ctx context.Context) ([]byte, error) { if err := s.Validate(); err != nil { return nil, err } return s.certDer, nil }
[ "func", "(", "s", "*", "X509Signer", ")", "Certificate", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "err", ":=", "s", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ...
// Certificate returns ASN.1 DER blob with the certificate of the signer.
[ "Certificate", "returns", "ASN", ".", "1", "DER", "blob", "with", "the", "certificate", "of", "the", "signer", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/client/x509signer.go#L94-L99
129,059
luci/luci-go
tokenserver/client/x509signer.go
Sign
func (s *X509Signer) Sign(ctx context.Context, blob []byte) ([]byte, error) { if err := s.Validate(); err != nil { return nil, err } var hashFunc crypto.Hash switch s.algo { case x509.SHA256WithRSA: hashFunc = crypto.SHA256 default: panic("someone forgot to implement hashing algo for new kind of a key") }...
go
func (s *X509Signer) Sign(ctx context.Context, blob []byte) ([]byte, error) { if err := s.Validate(); err != nil { return nil, err } var hashFunc crypto.Hash switch s.algo { case x509.SHA256WithRSA: hashFunc = crypto.SHA256 default: panic("someone forgot to implement hashing algo for new kind of a key") }...
[ "func", "(", "s", "*", "X509Signer", ")", "Sign", "(", "ctx", "context", ".", "Context", ",", "blob", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "err", ":=", "s", ".", "Validate", "(", ")", ";", "err", "!=", "...
// Sign signs a blob using the private key.
[ "Sign", "signs", "a", "blob", "using", "the", "private", "key", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/client/x509signer.go#L102-L120
129,060
luci/luci-go
tokenserver/client/x509signer.go
Validate
func (s *X509Signer) Validate() error { s.init.Do(func() { s.err = s.initialize() }) return s.err }
go
func (s *X509Signer) Validate() error { s.init.Do(func() { s.err = s.initialize() }) return s.err }
[ "func", "(", "s", "*", "X509Signer", ")", "Validate", "(", ")", "error", "{", "s", ".", "init", ".", "Do", "(", "func", "(", ")", "{", "s", ".", "err", "=", "s", ".", "initialize", "(", ")", "\n", "}", ")", "\n", "return", "s", ".", "err", ...
// Validate parses the private key and certificate file and verifies them. // // It checks that the public portion of the key matches what's in the // certificate.
[ "Validate", "parses", "the", "private", "key", "and", "certificate", "file", "and", "verifies", "them", ".", "It", "checks", "that", "the", "public", "portion", "of", "the", "key", "matches", "what", "s", "in", "the", "certificate", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/client/x509signer.go#L126-L131
129,061
luci/luci-go
milo/buildsource/buildbucket/pubsub.go
getSummary
func getSummary(c context.Context, host string, project string, id int64) (*model.BuildSummary, error) { client, err := buildbucketClient(c, host, auth.AsProject, auth.WithProject(project)) if err != nil { return nil, err } b, err := client.GetBuild(c, &buildbucketpb.GetBuildRequest{ Id: id, Fields: summa...
go
func getSummary(c context.Context, host string, project string, id int64) (*model.BuildSummary, error) { client, err := buildbucketClient(c, host, auth.AsProject, auth.WithProject(project)) if err != nil { return nil, err } b, err := client.GetBuild(c, &buildbucketpb.GetBuildRequest{ Id: id, Fields: summa...
[ "func", "getSummary", "(", "c", "context", ".", "Context", ",", "host", "string", ",", "project", "string", ",", "id", "int64", ")", "(", "*", "model", ".", "BuildSummary", ",", "error", ")", "{", "client", ",", "err", ":=", "buildbucketClient", "(", "...
// getSummary returns a model.BuildSummary representing a buildbucket build.
[ "getSummary", "returns", "a", "model", ".", "BuildSummary", "representing", "a", "buildbucket", "build", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/buildbucket/pubsub.go#L104-L148
129,062
luci/luci-go
milo/buildsource/buildbucket/pubsub.go
pubSubHandlerImpl
func pubSubHandlerImpl(c context.Context, r *http.Request) error { // This is the default action. The code below will modify the values of some // or all of these parameters. isLUCI, bucket, status, action := false, "UNKNOWN", "UNKNOWN", "Rejected" defer func() { // closure for late binding buildCounter.Add(c,...
go
func pubSubHandlerImpl(c context.Context, r *http.Request) error { // This is the default action. The code below will modify the values of some // or all of these parameters. isLUCI, bucket, status, action := false, "UNKNOWN", "UNKNOWN", "Rejected" defer func() { // closure for late binding buildCounter.Add(c,...
[ "func", "pubSubHandlerImpl", "(", "c", "context", ".", "Context", ",", "r", "*", "http", ".", "Request", ")", "error", "{", "// This is the default action. The code below will modify the values of some", "// or all of these parameters.", "isLUCI", ",", "bucket", ",", "sta...
// pubSubHandlerImpl takes the http.Request, expects to find // a common.PubSubSubscription JSON object in the Body, containing a bbPSEvent, // and handles the contents with generateSummary.
[ "pubSubHandlerImpl", "takes", "the", "http", ".", "Request", "expects", "to", "find", "a", "common", ".", "PubSubSubscription", "JSON", "object", "in", "the", "Body", "containing", "a", "bbPSEvent", "and", "handles", "the", "contents", "with", "generateSummary", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/buildbucket/pubsub.go#L153-L237
129,063
luci/luci-go
milo/buildsource/buildbucket/pubsub.go
MakeBuildKey
func MakeBuildKey(c context.Context, host, buildAddress string) *datastore.Key { return datastore.MakeKey(c, "buildbucket.Build", fmt.Sprintf("%s:%s", host, buildAddress)) }
go
func MakeBuildKey(c context.Context, host, buildAddress string) *datastore.Key { return datastore.MakeKey(c, "buildbucket.Build", fmt.Sprintf("%s:%s", host, buildAddress)) }
[ "func", "MakeBuildKey", "(", "c", "context", ".", "Context", ",", "host", ",", "buildAddress", "string", ")", "*", "datastore", ".", "Key", "{", "return", "datastore", ".", "MakeKey", "(", "c", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", ...
// MakeBuildKey returns a new datastore Key for a buildbucket.Build. // // There's currently no model associated with this key, but it's used as // a parent for a model.BuildSummary.
[ "MakeBuildKey", "returns", "a", "new", "datastore", "Key", "for", "a", "buildbucket", ".", "Build", ".", "There", "s", "currently", "no", "model", "associated", "with", "this", "key", "but", "it", "s", "used", "as", "a", "parent", "for", "a", "model", "....
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/buildbucket/pubsub.go#L243-L246
129,064
luci/luci-go
logdog/appengine/coordinator/context.go
WithConfigProvider
func WithConfigProvider(c context.Context, s ConfigProvider) context.Context { return context.WithValue(c, &configProviderKey, s) }
go
func WithConfigProvider(c context.Context, s ConfigProvider) context.Context { return context.WithValue(c, &configProviderKey, s) }
[ "func", "WithConfigProvider", "(", "c", "context", ".", "Context", ",", "s", "ConfigProvider", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "c", ",", "&", "configProviderKey", ",", "s", ")", "\n", "}" ]
// WithConfigProvider installs the supplied ConfigProvider instance into a // Context.
[ "WithConfigProvider", "installs", "the", "supplied", "ConfigProvider", "instance", "into", "a", "Context", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/appengine/coordinator/context.go#L66-L68
129,065
luci/luci-go
logdog/appengine/coordinator/context.go
Project
func Project(c context.Context) types.ProjectName { ns := info.GetNamespace(c) project := ProjectFromNamespace(ns) if project != "" { return project } panic(fmt.Errorf("current namespace %q does not begin with project namespace prefix (%q)", ns, ProjectNamespacePrefix)) }
go
func Project(c context.Context) types.ProjectName { ns := info.GetNamespace(c) project := ProjectFromNamespace(ns) if project != "" { return project } panic(fmt.Errorf("current namespace %q does not begin with project namespace prefix (%q)", ns, ProjectNamespacePrefix)) }
[ "func", "Project", "(", "c", "context", ".", "Context", ")", "types", ".", "ProjectName", "{", "ns", ":=", "info", ".", "GetNamespace", "(", "c", ")", "\n", "project", ":=", "ProjectFromNamespace", "(", "ns", ")", "\n", "if", "project", "!=", "\"", "\"...
// Project returns the current project installed in the supplied Context's // namespace. // // This function is called with the expectation that the Context is in a // namespace conforming to ProjectNamespace. If this is not the case, this // method will panic.
[ "Project", "returns", "the", "current", "project", "installed", "in", "the", "supplied", "Context", "s", "namespace", ".", "This", "function", "is", "called", "with", "the", "expectation", "that", "the", "Context", "is", "in", "a", "namespace", "conforming", "...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/appengine/coordinator/context.go#L237-L244
129,066
luci/luci-go
logdog/client/annotee/executor/executor.go
Run
func (e *Executor) Run(ctx context.Context, command []string) error { // Clear any previous state. e.executed = false e.returnCode = 0 e.step = nil if len(command) == 0 { return errors.New("no command") } ctx, cancelFunc := context.WithCancel(ctx) cmd := exec.CommandContext(ctx, command[0], command[1:]...) ...
go
func (e *Executor) Run(ctx context.Context, command []string) error { // Clear any previous state. e.executed = false e.returnCode = 0 e.step = nil if len(command) == 0 { return errors.New("no command") } ctx, cancelFunc := context.WithCancel(ctx) cmd := exec.CommandContext(ctx, command[0], command[1:]...) ...
[ "func", "(", "e", "*", "Executor", ")", "Run", "(", "ctx", "context", ".", "Context", ",", "command", "[", "]", "string", ")", "error", "{", "// Clear any previous state.", "e", ".", "executed", "=", "false", "\n", "e", ".", "returnCode", "=", "0", "\n...
// Run executes the bootstrapped process, blocking until it completes.
[ "Run", "executes", "the", "bootstrapped", "process", "blocking", "until", "it", "completes", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/client/annotee/executor/executor.go#L57-L136
129,067
luci/luci-go
common/errors/wrap.go
Unwrap
func Unwrap(err error) error { for { wrap, ok := err.(Wrapped) if !ok { return err } inner := wrap.InnerError() if inner == nil { break } err = inner } return err }
go
func Unwrap(err error) error { for { wrap, ok := err.(Wrapped) if !ok { return err } inner := wrap.InnerError() if inner == nil { break } err = inner } return err }
[ "func", "Unwrap", "(", "err", "error", ")", "error", "{", "for", "{", "wrap", ",", "ok", ":=", "err", ".", "(", "Wrapped", ")", "\n", "if", "!", "ok", "{", "return", "err", "\n", "}", "\n\n", "inner", ":=", "wrap", ".", "InnerError", "(", ")", ...
// Unwrap unwraps a wrapped error recursively, returning its inner error. // // If the supplied error is not nil, Unwrap will never return nil. If a // wrapped error reports that its InnerError is nil, that error will be // returned.
[ "Unwrap", "unwraps", "a", "wrapped", "error", "recursively", "returning", "its", "inner", "error", ".", "If", "the", "supplied", "error", "is", "not", "nil", "Unwrap", "will", "never", "return", "nil", ".", "If", "a", "wrapped", "error", "reports", "that", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/errors/wrap.go#L28-L42
129,068
luci/luci-go
machine-db/appengine/database/database.go
getDatabaseConnection
func getDatabaseConnection(c context.Context) (*sql.DB, error) { // Update the database pointer if the database settings have changed. This operation is costly, but should be rare. // Done here to ensure that a connection established with an outdated connection string is closed as soon as possible. settings, err := ...
go
func getDatabaseConnection(c context.Context) (*sql.DB, error) { // Update the database pointer if the database settings have changed. This operation is costly, but should be rare. // Done here to ensure that a connection established with an outdated connection string is closed as soon as possible. settings, err := ...
[ "func", "getDatabaseConnection", "(", "c", "context", ".", "Context", ")", "(", "*", "sql", ".", "DB", ",", "error", ")", "{", "// Update the database pointer if the database settings have changed. This operation is costly, but should be rare.", "// Done here to ensure that a con...
// getDatabaseConnection returns a pointer to the open database connection, creating it if necessary.
[ "getDatabaseConnection", "returns", "a", "pointer", "to", "the", "open", "database", "connection", "creating", "it", "if", "necessary", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/database/database.go#L51-L92
129,069
luci/luci-go
machine-db/appengine/database/database.go
Begin
func Begin(c context.Context) (*RollbackTx, error) { tx, err := Get(c).BeginTx(c, nil) return &RollbackTx{Tx: tx}, err }
go
func Begin(c context.Context) (*RollbackTx, error) { tx, err := Get(c).BeginTx(c, nil) return &RollbackTx{Tx: tx}, err }
[ "func", "Begin", "(", "c", "context", ".", "Context", ")", "(", "*", "RollbackTx", ",", "error", ")", "{", "tx", ",", "err", ":=", "Get", "(", "c", ")", ".", "BeginTx", "(", "c", ",", "nil", ")", "\n", "return", "&", "RollbackTx", "{", "Tx", ":...
// Begin begins a transaction using the database pointer embedded in the current context.
[ "Begin", "begins", "a", "transaction", "using", "the", "database", "pointer", "embedded", "in", "the", "current", "context", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/database/database.go#L95-L98
129,070
luci/luci-go
machine-db/appengine/database/database.go
Get
func Get(c context.Context) *sql.DB { return c.Value(&dbKey).(*sql.DB) }
go
func Get(c context.Context) *sql.DB { return c.Value(&dbKey).(*sql.DB) }
[ "func", "Get", "(", "c", "context", ".", "Context", ")", "*", "sql", ".", "DB", "{", "return", "c", ".", "Value", "(", "&", "dbKey", ")", ".", "(", "*", "sql", ".", "DB", ")", "\n", "}" ]
// Get returns the database pointer embedded in the current context. // The database pointer can be embedded in the current context using With.
[ "Get", "returns", "the", "database", "pointer", "embedded", "in", "the", "current", "context", ".", "The", "database", "pointer", "can", "be", "embedded", "in", "the", "current", "context", "using", "With", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/database/database.go#L102-L104
129,071
luci/luci-go
machine-db/appengine/database/database.go
With
func With(c context.Context, database *sql.DB) context.Context { return context.WithValue(c, &dbKey, database) }
go
func With(c context.Context, database *sql.DB) context.Context { return context.WithValue(c, &dbKey, database) }
[ "func", "With", "(", "c", "context", ".", "Context", ",", "database", "*", "sql", ".", "DB", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "c", ",", "&", "dbKey", ",", "database", ")", "\n", "}" ]
// With installs a database pointer into the given context. // It can be retrieved later using Get.
[ "With", "installs", "a", "database", "pointer", "into", "the", "given", "context", ".", "It", "can", "be", "retrieved", "later", "using", "Get", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/database/database.go#L108-L110
129,072
luci/luci-go
machine-db/appengine/database/database.go
WithMiddleware
func WithMiddleware(c *router.Context, next router.Handler) { database, err := getDatabaseConnection(c.Context) if err != nil { logging.Errorf(c.Context, "Failed to retrieve a database connection: %s", err.Error()) c.Writer.Header().Set("Content-Type", "text/plain") c.Writer.WriteHeader(http.StatusInternalServe...
go
func WithMiddleware(c *router.Context, next router.Handler) { database, err := getDatabaseConnection(c.Context) if err != nil { logging.Errorf(c.Context, "Failed to retrieve a database connection: %s", err.Error()) c.Writer.Header().Set("Content-Type", "text/plain") c.Writer.WriteHeader(http.StatusInternalServe...
[ "func", "WithMiddleware", "(", "c", "*", "router", ".", "Context", ",", "next", "router", ".", "Handler", ")", "{", "database", ",", "err", ":=", "getDatabaseConnection", "(", "c", ".", "Context", ")", "\n", "if", "err", "!=", "nil", "{", "logging", "....
// WithMiddleware is middleware which installs a database pointer into the given context. // It can be retrieved later in the middleware chain using Get.
[ "WithMiddleware", "is", "middleware", "which", "installs", "a", "database", "pointer", "into", "the", "given", "context", ".", "It", "can", "be", "retrieved", "later", "in", "the", "middleware", "chain", "using", "Get", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/database/database.go#L114-L124
129,073
luci/luci-go
buildbucket/luciexe/main.go
RunnerMain
func RunnerMain(args []string) int { if err := mainErr(args); err != nil { fmt.Fprintln(os.Stderr, err) return 1 } return 0 }
go
func RunnerMain(args []string) int { if err := mainErr(args); err != nil { fmt.Fprintln(os.Stderr, err) return 1 } return 0 }
[ "func", "RunnerMain", "(", "args", "[", "]", "string", ")", "int", "{", "if", "err", ":=", "mainErr", "(", "args", ")", ";", "err", "!=", "nil", "{", "fmt", ".", "Fprintln", "(", "os", ".", "Stderr", ",", "err", ")", "\n", "return", "1", "\n", ...
// RunnerMain runs LUCI runner, a program that runs a LUCI executable.
[ "RunnerMain", "runs", "LUCI", "runner", "a", "program", "that", "runs", "a", "LUCI", "executable", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/luciexe/main.go#L77-L83
129,074
luci/luci-go
milo/buildsource/rawpresentation/build.go
Normalize
func (as *AnnotationStream) Normalize() error { if err := as.Project.Validate(); err != nil { return errors.Annotate(err, "Invalid project name: %s", as.Project).Tag(grpcutil.InvalidArgumentTag).Err() } if err := as.Path.Validate(); err != nil { return errors.Annotate(err, "Invalid log stream path %q", as.Path)...
go
func (as *AnnotationStream) Normalize() error { if err := as.Project.Validate(); err != nil { return errors.Annotate(err, "Invalid project name: %s", as.Project).Tag(grpcutil.InvalidArgumentTag).Err() } if err := as.Path.Validate(); err != nil { return errors.Annotate(err, "Invalid log stream path %q", as.Path)...
[ "func", "(", "as", "*", "AnnotationStream", ")", "Normalize", "(", ")", "error", "{", "if", "err", ":=", "as", ".", "Project", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "errors", ".", "Annotate", "(", "err", ",", "\"", "\""...
// Normalize validates and normalizes the stream's parameters.
[ "Normalize", "validates", "and", "normalizes", "the", "stream", "s", "parameters", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/rawpresentation/build.go#L62-L72
129,075
luci/luci-go
milo/buildsource/rawpresentation/build.go
Fetch
func (as *AnnotationStream) Fetch(c context.Context) (*miloProto.Step, error) { // Cached? if as.cs.Step != nil { return as.cs.Step, nil } // Load from LogDog directly. log.Fields{ "host": as.Client.Host, "project": as.Project, "path": as.Path, }.Infof(c, "Making tail request to LogDog to fetch ann...
go
func (as *AnnotationStream) Fetch(c context.Context) (*miloProto.Step, error) { // Cached? if as.cs.Step != nil { return as.cs.Step, nil } // Load from LogDog directly. log.Fields{ "host": as.Client.Host, "project": as.Project, "path": as.Path, }.Infof(c, "Making tail request to LogDog to fetch ann...
[ "func", "(", "as", "*", "AnnotationStream", ")", "Fetch", "(", "c", "context", ".", "Context", ")", "(", "*", "miloProto", ".", "Step", ",", "error", ")", "{", "// Cached?", "if", "as", ".", "cs", ".", "Step", "!=", "nil", "{", "return", "as", ".",...
// Fetch loads the annotation stream from LogDog. // // If the stream does not exist, or is invalid, Fetch will return a Milo error. // Otherwise, it will return the Step that was loaded. // // Fetch caches the step, so multiple calls to Fetch will return the same Step // value.
[ "Fetch", "loads", "the", "annotation", "stream", "from", "LogDog", ".", "If", "the", "stream", "does", "not", "exist", "or", "is", "invalid", "Fetch", "will", "return", "a", "Milo", "error", ".", "Otherwise", "it", "will", "return", "the", "Step", "that", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/rawpresentation/build.go#L85-L164
129,076
luci/luci-go
milo/buildsource/rawpresentation/build.go
NewURLBuilder
func NewURLBuilder(addr *types.StreamAddr) *ViewerURLBuilder { prefix, _ := addr.Path.Split() return &ViewerURLBuilder{ Host: addr.Host, Prefix: prefix, Project: addr.Project, } }
go
func NewURLBuilder(addr *types.StreamAddr) *ViewerURLBuilder { prefix, _ := addr.Path.Split() return &ViewerURLBuilder{ Host: addr.Host, Prefix: prefix, Project: addr.Project, } }
[ "func", "NewURLBuilder", "(", "addr", "*", "types", ".", "StreamAddr", ")", "*", "ViewerURLBuilder", "{", "prefix", ",", "_", ":=", "addr", ".", "Path", ".", "Split", "(", ")", "\n", "return", "&", "ViewerURLBuilder", "{", "Host", ":", "addr", ".", "Ho...
// NewURLBuilder creates a new URLBuilder that can generate links to LogDog // pages given a LogDog StreamAddr.
[ "NewURLBuilder", "creates", "a", "new", "URLBuilder", "that", "can", "generate", "links", "to", "LogDog", "pages", "given", "a", "LogDog", "StreamAddr", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/rawpresentation/build.go#L202-L209
129,077
luci/luci-go
milo/buildsource/rawpresentation/build.go
BuildLink
func (b *ViewerURLBuilder) BuildLink(l *miloProto.Link) *ui.Link { switch t := l.Value.(type) { case *miloProto.Link_LogdogStream: ls := t.LogdogStream server := ls.Server if server == "" { server = b.Host } prefix := types.StreamName(ls.Prefix) if prefix == "" { prefix = b.Prefix } u := view...
go
func (b *ViewerURLBuilder) BuildLink(l *miloProto.Link) *ui.Link { switch t := l.Value.(type) { case *miloProto.Link_LogdogStream: ls := t.LogdogStream server := ls.Server if server == "" { server = b.Host } prefix := types.StreamName(ls.Prefix) if prefix == "" { prefix = b.Prefix } u := view...
[ "func", "(", "b", "*", "ViewerURLBuilder", ")", "BuildLink", "(", "l", "*", "miloProto", ".", "Link", ")", "*", "ui", ".", "Link", "{", "switch", "t", ":=", "l", ".", "Value", ".", "(", "type", ")", "{", "case", "*", "miloProto", ".", "Link_LogdogS...
// BuildLink implements URLBuilder.
[ "BuildLink", "implements", "URLBuilder", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/rawpresentation/build.go#L212-L245
129,078
luci/luci-go
milo/buildsource/rawpresentation/build.go
GetBuild
func GetBuild(c context.Context, host string, project types.ProjectName, path types.StreamPath) (*ui.MiloBuildLegacy, error) { as := AnnotationStream{ Project: project, Path: path, } if err := as.Normalize(); err != nil { return nil, err } // Setup our LogDog client. var err error if as.Client, err = N...
go
func GetBuild(c context.Context, host string, project types.ProjectName, path types.StreamPath) (*ui.MiloBuildLegacy, error) { as := AnnotationStream{ Project: project, Path: path, } if err := as.Normalize(); err != nil { return nil, err } // Setup our LogDog client. var err error if as.Client, err = N...
[ "func", "GetBuild", "(", "c", "context", ".", "Context", ",", "host", "string", ",", "project", "types", ".", "ProjectName", ",", "path", "types", ".", "StreamPath", ")", "(", "*", "ui", ".", "MiloBuildLegacy", ",", "error", ")", "{", "as", ":=", "Anno...
// GetBuild returns a build from a raw annotation stream.
[ "GetBuild", "returns", "a", "build", "from", "a", "raw", "annotation", "stream", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/rawpresentation/build.go#L248-L282
129,079
luci/luci-go
milo/buildsource/rawpresentation/build.go
ReadAnnotations
func ReadAnnotations(c context.Context, addr *types.StreamAddr) (*miloProto.Step, error) { log.Infof(c, "Loading build from LogDog stream at: %s", addr) client, err := NewClient(c, addr.Host) if err != nil { return nil, errors.Annotate(err, "failed to create LogDog client").Err() } as := AnnotationStream{ Cl...
go
func ReadAnnotations(c context.Context, addr *types.StreamAddr) (*miloProto.Step, error) { log.Infof(c, "Loading build from LogDog stream at: %s", addr) client, err := NewClient(c, addr.Host) if err != nil { return nil, errors.Annotate(err, "failed to create LogDog client").Err() } as := AnnotationStream{ Cl...
[ "func", "ReadAnnotations", "(", "c", "context", ".", "Context", ",", "addr", "*", "types", ".", "StreamAddr", ")", "(", "*", "miloProto", ".", "Step", ",", "error", ")", "{", "log", ".", "Infof", "(", "c", ",", "\"", "\"", ",", "addr", ")", "\n\n",...
// ReadAnnotations synchronously reads and decodes the latest Step information // from the provided StreamAddr.
[ "ReadAnnotations", "synchronously", "reads", "and", "decodes", "the", "latest", "Step", "information", "from", "the", "provided", "StreamAddr", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/rawpresentation/build.go#L286-L304
129,080
luci/luci-go
common/runtime/tracer/tracer.go
Stop
func Stop() { // Wait for on-going traces. globals.wg.Wait() globals.lockWriter.Lock() defer globals.lockWriter.Unlock() globals.lockContexts.Lock() defer globals.lockContexts.Unlock() if globals.out != nil { // TODO(maruel): Dump all the stack frames. _, _ = globals.out.Write(footerEvents) } globals.lockI...
go
func Stop() { // Wait for on-going traces. globals.wg.Wait() globals.lockWriter.Lock() defer globals.lockWriter.Unlock() globals.lockContexts.Lock() defer globals.lockContexts.Unlock() if globals.out != nil { // TODO(maruel): Dump all the stack frames. _, _ = globals.out.Write(footerEvents) } globals.lockI...
[ "func", "Stop", "(", ")", "{", "// Wait for on-going traces.", "globals", ".", "wg", ".", "Wait", "(", ")", "\n", "globals", ".", "lockWriter", ".", "Lock", "(", ")", "\n", "defer", "globals", ".", "lockWriter", ".", "Unlock", "(", ")", "\n", "globals", ...
// Stop stops the trace. // // It is important to call it so the trace file is properly formatted. Tracing // events after this call are ignored.
[ "Stop", "stops", "the", "trace", ".", "It", "is", "important", "to", "call", "it", "so", "the", "trace", "file", "is", "properly", "formatted", ".", "Tracing", "events", "after", "this", "call", "are", "ignored", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/runtime/tracer/tracer.go#L116-L136
129,081
luci/luci-go
common/runtime/tracer/tracer.go
Span
func Span(marker interface{}, name string, args Args) func(args Args) { c := getContext(marker) if c == nil { return dummy } tsStart := time.Since(consts.start) return func(argsEnd Args) { tsEnd := time.Since(consts.start) if tsEnd == tsStart { // Make sure a duration event lasts at least one nanosecond. ...
go
func Span(marker interface{}, name string, args Args) func(args Args) { c := getContext(marker) if c == nil { return dummy } tsStart := time.Since(consts.start) return func(argsEnd Args) { tsEnd := time.Since(consts.start) if tsEnd == tsStart { // Make sure a duration event lasts at least one nanosecond. ...
[ "func", "Span", "(", "marker", "interface", "{", "}", ",", "name", "string", ",", "args", "Args", ")", "func", "(", "args", "Args", ")", "{", "c", ":=", "getContext", "(", "marker", ")", "\n", "if", "c", "==", "nil", "{", "return", "dummy", "\n", ...
// Span defines an event with a duration. // // The caller MUST call the returned callback to 'close' the event. The // callback doesn't need to be called from the same goroutine as the initial // caller.
[ "Span", "defines", "an", "event", "with", "a", "duration", ".", "The", "caller", "MUST", "call", "the", "returned", "callback", "to", "close", "the", "event", ".", "The", "callback", "doesn", "t", "need", "to", "be", "called", "from", "the", "same", "gor...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/runtime/tracer/tracer.go#L143-L186
129,082
luci/luci-go
common/runtime/tracer/tracer.go
Instant
func Instant(marker interface{}, name string, s Scope, args Args) { if c := getContext(marker); c != nil { if args == nil { args = consts.fakeArgs } // getID() is a locking call. c.emit(&event{ Type: eventNestableInstant, Category: "ignored", Name: name, Scope: s, Args: args, ...
go
func Instant(marker interface{}, name string, s Scope, args Args) { if c := getContext(marker); c != nil { if args == nil { args = consts.fakeArgs } // getID() is a locking call. c.emit(&event{ Type: eventNestableInstant, Category: "ignored", Name: name, Scope: s, Args: args, ...
[ "func", "Instant", "(", "marker", "interface", "{", "}", ",", "name", "string", ",", "s", "Scope", ",", "args", "Args", ")", "{", "if", "c", ":=", "getContext", "(", "marker", ")", ";", "c", "!=", "nil", "{", "if", "args", "==", "nil", "{", "args...
// Instant registers an intantaneous event that has no duration.
[ "Instant", "registers", "an", "intantaneous", "event", "that", "has", "no", "duration", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/runtime/tracer/tracer.go#L189-L204
129,083
luci/luci-go
common/runtime/tracer/tracer.go
CounterSet
func CounterSet(marker interface{}, name string, value float64) { if c := getContext(marker); c != nil { // Sets ID so operations can be ordered. c.lock.Lock() c.counters[name] = value c.lock.Unlock() c.emit(&event{ Type: eventCounter, Name: name, Args: Args{"value": value}, ID: getID(), }) ...
go
func CounterSet(marker interface{}, name string, value float64) { if c := getContext(marker); c != nil { // Sets ID so operations can be ordered. c.lock.Lock() c.counters[name] = value c.lock.Unlock() c.emit(&event{ Type: eventCounter, Name: name, Args: Args{"value": value}, ID: getID(), }) ...
[ "func", "CounterSet", "(", "marker", "interface", "{", "}", ",", "name", "string", ",", "value", "float64", ")", "{", "if", "c", ":=", "getContext", "(", "marker", ")", ";", "c", "!=", "nil", "{", "// Sets ID so operations can be ordered.", "c", ".", "lock...
// CounterSet registers a new value for a counter. // // The values will be grouped inside the PID and each name displayed as a // separate line.
[ "CounterSet", "registers", "a", "new", "value", "for", "a", "counter", ".", "The", "values", "will", "be", "grouped", "inside", "the", "PID", "and", "each", "name", "displayed", "as", "a", "separate", "line", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/runtime/tracer/tracer.go#L210-L223
129,084
luci/luci-go
common/runtime/tracer/tracer.go
NewPID
func NewPID(marker interface{}, pname string) { globals.lockContexts.Lock() defer globals.lockContexts.Unlock() if globals.contexts == nil { return } newPID := globals.nextPID globals.nextPID++ c := &context{pid: newPID, counters: map[string]float64{}} globals.contexts[marker] = c if pname != "" { c.metada...
go
func NewPID(marker interface{}, pname string) { globals.lockContexts.Lock() defer globals.lockContexts.Unlock() if globals.contexts == nil { return } newPID := globals.nextPID globals.nextPID++ c := &context{pid: newPID, counters: map[string]float64{}} globals.contexts[marker] = c if pname != "" { c.metada...
[ "func", "NewPID", "(", "marker", "interface", "{", "}", ",", "pname", "string", ")", "{", "globals", ".", "lockContexts", ".", "Lock", "(", ")", "\n", "defer", "globals", ".", "lockContexts", ".", "Unlock", "(", ")", "\n", "if", "globals", ".", "contex...
// NewPID assigns a pseudo-process ID for this marker and TID 1. // // Optionally assigns name to the 'process'. The main use is to create a // logical group for events.
[ "NewPID", "assigns", "a", "pseudo", "-", "process", "ID", "for", "this", "marker", "and", "TID", "1", ".", "Optionally", "assigns", "name", "to", "the", "process", ".", "The", "main", "use", "is", "to", "create", "a", "logical", "group", "for", "events",...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/runtime/tracer/tracer.go#L249-L262
129,085
luci/luci-go
common/runtime/tracer/tracer.go
Discard
func Discard(marker interface{}) { globals.lockContexts.Lock() defer globals.lockContexts.Unlock() delete(globals.contexts, marker) }
go
func Discard(marker interface{}) { globals.lockContexts.Lock() defer globals.lockContexts.Unlock() delete(globals.contexts, marker) }
[ "func", "Discard", "(", "marker", "interface", "{", "}", ")", "{", "globals", ".", "lockContexts", ".", "Lock", "(", ")", "\n", "defer", "globals", ".", "lockContexts", ".", "Unlock", "(", ")", "\n", "delete", "(", "globals", ".", "contexts", ",", "mar...
// Discard forgets a context association created with NewPID. // // If not called, contexts accumulates and form a memory leak.
[ "Discard", "forgets", "a", "context", "association", "created", "with", "NewPID", ".", "If", "not", "called", "contexts", "accumulates", "and", "form", "a", "memory", "leak", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/runtime/tracer/tracer.go#L267-L271
129,086
luci/luci-go
common/runtime/tracer/tracer.go
emit
func (c *context) emit(e *event) { if e.Timestamp == 0 { e.Timestamp = fromDuration(time.Since(consts.start)) } // sync.WaitGroup.Add() use atomic.AddUint64(). globals.wg.Add(1) go func() { defer globals.wg.Done() e.Pid = c.pid e.Tid = 1 // Locking is done in a goroutine to not create implicit synchroniz...
go
func (c *context) emit(e *event) { if e.Timestamp == 0 { e.Timestamp = fromDuration(time.Since(consts.start)) } // sync.WaitGroup.Add() use atomic.AddUint64(). globals.wg.Add(1) go func() { defer globals.wg.Done() e.Pid = c.pid e.Tid = 1 // Locking is done in a goroutine to not create implicit synchroniz...
[ "func", "(", "c", "*", "context", ")", "emit", "(", "e", "*", "event", ")", "{", "if", "e", ".", "Timestamp", "==", "0", "{", "e", ".", "Timestamp", "=", "fromDuration", "(", "time", ".", "Since", "(", "consts", ".", "start", ")", ")", "\n", "}...
// emit asynchronously emits a trace event.
[ "emit", "asynchronously", "emits", "a", "trace", "event", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/runtime/tracer/tracer.go#L456-L487
129,087
luci/luci-go
common/runtime/tracer/tracer.go
metadata
func (c *context) metadata(m metadataType, args Args) { c.emit(&event{Type: eventMetadata, Name: string(m), Args: args}) }
go
func (c *context) metadata(m metadataType, args Args) { c.emit(&event{Type: eventMetadata, Name: string(m), Args: args}) }
[ "func", "(", "c", "*", "context", ")", "metadata", "(", "m", "metadataType", ",", "args", "Args", ")", "{", "c", ".", "emit", "(", "&", "event", "{", "Type", ":", "eventMetadata", ",", "Name", ":", "string", "(", "m", ")", ",", "Args", ":", "args...
// metadata registers metadata in the trace. For example putting a name on the // current pseudo process id or pseudo thread id.
[ "metadata", "registers", "metadata", "in", "the", "trace", ".", "For", "example", "putting", "a", "name", "on", "the", "current", "pseudo", "process", "id", "or", "pseudo", "thread", "id", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/runtime/tracer/tracer.go#L491-L493
129,088
luci/luci-go
vpython/python/find.go
Find
func Find(c context.Context, vers Version, lookPath LookPathFunc) (*Interpreter, error) { // pythonM.m, pythonM, python searches := make([]string, 0, 3) pv := vers pv.Patch = 0 if pv.Minor > 0 { searches = append(searches, pv.PythonBase()) pv.Minor = 0 } if pv.Major > 0 { searches = append(searches, pv.Pyt...
go
func Find(c context.Context, vers Version, lookPath LookPathFunc) (*Interpreter, error) { // pythonM.m, pythonM, python searches := make([]string, 0, 3) pv := vers pv.Patch = 0 if pv.Minor > 0 { searches = append(searches, pv.PythonBase()) pv.Minor = 0 } if pv.Major > 0 { searches = append(searches, pv.Pyt...
[ "func", "Find", "(", "c", "context", ".", "Context", ",", "vers", "Version", ",", "lookPath", "LookPathFunc", ")", "(", "*", "Interpreter", ",", "error", ")", "{", "// pythonM.m, pythonM, python", "searches", ":=", "make", "(", "[", "]", "string", ",", "0"...
// Find attempts to find a Python interpreter matching the supplied version // using PATH. // // In order to accommodate multiple configurations on operating systems, Find // will attempt to identify versions that appear on the path
[ "Find", "attempts", "to", "find", "a", "Python", "interpreter", "matching", "the", "supplied", "version", "using", "PATH", ".", "In", "order", "to", "accommodate", "multiple", "configurations", "on", "operating", "systems", "Find", "will", "attempt", "to", "iden...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/vpython/python/find.go#L61-L94
129,089
luci/luci-go
lucicfg/meta.go
Log
func (m *Meta) Log(ctx context.Context) { logging.Debugf(ctx, "Meta config:") logging.Debugf(ctx, " config_service_host = %q", m.ConfigServiceHost) logging.Debugf(ctx, " config_dir = %q", m.ConfigDir) logging.Debugf(ctx, " tracked_files = %v", m.TrackedFiles) logging.Debugf(ctx, " fail_on_warnings = %v", m.Fai...
go
func (m *Meta) Log(ctx context.Context) { logging.Debugf(ctx, "Meta config:") logging.Debugf(ctx, " config_service_host = %q", m.ConfigServiceHost) logging.Debugf(ctx, " config_dir = %q", m.ConfigDir) logging.Debugf(ctx, " tracked_files = %v", m.TrackedFiles) logging.Debugf(ctx, " fail_on_warnings = %v", m.Fai...
[ "func", "(", "m", "*", "Meta", ")", "Log", "(", "ctx", "context", ".", "Context", ")", "{", "logging", ".", "Debugf", "(", "ctx", ",", "\"", "\"", ")", "\n", "logging", ".", "Debugf", "(", "ctx", ",", "\"", "\"", ",", "m", ".", "ConfigServiceHost...
// Log logs the values of the meta parameters to Debug logger.
[ "Log", "logs", "the", "values", "of", "the", "meta", "parameters", "to", "Debug", "logger", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/meta.go#L52-L58
129,090
luci/luci-go
lucicfg/meta.go
RebaseConfigDir
func (m *Meta) RebaseConfigDir(root string) { if m.ConfigDir != "" && m.ConfigDir != "-" { m.ConfigDir = filepath.Join(root, filepath.FromSlash(m.ConfigDir)) } }
go
func (m *Meta) RebaseConfigDir(root string) { if m.ConfigDir != "" && m.ConfigDir != "-" { m.ConfigDir = filepath.Join(root, filepath.FromSlash(m.ConfigDir)) } }
[ "func", "(", "m", "*", "Meta", ")", "RebaseConfigDir", "(", "root", "string", ")", "{", "if", "m", ".", "ConfigDir", "!=", "\"", "\"", "&&", "m", ".", "ConfigDir", "!=", "\"", "\"", "{", "m", ".", "ConfigDir", "=", "filepath", ".", "Join", "(", "...
// RebaseConfigDir changes ConfigDir, if it is set, to be absolute by appending // it to the given root. // // Doesn't touch "-", which indicates "stdout".
[ "RebaseConfigDir", "changes", "ConfigDir", "if", "it", "is", "set", "to", "be", "absolute", "by", "appending", "it", "to", "the", "given", "root", ".", "Doesn", "t", "touch", "-", "which", "indicates", "stdout", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/meta.go#L64-L68
129,091
luci/luci-go
lucicfg/meta.go
AddFlags
func (m *Meta) AddFlags(fs *flag.FlagSet) { m.fs = fs fs.StringVar(&m.ConfigServiceHost, "config-service-host", m.ConfigServiceHost, "Hostname of a LUCI config service to use for validation.") fs.StringVar(&m.ConfigDir, "config-dir", m.ConfigDir, `A directory to place generated configs into (relative to cwd if giv...
go
func (m *Meta) AddFlags(fs *flag.FlagSet) { m.fs = fs fs.StringVar(&m.ConfigServiceHost, "config-service-host", m.ConfigServiceHost, "Hostname of a LUCI config service to use for validation.") fs.StringVar(&m.ConfigDir, "config-dir", m.ConfigDir, `A directory to place generated configs into (relative to cwd if giv...
[ "func", "(", "m", "*", "Meta", ")", "AddFlags", "(", "fs", "*", "flag", ".", "FlagSet", ")", "{", "m", ".", "fs", "=", "fs", "\n", "fs", ".", "StringVar", "(", "&", "m", ".", "ConfigServiceHost", ",", "\"", "\"", ",", "m", ".", "ConfigServiceHost...
// AddFlags registers command line flags that correspond to Meta fields.
[ "AddFlags", "registers", "command", "line", "flags", "that", "correspond", "to", "Meta", "fields", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/meta.go#L71-L80
129,092
luci/luci-go
lucicfg/meta.go
detectTouchedFlags
func (m *Meta) detectTouchedFlags() { switch { case m.fs == nil: return // not using CLI flags at all case m.detectedTouchedFlags: return // already did this case !m.fs.Parsed(): panic("detectTouchedFlags should be called after flags are parsed") } m.detectedTouchedFlags = true fields := m.fieldsMap() m...
go
func (m *Meta) detectTouchedFlags() { switch { case m.fs == nil: return // not using CLI flags at all case m.detectedTouchedFlags: return // already did this case !m.fs.Parsed(): panic("detectTouchedFlags should be called after flags are parsed") } m.detectedTouchedFlags = true fields := m.fieldsMap() m...
[ "func", "(", "m", "*", "Meta", ")", "detectTouchedFlags", "(", ")", "{", "switch", "{", "case", "m", ".", "fs", "==", "nil", ":", "return", "// not using CLI flags at all", "\n", "case", "m", ".", "detectedTouchedFlags", ":", "return", "// already did this", ...
// detectTouchedFlags is called after flags are parsed to figure out what flags // were explicitly set and what were left at their defaults. // // It updates Meta with information about touched flags which is later used // by PopulateFromTouchedIn and WasTouched functions.
[ "detectTouchedFlags", "is", "called", "after", "flags", "are", "parsed", "to", "figure", "out", "what", "flags", "were", "explicitly", "set", "and", "what", "were", "left", "at", "their", "defaults", ".", "It", "updates", "Meta", "with", "information", "about"...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/meta.go#L87-L105
129,093
luci/luci-go
lucicfg/meta.go
PopulateFromTouchedIn
func (m *Meta) PopulateFromTouchedIn(t *Meta) { t.detectTouchedFlags() left := m.fieldsMap() right := t.fieldsMap() for k, l := range left { r := right[k] if _, yes := t.touched[r]; yes { // Do *l = *r. switch l.(type) { case *string: *(l.(*string)) = *(r.(*string)) case *bool: *(l.(*bool)) ...
go
func (m *Meta) PopulateFromTouchedIn(t *Meta) { t.detectTouchedFlags() left := m.fieldsMap() right := t.fieldsMap() for k, l := range left { r := right[k] if _, yes := t.touched[r]; yes { // Do *l = *r. switch l.(type) { case *string: *(l.(*string)) = *(r.(*string)) case *bool: *(l.(*bool)) ...
[ "func", "(", "m", "*", "Meta", ")", "PopulateFromTouchedIn", "(", "t", "*", "Meta", ")", "{", "t", ".", "detectTouchedFlags", "(", ")", "\n", "left", ":=", "m", ".", "fieldsMap", "(", ")", "\n", "right", ":=", "t", ".", "fieldsMap", "(", ")", "\n",...
// PopulateFromTouchedIn takes all touched values in `t` and copies them to // `m`, overriding what's in `m`.
[ "PopulateFromTouchedIn", "takes", "all", "touched", "values", "in", "t", "and", "copies", "them", "to", "m", "overriding", "what", "s", "in", "m", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/meta.go#L109-L129
129,094
luci/luci-go
lucicfg/meta.go
fieldsMap
func (m *Meta) fieldsMap() map[string]interface{} { return map[string]interface{}{ "config_service_host": &m.ConfigServiceHost, "config_dir": &m.ConfigDir, "tracked_files": &m.TrackedFiles, "fail_on_warnings": &m.FailOnWarnings, } }
go
func (m *Meta) fieldsMap() map[string]interface{} { return map[string]interface{}{ "config_service_host": &m.ConfigServiceHost, "config_dir": &m.ConfigDir, "tracked_files": &m.TrackedFiles, "fail_on_warnings": &m.FailOnWarnings, } }
[ "func", "(", "m", "*", "Meta", ")", "fieldsMap", "(", ")", "map", "[", "string", "]", "interface", "{", "}", "{", "return", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "&", "m", ".", "ConfigServiceHost", ",", "\"", "\"...
// fieldsMap returns a mapping from a snake_case name of a field to a pointer to // this field inside 'm'. // // This is used by both Starlark accessors and for processing CLI flags.
[ "fieldsMap", "returns", "a", "mapping", "from", "a", "snake_case", "name", "of", "a", "field", "to", "a", "pointer", "to", "this", "field", "inside", "m", ".", "This", "is", "used", "by", "both", "Starlark", "accessors", "and", "for", "processing", "CLI", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/meta.go#L159-L166
129,095
luci/luci-go
lucicfg/meta.go
setField
func (m *Meta) setField(k string, v starlark.Value) (err error) { ptr := m.fieldsMap()[k] if ptr == nil { return fmt.Errorf("set_meta: no such meta key %q", k) } // On success, mark the field as modified. defer func() { if err == nil { m.touch(ptr) } }() switch ptr := ptr.(type) { case *string: if ...
go
func (m *Meta) setField(k string, v starlark.Value) (err error) { ptr := m.fieldsMap()[k] if ptr == nil { return fmt.Errorf("set_meta: no such meta key %q", k) } // On success, mark the field as modified. defer func() { if err == nil { m.touch(ptr) } }() switch ptr := ptr.(type) { case *string: if ...
[ "func", "(", "m", "*", "Meta", ")", "setField", "(", "k", "string", ",", "v", "starlark", ".", "Value", ")", "(", "err", "error", ")", "{", "ptr", ":=", "m", ".", "fieldsMap", "(", ")", "[", "k", "]", "\n", "if", "ptr", "==", "nil", "{", "ret...
// setField sets the field k to v.
[ "setField", "sets", "the", "field", "k", "to", "v", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/meta.go#L169-L219
129,096
luci/luci-go
dm/api/service/v1/graph_query_normalize.go
Normalize
func (g *GraphQuery) Normalize() error { if err := g.AttemptList.Normalize(); err != nil { return err } if len(g.AttemptRange) > 0 { lme := errors.NewLazyMultiError(len(g.AttemptRange)) for i, rng := range g.AttemptRange { lme.Assign(i, rng.Normalize()) } if err := lme.Get(); err != nil { return err ...
go
func (g *GraphQuery) Normalize() error { if err := g.AttemptList.Normalize(); err != nil { return err } if len(g.AttemptRange) > 0 { lme := errors.NewLazyMultiError(len(g.AttemptRange)) for i, rng := range g.AttemptRange { lme.Assign(i, rng.Normalize()) } if err := lme.Get(); err != nil { return err ...
[ "func", "(", "g", "*", "GraphQuery", ")", "Normalize", "(", ")", "error", "{", "if", "err", ":=", "g", ".", "AttemptList", ".", "Normalize", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "len", "(", "g", ".", "...
// Normalize returns an error iff this GraphQuery is not valid.
[ "Normalize", "returns", "an", "error", "iff", "this", "GraphQuery", "is", "not", "valid", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/service/v1/graph_query_normalize.go#L24-L47
129,097
luci/luci-go
dm/api/service/v1/graph_query_normalize.go
Normalize
func (al *GraphQuery_AttemptRange) Normalize() error { if al.Quest == "" { return fmt.Errorf("must specify quest") } if al.Low == 0 { return fmt.Errorf("must specify low") } if al.High <= al.Low { return fmt.Errorf("high must be > low") } return nil }
go
func (al *GraphQuery_AttemptRange) Normalize() error { if al.Quest == "" { return fmt.Errorf("must specify quest") } if al.Low == 0 { return fmt.Errorf("must specify low") } if al.High <= al.Low { return fmt.Errorf("high must be > low") } return nil }
[ "func", "(", "al", "*", "GraphQuery_AttemptRange", ")", "Normalize", "(", ")", "error", "{", "if", "al", ".", "Quest", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "al", ".", "Low", "==", "0"...
// Normalize returns nil iff this AttemptRange is in a bad state.
[ "Normalize", "returns", "nil", "iff", "this", "AttemptRange", "is", "in", "a", "bad", "state", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/service/v1/graph_query_normalize.go#L50-L61
129,098
luci/luci-go
dm/api/service/v1/graph_query_normalize.go
Normalize
func (s *GraphQuery_Search) Normalize() error { // for now, start and end MUST be timestamp values. switch s.Start.Value.(type) { case *PropertyValue_Time: default: return fmt.Errorf("invalid Start type: %T", s.Start.Value) } switch s.End.Value.(type) { case *PropertyValue_Time: default: return fmt.Errorf("...
go
func (s *GraphQuery_Search) Normalize() error { // for now, start and end MUST be timestamp values. switch s.Start.Value.(type) { case *PropertyValue_Time: default: return fmt.Errorf("invalid Start type: %T", s.Start.Value) } switch s.End.Value.(type) { case *PropertyValue_Time: default: return fmt.Errorf("...
[ "func", "(", "s", "*", "GraphQuery_Search", ")", "Normalize", "(", ")", "error", "{", "// for now, start and end MUST be timestamp values.", "switch", "s", ".", "Start", ".", "Value", ".", "(", "type", ")", "{", "case", "*", "PropertyValue_Time", ":", "default",...
// Normalize returns nil iff this Search is in a bad state.
[ "Normalize", "returns", "nil", "iff", "this", "Search", "is", "in", "a", "bad", "state", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/service/v1/graph_query_normalize.go#L64-L77
129,099
luci/luci-go
dm/appengine/deps/service.go
tumbleNow
func tumbleNow(c context.Context, m tumble.Mutation) error { err := tumble.RunMutation(c, m) if grpc.Code(err) == codes.Unknown { logging.WithError(err).Errorf(c, "unknown error while applying mutation %v", m) err = grpcutil.Internal } logging.Fields{"root": m.Root(c)}.Infof(c, "tumbleNow success") return err ...
go
func tumbleNow(c context.Context, m tumble.Mutation) error { err := tumble.RunMutation(c, m) if grpc.Code(err) == codes.Unknown { logging.WithError(err).Errorf(c, "unknown error while applying mutation %v", m) err = grpcutil.Internal } logging.Fields{"root": m.Root(c)}.Infof(c, "tumbleNow success") return err ...
[ "func", "tumbleNow", "(", "c", "context", ".", "Context", ",", "m", "tumble", ".", "Mutation", ")", "error", "{", "err", ":=", "tumble", ".", "RunMutation", "(", "c", ",", "m", ")", "\n", "if", "grpc", ".", "Code", "(", "err", ")", "==", "codes", ...
// tumbleNow will run the mutation immediately, converting any non grpc errors // to codes.Internal.
[ "tumbleNow", "will", "run", "the", "mutation", "immediately", "converting", "any", "non", "grpc", "errors", "to", "codes", ".", "Internal", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/appengine/deps/service.go#L102-L110