id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
8,100
luci/luci-go
lucicfg/normalize/scheduler.go
Scheduler
func Scheduler(c context.Context, cfg *pb.ProjectConfig) error { // Sort jobs by ID. sort.Slice(cfg.Job, func(i, j int) bool { return cfg.Job[i].Id < cfg.Job[j].Id }) sort.Slice(cfg.Trigger, func(i, j int) bool { return cfg.Trigger[i].Id < cfg.Trigger[j].Id }) // ACL set name => list of ACLs. aclSets := mak...
go
func Scheduler(c context.Context, cfg *pb.ProjectConfig) error { // Sort jobs by ID. sort.Slice(cfg.Job, func(i, j int) bool { return cfg.Job[i].Id < cfg.Job[j].Id }) sort.Slice(cfg.Trigger, func(i, j int) bool { return cfg.Trigger[i].Id < cfg.Trigger[j].Id }) // ACL set name => list of ACLs. aclSets := mak...
[ "func", "Scheduler", "(", "c", "context", ".", "Context", ",", "cfg", "*", "pb", ".", "ProjectConfig", ")", "error", "{", "// Sort jobs by ID.", "sort", ".", "Slice", "(", "cfg", ".", "Job", ",", "func", "(", "i", ",", "j", "int", ")", "bool", "{", ...
// Scheduler normalizes luci-scheduler.cfg config.
[ "Scheduler", "normalizes", "luci", "-", "scheduler", ".", "cfg", "config", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/normalize/scheduler.go#L30-L70
8,101
luci/luci-go
appengine/gaemiddleware/appengine.go
RequireCron
func RequireCron(c *router.Context, next router.Handler) { if !devAppserverBypassFn(c.Context) { if c.Request.Header.Get("X-Appengine-Cron") != "true" { logging.Errorf(c.Context, "request not made from cron") http.Error(c.Writer, "error: must be run from cron", http.StatusForbidden) return } } next(c) }
go
func RequireCron(c *router.Context, next router.Handler) { if !devAppserverBypassFn(c.Context) { if c.Request.Header.Get("X-Appengine-Cron") != "true" { logging.Errorf(c.Context, "request not made from cron") http.Error(c.Writer, "error: must be run from cron", http.StatusForbidden) return } } next(c) }
[ "func", "RequireCron", "(", "c", "*", "router", ".", "Context", ",", "next", "router", ".", "Handler", ")", "{", "if", "!", "devAppserverBypassFn", "(", "c", ".", "Context", ")", "{", "if", "c", ".", "Request", ".", "Header", ".", "Get", "(", "\"", ...
// RequireCron ensures that the request is from the appengine 'cron' service. // // It checks the presence of a magical header that can be set only by GAE. // If the header is not there, it aborts the request with StatusForbidden. // // This middleware has no effect when using 'BaseTest' or when running under // dev_ap...
[ "RequireCron", "ensures", "that", "the", "request", "is", "from", "the", "appengine", "cron", "service", ".", "It", "checks", "the", "presence", "of", "a", "magical", "header", "that", "can", "be", "set", "only", "by", "GAE", ".", "If", "the", "header", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/appengine/gaemiddleware/appengine.go#L34-L43
8,102
luci/luci-go
appengine/gaemiddleware/appengine.go
RequireTaskQueue
func RequireTaskQueue(queue string) router.Middleware { return func(c *router.Context, next router.Handler) { if !devAppserverBypassFn(c.Context) { qName := c.Request.Header.Get("X-AppEngine-QueueName") if qName == "" || (queue != "" && queue != qName) { logging.Errorf(c.Context, "request made from wrong t...
go
func RequireTaskQueue(queue string) router.Middleware { return func(c *router.Context, next router.Handler) { if !devAppserverBypassFn(c.Context) { qName := c.Request.Header.Get("X-AppEngine-QueueName") if qName == "" || (queue != "" && queue != qName) { logging.Errorf(c.Context, "request made from wrong t...
[ "func", "RequireTaskQueue", "(", "queue", "string", ")", "router", ".", "Middleware", "{", "return", "func", "(", "c", "*", "router", ".", "Context", ",", "next", "router", ".", "Handler", ")", "{", "if", "!", "devAppserverBypassFn", "(", "c", ".", "Cont...
// RequireTaskQueue ensures that the request is from the specified task queue. // // It checks the presence of a magical header that can be set only by GAE. // If the header is not there, it aborts the request with StatusForbidden. // // if 'queue' is the empty string, than this simply checks that this handler was // r...
[ "RequireTaskQueue", "ensures", "that", "the", "request", "is", "from", "the", "specified", "task", "queue", ".", "It", "checks", "the", "presence", "of", "a", "magical", "header", "that", "can", "be", "set", "only", "by", "GAE", ".", "If", "the", "header",...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/appengine/gaemiddleware/appengine.go#L55-L67
8,103
luci/luci-go
auth/internal/gce.go
NewGCETokenProvider
func NewGCETokenProvider(ctx context.Context, account string, scopes []string) (TokenProvider, error) { // Grab an email associated with the account. This must not be failing on // a healthy VM if the account is present. If it does, the metadata server is // broken. email, err := metadata.Get("instance/service-acco...
go
func NewGCETokenProvider(ctx context.Context, account string, scopes []string) (TokenProvider, error) { // Grab an email associated with the account. This must not be failing on // a healthy VM if the account is present. If it does, the metadata server is // broken. email, err := metadata.Get("instance/service-acco...
[ "func", "NewGCETokenProvider", "(", "ctx", "context", ".", "Context", ",", "account", "string", ",", "scopes", "[", "]", "string", ")", "(", "TokenProvider", ",", "error", ")", "{", "// Grab an email associated with the account. This must not be failing on", "// a healt...
// NewGCETokenProvider returns TokenProvider that knows how to use GCE metadata server.
[ "NewGCETokenProvider", "returns", "TokenProvider", "that", "knows", "how", "to", "use", "GCE", "metadata", "server", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/auth/internal/gce.go#L36-L69
8,104
luci/luci-go
appengine/gaemiddleware/context.go
ensurePrepared
func (e *Environment) ensurePrepared(c context.Context) { e.prepareOnce.Do(func() { e.processCacheData = caching.NewProcessCacheData() e.globalSettings = settings.New(gaesettings.Storage{}) if e.Prepare != nil { e.Prepare(c) } }) }
go
func (e *Environment) ensurePrepared(c context.Context) { e.prepareOnce.Do(func() { e.processCacheData = caching.NewProcessCacheData() e.globalSettings = settings.New(gaesettings.Storage{}) if e.Prepare != nil { e.Prepare(c) } }) }
[ "func", "(", "e", "*", "Environment", ")", "ensurePrepared", "(", "c", "context", ".", "Context", ")", "{", "e", ".", "prepareOnce", ".", "Do", "(", "func", "(", ")", "{", "e", ".", "processCacheData", "=", "caching", ".", "NewProcessCacheData", "(", "...
// ensurePrepared is called before handling requests to initialize global state.
[ "ensurePrepared", "is", "called", "before", "handling", "requests", "to", "initialize", "global", "state", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/appengine/gaemiddleware/context.go#L111-L119
8,105
luci/luci-go
appengine/gaemiddleware/context.go
InstallHandlers
func (e *Environment) InstallHandlers(r *router.Router) { e.InstallHandlersWithMiddleware(r, e.Base()) }
go
func (e *Environment) InstallHandlers(r *router.Router) { e.InstallHandlersWithMiddleware(r, e.Base()) }
[ "func", "(", "e", "*", "Environment", ")", "InstallHandlers", "(", "r", "*", "router", ".", "Router", ")", "{", "e", ".", "InstallHandlersWithMiddleware", "(", "r", ",", "e", ".", "Base", "(", ")", ")", "\n", "}" ]
// InstallHandlers installs handlers for an Environment's framework routes. // // See InstallHandlersWithMiddleware for more information.
[ "InstallHandlers", "installs", "handlers", "for", "an", "Environment", "s", "framework", "routes", ".", "See", "InstallHandlersWithMiddleware", "for", "more", "information", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/appengine/gaemiddleware/context.go#L124-L126
8,106
luci/luci-go
common/data/text/templateproto/render.go
Convert
func (m LiteralMap) Convert() (map[string]*Value, error) { ret := make(map[string]*Value, len(m)) for k, v := range m { v, err := NewValue(v) if err != nil { return nil, fmt.Errorf("key %q: %s", k, err) } ret[k] = v } return ret, nil }
go
func (m LiteralMap) Convert() (map[string]*Value, error) { ret := make(map[string]*Value, len(m)) for k, v := range m { v, err := NewValue(v) if err != nil { return nil, fmt.Errorf("key %q: %s", k, err) } ret[k] = v } return ret, nil }
[ "func", "(", "m", "LiteralMap", ")", "Convert", "(", ")", "(", "map", "[", "string", "]", "*", "Value", ",", "error", ")", "{", "ret", ":=", "make", "(", "map", "[", "string", "]", "*", "Value", ",", "len", "(", "m", ")", ")", "\n", "for", "k...
// Convert converts this to a parameter map that can be used with // Template.Render.
[ "Convert", "converts", "this", "to", "a", "parameter", "map", "that", "can", "be", "used", "with", "Template", ".", "Render", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/text/templateproto/render.go#L90-L100
8,107
luci/luci-go
common/data/text/templateproto/render.go
RenderL
func (t *File_Template) RenderL(m LiteralMap) (string, error) { pm, err := m.Convert() if err != nil { return "", err } return t.Render(pm) }
go
func (t *File_Template) RenderL(m LiteralMap) (string, error) { pm, err := m.Convert() if err != nil { return "", err } return t.Render(pm) }
[ "func", "(", "t", "*", "File_Template", ")", "RenderL", "(", "m", "LiteralMap", ")", "(", "string", ",", "error", ")", "{", "pm", ",", "err", ":=", "m", ".", "Convert", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "...
// RenderL renders this template with a LiteralMap, calling its Convert method // and passing the result to Render.
[ "RenderL", "renders", "this", "template", "with", "a", "LiteralMap", "calling", "its", "Convert", "method", "and", "passing", "the", "result", "to", "Render", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/text/templateproto/render.go#L104-L110
8,108
luci/luci-go
common/data/text/templateproto/render.go
Render
func (t *File_Template) Render(params map[string]*Value) (string, error) { sSet := stringset.New(len(params)) replacementSlice := make([]string, 0, len(t.Param)*2) for k, param := range t.Param { replacementSlice = append(replacementSlice, k) if newVal, ok := params[k]; ok { if err := param.Accepts(newVal); e...
go
func (t *File_Template) Render(params map[string]*Value) (string, error) { sSet := stringset.New(len(params)) replacementSlice := make([]string, 0, len(t.Param)*2) for k, param := range t.Param { replacementSlice = append(replacementSlice, k) if newVal, ok := params[k]; ok { if err := param.Accepts(newVal); e...
[ "func", "(", "t", "*", "File_Template", ")", "Render", "(", "params", "map", "[", "string", "]", "*", "Value", ")", "(", "string", ",", "error", ")", "{", "sSet", ":=", "stringset", ".", "New", "(", "len", "(", "params", ")", ")", "\n", "replacemen...
// Render turns the Template into a JSON document, filled with the given // parameters. It does not validate that the output is valid JSON, but if you // called Normalize on this Template already, then it WILL be valid JSON.
[ "Render", "turns", "the", "Template", "into", "a", "JSON", "document", "filled", "with", "the", "given", "parameters", ".", "It", "does", "not", "validate", "that", "the", "output", "is", "valid", "JSON", "but", "if", "you", "called", "Normalize", "on", "t...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/text/templateproto/render.go#L115-L146
8,109
luci/luci-go
machine-db/common/ips.go
String
func (i IPv4) String() string { ip := make(net.IP, 4) binary.BigEndian.PutUint32(ip, uint32(i)) return ip.String() }
go
func (i IPv4) String() string { ip := make(net.IP, 4) binary.BigEndian.PutUint32(ip, uint32(i)) return ip.String() }
[ "func", "(", "i", "IPv4", ")", "String", "(", ")", "string", "{", "ip", ":=", "make", "(", "net", ".", "IP", ",", "4", ")", "\n", "binary", ".", "BigEndian", ".", "PutUint32", "(", "ip", ",", "uint32", "(", "i", ")", ")", "\n", "return", "ip", ...
// String returns a string representation of this IPv4 address.
[ "String", "returns", "a", "string", "representation", "of", "this", "IPv4", "address", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/common/ips.go#L29-L33
8,110
luci/luci-go
machine-db/common/ips.go
IPv4Range
func IPv4Range(block string) (IPv4, int64, error) { ip, subnet, err := net.ParseCIDR(block) if err != nil { return 0, 0, errors.Reason("invalid CIDR block %q", block).Err() } ipv4 := ip.Mask(subnet.Mask).To4() if ipv4 == nil { return 0, 0, errors.Reason("invalid IPv4 CIDR block %q", block).Err() } ones, _ :=...
go
func IPv4Range(block string) (IPv4, int64, error) { ip, subnet, err := net.ParseCIDR(block) if err != nil { return 0, 0, errors.Reason("invalid CIDR block %q", block).Err() } ipv4 := ip.Mask(subnet.Mask).To4() if ipv4 == nil { return 0, 0, errors.Reason("invalid IPv4 CIDR block %q", block).Err() } ones, _ :=...
[ "func", "IPv4Range", "(", "block", "string", ")", "(", "IPv4", ",", "int64", ",", "error", ")", "{", "ip", ",", "subnet", ",", "err", ":=", "net", ".", "ParseCIDR", "(", "block", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "0", ...
// IPv4Range returns the starting address and length of the given IPv4 CIDR block.
[ "IPv4Range", "returns", "the", "starting", "address", "and", "length", "of", "the", "given", "IPv4", "CIDR", "block", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/common/ips.go#L36-L47
8,111
luci/luci-go
machine-db/common/ips.go
ParseIPv4
func ParseIPv4(s string) (IPv4, error) { ip := net.ParseIP(s) if ip != nil { ip = ip.To4() } if ip == nil { return 0, errors.Reason("invalid IPv4 address %q", s).Err() } return IPv4(binary.BigEndian.Uint32(ip)), nil }
go
func ParseIPv4(s string) (IPv4, error) { ip := net.ParseIP(s) if ip != nil { ip = ip.To4() } if ip == nil { return 0, errors.Reason("invalid IPv4 address %q", s).Err() } return IPv4(binary.BigEndian.Uint32(ip)), nil }
[ "func", "ParseIPv4", "(", "s", "string", ")", "(", "IPv4", ",", "error", ")", "{", "ip", ":=", "net", ".", "ParseIP", "(", "s", ")", "\n", "if", "ip", "!=", "nil", "{", "ip", "=", "ip", ".", "To4", "(", ")", "\n", "}", "\n", "if", "ip", "==...
// ParseIPv4 returns an IPv4 address from the given string.
[ "ParseIPv4", "returns", "an", "IPv4", "address", "from", "the", "given", "string", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/common/ips.go#L50-L59
8,112
luci/luci-go
logdog/client/cmd/logdog_butler/stream.go
properties
func (s streamConfig) properties() *streamproto.Properties { if s.ContentType == "" { // Choose content type based on format. s.ContentType = string(s.Type.DefaultContentType()) } return s.Properties() }
go
func (s streamConfig) properties() *streamproto.Properties { if s.ContentType == "" { // Choose content type based on format. s.ContentType = string(s.Type.DefaultContentType()) } return s.Properties() }
[ "func", "(", "s", "streamConfig", ")", "properties", "(", ")", "*", "streamproto", ".", "Properties", "{", "if", "s", ".", "ContentType", "==", "\"", "\"", "{", "// Choose content type based on format.", "s", ".", "ContentType", "=", "string", "(", "s", ".",...
// Converts command-line parameters into a stream.Config.
[ "Converts", "command", "-", "line", "parameters", "into", "a", "stream", ".", "Config", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/client/cmd/logdog_butler/stream.go#L52-L58
8,113
luci/luci-go
machine-db/client/cli/vms.go
printVMs
func printVMs(tsv bool, vms ...*crimson.VM) { if len(vms) > 0 { p := newStdoutPrinter(tsv) defer p.Flush() if !tsv { p.Row("Name", "VLAN", "IP Address", "Host", "Host VLAN", "Operating System", "Description", "Deployment Ticket", "State") } for _, vm := range vms { p.Row(vm.Name, vm.Vlan, vm.Ipv4, vm.H...
go
func printVMs(tsv bool, vms ...*crimson.VM) { if len(vms) > 0 { p := newStdoutPrinter(tsv) defer p.Flush() if !tsv { p.Row("Name", "VLAN", "IP Address", "Host", "Host VLAN", "Operating System", "Description", "Deployment Ticket", "State") } for _, vm := range vms { p.Row(vm.Name, vm.Vlan, vm.Ipv4, vm.H...
[ "func", "printVMs", "(", "tsv", "bool", ",", "vms", "...", "*", "crimson", ".", "VM", ")", "{", "if", "len", "(", "vms", ")", ">", "0", "{", "p", ":=", "newStdoutPrinter", "(", "tsv", ")", "\n", "defer", "p", ".", "Flush", "(", ")", "\n", "if",...
// printVMs prints VM data to stdout in tab-separated columns.
[ "printVMs", "prints", "VM", "data", "to", "stdout", "in", "tab", "-", "separated", "columns", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/client/cli/vms.go#L28-L39
8,114
luci/luci-go
machine-db/client/cli/vms.go
Run
func (c *AddVMCmd) Run(app subcommands.Application, args []string, env subcommands.Env) int { ctx := cli.GetContext(app, c, env) // TODO(smut): Validate required fields client-side. req := &crimson.CreateVMRequest{ Vm: &c.vm, } client := getClient(ctx) resp, err := client.CreateVM(ctx, req) if err != nil { e...
go
func (c *AddVMCmd) Run(app subcommands.Application, args []string, env subcommands.Env) int { ctx := cli.GetContext(app, c, env) // TODO(smut): Validate required fields client-side. req := &crimson.CreateVMRequest{ Vm: &c.vm, } client := getClient(ctx) resp, err := client.CreateVM(ctx, req) if err != nil { e...
[ "func", "(", "c", "*", "AddVMCmd", ")", "Run", "(", "app", "subcommands", ".", "Application", ",", "args", "[", "]", "string", ",", "env", "subcommands", ".", "Env", ")", "int", "{", "ctx", ":=", "cli", ".", "GetContext", "(", "app", ",", "c", ",",...
// Run runs the command to add a VM.
[ "Run", "runs", "the", "command", "to", "add", "a", "VM", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/client/cli/vms.go#L48-L62
8,115
luci/luci-go
machine-db/client/cli/vms.go
addVMCmd
func addVMCmd(params *Parameters) *subcommands.Command { return &subcommands.Command{ UsageLine: "add-vm -name <name> -host <name> -os <os> -ip <ip address> -state <state> [-desc <description>] [-tick <deployment ticket>]", ShortDesc: "adds a VM", LongDesc: "Adds a VM to the database.\n\nExample:\ncrimson add-v...
go
func addVMCmd(params *Parameters) *subcommands.Command { return &subcommands.Command{ UsageLine: "add-vm -name <name> -host <name> -os <os> -ip <ip address> -state <state> [-desc <description>] [-tick <deployment ticket>]", ShortDesc: "adds a VM", LongDesc: "Adds a VM to the database.\n\nExample:\ncrimson add-v...
[ "func", "addVMCmd", "(", "params", "*", "Parameters", ")", "*", "subcommands", ".", "Command", "{", "return", "&", "subcommands", ".", "Command", "{", "UsageLine", ":", "\"", "\"", ",", "ShortDesc", ":", "\"", "\"", ",", "LongDesc", ":", "\"", "\\n", "...
// addVMCmd returns a command to add a VM.
[ "addVMCmd", "returns", "a", "command", "to", "add", "a", "VM", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/client/cli/vms.go#L65-L83
8,116
luci/luci-go
machine-db/client/cli/vms.go
Run
func (c *GetVMsCmd) Run(app subcommands.Application, args []string, env subcommands.Env) int { ctx := cli.GetContext(app, c, env) client := getClient(ctx) resp, err := client.ListVMs(ctx, &c.req) if err != nil { errors.Log(ctx, err) return 1 } printVMs(c.f.tsv, resp.Vms...) return 0 }
go
func (c *GetVMsCmd) Run(app subcommands.Application, args []string, env subcommands.Env) int { ctx := cli.GetContext(app, c, env) client := getClient(ctx) resp, err := client.ListVMs(ctx, &c.req) if err != nil { errors.Log(ctx, err) return 1 } printVMs(c.f.tsv, resp.Vms...) return 0 }
[ "func", "(", "c", "*", "GetVMsCmd", ")", "Run", "(", "app", "subcommands", ".", "Application", ",", "args", "[", "]", "string", ",", "env", "subcommands", ".", "Env", ")", "int", "{", "ctx", ":=", "cli", ".", "GetContext", "(", "app", ",", "c", ","...
// Run runs the command to get VMs.
[ "Run", "runs", "the", "command", "to", "get", "VMs", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/client/cli/vms.go#L142-L152
8,117
luci/luci-go
machine-db/client/cli/vms.go
getVMsCmd
func getVMsCmd(params *Parameters) *subcommands.Command { return &subcommands.Command{ UsageLine: "get-vms [-name <name>]... [-vlan <id>]... [-ip <ip address>]...", ShortDesc: "retrieves VMs", LongDesc: "Retrieves VMs matching the given names and VLANs, or all VMs if names and VLANs are omitted.\n\nExample to g...
go
func getVMsCmd(params *Parameters) *subcommands.Command { return &subcommands.Command{ UsageLine: "get-vms [-name <name>]... [-vlan <id>]... [-ip <ip address>]...", ShortDesc: "retrieves VMs", LongDesc: "Retrieves VMs matching the given names and VLANs, or all VMs if names and VLANs are omitted.\n\nExample to g...
[ "func", "getVMsCmd", "(", "params", "*", "Parameters", ")", "*", "subcommands", ".", "Command", "{", "return", "&", "subcommands", ".", "Command", "{", "UsageLine", ":", "\"", "\"", ",", "ShortDesc", ":", "\"", "\"", ",", "LongDesc", ":", "\"", "\\n", ...
// getVMsCmd returns a command to get VMs.
[ "getVMsCmd", "returns", "a", "command", "to", "get", "VMs", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/client/cli/vms.go#L155-L173
8,118
luci/luci-go
common/data/sortby/sortby.go
Use
func (c Chain) Use(i, j int) bool { for _, less := range c { if less == nil { continue } if less(i, j) { return true } else if less(j, i) { return false } } return false }
go
func (c Chain) Use(i, j int) bool { for _, less := range c { if less == nil { continue } if less(i, j) { return true } else if less(j, i) { return false } } return false }
[ "func", "(", "c", "Chain", ")", "Use", "(", "i", ",", "j", "int", ")", "bool", "{", "for", "_", ",", "less", ":=", "range", "c", "{", "if", "less", "==", "nil", "{", "continue", "\n", "}", "\n", "if", "less", "(", "i", ",", "j", ")", "{", ...
// Use is a sort-compatible LessFn that actually executes the full chain of // comparisons.
[ "Use", "is", "a", "sort", "-", "compatible", "LessFn", "that", "actually", "executes", "the", "full", "chain", "of", "comparisons", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/sortby/sortby.go#L32-L44
8,119
luci/luci-go
tokenserver/appengine/impl/serviceaccounts/rpc_inspect_oauth_token_grant.go
InspectOAuthTokenGrant
func (r *InspectOAuthTokenGrantRPC) InspectOAuthTokenGrant(c context.Context, req *admin.InspectOAuthTokenGrantRequest) (*admin.InspectOAuthTokenGrantResponse, error) { inspection, err := InspectGrant(c, r.Signer, req.Token) if err != nil { return nil, status.Errorf(codes.Internal, err.Error()) } resp := &admin....
go
func (r *InspectOAuthTokenGrantRPC) InspectOAuthTokenGrant(c context.Context, req *admin.InspectOAuthTokenGrantRequest) (*admin.InspectOAuthTokenGrantResponse, error) { inspection, err := InspectGrant(c, r.Signer, req.Token) if err != nil { return nil, status.Errorf(codes.Internal, err.Error()) } resp := &admin....
[ "func", "(", "r", "*", "InspectOAuthTokenGrantRPC", ")", "InspectOAuthTokenGrant", "(", "c", "context", ".", "Context", ",", "req", "*", "admin", ".", "InspectOAuthTokenGrantRequest", ")", "(", "*", "admin", ".", "InspectOAuthTokenGrantResponse", ",", "error", ")"...
// InspectOAuthTokenGrant decodes the given OAuth token grant.
[ "InspectOAuthTokenGrant", "decodes", "the", "given", "OAuth", "token", "grant", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/serviceaccounts/rpc_inspect_oauth_token_grant.go#L35-L102
8,120
luci/luci-go
cipd/common/iid.go
InstanceIDToObjectRef
func InstanceIDToObjectRef(iid string) *api.ObjectRef { // Legacy SHA1-based instances use hex(sha1) as instance ID, 40 chars. if len(iid) == 40 { if err := checkIsHex(iid); err != nil { panic(fmt.Errorf("not a valid package instance ID %q - %s", iid, err)) } return &api.ObjectRef{ HashAlgo: api.HashAlgo...
go
func InstanceIDToObjectRef(iid string) *api.ObjectRef { // Legacy SHA1-based instances use hex(sha1) as instance ID, 40 chars. if len(iid) == 40 { if err := checkIsHex(iid); err != nil { panic(fmt.Errorf("not a valid package instance ID %q - %s", iid, err)) } return &api.ObjectRef{ HashAlgo: api.HashAlgo...
[ "func", "InstanceIDToObjectRef", "(", "iid", "string", ")", "*", "api", ".", "ObjectRef", "{", "// Legacy SHA1-based instances use hex(sha1) as instance ID, 40 chars.", "if", "len", "(", "iid", ")", "==", "40", "{", "if", "err", ":=", "checkIsHex", "(", "iid", ")"...
// InstanceIDToObjectRef is a reverse of ObjectRefToInstanceID. // // Panics if the instance ID is incorrect. Use ValidateInstanceID if // this is a concern.
[ "InstanceIDToObjectRef", "is", "a", "reverse", "of", "ObjectRefToInstanceID", ".", "Panics", "if", "the", "instance", "ID", "is", "incorrect", ".", "Use", "ValidateInstanceID", "if", "this", "is", "a", "concern", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/common/iid.go#L145-L161
8,121
luci/luci-go
cipd/common/iid.go
decodeObjectRef
func decodeObjectRef(iid string) (*api.ObjectRef, error) { // Skip obviously wrong instance IDs faster and with a cleaner error message. // We assume we use at least 160 bit digests here (which translates to at // least 28 bytes of encoded iid). if len(iid) < 28 { return nil, fmt.Errorf("not a valid size for an e...
go
func decodeObjectRef(iid string) (*api.ObjectRef, error) { // Skip obviously wrong instance IDs faster and with a cleaner error message. // We assume we use at least 160 bit digests here (which translates to at // least 28 bytes of encoded iid). if len(iid) < 28 { return nil, fmt.Errorf("not a valid size for an e...
[ "func", "decodeObjectRef", "(", "iid", "string", ")", "(", "*", "api", ".", "ObjectRef", ",", "error", ")", "{", "// Skip obviously wrong instance IDs faster and with a cleaner error message.", "// We assume we use at least 160 bit digests here (which translates to at", "// least 2...
// decodeObjectRef is a reverse of encodeObjectRef.
[ "decodeObjectRef", "is", "a", "reverse", "of", "encodeObjectRef", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/common/iid.go#L197-L235
8,122
luci/luci-go
cipd/common/iid.go
checkIsHex
func checkIsHex(s string) error { switch { case s == "": return fmt.Errorf("empty hex string") case len(s)%2 != 0: return fmt.Errorf("uneven number of symbols in the hex string") } for _, c := range s { if !((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f')) { return fmt.Errorf("bad lowercase hex string %q...
go
func checkIsHex(s string) error { switch { case s == "": return fmt.Errorf("empty hex string") case len(s)%2 != 0: return fmt.Errorf("uneven number of symbols in the hex string") } for _, c := range s { if !((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f')) { return fmt.Errorf("bad lowercase hex string %q...
[ "func", "checkIsHex", "(", "s", "string", ")", "error", "{", "switch", "{", "case", "s", "==", "\"", "\"", ":", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "case", "len", "(", "s", ")", "%", "2", "!=", "0", ":", "return", "fmt",...
// checkIsHex returns an error if a string is not a lowercase hex string. // // Empty string is rejected as invalid too.
[ "checkIsHex", "returns", "an", "error", "if", "a", "string", "is", "not", "a", "lowercase", "hex", "string", ".", "Empty", "string", "is", "rejected", "as", "invalid", "too", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/common/iid.go#L240-L253
8,123
luci/luci-go
server/auth/service/validation.go
validateAuthDB
func validateAuthDB(db *protocol.AuthDB) error { groups := make(map[string]*protocol.AuthGroup, len(db.GetGroups())) for _, g := range db.GetGroups() { groups[g.GetName()] = g } for name := range groups { if err := validateAuthGroup(name, groups); err != nil { return err } } for _, wl := range db.GetIpWh...
go
func validateAuthDB(db *protocol.AuthDB) error { groups := make(map[string]*protocol.AuthGroup, len(db.GetGroups())) for _, g := range db.GetGroups() { groups[g.GetName()] = g } for name := range groups { if err := validateAuthGroup(name, groups); err != nil { return err } } for _, wl := range db.GetIpWh...
[ "func", "validateAuthDB", "(", "db", "*", "protocol", ".", "AuthDB", ")", "error", "{", "groups", ":=", "make", "(", "map", "[", "string", "]", "*", "protocol", ".", "AuthGroup", ",", "len", "(", "db", ".", "GetGroups", "(", ")", ")", ")", "\n", "f...
// validateAuthDB returns nil if AuthDB looks correct.
[ "validateAuthDB", "returns", "nil", "if", "AuthDB", "looks", "correct", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/server/auth/service/validation.go#L27-L48
8,124
luci/luci-go
server/auth/service/validation.go
validateAuthGroup
func validateAuthGroup(name string, groups map[string]*protocol.AuthGroup) error { g := groups[name] for _, ident := range g.GetMembers() { if _, err := identity.MakeIdentity(ident); err != nil { return fmt.Errorf("auth: invalid identity %q in group %q - %s", ident, name, err) } } for _, glob := range g.Ge...
go
func validateAuthGroup(name string, groups map[string]*protocol.AuthGroup) error { g := groups[name] for _, ident := range g.GetMembers() { if _, err := identity.MakeIdentity(ident); err != nil { return fmt.Errorf("auth: invalid identity %q in group %q - %s", ident, name, err) } } for _, glob := range g.Ge...
[ "func", "validateAuthGroup", "(", "name", "string", ",", "groups", "map", "[", "string", "]", "*", "protocol", ".", "AuthGroup", ")", "error", "{", "g", ":=", "groups", "[", "name", "]", "\n\n", "for", "_", ",", "ident", ":=", "range", "g", ".", "Get...
// validateAuthGroup returns nil if AuthGroup looks correct.
[ "validateAuthGroup", "returns", "nil", "if", "AuthGroup", "looks", "correct", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/server/auth/service/validation.go#L51-L77
8,125
luci/luci-go
server/auth/service/validation.go
findGroupCycle
func findGroupCycle(name string, groups map[string]*protocol.AuthGroup) []string { // Set of groups that are completely explored (all subtree is traversed). visited := map[string]bool{} // Stack of groups that are being explored now. In case a cycle is detected // it would contain that cycle. var visiting []strin...
go
func findGroupCycle(name string, groups map[string]*protocol.AuthGroup) []string { // Set of groups that are completely explored (all subtree is traversed). visited := map[string]bool{} // Stack of groups that are being explored now. In case a cycle is detected // it would contain that cycle. var visiting []strin...
[ "func", "findGroupCycle", "(", "name", "string", ",", "groups", "map", "[", "string", "]", "*", "protocol", ".", "AuthGroup", ")", "[", "]", "string", "{", "// Set of groups that are completely explored (all subtree is traversed).", "visited", ":=", "map", "[", "str...
// findGroupCycle searches for a group dependency cycle that contains group // `name`. Returns list of groups that form the cycle if found, empty list // if no cycles. Unknown groups are considered empty.
[ "findGroupCycle", "searches", "for", "a", "group", "dependency", "cycle", "that", "contains", "group", "name", ".", "Returns", "list", "of", "groups", "that", "form", "the", "cycle", "if", "found", "empty", "list", "if", "no", "cycles", ".", "Unknown", "grou...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/server/auth/service/validation.go#L82-L122
8,126
luci/luci-go
server/auth/service/validation.go
validateIPWhitelist
func validateIPWhitelist(wl *protocol.AuthIPWhitelist) error { for _, subnet := range wl.GetSubnets() { if _, _, err := net.ParseCIDR(subnet); err != nil { return fmt.Errorf("bad subnet %q - %s", subnet, err) } } return nil }
go
func validateIPWhitelist(wl *protocol.AuthIPWhitelist) error { for _, subnet := range wl.GetSubnets() { if _, _, err := net.ParseCIDR(subnet); err != nil { return fmt.Errorf("bad subnet %q - %s", subnet, err) } } return nil }
[ "func", "validateIPWhitelist", "(", "wl", "*", "protocol", ".", "AuthIPWhitelist", ")", "error", "{", "for", "_", ",", "subnet", ":=", "range", "wl", ".", "GetSubnets", "(", ")", "{", "if", "_", ",", "_", ",", "err", ":=", "net", ".", "ParseCIDR", "(...
// validateIPWhitelist checks IPs in the whitelist are parsable.
[ "validateIPWhitelist", "checks", "IPs", "in", "the", "whitelist", "are", "parsable", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/server/auth/service/validation.go#L125-L132
8,127
luci/luci-go
common/clock/clockflag/duration.go
ParseDuration
func ParseDuration(v string) (Duration, error) { duration, err := time.ParseDuration(v) if err != nil { return 0, err } return Duration(duration), nil }
go
func ParseDuration(v string) (Duration, error) { duration, err := time.ParseDuration(v) if err != nil { return 0, err } return Duration(duration), nil }
[ "func", "ParseDuration", "(", "v", "string", ")", "(", "Duration", ",", "error", ")", "{", "duration", ",", "err", ":=", "time", ".", "ParseDuration", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", ...
// ParseDuration parses a clockflag Duration from a string. This is basically // a typed fall-through to time.ParseDuration.
[ "ParseDuration", "parses", "a", "clockflag", "Duration", "from", "a", "string", ".", "This", "is", "basically", "a", "typed", "fall", "-", "through", "to", "time", ".", "ParseDuration", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/clock/clockflag/duration.go#L69-L75
8,128
luci/luci-go
milo/buildsource/buildbot/builder.go
mergeText
func mergeText(text []string) []string { merged := make([]string, 0, len(text)) merge := false for _, line := range text { if merge { merge = false merged[len(merged)-1] += " " + line continue } merged = append(merged, line) switch line { case "build", "failed", "exception": merge = true defa...
go
func mergeText(text []string) []string { merged := make([]string, 0, len(text)) merge := false for _, line := range text { if merge { merge = false merged[len(merged)-1] += " " + line continue } merged = append(merged, line) switch line { case "build", "failed", "exception": merge = true defa...
[ "func", "mergeText", "(", "text", "[", "]", "string", ")", "[", "]", "string", "{", "merged", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "text", ")", ")", "\n", "merge", ":=", "false", "\n", "for", "_", ",", "line", ":=",...
// mergeText merges buildbot summary texts, which sometimes separates // words that should be merged together, this combines them into a single // line.
[ "mergeText", "merges", "buildbot", "summary", "texts", "which", "sometimes", "separates", "words", "that", "should", "be", "merged", "together", "this", "combines", "them", "into", "a", "single", "line", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/buildbot/builder.go#L49-L78
8,129
luci/luci-go
milo/buildsource/buildbot/builder.go
GetBuilder
func GetBuilder(c context.Context, masterName, builderName string, limit int, cursor string) (*ui.Builder, error) { if err := buildstore.CanAccessMaster(c, masterName); err != nil { return nil, err } result := &ui.Builder{ Name: builderName, } master, err := buildstore.GetMaster(c, masterName, false) if err !...
go
func GetBuilder(c context.Context, masterName, builderName string, limit int, cursor string) (*ui.Builder, error) { if err := buildstore.CanAccessMaster(c, masterName); err != nil { return nil, err } result := &ui.Builder{ Name: builderName, } master, err := buildstore.GetMaster(c, masterName, false) if err !...
[ "func", "GetBuilder", "(", "c", "context", ".", "Context", ",", "masterName", ",", "builderName", "string", ",", "limit", "int", ",", "cursor", "string", ")", "(", "*", "ui", ".", "Builder", ",", "error", ")", "{", "if", "err", ":=", "buildstore", ".",...
// GetBuilder is the implementation for getting a milo builder page from // buildbot.
[ "GetBuilder", "is", "the", "implementation", "for", "getting", "a", "milo", "builder", "page", "from", "buildbot", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/buildbot/builder.go#L110-L209
8,130
luci/luci-go
machine-db/appengine/rpc/hosts.go
DeleteHost
func (*Service) DeleteHost(c context.Context, req *crimson.DeleteHostRequest) (*empty.Empty, error) { if err := deleteHost(c, req.Name); err != nil { return nil, err } return &empty.Empty{}, nil }
go
func (*Service) DeleteHost(c context.Context, req *crimson.DeleteHostRequest) (*empty.Empty, error) { if err := deleteHost(c, req.Name); err != nil { return nil, err } return &empty.Empty{}, nil }
[ "func", "(", "*", "Service", ")", "DeleteHost", "(", "c", "context", ".", "Context", ",", "req", "*", "crimson", ".", "DeleteHostRequest", ")", "(", "*", "empty", ".", "Empty", ",", "error", ")", "{", "if", "err", ":=", "deleteHost", "(", "c", ",", ...
// DeleteHost handles a request to delete an existing host.
[ "DeleteHost", "handles", "a", "request", "to", "delete", "an", "existing", "host", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/hosts.go#L36-L41
8,131
luci/luci-go
machine-db/appengine/rpc/hosts.go
deleteHost
func deleteHost(c context.Context, name string) error { if name == "" { return status.Error(codes.InvalidArgument, "hostname is required and must be non-empty") } db := database.Get(c) res, err := db.ExecContext(c, `DELETE FROM hostnames WHERE name = ?`, name) if err != nil { switch e, ok := err.(*mysql.MySQL...
go
func deleteHost(c context.Context, name string) error { if name == "" { return status.Error(codes.InvalidArgument, "hostname is required and must be non-empty") } db := database.Get(c) res, err := db.ExecContext(c, `DELETE FROM hostnames WHERE name = ?`, name) if err != nil { switch e, ok := err.(*mysql.MySQL...
[ "func", "deleteHost", "(", "c", "context", ".", "Context", ",", "name", "string", ")", "error", "{", "if", "name", "==", "\"", "\"", "{", "return", "status", ".", "Error", "(", "codes", ".", "InvalidArgument", ",", "\"", "\"", ")", "\n", "}", "\n\n",...
// deleteHost deletes an existing host from the database.
[ "deleteHost", "deletes", "an", "existing", "host", "from", "the", "database", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/hosts.go#L44-L72
8,132
luci/luci-go
common/sync/parallel/buffer.go
process
func (b *Buffer) process() { defer close(b.tasksFinishedC) // outC is the channel that we send work to. We toggle it between nil and our // Runner's WorkC depending on whether we have work. // // cur is the current work to send. It is only valid if hasWork is true. var outC chan<- WorkItem var cur WorkItem //...
go
func (b *Buffer) process() { defer close(b.tasksFinishedC) // outC is the channel that we send work to. We toggle it between nil and our // Runner's WorkC depending on whether we have work. // // cur is the current work to send. It is only valid if hasWork is true. var outC chan<- WorkItem var cur WorkItem //...
[ "func", "(", "b", "*", "Buffer", ")", "process", "(", ")", "{", "defer", "close", "(", "b", ".", "tasksFinishedC", ")", "\n\n", "// outC is the channel that we send work to. We toggle it between nil and our", "// Runner's WorkC depending on whether we have work.", "//", "//...
// process enqueues tasks into the Buffer and dispatches them to the underlying // Runner when available.
[ "process", "enqueues", "tasks", "into", "the", "Buffer", "and", "dispatches", "them", "to", "the", "underlying", "Runner", "when", "available", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/sync/parallel/buffer.go#L52-L115
8,133
luci/luci-go
common/sync/parallel/buffer.go
RunOne
func (b *Buffer) RunOne(f func() error) <-chan error { b.init() errC := make(chan error) b.workC <- WorkItem{ F: f, ErrC: errC, After: func() { close(errC) }, } return errC }
go
func (b *Buffer) RunOne(f func() error) <-chan error { b.init() errC := make(chan error) b.workC <- WorkItem{ F: f, ErrC: errC, After: func() { close(errC) }, } return errC }
[ "func", "(", "b", "*", "Buffer", ")", "RunOne", "(", "f", "func", "(", ")", "error", ")", "<-", "chan", "error", "{", "b", ".", "init", "(", ")", "\n\n", "errC", ":=", "make", "(", "chan", "error", ")", "\n", "b", ".", "workC", "<-", "WorkItem"...
// RunOne implements the same semantics as Runner's RunOne. However, if the // dispatch pipeline is full, RunOne will buffer the work and return immediately // rather than block.
[ "RunOne", "implements", "the", "same", "semantics", "as", "Runner", "s", "RunOne", ".", "However", "if", "the", "dispatch", "pipeline", "is", "full", "RunOne", "will", "buffer", "the", "work", "and", "return", "immediately", "rather", "than", "block", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/sync/parallel/buffer.go#L135-L145
8,134
luci/luci-go
common/sync/parallel/buffer.go
Close
func (b *Buffer) Close() { b.init() close(b.workC) <-b.tasksFinishedC b.Runner.Close() }
go
func (b *Buffer) Close() { b.init() close(b.workC) <-b.tasksFinishedC b.Runner.Close() }
[ "func", "(", "b", "*", "Buffer", ")", "Close", "(", ")", "{", "b", ".", "init", "(", ")", "\n\n", "close", "(", "b", ".", "workC", ")", "\n", "<-", "b", ".", "tasksFinishedC", "\n", "b", ".", "Runner", ".", "Close", "(", ")", "\n", "}" ]
// Close flushes the remaining tasks in the Buffer and Closes the underlying // Runner. // // Adding new tasks to the Buffer after Close has been invoked will cause a // panic.
[ "Close", "flushes", "the", "remaining", "tasks", "in", "the", "Buffer", "and", "Closes", "the", "underlying", "Runner", ".", "Adding", "new", "tasks", "to", "the", "Buffer", "after", "Close", "has", "been", "invoked", "will", "cause", "a", "panic", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/sync/parallel/buffer.go#L161-L167
8,135
luci/luci-go
server/caching/process.go
LRU
func (h LRUHandle) LRU(c context.Context) *lru.Cache { return c.Value(&processCacheKey).(*ProcessCacheData).caches[int(h)] }
go
func (h LRUHandle) LRU(c context.Context) *lru.Cache { return c.Value(&processCacheKey).(*ProcessCacheData).caches[int(h)] }
[ "func", "(", "h", "LRUHandle", ")", "LRU", "(", "c", "context", ".", "Context", ")", "*", "lru", ".", "Cache", "{", "return", "c", ".", "Value", "(", "&", "processCacheKey", ")", ".", "(", "*", "ProcessCacheData", ")", ".", "caches", "[", "int", "(...
// LRU returns global lru.Cache referenced by this handle. // // If the context doesn't have ProcessCacheData installed, this will panic.
[ "LRU", "returns", "global", "lru", ".", "Cache", "referenced", "by", "this", "handle", ".", "If", "the", "context", "doesn", "t", "have", "ProcessCacheData", "installed", "this", "will", "panic", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/server/caching/process.go#L63-L65
8,136
luci/luci-go
server/caching/process.go
Fetch
func (h SlotHandle) Fetch(c context.Context, cb FetchCallback) (interface{}, error) { return c.Value(&processCacheKey).(*ProcessCacheData).slots[int(h)].Get(c, lazyslot.Fetcher(cb)) }
go
func (h SlotHandle) Fetch(c context.Context, cb FetchCallback) (interface{}, error) { return c.Value(&processCacheKey).(*ProcessCacheData).slots[int(h)].Get(c, lazyslot.Fetcher(cb)) }
[ "func", "(", "h", "SlotHandle", ")", "Fetch", "(", "c", "context", ".", "Context", ",", "cb", "FetchCallback", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "c", ".", "Value", "(", "&", "processCacheKey", ")", ".", "(", "*", "P...
// Fetch returns the cached data, if it is available and fresh, or attempts to // refresh it by calling the given callback. // // If the context doesn't have ProcessCacheData installed, this will panic.
[ "Fetch", "returns", "the", "cached", "data", "if", "it", "is", "available", "and", "fresh", "or", "attempts", "to", "refresh", "it", "by", "calling", "the", "given", "callback", ".", "If", "the", "context", "doesn", "t", "have", "ProcessCacheData", "installe...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/server/caching/process.go#L101-L103
8,137
luci/luci-go
cipd/client/cipd/pkg/manifest.go
ReadManifest
func ReadManifest(r io.Reader) (manifest Manifest, err error) { blob, err := ioutil.ReadAll(r) if err == nil { err = json.Unmarshal(blob, &manifest) } return }
go
func ReadManifest(r io.Reader) (manifest Manifest, err error) { blob, err := ioutil.ReadAll(r) if err == nil { err = json.Unmarshal(blob, &manifest) } return }
[ "func", "ReadManifest", "(", "r", "io", ".", "Reader", ")", "(", "manifest", "Manifest", ",", "err", "error", ")", "{", "blob", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "r", ")", "\n", "if", "err", "==", "nil", "{", "err", "=", "json", "....
// ReadManifest reads and decodes manifest JSON from io.Reader.
[ "ReadManifest", "reads", "and", "decodes", "manifest", "JSON", "from", "io", ".", "Reader", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/pkg/manifest.go#L99-L105
8,138
luci/luci-go
cipd/client/cipd/pkg/manifest.go
WriteManifest
func WriteManifest(m *Manifest, w io.Writer) error { data, err := json.MarshalIndent(m, "", " ") if err != nil { return err } _, err = w.Write(data) return err }
go
func WriteManifest(m *Manifest, w io.Writer) error { data, err := json.MarshalIndent(m, "", " ") if err != nil { return err } _, err = w.Write(data) return err }
[ "func", "WriteManifest", "(", "m", "*", "Manifest", ",", "w", "io", ".", "Writer", ")", "error", "{", "data", ",", "err", ":=", "json", ".", "MarshalIndent", "(", "m", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", ...
// WriteManifest encodes and writes manifest JSON to io.Writer.
[ "WriteManifest", "encodes", "and", "writes", "manifest", "JSON", "to", "io", ".", "Writer", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/pkg/manifest.go#L108-L115
8,139
luci/luci-go
logdog/client/coordinator/client.go
NewClient
func NewClient(c *prpc.Client) *Client { return &Client{ C: logdog.NewLogsPRPCClient(c), Host: c.Host, } }
go
func NewClient(c *prpc.Client) *Client { return &Client{ C: logdog.NewLogsPRPCClient(c), Host: c.Host, } }
[ "func", "NewClient", "(", "c", "*", "prpc", ".", "Client", ")", "*", "Client", "{", "return", "&", "Client", "{", "C", ":", "logdog", ".", "NewLogsPRPCClient", "(", "c", ")", ",", "Host", ":", "c", ".", "Host", ",", "}", "\n", "}" ]
// NewClient returns a new Client instance bound to a pRPC Client.
[ "NewClient", "returns", "a", "new", "Client", "instance", "bound", "to", "a", "pRPC", "Client", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/client/coordinator/client.go#L43-L48
8,140
luci/luci-go
logdog/client/coordinator/client.go
Stream
func (c *Client) Stream(project types.ProjectName, path types.StreamPath) *Stream { return &Stream{ c: c, project: project, path: path, } }
go
func (c *Client) Stream(project types.ProjectName, path types.StreamPath) *Stream { return &Stream{ c: c, project: project, path: path, } }
[ "func", "(", "c", "*", "Client", ")", "Stream", "(", "project", "types", ".", "ProjectName", ",", "path", "types", ".", "StreamPath", ")", "*", "Stream", "{", "return", "&", "Stream", "{", "c", ":", "c", ",", "project", ":", "project", ",", "path", ...
// Stream returns a Stream instance for the named stream.
[ "Stream", "returns", "a", "Stream", "instance", "for", "the", "named", "stream", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/client/coordinator/client.go#L51-L57
8,141
luci/luci-go
tokenserver/appengine/impl/utils/policy/policy.go
Queryable
func (p *Policy) Queryable(c context.Context) (Queryable, error) { val, err := p.cache.Get(c, func(prev interface{}) (newQ interface{}, exp time.Duration, err error) { prevQ, _ := prev.(Queryable) newQ, err = p.grabQueryable(c, prevQ) if err == nil { exp = cacheExpiry(c) } return }) if err != nil { re...
go
func (p *Policy) Queryable(c context.Context) (Queryable, error) { val, err := p.cache.Get(c, func(prev interface{}) (newQ interface{}, exp time.Duration, err error) { prevQ, _ := prev.(Queryable) newQ, err = p.grabQueryable(c, prevQ) if err == nil { exp = cacheExpiry(c) } return }) if err != nil { re...
[ "func", "(", "p", "*", "Policy", ")", "Queryable", "(", "c", "context", ".", "Context", ")", "(", "Queryable", ",", "error", ")", "{", "val", ",", "err", ":=", "p", ".", "cache", ".", "Get", "(", "c", ",", "func", "(", "prev", "interface", "{", ...
// Queryable returns a form of the policy document optimized for queries. // // This is hot function called from each RPC handler. It uses local in-memory // cache to store the configs, synchronizing it with the state stored in the // datastore once a minute. // // Returns ErrNoPolicy if the policy config wasn't import...
[ "Queryable", "returns", "a", "form", "of", "the", "policy", "document", "optimized", "for", "queries", ".", "This", "is", "hot", "function", "called", "from", "each", "RPC", "handler", ".", "It", "uses", "local", "in", "-", "memory", "cache", "to", "store"...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/utils/policy/policy.go#L199-L212
8,142
luci/luci-go
tokenserver/appengine/impl/utils/policy/policy.go
grabQueryable
func (p *Policy) grabQueryable(c context.Context, prevQ Queryable) (Queryable, error) { c = logging.SetField(c, "policy", p.Name) logging.Infof(c, "Checking version of the policy in the datastore") hdr, err := getImportedPolicyHeader(c, p.Name) switch { case err != nil: return nil, errors.Annotate(err, "failed ...
go
func (p *Policy) grabQueryable(c context.Context, prevQ Queryable) (Queryable, error) { c = logging.SetField(c, "policy", p.Name) logging.Infof(c, "Checking version of the policy in the datastore") hdr, err := getImportedPolicyHeader(c, p.Name) switch { case err != nil: return nil, errors.Annotate(err, "failed ...
[ "func", "(", "p", "*", "Policy", ")", "grabQueryable", "(", "c", "context", ".", "Context", ",", "prevQ", "Queryable", ")", "(", "Queryable", ",", "error", ")", "{", "c", "=", "logging", ".", "SetField", "(", "c", ",", "\"", "\"", ",", "p", ".", ...
// grabQueryable is called whenever cached Queryable in p.cache expires.
[ "grabQueryable", "is", "called", "whenever", "cached", "Queryable", "in", "p", ".", "cache", "expires", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/utils/policy/policy.go#L215-L267
8,143
luci/luci-go
tokenserver/appengine/impl/utils/policy/policy.go
cacheExpiry
func cacheExpiry(c context.Context) time.Duration { rnd := time.Duration(mathrand.Int63n(c, int64(time.Minute))) return 4*time.Minute + rnd }
go
func cacheExpiry(c context.Context) time.Duration { rnd := time.Duration(mathrand.Int63n(c, int64(time.Minute))) return 4*time.Minute + rnd }
[ "func", "cacheExpiry", "(", "c", "context", ".", "Context", ")", "time", ".", "Duration", "{", "rnd", ":=", "time", ".", "Duration", "(", "mathrand", ".", "Int63n", "(", "c", ",", "int64", "(", "time", ".", "Minute", ")", ")", ")", "\n", "return", ...
// cacheExpiry returns a random duration from [4 min, 5 min). // // It's used to define when to refresh in-memory Queryable cache. We randomize // it to desynchronize cache updates of different Policy instances.
[ "cacheExpiry", "returns", "a", "random", "duration", "from", "[", "4", "min", "5", "min", ")", ".", "It", "s", "used", "to", "define", "when", "to", "refresh", "in", "-", "memory", "Queryable", "cache", ".", "We", "randomize", "it", "to", "desynchronize"...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/utils/policy/policy.go#L273-L276
8,144
luci/luci-go
common/tsmon/target/context.go
Set
func Set(ctx context.Context, t types.Target) context.Context { return context.WithValue(ctx, targetKey, t) }
go
func Set(ctx context.Context, t types.Target) context.Context { return context.WithValue(ctx, targetKey, t) }
[ "func", "Set", "(", "ctx", "context", ".", "Context", ",", "t", "types", ".", "Target", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "ctx", ",", "targetKey", ",", "t", ")", "\n", "}" ]
// Set returns a new context with the given target set. If this context is // passed to metric Set, Get or Incr methods the metrics for that target will be // affected. A nil target means to use the default target.
[ "Set", "returns", "a", "new", "context", "with", "the", "given", "target", "set", ".", "If", "this", "context", "is", "passed", "to", "metric", "Set", "Get", "or", "Incr", "methods", "the", "metrics", "for", "that", "target", "will", "be", "affected", "....
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/tsmon/target/context.go#L30-L32
8,145
luci/luci-go
common/tsmon/target/context.go
Get
func Get(ctx context.Context) types.Target { if t, ok := ctx.Value(targetKey).(types.Target); ok { return t } return nil }
go
func Get(ctx context.Context) types.Target { if t, ok := ctx.Value(targetKey).(types.Target); ok { return t } return nil }
[ "func", "Get", "(", "ctx", "context", ".", "Context", ")", "types", ".", "Target", "{", "if", "t", ",", "ok", ":=", "ctx", ".", "Value", "(", "targetKey", ")", ".", "(", "types", ".", "Target", ")", ";", "ok", "{", "return", "t", "\n", "}", "\n...
// Get returns the target set in this context.
[ "Get", "returns", "the", "target", "set", "in", "this", "context", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/tsmon/target/context.go#L35-L40
8,146
luci/luci-go
common/tsmon/target/context.go
GetWithDefault
func GetWithDefault(ctx context.Context, def types.Target) types.Target { if t := Get(ctx); t != nil { return t } return def }
go
func GetWithDefault(ctx context.Context, def types.Target) types.Target { if t := Get(ctx); t != nil { return t } return def }
[ "func", "GetWithDefault", "(", "ctx", "context", ".", "Context", ",", "def", "types", ".", "Target", ")", "types", ".", "Target", "{", "if", "t", ":=", "Get", "(", "ctx", ")", ";", "t", "!=", "nil", "{", "return", "t", "\n", "}", "\n", "return", ...
// GetWithDefault is like Get, except it returns the given default value if // there is no target set in the context.
[ "GetWithDefault", "is", "like", "Get", "except", "it", "returns", "the", "given", "default", "value", "if", "there", "is", "no", "target", "set", "in", "the", "context", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/tsmon/target/context.go#L44-L49
8,147
luci/luci-go
logdog/appengine/coordinator/flex/logs/query.go
applyTrinary
func applyTrinary(q *ds.Query, v logdog.QueryRequest_Trinary, f func(*ds.Query, bool) *ds.Query) *ds.Query { switch v { case logdog.QueryRequest_YES: return f(q, true) case logdog.QueryRequest_NO: return f(q, false) default: // Default is "both". return q } }
go
func applyTrinary(q *ds.Query, v logdog.QueryRequest_Trinary, f func(*ds.Query, bool) *ds.Query) *ds.Query { switch v { case logdog.QueryRequest_YES: return f(q, true) case logdog.QueryRequest_NO: return f(q, false) default: // Default is "both". return q } }
[ "func", "applyTrinary", "(", "q", "*", "ds", ".", "Query", ",", "v", "logdog", ".", "QueryRequest_Trinary", ",", "f", "func", "(", "*", "ds", ".", "Query", ",", "bool", ")", "*", "ds", ".", "Query", ")", "*", "ds", ".", "Query", "{", "switch", "v...
// applyTrinary executes the supplied query modification function based on a // trinary value. // // If the value is "YES", it will be executed with "true". If "NO", "false". If // "BOTH", it will not be executed.
[ "applyTrinary", "executes", "the", "supplied", "query", "modification", "function", "based", "on", "a", "trinary", "value", ".", "If", "the", "value", "is", "YES", "it", "will", "be", "executed", "with", "true", ".", "If", "NO", "false", ".", "If", "BOTH",...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/appengine/coordinator/flex/logs/query.go#L46-L58
8,148
luci/luci-go
logdog/appengine/coordinator/flex/logs/query.go
Query
func (s *server) Query(c context.Context, req *logdog.QueryRequest) (*logdog.QueryResponse, error) { // Non-admin users may not request purged results. canSeePurged := true if err := coordinator.IsAdminUser(c); err != nil { canSeePurged = false // Non-admin user. if req.Purged == logdog.QueryRequest_YES { ...
go
func (s *server) Query(c context.Context, req *logdog.QueryRequest) (*logdog.QueryResponse, error) { // Non-admin users may not request purged results. canSeePurged := true if err := coordinator.IsAdminUser(c); err != nil { canSeePurged = false // Non-admin user. if req.Purged == logdog.QueryRequest_YES { ...
[ "func", "(", "s", "*", "server", ")", "Query", "(", "c", "context", ".", "Context", ",", "req", "*", "logdog", ".", "QueryRequest", ")", "(", "*", "logdog", ".", "QueryResponse", ",", "error", ")", "{", "// Non-admin users may not request purged results.", "...
// Query returns log stream paths that match the requested query.
[ "Query", "returns", "log", "stream", "paths", "that", "match", "the", "requested", "query", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/appengine/coordinator/flex/logs/query.go#L61-L106
8,149
luci/luci-go
machine-db/appengine/rpc/queries.go
selectInInt64
func selectInInt64(b squirrel.SelectBuilder, expr string, values []int64) squirrel.SelectBuilder { if len(values) == 0 { return b } args := make([]interface{}, len(values)) for i, val := range values { args[i] = val } return b.Where(expr+" IN ("+squirrel.Placeholders(len(args))+")", args...) }
go
func selectInInt64(b squirrel.SelectBuilder, expr string, values []int64) squirrel.SelectBuilder { if len(values) == 0 { return b } args := make([]interface{}, len(values)) for i, val := range values { args[i] = val } return b.Where(expr+" IN ("+squirrel.Placeholders(len(args))+")", args...) }
[ "func", "selectInInt64", "(", "b", "squirrel", ".", "SelectBuilder", ",", "expr", "string", ",", "values", "[", "]", "int64", ")", "squirrel", ".", "SelectBuilder", "{", "if", "len", "(", "values", ")", "==", "0", "{", "return", "b", "\n", "}", "\n", ...
// selectInInt64 returns the given SELECT modified with a WHERE IN clause. // expr is the left-hand side of the IN operator, values is the right-hand side. No-op if values is empty.
[ "selectInInt64", "returns", "the", "given", "SELECT", "modified", "with", "a", "WHERE", "IN", "clause", ".", "expr", "is", "the", "left", "-", "hand", "side", "of", "the", "IN", "operator", "values", "is", "the", "right", "-", "hand", "side", ".", "No", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/queries.go#L25-L34
8,150
luci/luci-go
machine-db/appengine/rpc/queries.go
selectInState
func selectInState(b squirrel.SelectBuilder, expr string, values []common.State) squirrel.SelectBuilder { if len(values) == 0 { return b } args := make([]interface{}, len(values)) for i, val := range values { args[i] = val } return b.Where(expr+" IN ("+squirrel.Placeholders(len(args))+")", args...) }
go
func selectInState(b squirrel.SelectBuilder, expr string, values []common.State) squirrel.SelectBuilder { if len(values) == 0 { return b } args := make([]interface{}, len(values)) for i, val := range values { args[i] = val } return b.Where(expr+" IN ("+squirrel.Placeholders(len(args))+")", args...) }
[ "func", "selectInState", "(", "b", "squirrel", ".", "SelectBuilder", ",", "expr", "string", ",", "values", "[", "]", "common", ".", "State", ")", "squirrel", ".", "SelectBuilder", "{", "if", "len", "(", "values", ")", "==", "0", "{", "return", "b", "\n...
// selectInState returns the given SELECT modified with a WHERE IN clause. // expr is the left-hand side of the IN operator, values is the right-hand side. No-op if values is empty.
[ "selectInState", "returns", "the", "given", "SELECT", "modified", "with", "a", "WHERE", "IN", "clause", ".", "expr", "is", "the", "left", "-", "hand", "side", "of", "the", "IN", "operator", "values", "is", "the", "right", "-", "hand", "side", ".", "No", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/queries.go#L38-L47
8,151
luci/luci-go
lucicfg/cli/cmds/diff/diff.go
Cmd
func Cmd(params base.Parameters) *subcommands.Command { return &subcommands.Command{ UsageLine: "semantic-diff SCRIPT CONFIG [CONFIG CONFIG ...]", ShortDesc: "interprets a high-level config, compares the result to existing configs", LongDesc: `Interprets a high-level config, compares the result to existing confi...
go
func Cmd(params base.Parameters) *subcommands.Command { return &subcommands.Command{ UsageLine: "semantic-diff SCRIPT CONFIG [CONFIG CONFIG ...]", ShortDesc: "interprets a high-level config, compares the result to existing configs", LongDesc: `Interprets a high-level config, compares the result to existing confi...
[ "func", "Cmd", "(", "params", "base", ".", "Parameters", ")", "*", "subcommands", ".", "Command", "{", "return", "&", "subcommands", ".", "Command", "{", "UsageLine", ":", "\"", "\"", ",", "ShortDesc", ":", "\"", "\"", ",", "LongDesc", ":", "`Interprets ...
// Cmd is 'semantic-diff' subcommand.
[ "Cmd", "is", "semantic", "-", "diff", "subcommand", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/cli/cmds/diff/diff.go#L48-L78
8,152
luci/luci-go
lucicfg/cli/cmds/diff/diff.go
normalizeOne
func normalizeOne(ctx context.Context, in []byte, p *configPair) (out []byte, err error) { msg := reflect.New(p.typ.Elem()).Interface().(proto.Message) if err = luciproto.UnmarshalTextML(string(in), msg); err != nil { return } if err = p.protoNormalizer(ctx, msg); err != nil { return } return []byte(proto.Mar...
go
func normalizeOne(ctx context.Context, in []byte, p *configPair) (out []byte, err error) { msg := reflect.New(p.typ.Elem()).Interface().(proto.Message) if err = luciproto.UnmarshalTextML(string(in), msg); err != nil { return } if err = p.protoNormalizer(ctx, msg); err != nil { return } return []byte(proto.Mar...
[ "func", "normalizeOne", "(", "ctx", "context", ".", "Context", ",", "in", "[", "]", "byte", ",", "p", "*", "configPair", ")", "(", "out", "[", "]", "byte", ",", "err", "error", ")", "{", "msg", ":=", "reflect", ".", "New", "(", "p", ".", "typ", ...
// normalizeOne deserializes the proto, passes it through normalizer, serializes // it back.
[ "normalizeOne", "deserializes", "the", "proto", "passes", "it", "through", "normalizer", "serializes", "it", "back", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/cli/cmds/diff/diff.go#L253-L262
8,153
luci/luci-go
milo/rpc/buildinfo.go
Get
func (svc *BuildInfoService) Get(c context.Context, req *milo.BuildInfoRequest) (*milo.BuildInfoResponse, error) { projectHint := req.ProjectHint if projectHint != "" { if err := config.ValidateProjectName(projectHint); err != nil { return nil, grpcutil.Errf(codes.InvalidArgument, "invalid project hint: %s", err...
go
func (svc *BuildInfoService) Get(c context.Context, req *milo.BuildInfoRequest) (*milo.BuildInfoResponse, error) { projectHint := req.ProjectHint if projectHint != "" { if err := config.ValidateProjectName(projectHint); err != nil { return nil, grpcutil.Errf(codes.InvalidArgument, "invalid project hint: %s", err...
[ "func", "(", "svc", "*", "BuildInfoService", ")", "Get", "(", "c", "context", ".", "Context", ",", "req", "*", "milo", ".", "BuildInfoRequest", ")", "(", "*", "milo", ".", "BuildInfoResponse", ",", "error", ")", "{", "projectHint", ":=", "req", ".", "P...
// Get implements milo.BuildInfoServer.
[ "Get", "implements", "milo", ".", "BuildInfoServer", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/rpc/buildinfo.go#L90-L130
8,154
luci/luci-go
client/isolated/scattergather.go
Set
func (sc *ScatterGather) Set(value string) error { parsed := strings.SplitN(value, ":", 2) if len(parsed) != 2 { return errors.Reason("malformed input %q", value).Err() } if *sc == nil { *sc = ScatterGather{} } return sc.Add(parsed[0], parsed[1]) }
go
func (sc *ScatterGather) Set(value string) error { parsed := strings.SplitN(value, ":", 2) if len(parsed) != 2 { return errors.Reason("malformed input %q", value).Err() } if *sc == nil { *sc = ScatterGather{} } return sc.Add(parsed[0], parsed[1]) }
[ "func", "(", "sc", "*", "ScatterGather", ")", "Set", "(", "value", "string", ")", "error", "{", "parsed", ":=", "strings", ".", "SplitN", "(", "value", ",", "\"", "\"", ",", "2", ")", "\n", "if", "len", "(", "parsed", ")", "!=", "2", "{", "return...
// Set implements the flags.Var interface.
[ "Set", "implements", "the", "flags", ".", "Var", "interface", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/client/isolated/scattergather.go#L55-L64
8,155
luci/luci-go
common/proto/srcman/diff.go
add
func (c *modifiedTracker) add(st ManifestDiff_Stat) ManifestDiff_Stat { *c = *c || st != ManifestDiff_EQUAL return st }
go
func (c *modifiedTracker) add(st ManifestDiff_Stat) ManifestDiff_Stat { *c = *c || st != ManifestDiff_EQUAL return st }
[ "func", "(", "c", "*", "modifiedTracker", ")", "add", "(", "st", "ManifestDiff_Stat", ")", "ManifestDiff_Stat", "{", "*", "c", "=", "*", "c", "||", "st", "!=", "ManifestDiff_EQUAL", "\n", "return", "st", "\n", "}" ]
// add incorporates `st` into this modifiedTracker's state.
[ "add", "incorporates", "st", "into", "this", "modifiedTracker", "s", "state", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/proto/srcman/diff.go#L89-L92
8,156
luci/luci-go
common/proto/srcman/diff.go
Diff
func (old *Manifest_GitCheckout) Diff(new *Manifest_GitCheckout) *ManifestDiff_GitCheckout { if old == nil && new == nil { return nil } ret := &ManifestDiff_GitCheckout{} ret.Overall = zeroCmpTwo(old, new, func() ManifestDiff_Stat { if old.RepoUrl == new.RepoUrl { // For now, the canoncial 'diff' URL is al...
go
func (old *Manifest_GitCheckout) Diff(new *Manifest_GitCheckout) *ManifestDiff_GitCheckout { if old == nil && new == nil { return nil } ret := &ManifestDiff_GitCheckout{} ret.Overall = zeroCmpTwo(old, new, func() ManifestDiff_Stat { if old.RepoUrl == new.RepoUrl { // For now, the canoncial 'diff' URL is al...
[ "func", "(", "old", "*", "Manifest_GitCheckout", ")", "Diff", "(", "new", "*", "Manifest_GitCheckout", ")", "*", "ManifestDiff_GitCheckout", "{", "if", "old", "==", "nil", "&&", "new", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "ret", ":=", "&...
// Diff generates a Stat reflecting the difference between the `old` // GitCheckout and the `new` one. // // This will generate a Stat of `DIFF` if the two GitCheckout's are non-nil and // share the same RepoUrl. // // This only calculates the pure-data differences. Notably, this will not reach // out to any remote ser...
[ "Diff", "generates", "a", "Stat", "reflecting", "the", "difference", "between", "the", "old", "GitCheckout", "and", "the", "new", "one", ".", "This", "will", "generate", "a", "Stat", "of", "DIFF", "if", "the", "two", "GitCheckout", "s", "are", "non", "-", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/proto/srcman/diff.go#L123-L163
8,157
luci/luci-go
common/proto/srcman/diff.go
Diff
func (old *Manifest_CIPDPackage) Diff(new *Manifest_CIPDPackage) ManifestDiff_Stat { return zeroCmpTwo(old, new, func() ManifestDiff_Stat { // Version and PackagePattern don't matter for diff purposes. return zeroCmpTwo(old.InstanceId, new.InstanceId, nil) }) }
go
func (old *Manifest_CIPDPackage) Diff(new *Manifest_CIPDPackage) ManifestDiff_Stat { return zeroCmpTwo(old, new, func() ManifestDiff_Stat { // Version and PackagePattern don't matter for diff purposes. return zeroCmpTwo(old.InstanceId, new.InstanceId, nil) }) }
[ "func", "(", "old", "*", "Manifest_CIPDPackage", ")", "Diff", "(", "new", "*", "Manifest_CIPDPackage", ")", "ManifestDiff_Stat", "{", "return", "zeroCmpTwo", "(", "old", ",", "new", ",", "func", "(", ")", "ManifestDiff_Stat", "{", "// Version and PackagePattern do...
// Diff generates a ManifestDiff_Stat reflecting the difference between the `old` // CIPDPackage and the `new` one.
[ "Diff", "generates", "a", "ManifestDiff_Stat", "reflecting", "the", "difference", "between", "the", "old", "CIPDPackage", "and", "the", "new", "one", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/proto/srcman/diff.go#L167-L172
8,158
luci/luci-go
common/proto/srcman/diff.go
IsolatedDiff
func IsolatedDiff(oldisos, newisos []*Manifest_Isolated) ManifestDiff_Stat { return zeroCmpTwo(oldisos, newisos, func() ManifestDiff_Stat { // we know they're non-zero and also have the same length at this point for i, old := range oldisos { new := newisos[i] if old.Namespace != new.Namespace { return Ma...
go
func IsolatedDiff(oldisos, newisos []*Manifest_Isolated) ManifestDiff_Stat { return zeroCmpTwo(oldisos, newisos, func() ManifestDiff_Stat { // we know they're non-zero and also have the same length at this point for i, old := range oldisos { new := newisos[i] if old.Namespace != new.Namespace { return Ma...
[ "func", "IsolatedDiff", "(", "oldisos", ",", "newisos", "[", "]", "*", "Manifest_Isolated", ")", "ManifestDiff_Stat", "{", "return", "zeroCmpTwo", "(", "oldisos", ",", "newisos", ",", "func", "(", ")", "ManifestDiff_Stat", "{", "// we know they're non-zero and also ...
// IsolatedDiff produces a ManifestDiff_Stat reflecting the difference between // two lists of Manifest_Isolated's.
[ "IsolatedDiff", "produces", "a", "ManifestDiff_Stat", "reflecting", "the", "difference", "between", "two", "lists", "of", "Manifest_Isolated", "s", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/proto/srcman/diff.go#L176-L190
8,159
luci/luci-go
common/proto/srcman/diff.go
Diff
func (old *Manifest_Directory) Diff(new *Manifest_Directory) *ManifestDiff_Directory { ret := &ManifestDiff_Directory{} ret.Overall = zeroCmpTwo(old, new, func() ManifestDiff_Stat { var dirChanged modifiedTracker if ret.GitCheckout = old.GitCheckout.Diff(new.GitCheckout); ret.GitCheckout != nil { dirChanged....
go
func (old *Manifest_Directory) Diff(new *Manifest_Directory) *ManifestDiff_Directory { ret := &ManifestDiff_Directory{} ret.Overall = zeroCmpTwo(old, new, func() ManifestDiff_Stat { var dirChanged modifiedTracker if ret.GitCheckout = old.GitCheckout.Diff(new.GitCheckout); ret.GitCheckout != nil { dirChanged....
[ "func", "(", "old", "*", "Manifest_Directory", ")", "Diff", "(", "new", "*", "Manifest_Directory", ")", "*", "ManifestDiff_Directory", "{", "ret", ":=", "&", "ManifestDiff_Directory", "{", "}", "\n\n", "ret", ".", "Overall", "=", "zeroCmpTwo", "(", "old", ",...
// Diff generates a ManifestDiff_Directory object which shows what changed // between the `old` manifest directory and the `new` manifest directory.
[ "Diff", "generates", "a", "ManifestDiff_Directory", "object", "which", "shows", "what", "changed", "between", "the", "old", "manifest", "directory", "and", "the", "new", "manifest", "directory", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/proto/srcman/diff.go#L194-L229
8,160
luci/luci-go
common/proto/srcman/diff.go
Diff
func (old *Manifest) Diff(new *Manifest) *ManifestDiff { ret := &ManifestDiff{ Old: old, New: new, Directories: map[string]*ManifestDiff_Directory{}, } ret.Overall = zeroCmpTwo(old, new, func() ManifestDiff_Stat { var anyChanged modifiedTracker for path, olddir := range old.Directories { ...
go
func (old *Manifest) Diff(new *Manifest) *ManifestDiff { ret := &ManifestDiff{ Old: old, New: new, Directories: map[string]*ManifestDiff_Directory{}, } ret.Overall = zeroCmpTwo(old, new, func() ManifestDiff_Stat { var anyChanged modifiedTracker for path, olddir := range old.Directories { ...
[ "func", "(", "old", "*", "Manifest", ")", "Diff", "(", "new", "*", "Manifest", ")", "*", "ManifestDiff", "{", "ret", ":=", "&", "ManifestDiff", "{", "Old", ":", "old", ",", "New", ":", "new", ",", "Directories", ":", "map", "[", "string", "]", "*",...
// Diff generates a ManifestDiff object which shows what changed between the // `old` manifest and the `new` manifest. // // This only calculates the pure-data differences. Notably, this will not reach // out to any remote services to populate the git_history field.
[ "Diff", "generates", "a", "ManifestDiff", "object", "which", "shows", "what", "changed", "between", "the", "old", "manifest", "and", "the", "new", "manifest", ".", "This", "only", "calculates", "the", "pure", "-", "data", "differences", ".", "Notably", "this",...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/proto/srcman/diff.go#L236-L261
8,161
luci/luci-go
dm/api/template/loader.go
LoadFile
func LoadFile(c context.Context, project, ref string) (file *File, vers string, err error) { // If ref is "", this will be a standard project config set. cfgSet := config.RefSet(project, ref) file = &File{} var meta config.Meta if err = cfgclient.Get(c, cfgclient.AsService, cfgSet, "dm/quest_templates.cfg", textp...
go
func LoadFile(c context.Context, project, ref string) (file *File, vers string, err error) { // If ref is "", this will be a standard project config set. cfgSet := config.RefSet(project, ref) file = &File{} var meta config.Meta if err = cfgclient.Get(c, cfgclient.AsService, cfgSet, "dm/quest_templates.cfg", textp...
[ "func", "LoadFile", "(", "c", "context", ".", "Context", ",", "project", ",", "ref", "string", ")", "(", "file", "*", "File", ",", "vers", "string", ",", "err", "error", ")", "{", "// If ref is \"\", this will be a standard project config set.", "cfgSet", ":=", ...
// LoadFile loads a File by configSet and path.
[ "LoadFile", "loads", "a", "File", "by", "configSet", "and", "path", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/template/loader.go#L29-L41
8,162
luci/luci-go
dm/api/service/v1/attempt_data.go
NewJsonResult
func NewJsonResult(data string, exps ...time.Time) *JsonResult { exp := time.Time{} switch l := len(exps); { case l == 1: exp = exps[0] case l > 1: panic("too many exps") } return &JsonResult{ Object: data, Size: uint32(len(data)), Expiration: google_pb.NewTimestamp(exp), } }
go
func NewJsonResult(data string, exps ...time.Time) *JsonResult { exp := time.Time{} switch l := len(exps); { case l == 1: exp = exps[0] case l > 1: panic("too many exps") } return &JsonResult{ Object: data, Size: uint32(len(data)), Expiration: google_pb.NewTimestamp(exp), } }
[ "func", "NewJsonResult", "(", "data", "string", ",", "exps", "...", "time", ".", "Time", ")", "*", "JsonResult", "{", "exp", ":=", "time", ".", "Time", "{", "}", "\n", "switch", "l", ":=", "len", "(", "exps", ")", ";", "{", "case", "l", "==", "1"...
// NewJsonResult creates a new JsonResult object with optional expiration time.
[ "NewJsonResult", "creates", "a", "new", "JsonResult", "object", "with", "optional", "expiration", "time", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/service/v1/attempt_data.go#L24-L37
8,163
luci/luci-go
dm/api/service/v1/attempt_data.go
NewDatalessJsonResult
func NewDatalessJsonResult(size uint32, exps ...time.Time) *JsonResult { exp := time.Time{} switch l := len(exps); { case l == 1: exp = exps[0] case l > 1: panic("too many exps") } return &JsonResult{Size: size, Expiration: google_pb.NewTimestamp(exp)} }
go
func NewDatalessJsonResult(size uint32, exps ...time.Time) *JsonResult { exp := time.Time{} switch l := len(exps); { case l == 1: exp = exps[0] case l > 1: panic("too many exps") } return &JsonResult{Size: size, Expiration: google_pb.NewTimestamp(exp)} }
[ "func", "NewDatalessJsonResult", "(", "size", "uint32", ",", "exps", "...", "time", ".", "Time", ")", "*", "JsonResult", "{", "exp", ":=", "time", ".", "Time", "{", "}", "\n", "switch", "l", ":=", "len", "(", "exps", ")", ";", "{", "case", "l", "==...
// NewDatalessJsonResult creates a new JsonResult object without data and with // optional expiration time.
[ "NewDatalessJsonResult", "creates", "a", "new", "JsonResult", "object", "without", "data", "and", "with", "optional", "expiration", "time", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/service/v1/attempt_data.go#L41-L50
8,164
luci/luci-go
dm/api/service/v1/attempt_data.go
NewAttemptExecuting
func NewAttemptExecuting(curExID uint32) *Attempt { return &Attempt{ Data: &Attempt_Data{ NumExecutions: curExID, AttemptType: &Attempt_Data_Executing_{ &Attempt_Data_Executing{CurExecutionId: curExID}}}} }
go
func NewAttemptExecuting(curExID uint32) *Attempt { return &Attempt{ Data: &Attempt_Data{ NumExecutions: curExID, AttemptType: &Attempt_Data_Executing_{ &Attempt_Data_Executing{CurExecutionId: curExID}}}} }
[ "func", "NewAttemptExecuting", "(", "curExID", "uint32", ")", "*", "Attempt", "{", "return", "&", "Attempt", "{", "Data", ":", "&", "Attempt_Data", "{", "NumExecutions", ":", "curExID", ",", "AttemptType", ":", "&", "Attempt_Data_Executing_", "{", "&", "Attemp...
// NewAttemptExecuting creates an Attempt in the EXECUTING state.
[ "NewAttemptExecuting", "creates", "an", "Attempt", "in", "the", "EXECUTING", "state", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/service/v1/attempt_data.go#L61-L67
8,165
luci/luci-go
dm/api/service/v1/attempt_data.go
NewAttemptWaiting
func NewAttemptWaiting(numWaiting uint32) *Attempt { return &Attempt{ Data: &Attempt_Data{ AttemptType: &Attempt_Data_Waiting_{ &Attempt_Data_Waiting{NumWaiting: numWaiting}}}} }
go
func NewAttemptWaiting(numWaiting uint32) *Attempt { return &Attempt{ Data: &Attempt_Data{ AttemptType: &Attempt_Data_Waiting_{ &Attempt_Data_Waiting{NumWaiting: numWaiting}}}} }
[ "func", "NewAttemptWaiting", "(", "numWaiting", "uint32", ")", "*", "Attempt", "{", "return", "&", "Attempt", "{", "Data", ":", "&", "Attempt_Data", "{", "AttemptType", ":", "&", "Attempt_Data_Waiting_", "{", "&", "Attempt_Data_Waiting", "{", "NumWaiting", ":", ...
// NewAttemptWaiting creates an Attempt in the WAITING state.
[ "NewAttemptWaiting", "creates", "an", "Attempt", "in", "the", "WAITING", "state", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/service/v1/attempt_data.go#L70-L75
8,166
luci/luci-go
dm/api/service/v1/attempt_data.go
NewAttemptFinished
func NewAttemptFinished(result *JsonResult) *Attempt { return &Attempt{ Data: &Attempt_Data{ AttemptType: &Attempt_Data_Finished_{ &Attempt_Data_Finished{Data: result}}}} }
go
func NewAttemptFinished(result *JsonResult) *Attempt { return &Attempt{ Data: &Attempt_Data{ AttemptType: &Attempt_Data_Finished_{ &Attempt_Data_Finished{Data: result}}}} }
[ "func", "NewAttemptFinished", "(", "result", "*", "JsonResult", ")", "*", "Attempt", "{", "return", "&", "Attempt", "{", "Data", ":", "&", "Attempt_Data", "{", "AttemptType", ":", "&", "Attempt_Data_Finished_", "{", "&", "Attempt_Data_Finished", "{", "Data", "...
// NewAttemptFinished creates an Attempt in the FINISHED state.
[ "NewAttemptFinished", "creates", "an", "Attempt", "in", "the", "FINISHED", "state", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/service/v1/attempt_data.go#L78-L83
8,167
luci/luci-go
dm/api/service/v1/attempt_data.go
NewAttemptAbnormalFinish
func NewAttemptAbnormalFinish(af *AbnormalFinish) *Attempt { return &Attempt{ Data: &Attempt_Data{ AttemptType: &Attempt_Data_AbnormalFinish{af}}} }
go
func NewAttemptAbnormalFinish(af *AbnormalFinish) *Attempt { return &Attempt{ Data: &Attempt_Data{ AttemptType: &Attempt_Data_AbnormalFinish{af}}} }
[ "func", "NewAttemptAbnormalFinish", "(", "af", "*", "AbnormalFinish", ")", "*", "Attempt", "{", "return", "&", "Attempt", "{", "Data", ":", "&", "Attempt_Data", "{", "AttemptType", ":", "&", "Attempt_Data_AbnormalFinish", "{", "af", "}", "}", "}", "\n", "}" ...
// NewAttemptAbnormalFinish creates an Attempt in the ABNORMAL_FINISH state.
[ "NewAttemptAbnormalFinish", "creates", "an", "Attempt", "in", "the", "ABNORMAL_FINISH", "state", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/service/v1/attempt_data.go#L86-L90
8,168
luci/luci-go
dm/api/service/v1/attempt_data.go
State
func (d *Attempt_Data) State() Attempt_State { if d != nil { switch d.AttemptType.(type) { case *Attempt_Data_Scheduling_: return Attempt_SCHEDULING case *Attempt_Data_Executing_: return Attempt_EXECUTING case *Attempt_Data_Waiting_: return Attempt_WAITING case *Attempt_Data_Finished_: return Att...
go
func (d *Attempt_Data) State() Attempt_State { if d != nil { switch d.AttemptType.(type) { case *Attempt_Data_Scheduling_: return Attempt_SCHEDULING case *Attempt_Data_Executing_: return Attempt_EXECUTING case *Attempt_Data_Waiting_: return Attempt_WAITING case *Attempt_Data_Finished_: return Att...
[ "func", "(", "d", "*", "Attempt_Data", ")", "State", "(", ")", "Attempt_State", "{", "if", "d", "!=", "nil", "{", "switch", "d", ".", "AttemptType", ".", "(", "type", ")", "{", "case", "*", "Attempt_Data_Scheduling_", ":", "return", "Attempt_SCHEDULING", ...
// State computes the Attempt_State for the current Attempt_Data
[ "State", "computes", "the", "Attempt_State", "for", "the", "current", "Attempt_Data" ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/service/v1/attempt_data.go#L93-L109
8,169
luci/luci-go
dm/api/service/v1/attempt_data.go
NormalizePartial
func (d *Attempt) NormalizePartial() { p := d.GetPartial() if p == nil { return } if !(p.Data || p.Executions || p.FwdDeps || p.BackDeps || p.Result != Attempt_Partial_LOADED) { d.Partial = nil } }
go
func (d *Attempt) NormalizePartial() { p := d.GetPartial() if p == nil { return } if !(p.Data || p.Executions || p.FwdDeps || p.BackDeps || p.Result != Attempt_Partial_LOADED) { d.Partial = nil } }
[ "func", "(", "d", "*", "Attempt", ")", "NormalizePartial", "(", ")", "{", "p", ":=", "d", ".", "GetPartial", "(", ")", "\n", "if", "p", "==", "nil", "{", "return", "\n", "}", "\n", "if", "!", "(", "p", ".", "Data", "||", "p", ".", "Executions",...
// NormalizePartial will nil out the Partial field for this Attempt if all // Partial fields are false.
[ "NormalizePartial", "will", "nil", "out", "the", "Partial", "field", "for", "this", "Attempt", "if", "all", "Partial", "fields", "are", "false", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/service/v1/attempt_data.go#L113-L122
8,170
luci/luci-go
dm/api/service/v1/attempt_data.go
Any
func (p *Attempt_Partial) Any() bool { return (p.BackDeps || p.Data || p.Executions || p.FwdDeps || p.Result == Attempt_Partial_NOT_LOADED) }
go
func (p *Attempt_Partial) Any() bool { return (p.BackDeps || p.Data || p.Executions || p.FwdDeps || p.Result == Attempt_Partial_NOT_LOADED) }
[ "func", "(", "p", "*", "Attempt_Partial", ")", "Any", "(", ")", "bool", "{", "return", "(", "p", ".", "BackDeps", "||", "p", ".", "Data", "||", "p", ".", "Executions", "||", "p", ".", "FwdDeps", "||", "p", ".", "Result", "==", "Attempt_Partial_NOT_LO...
// Any returns true iff any of the Partial fields are true such that they could // be successfully loaded on a subsequent query.
[ "Any", "returns", "true", "iff", "any", "of", "the", "Partial", "fields", "are", "true", "such", "that", "they", "could", "be", "successfully", "loaded", "on", "a", "subsequent", "query", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/dm/api/service/v1/attempt_data.go#L126-L129
8,171
luci/luci-go
common/sync/parallel/workPool.go
WorkPool
func WorkPool(workers int, gen func(chan<- func() error)) error { return multiErrorFromErrors(Run(workers, gen)) }
go
func WorkPool(workers int, gen func(chan<- func() error)) error { return multiErrorFromErrors(Run(workers, gen)) }
[ "func", "WorkPool", "(", "workers", "int", ",", "gen", "func", "(", "chan", "<-", "func", "(", ")", "error", ")", ")", "error", "{", "return", "multiErrorFromErrors", "(", "Run", "(", "workers", ",", "gen", ")", ")", "\n", "}" ]
// WorkPool creates a fixed-size pool of worker goroutines. A supplied generator // method creates task functions and passes them through to the work pool. // // WorkPool will use at most workers goroutines to execute the supplied tasks. // If workers is <= 0, WorkPool will be unbounded and behave like FanOutIn. // // ...
[ "WorkPool", "creates", "a", "fixed", "-", "size", "pool", "of", "worker", "goroutines", ".", "A", "supplied", "generator", "method", "creates", "task", "functions", "and", "passes", "them", "through", "to", "the", "work", "pool", ".", "WorkPool", "will", "us...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/sync/parallel/workPool.go#L29-L31
8,172
luci/luci-go
common/sync/parallel/workPool.go
multiErrorFromErrors
func multiErrorFromErrors(ch <-chan error) error { if ch == nil { return nil } ret := errors.MultiError(nil) for e := range ch { if e == nil { continue } ret = append(ret, e) } if len(ret) == 0 { return nil } return ret }
go
func multiErrorFromErrors(ch <-chan error) error { if ch == nil { return nil } ret := errors.MultiError(nil) for e := range ch { if e == nil { continue } ret = append(ret, e) } if len(ret) == 0 { return nil } return ret }
[ "func", "multiErrorFromErrors", "(", "ch", "<-", "chan", "error", ")", "error", "{", "if", "ch", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "ret", ":=", "errors", ".", "MultiError", "(", "nil", ")", "\n", "for", "e", ":=", "range", "ch", "...
// multiErrorFromErrors takes an error-channel, blocks on it, and returns // a MultiError for any errors pushed to it over the channel, or nil if // all the errors were nil.
[ "multiErrorFromErrors", "takes", "an", "error", "-", "channel", "blocks", "on", "it", "and", "returns", "a", "MultiError", "for", "any", "errors", "pushed", "to", "it", "over", "the", "channel", "or", "nil", "if", "all", "the", "errors", "were", "nil", "."...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/sync/parallel/workPool.go#L51-L66
8,173
luci/luci-go
vpython/venv/venv.go
blocker
func blocker(c context.Context) fslock.Blocker { return func() error { logging.Debugf(c, "Lock is currently held. Sleeping %v and retrying...", lockHeldDelay) tr := clock.Sleep(c, lockHeldDelay) return tr.Err } }
go
func blocker(c context.Context) fslock.Blocker { return func() error { logging.Debugf(c, "Lock is currently held. Sleeping %v and retrying...", lockHeldDelay) tr := clock.Sleep(c, lockHeldDelay) return tr.Err } }
[ "func", "blocker", "(", "c", "context", ".", "Context", ")", "fslock", ".", "Blocker", "{", "return", "func", "(", ")", "error", "{", "logging", ".", "Debugf", "(", "c", ",", "\"", "\"", ",", "lockHeldDelay", ")", "\n", "tr", ":=", "clock", ".", "S...
// blocker is an fslock.Blocker implementation that sleeps lockHeldDelay in // between attempts.
[ "blocker", "is", "an", "fslock", ".", "Blocker", "implementation", "that", "sleeps", "lockHeldDelay", "in", "between", "attempts", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/vpython/venv/venv.go#L87-L93
8,174
luci/luci-go
vpython/venv/venv.go
With
func With(c context.Context, cfg Config, fn func(context.Context, *Env) error) error { // Track which VirtualEnv we use so we can exempt them from pruning. usedEnvs := stringset.New(2) // Start with an empty VirtualEnv. We will use this to probe the local // system. // // If our configured VirtualEnv is, itself,...
go
func With(c context.Context, cfg Config, fn func(context.Context, *Env) error) error { // Track which VirtualEnv we use so we can exempt them from pruning. usedEnvs := stringset.New(2) // Start with an empty VirtualEnv. We will use this to probe the local // system. // // If our configured VirtualEnv is, itself,...
[ "func", "With", "(", "c", "context", ".", "Context", ",", "cfg", "Config", ",", "fn", "func", "(", "context", ".", "Context", ",", "*", "Env", ")", "error", ")", "error", "{", "// Track which VirtualEnv we use so we can exempt them from pruning.", "usedEnvs", ":...
// With creates a new Env and executes "fn" with assumed ownership of that Env. // // The Context passed to "fn" will be cancelled if we lose perceived ownership // of the configured environment. This is not an expected scenario, and should // be considered an error condition. The Env passed to "fn" is valid only for /...
[ "With", "creates", "a", "new", "Env", "and", "executes", "fn", "with", "assumed", "ownership", "of", "that", "Env", ".", "The", "Context", "passed", "to", "fn", "will", "be", "cancelled", "if", "we", "lose", "perceived", "ownership", "of", "the", "configur...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/vpython/venv/venv.go#L135-L169
8,175
luci/luci-go
vpython/venv/venv.go
Delete
func Delete(c context.Context, cfg Config) error { // Attempt to acquire the environment's lock. e, err := cfg.makeEnv(c, nil) if err != nil { return err } return e.Delete(c) }
go
func Delete(c context.Context, cfg Config) error { // Attempt to acquire the environment's lock. e, err := cfg.makeEnv(c, nil) if err != nil { return err } return e.Delete(c) }
[ "func", "Delete", "(", "c", "context", ".", "Context", ",", "cfg", "Config", ")", "error", "{", "// Attempt to acquire the environment's lock.", "e", ",", "err", ":=", "cfg", ".", "makeEnv", "(", "c", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{",...
// Delete removes all resources consumed by an environment. // // Delete will acquire an exclusive lock on the environment and assert that it // is not in use prior to deletion. This is non-blocking, and an error will be // returned if the lock could not be acquired. // // If deletion fails, a wrapped error will be ret...
[ "Delete", "removes", "all", "resources", "consumed", "by", "an", "environment", ".", "Delete", "will", "acquire", "an", "exclusive", "lock", "on", "the", "environment", "and", "assert", "that", "it", "is", "not", "in", "use", "prior", "to", "deletion", ".", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/vpython/venv/venv.go#L178-L185
8,176
luci/luci-go
vpython/venv/venv.go
Interpreter
func (e *Env) Interpreter() *python.Interpreter { if e.interpreter == nil { e.interpreter = &python.Interpreter{ Python: e.Python, } } return e.interpreter }
go
func (e *Env) Interpreter() *python.Interpreter { if e.interpreter == nil { e.interpreter = &python.Interpreter{ Python: e.Python, } } return e.interpreter }
[ "func", "(", "e", "*", "Env", ")", "Interpreter", "(", ")", "*", "python", ".", "Interpreter", "{", "if", "e", ".", "interpreter", "==", "nil", "{", "e", ".", "interpreter", "=", "&", "python", ".", "Interpreter", "{", "Python", ":", "e", ".", "Pyt...
// Interpreter returns the VirtualEnv's isolated Python Interpreter instance.
[ "Interpreter", "returns", "the", "VirtualEnv", "s", "isolated", "Python", "Interpreter", "instance", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/vpython/venv/venv.go#L394-L401
8,177
luci/luci-go
vpython/venv/venv.go
WriteEnvironmentStamp
func (e *Env) WriteEnvironmentStamp() error { environment := e.Environment if environment == nil { environment = &vpython.Environment{} } return writeTextProto(e.EnvironmentStampPath, environment) }
go
func (e *Env) WriteEnvironmentStamp() error { environment := e.Environment if environment == nil { environment = &vpython.Environment{} } return writeTextProto(e.EnvironmentStampPath, environment) }
[ "func", "(", "e", "*", "Env", ")", "WriteEnvironmentStamp", "(", ")", "error", "{", "environment", ":=", "e", ".", "Environment", "\n", "if", "environment", "==", "nil", "{", "environment", "=", "&", "vpython", ".", "Environment", "{", "}", "\n", "}", ...
// WriteEnvironmentStamp writes a text protobuf form of spec to path.
[ "WriteEnvironmentStamp", "writes", "a", "text", "protobuf", "form", "of", "spec", "to", "path", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/vpython/venv/venv.go#L412-L418
8,178
luci/luci-go
vpython/venv/venv.go
AssertCompleteAndLoad
func (e *Env) AssertCompleteAndLoad() error { if err := e.assertComplete(); err != nil { return err } var environment vpython.Environment if err := spec.LoadEnvironment(e.EnvironmentStampPath, &environment); err != nil { return err } if err := spec.NormalizeEnvironment(&environment); err != nil { return er...
go
func (e *Env) AssertCompleteAndLoad() error { if err := e.assertComplete(); err != nil { return err } var environment vpython.Environment if err := spec.LoadEnvironment(e.EnvironmentStampPath, &environment); err != nil { return err } if err := spec.NormalizeEnvironment(&environment); err != nil { return er...
[ "func", "(", "e", "*", "Env", ")", "AssertCompleteAndLoad", "(", ")", "error", "{", "if", "err", ":=", "e", ".", "assertComplete", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "var", "environment", "vpython", ".", "Envi...
// AssertCompleteAndLoad asserts that the VirtualEnv's completion // flag exists. If it does, the environment's stamp is loaded into e.Environment // and nil is returned. // // An error is returned if the completion flag does not exist, or if the // VirtualEnv environment stamp could not be loaded.
[ "AssertCompleteAndLoad", "asserts", "that", "the", "VirtualEnv", "s", "completion", "flag", "exists", ".", "If", "it", "does", "the", "environment", "s", "stamp", "is", "loaded", "into", "e", ".", "Environment", "and", "nil", "is", "returned", ".", "An", "er...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/vpython/venv/venv.go#L426-L456
8,179
luci/luci-go
vpython/venv/venv.go
getPEP425Tags
func (e *Env) getPEP425Tags(c context.Context, env []string) ([]*vpython.PEP425Tag, error) { // This script will return a list of 3-entry lists: // [0]: version (e.g., "cp27") // [1]: abi (e.g., "cp27mu", "none") // [2]: arch (e.g., "x86_64", "armv7l", "any") const script = `import json, pip.pep425tags, sys; ` + ...
go
func (e *Env) getPEP425Tags(c context.Context, env []string) ([]*vpython.PEP425Tag, error) { // This script will return a list of 3-entry lists: // [0]: version (e.g., "cp27") // [1]: abi (e.g., "cp27mu", "none") // [2]: arch (e.g., "x86_64", "armv7l", "any") const script = `import json, pip.pep425tags, sys; ` + ...
[ "func", "(", "e", "*", "Env", ")", "getPEP425Tags", "(", "c", "context", ".", "Context", ",", "env", "[", "]", "string", ")", "(", "[", "]", "*", "vpython", ".", "PEP425Tag", ",", "error", ")", "{", "// This script will return a list of 3-entry lists:", "/...
// getPEP425Tags calls Python's pip.pep425tags package to retrieve the tags. // // This must be run while "pip" is installed in the VirtualEnv.
[ "getPEP425Tags", "calls", "Python", "s", "pip", ".", "pep425tags", "package", "to", "retrieve", "the", "tags", ".", "This", "must", "be", "run", "while", "pip", "is", "installed", "in", "the", "VirtualEnv", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/vpython/venv/venv.go#L640-L690
8,180
luci/luci-go
vpython/venv/venv.go
Delete
func (e *Env) Delete(c context.Context) error { removedLock := false err := e.withExclusiveLockNonBlocking(func() error { logging.Debugf(c, "(Delete) Got exclusive lock for: %s", e.Name) // Delete our environment directory. if err := filesystem.RemoveAll(e.Root); err != nil { return errors.Annotate(err, "fa...
go
func (e *Env) Delete(c context.Context) error { removedLock := false err := e.withExclusiveLockNonBlocking(func() error { logging.Debugf(c, "(Delete) Got exclusive lock for: %s", e.Name) // Delete our environment directory. if err := filesystem.RemoveAll(e.Root); err != nil { return errors.Annotate(err, "fa...
[ "func", "(", "e", "*", "Env", ")", "Delete", "(", "c", "context", ".", "Context", ")", "error", "{", "removedLock", ":=", "false", "\n", "err", ":=", "e", ".", "withExclusiveLockNonBlocking", "(", "func", "(", ")", "error", "{", "logging", ".", "Debugf...
// Delete removes all resources consumed by an environment. // // Delete will acquire an exclusive lock on the environment and assert that it // is not in use prior to deletion. This is non-blocking, and an error will be // returned if the lock could not be acquired. // // If the environment was not deleted, a non-nil ...
[ "Delete", "removes", "all", "resources", "consumed", "by", "an", "environment", ".", "Delete", "will", "acquire", "an", "exclusive", "lock", "on", "the", "environment", "and", "assert", "that", "it", "is", "not", "in", "use", "prior", "to", "deletion", ".", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/vpython/venv/venv.go#L845-L882
8,181
luci/luci-go
vpython/venv/venv.go
attachOutputForLogging
func attachOutputForLogging(c context.Context, l logging.Level, cmd *exec.Cmd) func(context.Context, logging.Level) { if logging.IsLogging(c, logging.Info) { logging.Infof(c, "Running Python command (cwd=%s): %s", cmd.Dir, strings.Join(cmd.Args, " ")) } var out io.Writer var buf bytes.Buffer if logging.IsLog...
go
func attachOutputForLogging(c context.Context, l logging.Level, cmd *exec.Cmd) func(context.Context, logging.Level) { if logging.IsLogging(c, logging.Info) { logging.Infof(c, "Running Python command (cwd=%s): %s", cmd.Dir, strings.Join(cmd.Args, " ")) } var out io.Writer var buf bytes.Buffer if logging.IsLog...
[ "func", "attachOutputForLogging", "(", "c", "context", ".", "Context", ",", "l", "logging", ".", "Level", ",", "cmd", "*", "exec", ".", "Cmd", ")", "func", "(", "context", ".", "Context", ",", "logging", ".", "Level", ")", "{", "if", "logging", ".", ...
// attachOutputForLogging modifies the supplied cmd's Stdout and Stderr fields // to output appropriately, assuming it isn't otherwise configured. // // If we are logging at level l, the process's Stdout and Stderr will be // directly connected to STDERR // // This will return a callback that can be invoked to dump any...
[ "attachOutputForLogging", "modifies", "the", "supplied", "cmd", "s", "Stdout", "and", "Stderr", "fields", "to", "output", "appropriately", "assuming", "it", "isn", "t", "otherwise", "configured", ".", "If", "we", "are", "logging", "at", "level", "l", "the", "p...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/vpython/venv/venv.go#L915-L945
8,182
luci/luci-go
vpython/venv/venv.go
mustReleaseLock
func mustReleaseLock(c context.Context, lock fslock.Handle, fn func() error) error { defer func() { if err := lock.Unlock(); err != nil { errors.Log(c, errors.Annotate(err, "failed to release lock").Err()) // TODO(maruel): There's a bug somewhere here that cases failures on // Swarming tasks. Since they are...
go
func mustReleaseLock(c context.Context, lock fslock.Handle, fn func() error) error { defer func() { if err := lock.Unlock(); err != nil { errors.Log(c, errors.Annotate(err, "failed to release lock").Err()) // TODO(maruel): There's a bug somewhere here that cases failures on // Swarming tasks. Since they are...
[ "func", "mustReleaseLock", "(", "c", "context", ".", "Context", ",", "lock", "fslock", ".", "Handle", ",", "fn", "func", "(", ")", "error", ")", "error", "{", "defer", "func", "(", ")", "{", "if", "err", ":=", "lock", ".", "Unlock", "(", ")", ";", ...
// mustReleaseLock calls the wrapped function, releasing the lock at the end // of its execution. If the lock could not be released, this function will // panic, since the locking state can no longer be determined.
[ "mustReleaseLock", "calls", "the", "wrapped", "function", "releasing", "the", "lock", "at", "the", "end", "of", "its", "execution", ".", "If", "the", "lock", "could", "not", "be", "released", "this", "function", "will", "panic", "since", "the", "locking", "s...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/vpython/venv/venv.go#L950-L963
8,183
luci/luci-go
vpython/venv/venv.go
writeFile
func writeFile(path string, data []byte, mode os.FileMode) error { // Ensure that the parent directory is user-writable, since this is a // requirement in order to make modifications to that directory. parentDir := filepath.Dir(path) if err := filesystem.MakePathUserWritable(parentDir, nil); err != nil { return e...
go
func writeFile(path string, data []byte, mode os.FileMode) error { // Ensure that the parent directory is user-writable, since this is a // requirement in order to make modifications to that directory. parentDir := filepath.Dir(path) if err := filesystem.MakePathUserWritable(parentDir, nil); err != nil { return e...
[ "func", "writeFile", "(", "path", "string", ",", "data", "[", "]", "byte", ",", "mode", "os", ".", "FileMode", ")", "error", "{", "// Ensure that the parent directory is user-writable, since this is a", "// requirement in order to make modifications to that directory.", "pare...
// writeFile writes the contents of data to the specified path. It // handles additional cases where the file already exists by deleting it // first, allowing it to be overwritten.
[ "writeFile", "writes", "the", "contents", "of", "data", "to", "the", "specified", "path", ".", "It", "handles", "additional", "cases", "where", "the", "file", "already", "exists", "by", "deleting", "it", "first", "allowing", "it", "to", "be", "overwritten", ...
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/vpython/venv/venv.go#L968-L986
8,184
luci/luci-go
scheduler/appengine/engine/engine.go
NewEngine
func NewEngine(cfg Config) EngineInternal { eng := &engineImpl{cfg: cfg} eng.init() return eng }
go
func NewEngine(cfg Config) EngineInternal { eng := &engineImpl{cfg: cfg} eng.init() return eng }
[ "func", "NewEngine", "(", "cfg", "Config", ")", "EngineInternal", "{", "eng", ":=", "&", "engineImpl", "{", "cfg", ":", "cfg", "}", "\n", "eng", ".", "init", "(", ")", "\n", "return", "eng", "\n", "}" ]
// NewEngine returns default implementation of EngineInternal.
[ "NewEngine", "returns", "default", "implementation", "of", "EngineInternal", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/engine.go#L244-L248
8,185
luci/luci-go
scheduler/appengine/engine/engine.go
init
func (e *engineImpl) init() { // TODO(vadimsh): Figure out retry parameters for all tasks. e.cfg.Dispatcher.RegisterTask(&internal.LaunchInvocationsBatchTask{}, e.execLaunchInvocationsBatchTask, "batches", nil) e.cfg.Dispatcher.RegisterTask(&internal.LaunchInvocationTask{}, e.execLaunchInvocationTask, "launches", ni...
go
func (e *engineImpl) init() { // TODO(vadimsh): Figure out retry parameters for all tasks. e.cfg.Dispatcher.RegisterTask(&internal.LaunchInvocationsBatchTask{}, e.execLaunchInvocationsBatchTask, "batches", nil) e.cfg.Dispatcher.RegisterTask(&internal.LaunchInvocationTask{}, e.execLaunchInvocationTask, "launches", ni...
[ "func", "(", "e", "*", "engineImpl", ")", "init", "(", ")", "{", "// TODO(vadimsh): Figure out retry parameters for all tasks.", "e", ".", "cfg", ".", "Dispatcher", ".", "RegisterTask", "(", "&", "internal", ".", "LaunchInvocationsBatchTask", "{", "}", ",", "e", ...
// init registers task queue handlers.
[ "init", "registers", "task", "queue", "handlers", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/engine.go#L259-L271
8,186
luci/luci-go
scheduler/appengine/engine/engine.go
GetVisibleProjectJobs
func (e *engineImpl) GetVisibleProjectJobs(c context.Context, projectID string) ([]*Job, error) { q := ds.NewQuery("Job").Eq("Enabled", true).Eq("ProjectID", projectID) return e.queryEnabledVisibleJobs(c, q) }
go
func (e *engineImpl) GetVisibleProjectJobs(c context.Context, projectID string) ([]*Job, error) { q := ds.NewQuery("Job").Eq("Enabled", true).Eq("ProjectID", projectID) return e.queryEnabledVisibleJobs(c, q) }
[ "func", "(", "e", "*", "engineImpl", ")", "GetVisibleProjectJobs", "(", "c", "context", ".", "Context", ",", "projectID", "string", ")", "(", "[", "]", "*", "Job", ",", "error", ")", "{", "q", ":=", "ds", ".", "NewQuery", "(", "\"", "\"", ")", ".",...
// GetVisibleProjectJobs enabled visible jobs belonging to a project. // // Part of the public interface, checks ACLs.
[ "GetVisibleProjectJobs", "enabled", "visible", "jobs", "belonging", "to", "a", "project", ".", "Part", "of", "the", "public", "interface", "checks", "ACLs", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/engine.go#L287-L290
8,187
luci/luci-go
scheduler/appengine/engine/engine.go
GetVisibleJob
func (e *engineImpl) GetVisibleJob(c context.Context, jobID string) (*Job, error) { job, err := e.getJob(c, jobID) switch { case err != nil: return nil, err case job == nil || !job.Enabled: return nil, ErrNoSuchJob } if err := job.CheckRole(c, acl.Reader); err != nil { if err == ErrNoPermission { err = E...
go
func (e *engineImpl) GetVisibleJob(c context.Context, jobID string) (*Job, error) { job, err := e.getJob(c, jobID) switch { case err != nil: return nil, err case job == nil || !job.Enabled: return nil, ErrNoSuchJob } if err := job.CheckRole(c, acl.Reader); err != nil { if err == ErrNoPermission { err = E...
[ "func", "(", "e", "*", "engineImpl", ")", "GetVisibleJob", "(", "c", "context", ".", "Context", ",", "jobID", "string", ")", "(", "*", "Job", ",", "error", ")", "{", "job", ",", "err", ":=", "e", ".", "getJob", "(", "c", ",", "jobID", ")", "\n", ...
// GetVisibleJob returns a single visible job given its full ID. // // Part of the public interface, checks ACLs.
[ "GetVisibleJob", "returns", "a", "single", "visible", "job", "given", "its", "full", "ID", ".", "Part", "of", "the", "public", "interface", "checks", "ACLs", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/engine.go#L295-L310
8,188
luci/luci-go
scheduler/appengine/engine/engine.go
GetVisibleJobBatch
func (e *engineImpl) GetVisibleJobBatch(c context.Context, jobIDs []string) (map[string]*Job, error) { // TODO(vadimsh): This can be parallelized to be single GetMulti RPC to fetch // jobs and single filterForRole to check ACLs. In practice O(len(jobIDs)) is // small, so there's no pressing need to do this. visible...
go
func (e *engineImpl) GetVisibleJobBatch(c context.Context, jobIDs []string) (map[string]*Job, error) { // TODO(vadimsh): This can be parallelized to be single GetMulti RPC to fetch // jobs and single filterForRole to check ACLs. In practice O(len(jobIDs)) is // small, so there's no pressing need to do this. visible...
[ "func", "(", "e", "*", "engineImpl", ")", "GetVisibleJobBatch", "(", "c", "context", ".", "Context", ",", "jobIDs", "[", "]", "string", ")", "(", "map", "[", "string", "]", "*", "Job", ",", "error", ")", "{", "// TODO(vadimsh): This can be parallelized to be...
// GetVisibleJobBatch is like GetVisibleJob, except it operates on a batch of // jobs at once. // // Part of the public interface. // // Part of the public interface, checks ACLs.
[ "GetVisibleJobBatch", "is", "like", "GetVisibleJob", "except", "it", "operates", "on", "a", "batch", "of", "jobs", "at", "once", ".", "Part", "of", "the", "public", "interface", ".", "Part", "of", "the", "public", "interface", "checks", "ACLs", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/engine.go#L318-L332
8,189
luci/luci-go
scheduler/appengine/engine/engine.go
ListInvocations
func (e *engineImpl) ListInvocations(c context.Context, job *Job, opts ListInvocationsOpts) ([]*Invocation, string, error) { if opts.ActiveOnly && opts.FinishedOnly { return nil, "", fmt.Errorf("using both ActiveOnly and FinishedOnly is not allowed") } if opts.PageSize <= 0 || opts.PageSize > 500 { opts.PageSiz...
go
func (e *engineImpl) ListInvocations(c context.Context, job *Job, opts ListInvocationsOpts) ([]*Invocation, string, error) { if opts.ActiveOnly && opts.FinishedOnly { return nil, "", fmt.Errorf("using both ActiveOnly and FinishedOnly is not allowed") } if opts.PageSize <= 0 || opts.PageSize > 500 { opts.PageSiz...
[ "func", "(", "e", "*", "engineImpl", ")", "ListInvocations", "(", "c", "context", ".", "Context", ",", "job", "*", "Job", ",", "opts", "ListInvocationsOpts", ")", "(", "[", "]", "*", "Invocation", ",", "string", ",", "error", ")", "{", "if", "opts", ...
// ListInvocations returns invocations of a given job, most recent first. // // Part of the public interface.
[ "ListInvocations", "returns", "invocations", "of", "a", "given", "job", "most", "recent", "first", ".", "Part", "of", "the", "public", "interface", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/engine.go#L337-L397
8,190
luci/luci-go
scheduler/appengine/engine/engine.go
GetInvocation
func (e *engineImpl) GetInvocation(c context.Context, job *Job, invID int64) (*Invocation, error) { // Note: we want public API users to go through GetVisibleJob to check ACLs, // thus usage of *Job, even though JobID string is sufficient in this case. return e.getInvocation(c, job.JobID, invID) }
go
func (e *engineImpl) GetInvocation(c context.Context, job *Job, invID int64) (*Invocation, error) { // Note: we want public API users to go through GetVisibleJob to check ACLs, // thus usage of *Job, even though JobID string is sufficient in this case. return e.getInvocation(c, job.JobID, invID) }
[ "func", "(", "e", "*", "engineImpl", ")", "GetInvocation", "(", "c", "context", ".", "Context", ",", "job", "*", "Job", ",", "invID", "int64", ")", "(", "*", "Invocation", ",", "error", ")", "{", "// Note: we want public API users to go through GetVisibleJob to ...
// GetInvocation returns some invocation of a given job. // // Part of the public interface.
[ "GetInvocation", "returns", "some", "invocation", "of", "a", "given", "job", ".", "Part", "of", "the", "public", "interface", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/engine.go#L402-L406
8,191
luci/luci-go
scheduler/appengine/engine/engine.go
PauseJob
func (e *engineImpl) PauseJob(c context.Context, job *Job) error { if err := job.CheckRole(c, acl.Owner); err != nil { return err } return e.setJobPausedFlag(c, job, true, auth.CurrentIdentity(c)) }
go
func (e *engineImpl) PauseJob(c context.Context, job *Job) error { if err := job.CheckRole(c, acl.Owner); err != nil { return err } return e.setJobPausedFlag(c, job, true, auth.CurrentIdentity(c)) }
[ "func", "(", "e", "*", "engineImpl", ")", "PauseJob", "(", "c", "context", ".", "Context", ",", "job", "*", "Job", ")", "error", "{", "if", "err", ":=", "job", ".", "CheckRole", "(", "c", ",", "acl", ".", "Owner", ")", ";", "err", "!=", "nil", ...
// PauseJob prevents new automatic invocations of a job. // // Part of the public interface, checks ACLs.
[ "PauseJob", "prevents", "new", "automatic", "invocations", "of", "a", "job", ".", "Part", "of", "the", "public", "interface", "checks", "ACLs", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/engine.go#L411-L416
8,192
luci/luci-go
scheduler/appengine/engine/engine.go
AbortInvocation
func (e *engineImpl) AbortInvocation(c context.Context, job *Job, invID int64) error { if err := job.CheckRole(c, acl.Owner); err != nil { return err } return e.abortInvocation(c, job.JobID, invID) }
go
func (e *engineImpl) AbortInvocation(c context.Context, job *Job, invID int64) error { if err := job.CheckRole(c, acl.Owner); err != nil { return err } return e.abortInvocation(c, job.JobID, invID) }
[ "func", "(", "e", "*", "engineImpl", ")", "AbortInvocation", "(", "c", "context", ".", "Context", ",", "job", "*", "Job", ",", "invID", "int64", ")", "error", "{", "if", "err", ":=", "job", ".", "CheckRole", "(", "c", ",", "acl", ".", "Owner", ")",...
// AbortInvocation forcefully moves the invocation to a failed state. // // Part of the public interface, checks ACLs.
[ "AbortInvocation", "forcefully", "moves", "the", "invocation", "to", "a", "failed", "state", ".", "Part", "of", "the", "public", "interface", "checks", "ACLs", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/engine.go#L477-L482
8,193
luci/luci-go
scheduler/appengine/engine/engine.go
EmitTriggers
func (e *engineImpl) EmitTriggers(c context.Context, perJob map[*Job][]*internal.Trigger) error { // Make sure the caller has permissions to add triggers to all jobs. jobs := make([]*Job, 0, len(perJob)) for j := range perJob { jobs = append(jobs, j) } switch filtered, err := e.filterForRole(c, jobs, acl.Trigger...
go
func (e *engineImpl) EmitTriggers(c context.Context, perJob map[*Job][]*internal.Trigger) error { // Make sure the caller has permissions to add triggers to all jobs. jobs := make([]*Job, 0, len(perJob)) for j := range perJob { jobs = append(jobs, j) } switch filtered, err := e.filterForRole(c, jobs, acl.Trigger...
[ "func", "(", "e", "*", "engineImpl", ")", "EmitTriggers", "(", "c", "context", ".", "Context", ",", "perJob", "map", "[", "*", "Job", "]", "[", "]", "*", "internal", ".", "Trigger", ")", "error", "{", "// Make sure the caller has permissions to add triggers to...
// EmitTriggers puts one or more triggers into pending trigger queues of the // specified jobs.
[ "EmitTriggers", "puts", "one", "or", "more", "triggers", "into", "pending", "trigger", "queues", "of", "the", "specified", "jobs", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/engine.go#L486-L512
8,194
luci/luci-go
scheduler/appengine/engine/engine.go
ListTriggers
func (e *engineImpl) ListTriggers(c context.Context, job *Job) ([]*internal.Trigger, error) { _, triggers, err := pendingTriggersSet(c, job.JobID).Triggers(c) if err != nil { return nil, transient.Tag.Apply(err) } sortTriggers(triggers) return triggers, nil }
go
func (e *engineImpl) ListTriggers(c context.Context, job *Job) ([]*internal.Trigger, error) { _, triggers, err := pendingTriggersSet(c, job.JobID).Triggers(c) if err != nil { return nil, transient.Tag.Apply(err) } sortTriggers(triggers) return triggers, nil }
[ "func", "(", "e", "*", "engineImpl", ")", "ListTriggers", "(", "c", "context", ".", "Context", ",", "job", "*", "Job", ")", "(", "[", "]", "*", "internal", ".", "Trigger", ",", "error", ")", "{", "_", ",", "triggers", ",", "err", ":=", "pendingTrig...
// ListTriggers returns sorted list of job's pending triggers.
[ "ListTriggers", "returns", "sorted", "list", "of", "job", "s", "pending", "triggers", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/engine.go#L515-L522
8,195
luci/luci-go
scheduler/appengine/engine/engine.go
GetJobTriageLog
func (e *engineImpl) GetJobTriageLog(c context.Context, job *Job) (*JobTriageLog, error) { log := JobTriageLog{JobID: job.JobID} switch err := ds.Get(c, &log); { case err == ds.ErrNoSuchEntity: return nil, nil case err != nil: return nil, transient.Tag.Apply(err) } // We assume the log is stale if the latest...
go
func (e *engineImpl) GetJobTriageLog(c context.Context, job *Job) (*JobTriageLog, error) { log := JobTriageLog{JobID: job.JobID} switch err := ds.Get(c, &log); { case err == ds.ErrNoSuchEntity: return nil, nil case err != nil: return nil, transient.Tag.Apply(err) } // We assume the log is stale if the latest...
[ "func", "(", "e", "*", "engineImpl", ")", "GetJobTriageLog", "(", "c", "context", ".", "Context", ",", "job", "*", "Job", ")", "(", "*", "JobTriageLog", ",", "error", ")", "{", "log", ":=", "JobTriageLog", "{", "JobID", ":", "job", ".", "JobID", "}",...
// GetJobTriageLog returns a log from the latest job triage procedure.
[ "GetJobTriageLog", "returns", "a", "log", "from", "the", "latest", "job", "triage", "procedure", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/engine.go#L525-L545
8,196
luci/luci-go
scheduler/appengine/engine/engine.go
GetAllProjects
func (e *engineImpl) GetAllProjects(c context.Context) ([]string, error) { q := ds.NewQuery("Job"). Eq("Enabled", true). Project("ProjectID"). Distinct(true) entities := []Job{} if err := ds.GetAll(c, q, &entities); err != nil { return nil, transient.Tag.Apply(err) } // Filter out duplicates, sort. projec...
go
func (e *engineImpl) GetAllProjects(c context.Context) ([]string, error) { q := ds.NewQuery("Job"). Eq("Enabled", true). Project("ProjectID"). Distinct(true) entities := []Job{} if err := ds.GetAll(c, q, &entities); err != nil { return nil, transient.Tag.Apply(err) } // Filter out duplicates, sort. projec...
[ "func", "(", "e", "*", "engineImpl", ")", "GetAllProjects", "(", "c", "context", ".", "Context", ")", "(", "[", "]", "string", ",", "error", ")", "{", "q", ":=", "ds", ".", "NewQuery", "(", "\"", "\"", ")", ".", "Eq", "(", "\"", "\"", ",", "tru...
// GetAllProjects returns projects that have at least one enabled job. // // Part of the internal interface, doesn't check ACLs.
[ "GetAllProjects", "returns", "projects", "that", "have", "at", "least", "one", "enabled", "job", ".", "Part", "of", "the", "internal", "interface", "doesn", "t", "check", "ACLs", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/engine.go#L558-L575
8,197
luci/luci-go
scheduler/appengine/engine/engine.go
UpdateProjectJobs
func (e *engineImpl) UpdateProjectJobs(c context.Context, projectID string, defs []catalog.Definition) error { // JobID -> *Job map. existing, err := e.getProjectJobs(c, projectID) if err != nil { return err } // JobID -> new definition revision map. updated := make(map[string]string, len(defs)) for _, def := ...
go
func (e *engineImpl) UpdateProjectJobs(c context.Context, projectID string, defs []catalog.Definition) error { // JobID -> *Job map. existing, err := e.getProjectJobs(c, projectID) if err != nil { return err } // JobID -> new definition revision map. updated := make(map[string]string, len(defs)) for _, def := ...
[ "func", "(", "e", "*", "engineImpl", ")", "UpdateProjectJobs", "(", "c", "context", ".", "Context", ",", "projectID", "string", ",", "defs", "[", "]", "catalog", ".", "Definition", ")", "error", "{", "// JobID -> *Job map.", "existing", ",", "err", ":=", "...
// UpdateProjectJobs adds new, removes old and updates existing jobs. // // Part of the internal interface, doesn't check ACLs.
[ "UpdateProjectJobs", "adds", "new", "removes", "old", "and", "updates", "existing", "jobs", ".", "Part", "of", "the", "internal", "interface", "doesn", "t", "check", "ACLs", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/engine.go#L580-L631
8,198
luci/luci-go
scheduler/appengine/engine/engine.go
ResetAllJobsOnDevServer
func (e *engineImpl) ResetAllJobsOnDevServer(c context.Context) error { if !info.IsDevAppServer(c) { return errors.New("ResetAllJobsOnDevServer must not be used in production") } q := ds.NewQuery("Job").Eq("Enabled", true) keys := []*ds.Key{} if err := ds.GetAll(c, q, &keys); err != nil { return transient.Tag....
go
func (e *engineImpl) ResetAllJobsOnDevServer(c context.Context) error { if !info.IsDevAppServer(c) { return errors.New("ResetAllJobsOnDevServer must not be used in production") } q := ds.NewQuery("Job").Eq("Enabled", true) keys := []*ds.Key{} if err := ds.GetAll(c, q, &keys); err != nil { return transient.Tag....
[ "func", "(", "e", "*", "engineImpl", ")", "ResetAllJobsOnDevServer", "(", "c", "context", ".", "Context", ")", "error", "{", "if", "!", "info", ".", "IsDevAppServer", "(", "c", ")", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}"...
// ResetAllJobsOnDevServer forcefully resets state of all enabled jobs. // // Part of the internal interface, doesn't check ACLs.
[ "ResetAllJobsOnDevServer", "forcefully", "resets", "state", "of", "all", "enabled", "jobs", ".", "Part", "of", "the", "internal", "interface", "doesn", "t", "check", "ACLs", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/engine.go#L636-L656
8,199
luci/luci-go
scheduler/appengine/engine/engine.go
ProcessPubSubPush
func (e *engineImpl) ProcessPubSubPush(c context.Context, body []byte) error { var pushBody struct { Message pubsub.PubsubMessage `json:"message"` } if err := json.Unmarshal(body, &pushBody); err != nil { return err } // Retry once after a slight adhoc delay (to let datastore transactions land) // instead of ...
go
func (e *engineImpl) ProcessPubSubPush(c context.Context, body []byte) error { var pushBody struct { Message pubsub.PubsubMessage `json:"message"` } if err := json.Unmarshal(body, &pushBody); err != nil { return err } // Retry once after a slight adhoc delay (to let datastore transactions land) // instead of ...
[ "func", "(", "e", "*", "engineImpl", ")", "ProcessPubSubPush", "(", "c", "context", ".", "Context", ",", "body", "[", "]", "byte", ")", "error", "{", "var", "pushBody", "struct", "{", "Message", "pubsub", ".", "PubsubMessage", "`json:\"message\"`", "\n", "...
// ProcessPubSubPush is called whenever incoming PubSub message is received. // // Part of the internal interface, doesn't check ACLs.
[ "ProcessPubSubPush", "is", "called", "whenever", "incoming", "PubSub", "message", "is", "received", ".", "Part", "of", "the", "internal", "interface", "doesn", "t", "check", "ACLs", "." ]
f6cef429871eee3be7c6903af88d3ee884eaf683
https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/scheduler/appengine/engine/engine.go#L661-L681