id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
131,400 | luci/luci-go | cipd/client/cipd/reader/reader.go | OpenInstance | func OpenInstance(ctx context.Context, r pkg.Source, opts OpenInstanceOpts) (pkg.Instance, error) {
out := &packageInstance{data: r}
if err := out.open(opts); err != nil {
return nil, err
}
return out, nil
} | go | func OpenInstance(ctx context.Context, r pkg.Source, opts OpenInstanceOpts) (pkg.Instance, error) {
out := &packageInstance{data: r}
if err := out.open(opts); err != nil {
return nil, err
}
return out, nil
} | [
"func",
"OpenInstance",
"(",
"ctx",
"context",
".",
"Context",
",",
"r",
"pkg",
".",
"Source",
",",
"opts",
"OpenInstanceOpts",
")",
"(",
"pkg",
".",
"Instance",
",",
"error",
")",
"{",
"out",
":=",
"&",
"packageInstance",
"{",
"data",
":",
"r",
"}",
... | // OpenInstance opens a package instance by reading it from the given source.
//
// The caller is responsible for closing the instance when done with it.
//
// On success it takes ownership of the source, closing it when the instance
// itself is closed. On errors the source is left open. It's a responsibility of
// th... | [
"OpenInstance",
"opens",
"a",
"package",
"instance",
"by",
"reading",
"it",
"from",
"the",
"given",
"source",
".",
"The",
"caller",
"is",
"responsible",
"for",
"closing",
"the",
"instance",
"when",
"done",
"with",
"it",
".",
"On",
"success",
"it",
"takes",
... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/reader/reader.go#L99-L105 |
131,401 | luci/luci-go | cipd/client/cipd/reader/reader.go | OpenInstanceFile | func OpenInstanceFile(ctx context.Context, path string, opts OpenInstanceOpts) (pkg.Instance, error) {
file, err := os.Open(path)
if err != nil {
return nil, err
}
inst, err := OpenInstance(ctx, fileSource{file}, opts)
if err != nil {
file.Close()
return nil, err
}
return inst, nil
} | go | func OpenInstanceFile(ctx context.Context, path string, opts OpenInstanceOpts) (pkg.Instance, error) {
file, err := os.Open(path)
if err != nil {
return nil, err
}
inst, err := OpenInstance(ctx, fileSource{file}, opts)
if err != nil {
file.Close()
return nil, err
}
return inst, nil
} | [
"func",
"OpenInstanceFile",
"(",
"ctx",
"context",
".",
"Context",
",",
"path",
"string",
",",
"opts",
"OpenInstanceOpts",
")",
"(",
"pkg",
".",
"Instance",
",",
"error",
")",
"{",
"file",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"path",
")",
"\n",
... | // OpenInstanceFile opens a package instance by reading it from a file on disk.
//
// The caller is responsible for closing the instance when done with it. This
// will close the underlying file too. | [
"OpenInstanceFile",
"opens",
"a",
"package",
"instance",
"by",
"reading",
"it",
"from",
"a",
"file",
"on",
"disk",
".",
"The",
"caller",
"is",
"responsible",
"for",
"closing",
"the",
"instance",
"when",
"done",
"with",
"it",
".",
"This",
"will",
"close",
"... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/reader/reader.go#L117-L128 |
131,402 | luci/luci-go | cipd/client/cipd/reader/reader.go | ExtractFilesTxn | func ExtractFilesTxn(ctx context.Context, files []fs.File, dest fs.TransactionalDestination, withManifest pkg.ManifestMode) (extracted []pkg.FileInfo, err error) {
if err := dest.Begin(ctx); err != nil {
return nil, err
}
// Cleanup the garbage even on panics.
defer func() {
endErr := dest.End(ctx, err == nil)... | go | func ExtractFilesTxn(ctx context.Context, files []fs.File, dest fs.TransactionalDestination, withManifest pkg.ManifestMode) (extracted []pkg.FileInfo, err error) {
if err := dest.Begin(ctx); err != nil {
return nil, err
}
// Cleanup the garbage even on panics.
defer func() {
endErr := dest.End(ctx, err == nil)... | [
"func",
"ExtractFilesTxn",
"(",
"ctx",
"context",
".",
"Context",
",",
"files",
"[",
"]",
"fs",
".",
"File",
",",
"dest",
"fs",
".",
"TransactionalDestination",
",",
"withManifest",
"pkg",
".",
"ManifestMode",
")",
"(",
"extracted",
"[",
"]",
"pkg",
".",
... | // ExtractFilesTxn is like ExtractFiles, but it also opens and closes
// the transaction over fs.TransactionalDestination object.
//
// It guarantees that if extraction fails for some reason, there'll be no
// garbage laying around. | [
"ExtractFilesTxn",
"is",
"like",
"ExtractFiles",
"but",
"it",
"also",
"opens",
"and",
"closes",
"the",
"transaction",
"over",
"fs",
".",
"TransactionalDestination",
"object",
".",
"It",
"guarantees",
"that",
"if",
"extraction",
"fails",
"for",
"some",
"reason",
... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/reader/reader.go#L282-L299 |
131,403 | luci/luci-go | cipd/client/cipd/reader/reader.go | advance | func (r *progressReporter) advance(f fs.File) {
if r.totalCount == 0 {
return
}
now := clock.Now(r.ctx)
reportNow := false
progress := 0
// We don't count size of the symlinks toward total.
var size uint64
if !f.Symlink() {
size = f.Size()
}
// Report progress on first and last 'advance' calls and each... | go | func (r *progressReporter) advance(f fs.File) {
if r.totalCount == 0 {
return
}
now := clock.Now(r.ctx)
reportNow := false
progress := 0
// We don't count size of the symlinks toward total.
var size uint64
if !f.Symlink() {
size = f.Size()
}
// Report progress on first and last 'advance' calls and each... | [
"func",
"(",
"r",
"*",
"progressReporter",
")",
"advance",
"(",
"f",
"fs",
".",
"File",
")",
"{",
"if",
"r",
".",
"totalCount",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n\n",
"now",
":=",
"clock",
".",
"Now",
"(",
"r",
".",
"ctx",
")",
"\n",
"rep... | // advance moves the progress indicator, occasionally logging it. | [
"advance",
"moves",
"the",
"progress",
"indicator",
"occasionally",
"logging",
"it",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/reader/reader.go#L332-L365 |
131,404 | luci/luci-go | cipd/client/cipd/reader/reader.go | IsCorruptionError | func IsCorruptionError(err error) bool {
switch err {
case io.ErrUnexpectedEOF, zip.ErrFormat, zip.ErrChecksum, zip.ErrAlgorithm, ErrHashMismatch:
return true
}
return false
} | go | func IsCorruptionError(err error) bool {
switch err {
case io.ErrUnexpectedEOF, zip.ErrFormat, zip.ErrChecksum, zip.ErrAlgorithm, ErrHashMismatch:
return true
}
return false
} | [
"func",
"IsCorruptionError",
"(",
"err",
"error",
")",
"bool",
"{",
"switch",
"err",
"{",
"case",
"io",
".",
"ErrUnexpectedEOF",
",",
"zip",
".",
"ErrFormat",
",",
"zip",
".",
"ErrChecksum",
",",
"zip",
".",
"ErrAlgorithm",
",",
"ErrHashMismatch",
":",
"re... | // IsCorruptionError returns true iff err indicates corruption. | [
"IsCorruptionError",
"returns",
"true",
"iff",
"err",
"indicates",
"corruption",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/reader/reader.go#L527-L533 |
131,405 | luci/luci-go | cipd/client/cipd/reader/reader.go | readManifestFile | func readManifestFile(f fs.File) (pkg.Manifest, error) {
r, err := f.Open()
if err != nil {
return pkg.Manifest{}, err
}
defer r.Close()
return pkg.ReadManifest(r)
} | go | func readManifestFile(f fs.File) (pkg.Manifest, error) {
r, err := f.Open()
if err != nil {
return pkg.Manifest{}, err
}
defer r.Close()
return pkg.ReadManifest(r)
} | [
"func",
"readManifestFile",
"(",
"f",
"fs",
".",
"File",
")",
"(",
"pkg",
".",
"Manifest",
",",
"error",
")",
"{",
"r",
",",
"err",
":=",
"f",
".",
"Open",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"pkg",
".",
"Manifest",
"{",
"}... | // readManifestFile decodes manifest file zipped inside the package. | [
"readManifestFile",
"decodes",
"manifest",
"file",
"zipped",
"inside",
"the",
"package",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/reader/reader.go#L552-L559 |
131,406 | luci/luci-go | cipd/client/cipd/reader/reader.go | makeVersionFile | func makeVersionFile(relPath string, versionFile pkg.VersionFile) (fs.File, error) {
if !fs.IsCleanSlashPath(relPath) {
return nil, fmt.Errorf("invalid version_file: %s", relPath)
}
blob, err := json.MarshalIndent(versionFile, "", " ")
if err != nil {
return nil, err
}
return &blobFile{
name: relPath,
bl... | go | func makeVersionFile(relPath string, versionFile pkg.VersionFile) (fs.File, error) {
if !fs.IsCleanSlashPath(relPath) {
return nil, fmt.Errorf("invalid version_file: %s", relPath)
}
blob, err := json.MarshalIndent(versionFile, "", " ")
if err != nil {
return nil, err
}
return &blobFile{
name: relPath,
bl... | [
"func",
"makeVersionFile",
"(",
"relPath",
"string",
",",
"versionFile",
"pkg",
".",
"VersionFile",
")",
"(",
"fs",
".",
"File",
",",
"error",
")",
"{",
"if",
"!",
"fs",
".",
"IsCleanSlashPath",
"(",
"relPath",
")",
"{",
"return",
"nil",
",",
"fmt",
".... | // makeVersionFile returns File representing a JSON blob with info about package
// version. It's what's deployed at path specified in 'version_file' stanza in
// package definition YAML. | [
"makeVersionFile",
"returns",
"File",
"representing",
"a",
"JSON",
"blob",
"with",
"info",
"about",
"package",
"version",
".",
"It",
"s",
"what",
"s",
"deployed",
"at",
"path",
"specified",
"in",
"version_file",
"stanza",
"in",
"package",
"definition",
"YAML",
... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/reader/reader.go#L564-L576 |
131,407 | luci/luci-go | cipd/client/cipd/reader/reader.go | prefetch | func (f *fileInZip) prefetch() error {
if f.body != nil {
return nil
}
r, err := f.z.Open()
if err != nil {
return err
}
defer r.Close()
f.body, err = ioutil.ReadAll(r)
return err
} | go | func (f *fileInZip) prefetch() error {
if f.body != nil {
return nil
}
r, err := f.z.Open()
if err != nil {
return err
}
defer r.Close()
f.body, err = ioutil.ReadAll(r)
return err
} | [
"func",
"(",
"f",
"*",
"fileInZip",
")",
"prefetch",
"(",
")",
"error",
"{",
"if",
"f",
".",
"body",
"!=",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"r",
",",
"err",
":=",
"f",
".",
"z",
".",
"Open",
"(",
")",
"\n",
"if",
"err",
"!=",
"... | // prefetch loads the body of file into memory to speed up later calls. | [
"prefetch",
"loads",
"the",
"body",
"of",
"file",
"into",
"memory",
"to",
"speed",
"up",
"later",
"calls",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/client/cipd/reader/reader.go#L606-L617 |
131,408 | luci/luci-go | milo/git/combined_logs.go | pop | func (rc *refCommits) pop() (commit *gitpb.Commit, empty bool) {
commit, rc.commits = rc.commits[0], rc.commits[1:]
return commit, len(rc.commits) == 0
} | go | func (rc *refCommits) pop() (commit *gitpb.Commit, empty bool) {
commit, rc.commits = rc.commits[0], rc.commits[1:]
return commit, len(rc.commits) == 0
} | [
"func",
"(",
"rc",
"*",
"refCommits",
")",
"pop",
"(",
")",
"(",
"commit",
"*",
"gitpb",
".",
"Commit",
",",
"empty",
"bool",
")",
"{",
"commit",
",",
"rc",
".",
"commits",
"=",
"rc",
".",
"commits",
"[",
"0",
"]",
",",
"rc",
".",
"commits",
"[... | // The pop method removes and returns first commit. Second return value is true
// if this was the last commit. Caller must ensure refCommits has commits when
// calling the method. | [
"The",
"pop",
"method",
"removes",
"and",
"returns",
"first",
"commit",
".",
"Second",
"return",
"value",
"is",
"true",
"if",
"this",
"was",
"the",
"last",
"commit",
".",
"Caller",
"must",
"ensure",
"refCommits",
"has",
"commits",
"when",
"calling",
"the",
... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/git/combined_logs.go#L46-L49 |
131,409 | luci/luci-go | milo/git/combined_logs.go | CombinedLogs | func (impl *implementation) CombinedLogs(c context.Context, host, project, excludeRef string, refs []string, limit int) (commits []*gitpb.Commit, err error) {
defer func() { err = errors.Annotate(common.TagGRPC(c, err), "gitiles.CombinedLogs").Err() }()
// Check if the user is allowed to access this project.
allowe... | go | func (impl *implementation) CombinedLogs(c context.Context, host, project, excludeRef string, refs []string, limit int) (commits []*gitpb.Commit, err error) {
defer func() { err = errors.Annotate(common.TagGRPC(c, err), "gitiles.CombinedLogs").Err() }()
// Check if the user is allowed to access this project.
allowe... | [
"func",
"(",
"impl",
"*",
"implementation",
")",
"CombinedLogs",
"(",
"c",
"context",
".",
"Context",
",",
"host",
",",
"project",
",",
"excludeRef",
"string",
",",
"refs",
"[",
"]",
"string",
",",
"limit",
"int",
")",
"(",
"commits",
"[",
"]",
"*",
... | // CombinedLogs implements Client interface. | [
"CombinedLogs",
"implements",
"Client",
"interface",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/git/combined_logs.go#L261-L321 |
131,410 | luci/luci-go | machine-db/appengine/model/racks.go | fetch | func (t *RacksTable) fetch(c context.Context) error {
db := database.Get(c)
rows, err := db.QueryContext(c, `
SELECT id, name, description, state, datacenter_id
FROM racks
`)
if err != nil {
return errors.Annotate(err, "failed to select racks").Err()
}
defer rows.Close()
for rows.Next() {
rack := &Rack{}... | go | func (t *RacksTable) fetch(c context.Context) error {
db := database.Get(c)
rows, err := db.QueryContext(c, `
SELECT id, name, description, state, datacenter_id
FROM racks
`)
if err != nil {
return errors.Annotate(err, "failed to select racks").Err()
}
defer rows.Close()
for rows.Next() {
rack := &Rack{}... | [
"func",
"(",
"t",
"*",
"RacksTable",
")",
"fetch",
"(",
"c",
"context",
".",
"Context",
")",
"error",
"{",
"db",
":=",
"database",
".",
"Get",
"(",
"c",
")",
"\n",
"rows",
",",
"err",
":=",
"db",
".",
"QueryContext",
"(",
"c",
",",
"`\n\t\tSELECT i... | // fetch fetches the racks from the database. | [
"fetch",
"fetches",
"the",
"racks",
"from",
"the",
"database",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/model/racks.go#L50-L68 |
131,411 | luci/luci-go | machine-db/appengine/model/racks.go | remove | func (t *RacksTable) remove(c context.Context) error {
// Avoid using the database connection to prepare unnecessary statements.
if len(t.removals) == 0 {
return nil
}
db := database.Get(c)
stmt, err := db.PrepareContext(c, `
DELETE FROM racks
WHERE id = ?
`)
if err != nil {
return errors.Annotate(err, ... | go | func (t *RacksTable) remove(c context.Context) error {
// Avoid using the database connection to prepare unnecessary statements.
if len(t.removals) == 0 {
return nil
}
db := database.Get(c)
stmt, err := db.PrepareContext(c, `
DELETE FROM racks
WHERE id = ?
`)
if err != nil {
return errors.Annotate(err, ... | [
"func",
"(",
"t",
"*",
"RacksTable",
")",
"remove",
"(",
"c",
"context",
".",
"Context",
")",
"error",
"{",
"// Avoid using the database connection to prepare unnecessary statements.",
"if",
"len",
"(",
"t",
".",
"removals",
")",
"==",
"0",
"{",
"return",
"nil",... | // remove removes all racks pending removal from the database, clearing pending removals.
// No-op unless computeChanges was called first. Idempotent until computeChanges is called again. | [
"remove",
"removes",
"all",
"racks",
"pending",
"removal",
"from",
"the",
"database",
"clearing",
"pending",
"removals",
".",
"No",
"-",
"op",
"unless",
"computeChanges",
"was",
"called",
"first",
".",
"Idempotent",
"until",
"computeChanges",
"is",
"called",
"ag... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/model/racks.go#L161-L200 |
131,412 | luci/luci-go | machine-db/appengine/model/racks.go | ids | func (t *RacksTable) ids(c context.Context) map[string]int64 {
racks := make(map[string]int64, len(t.current))
for _, rack := range t.current {
racks[rack.Name] = rack.Id
}
return racks
} | go | func (t *RacksTable) ids(c context.Context) map[string]int64 {
racks := make(map[string]int64, len(t.current))
for _, rack := range t.current {
racks[rack.Name] = rack.Id
}
return racks
} | [
"func",
"(",
"t",
"*",
"RacksTable",
")",
"ids",
"(",
"c",
"context",
".",
"Context",
")",
"map",
"[",
"string",
"]",
"int64",
"{",
"racks",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"int64",
",",
"len",
"(",
"t",
".",
"current",
")",
")",
... | // ids returns a map of rack names to IDs. | [
"ids",
"returns",
"a",
"map",
"of",
"rack",
"names",
"to",
"IDs",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/model/racks.go#L246-L252 |
131,413 | luci/luci-go | machine-db/appengine/model/racks.go | EnsureRacks | func EnsureRacks(c context.Context, cfgs []*config.Datacenter, datacenterIds map[string]int64) (map[string]int64, error) {
t := &RacksTable{}
t.datacenters = datacenterIds
if err := t.fetch(c); err != nil {
return nil, errors.Annotate(err, "failed to fetch racks").Err()
}
if err := t.computeChanges(c, cfgs); err... | go | func EnsureRacks(c context.Context, cfgs []*config.Datacenter, datacenterIds map[string]int64) (map[string]int64, error) {
t := &RacksTable{}
t.datacenters = datacenterIds
if err := t.fetch(c); err != nil {
return nil, errors.Annotate(err, "failed to fetch racks").Err()
}
if err := t.computeChanges(c, cfgs); err... | [
"func",
"EnsureRacks",
"(",
"c",
"context",
".",
"Context",
",",
"cfgs",
"[",
"]",
"*",
"config",
".",
"Datacenter",
",",
"datacenterIds",
"map",
"[",
"string",
"]",
"int64",
")",
"(",
"map",
"[",
"string",
"]",
"int64",
",",
"error",
")",
"{",
"t",
... | // EnsureRacks ensures the database contains exactly the given racks.
// Returns a map of rack names to IDs in the database. | [
"EnsureRacks",
"ensures",
"the",
"database",
"contains",
"exactly",
"the",
"given",
"racks",
".",
"Returns",
"a",
"map",
"of",
"rack",
"names",
"to",
"IDs",
"in",
"the",
"database",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/model/racks.go#L256-L275 |
131,414 | luci/luci-go | luci_notify/notify/pubsub.go | sortEmailNotify | func sortEmailNotify(en []EmailNotify) {
sort.Slice(en, func(i, j int) bool {
first := en[i]
second := en[j]
emailResult := strings.Compare(first.Email, second.Email)
if emailResult == 0 {
return strings.Compare(first.Template, second.Template) < 0
}
return emailResult < 0
})
} | go | func sortEmailNotify(en []EmailNotify) {
sort.Slice(en, func(i, j int) bool {
first := en[i]
second := en[j]
emailResult := strings.Compare(first.Email, second.Email)
if emailResult == 0 {
return strings.Compare(first.Template, second.Template) < 0
}
return emailResult < 0
})
} | [
"func",
"sortEmailNotify",
"(",
"en",
"[",
"]",
"EmailNotify",
")",
"{",
"sort",
".",
"Slice",
"(",
"en",
",",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"first",
":=",
"en",
"[",
"i",
"]",
"\n",
"second",
":=",
"en",
"[",
"j",
"]",
... | // sortEmailNotify sorts a list of EmailNotify by Email, then Template. | [
"sortEmailNotify",
"sorts",
"a",
"list",
"of",
"EmailNotify",
"by",
"Email",
"then",
"Template",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/luci_notify/notify/pubsub.go#L85-L95 |
131,415 | luci/luci-go | luci_notify/notify/pubsub.go | BuildbucketPubSubHandler | func BuildbucketPubSubHandler(ctx *router.Context, d *tq.Dispatcher) error {
c := ctx.Context
build, err := extractBuild(c, ctx.Request)
switch {
case err != nil:
return errors.Annotate(err, "failed to extract build").Err()
case build == nil:
// Ignore.
return nil
default:
return handleBuild(c, d, build... | go | func BuildbucketPubSubHandler(ctx *router.Context, d *tq.Dispatcher) error {
c := ctx.Context
build, err := extractBuild(c, ctx.Request)
switch {
case err != nil:
return errors.Annotate(err, "failed to extract build").Err()
case build == nil:
// Ignore.
return nil
default:
return handleBuild(c, d, build... | [
"func",
"BuildbucketPubSubHandler",
"(",
"ctx",
"*",
"router",
".",
"Context",
",",
"d",
"*",
"tq",
".",
"Dispatcher",
")",
"error",
"{",
"c",
":=",
"ctx",
".",
"Context",
"\n",
"build",
",",
"err",
":=",
"extractBuild",
"(",
"c",
",",
"ctx",
".",
"R... | // BuildbucketPubSubHandler is the main entrypoint for a new update from buildbucket's pubsub.
//
// This handler delegates the actual processing of the build to handleBuild.
// Its primary purpose is to unwrap context boilerplate and deal with progress-stopping errors. | [
"BuildbucketPubSubHandler",
"is",
"the",
"main",
"entrypoint",
"for",
"a",
"new",
"update",
"from",
"buildbucket",
"s",
"pubsub",
".",
"This",
"handler",
"delegates",
"the",
"actual",
"processing",
"of",
"the",
"build",
"to",
"handleBuild",
".",
"Its",
"primary"... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/luci_notify/notify/pubsub.go#L344-L358 |
131,416 | luci/luci-go | luci_notify/notify/pubsub.go | extractBuild | func extractBuild(c context.Context, r *http.Request) (*Build, error) {
// sent by pubsub.
// This struct is just convenient for unwrapping the json message
var msg struct {
Message struct {
Data []byte
}
Attributes map[string]interface{}
}
if err := json.NewDecoder(r.Body).Decode(&msg); err != nil {
re... | go | func extractBuild(c context.Context, r *http.Request) (*Build, error) {
// sent by pubsub.
// This struct is just convenient for unwrapping the json message
var msg struct {
Message struct {
Data []byte
}
Attributes map[string]interface{}
}
if err := json.NewDecoder(r.Body).Decode(&msg); err != nil {
re... | [
"func",
"extractBuild",
"(",
"c",
"context",
".",
"Context",
",",
"r",
"*",
"http",
".",
"Request",
")",
"(",
"*",
"Build",
",",
"error",
")",
"{",
"// sent by pubsub.",
"// This struct is just convenient for unwrapping the json message",
"var",
"msg",
"struct",
"... | // extractBuild constructs a Build from the PubSub HTTP request. | [
"extractBuild",
"constructs",
"a",
"Build",
"from",
"the",
"PubSub",
"HTTP",
"request",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/luci_notify/notify/pubsub.go#L367-L428 |
131,417 | luci/luci-go | cipd/appengine/impl/repo/acl.go | rolesInPrefix | func rolesInPrefix(c context.Context, metas []*api.PrefixMetadata) ([]api.Role, error) {
roles := roleSet()
for _, meta := range metas {
for _, acl := range meta.Acls {
if _, ok := roles[acl.Role]; ok {
continue // seen this role already
}
switch yes, err := isInACL(c, acl); {
case err != nil:
r... | go | func rolesInPrefix(c context.Context, metas []*api.PrefixMetadata) ([]api.Role, error) {
roles := roleSet()
for _, meta := range metas {
for _, acl := range meta.Acls {
if _, ok := roles[acl.Role]; ok {
continue // seen this role already
}
switch yes, err := isInACL(c, acl); {
case err != nil:
r... | [
"func",
"rolesInPrefix",
"(",
"c",
"context",
".",
"Context",
",",
"metas",
"[",
"]",
"*",
"api",
".",
"PrefixMetadata",
")",
"(",
"[",
"]",
"api",
".",
"Role",
",",
"error",
")",
"{",
"roles",
":=",
"roleSet",
"(",
")",
"\n",
"for",
"_",
",",
"m... | // rolesInPrefix returns a union of roles the caller has in given supplied
// PrefixMetadata objects.
//
// It understands the role inheritance defined by impliedRoles map.
//
// Returns only transient errors. | [
"rolesInPrefix",
"returns",
"a",
"union",
"of",
"roles",
"the",
"caller",
"has",
"in",
"given",
"supplied",
"PrefixMetadata",
"objects",
".",
"It",
"understands",
"the",
"role",
"inheritance",
"defined",
"by",
"impliedRoles",
"map",
".",
"Returns",
"only",
"tran... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/repo/acl.go#L121-L148 |
131,418 | luci/luci-go | cipd/appengine/impl/repo/acl.go | isInACL | func isInACL(c context.Context, acl *api.PrefixMetadata_ACL) (bool, error) {
caller := string(auth.CurrentIdentity(c)) // e.g. "user:abc@example.com"
var groups []string
for _, p := range acl.Principals {
if p == caller {
return true, nil // the caller was specified in ACLs explicitly
}
if s := strings.Spl... | go | func isInACL(c context.Context, acl *api.PrefixMetadata_ACL) (bool, error) {
caller := string(auth.CurrentIdentity(c)) // e.g. "user:abc@example.com"
var groups []string
for _, p := range acl.Principals {
if p == caller {
return true, nil // the caller was specified in ACLs explicitly
}
if s := strings.Spl... | [
"func",
"isInACL",
"(",
"c",
"context",
".",
"Context",
",",
"acl",
"*",
"api",
".",
"PrefixMetadata_ACL",
")",
"(",
"bool",
",",
"error",
")",
"{",
"caller",
":=",
"string",
"(",
"auth",
".",
"CurrentIdentity",
"(",
"c",
")",
")",
"// e.g. \"user:abc@ex... | // isInACL is true if the caller is in the given access control list. | [
"isInACL",
"is",
"true",
"if",
"the",
"caller",
"is",
"in",
"the",
"given",
"access",
"control",
"list",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/repo/acl.go#L151-L169 |
131,419 | luci/luci-go | logdog/common/viewer/url.go | GetURL | func GetURL(host string, project types.ProjectName, paths ...types.StreamPath) string {
values := make([]string, len(paths))
for i, p := range paths {
values[i] = fmt.Sprintf("%s/%s", project, p)
}
u := url.URL{
Scheme: "https",
Host: host,
}
if len(values) == 1 {
u.Path = "logs/" + values[0]
} else {
... | go | func GetURL(host string, project types.ProjectName, paths ...types.StreamPath) string {
values := make([]string, len(paths))
for i, p := range paths {
values[i] = fmt.Sprintf("%s/%s", project, p)
}
u := url.URL{
Scheme: "https",
Host: host,
}
if len(values) == 1 {
u.Path = "logs/" + values[0]
} else {
... | [
"func",
"GetURL",
"(",
"host",
"string",
",",
"project",
"types",
".",
"ProjectName",
",",
"paths",
"...",
"types",
".",
"StreamPath",
")",
"string",
"{",
"values",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"paths",
")",
")",
"\n",
"for... | // GetURL generates a LogDog app viewer URL for the specified streams.
// Uses the plain-text endpoint for single stream paths, and the client-side endpoint for multi-stream paths. | [
"GetURL",
"generates",
"a",
"LogDog",
"app",
"viewer",
"URL",
"for",
"the",
"specified",
"streams",
".",
"Uses",
"the",
"plain",
"-",
"text",
"endpoint",
"for",
"single",
"stream",
"paths",
"and",
"the",
"client",
"-",
"side",
"endpoint",
"for",
"multi",
"... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/common/viewer/url.go#L28-L46 |
131,420 | luci/luci-go | gce/cmd/agent/assets.gen.go | GetAssetSHA256 | func GetAssetSHA256(name string) []byte {
data := fileSha256s[name]
if data == nil {
return nil
}
return append([]byte(nil), data...)
} | go | func GetAssetSHA256(name string) []byte {
data := fileSha256s[name]
if data == nil {
return nil
}
return append([]byte(nil), data...)
} | [
"func",
"GetAssetSHA256",
"(",
"name",
"string",
")",
"[",
"]",
"byte",
"{",
"data",
":=",
"fileSha256s",
"[",
"name",
"]",
"\n",
"if",
"data",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"append",
"(",
"[",
"]",
"byte",
"(",
"nil... | // GetAssetSHA256 returns the asset checksum. Returns nil if no such asset
// exists. | [
"GetAssetSHA256",
"returns",
"the",
"asset",
"checksum",
".",
"Returns",
"nil",
"if",
"no",
"such",
"asset",
"exists",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/gce/cmd/agent/assets.gen.go#L35-L41 |
131,421 | luci/luci-go | gce/cmd/agent/assets.gen.go | Assets | func Assets() map[string]string {
cpy := make(map[string]string, len(files))
for k, v := range files {
cpy[k] = v
}
return cpy
} | go | func Assets() map[string]string {
cpy := make(map[string]string, len(files))
for k, v := range files {
cpy[k] = v
}
return cpy
} | [
"func",
"Assets",
"(",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"cpy",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"len",
"(",
"files",
")",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"files",
"{",
"cpy",
"[",
"k",
... | // Assets returns a map of all assets. | [
"Assets",
"returns",
"a",
"map",
"of",
"all",
"assets",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/gce/cmd/agent/assets.gen.go#L44-L50 |
131,422 | luci/luci-go | machine-db/appengine/rpc/vlans.go | ListVLANs | func (*Service) ListVLANs(c context.Context, req *crimson.ListVLANsRequest) (*crimson.ListVLANsResponse, error) {
ids := make(map[int64]struct{}, len(req.Ids))
for _, id := range req.Ids {
ids[id] = struct{}{}
}
vlans, err := listVLANs(c, ids, stringset.NewFromSlice(req.Aliases...))
if err != nil {
return nil,... | go | func (*Service) ListVLANs(c context.Context, req *crimson.ListVLANsRequest) (*crimson.ListVLANsResponse, error) {
ids := make(map[int64]struct{}, len(req.Ids))
for _, id := range req.Ids {
ids[id] = struct{}{}
}
vlans, err := listVLANs(c, ids, stringset.NewFromSlice(req.Aliases...))
if err != nil {
return nil,... | [
"func",
"(",
"*",
"Service",
")",
"ListVLANs",
"(",
"c",
"context",
".",
"Context",
",",
"req",
"*",
"crimson",
".",
"ListVLANsRequest",
")",
"(",
"*",
"crimson",
".",
"ListVLANsResponse",
",",
"error",
")",
"{",
"ids",
":=",
"make",
"(",
"map",
"[",
... | // ListVLANs handles a request to retrieve VLANs. | [
"ListVLANs",
"handles",
"a",
"request",
"to",
"retrieve",
"VLANs",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/vlans.go#L28-L40 |
131,423 | luci/luci-go | machine-db/appengine/rpc/vlans.go | listVLANs | func listVLANs(c context.Context, ids map[int64]struct{}, aliases stringset.Set) ([]*crimson.VLAN, error) {
db := database.Get(c)
rows, err := db.QueryContext(c, `
SELECT id, alias, state, cidr_block
FROM vlans
`)
if err != nil {
return nil, errors.Annotate(err, "failed to fetch VLANs").Err()
}
defer rows.C... | go | func listVLANs(c context.Context, ids map[int64]struct{}, aliases stringset.Set) ([]*crimson.VLAN, error) {
db := database.Get(c)
rows, err := db.QueryContext(c, `
SELECT id, alias, state, cidr_block
FROM vlans
`)
if err != nil {
return nil, errors.Annotate(err, "failed to fetch VLANs").Err()
}
defer rows.C... | [
"func",
"listVLANs",
"(",
"c",
"context",
".",
"Context",
",",
"ids",
"map",
"[",
"int64",
"]",
"struct",
"{",
"}",
",",
"aliases",
"stringset",
".",
"Set",
")",
"(",
"[",
"]",
"*",
"crimson",
".",
"VLAN",
",",
"error",
")",
"{",
"db",
":=",
"dat... | // listVLANs returns a slice of VLANs in the database.
// VLANs matching either a given ID or a given alias are returned. Specify no IDs or aliases to return all VLANs. | [
"listVLANs",
"returns",
"a",
"slice",
"of",
"VLANs",
"in",
"the",
"database",
".",
"VLANs",
"matching",
"either",
"a",
"given",
"ID",
"or",
"a",
"given",
"alias",
"are",
"returned",
".",
"Specify",
"no",
"IDs",
"or",
"aliases",
"to",
"return",
"all",
"VL... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/machine-db/appengine/rpc/vlans.go#L44-L68 |
131,424 | luci/luci-go | milo/frontend/view_build.go | handleLUCIBuild | func handleLUCIBuild(c *router.Context) error {
bucket := c.Params.ByName("bucket")
buildername := c.Params.ByName("builder")
numberOrId := c.Params.ByName("numberOrId")
forceBlamelist := c.Request.FormValue("blamelist") != ""
if _, v2Bucket := deprecated.BucketNameToV2(bucket); v2Bucket != "" {
// Params bucke... | go | func handleLUCIBuild(c *router.Context) error {
bucket := c.Params.ByName("bucket")
buildername := c.Params.ByName("builder")
numberOrId := c.Params.ByName("numberOrId")
forceBlamelist := c.Request.FormValue("blamelist") != ""
if _, v2Bucket := deprecated.BucketNameToV2(bucket); v2Bucket != "" {
// Params bucke... | [
"func",
"handleLUCIBuild",
"(",
"c",
"*",
"router",
".",
"Context",
")",
"error",
"{",
"bucket",
":=",
"c",
".",
"Params",
".",
"ByName",
"(",
"\"",
"\"",
")",
"\n",
"buildername",
":=",
"c",
".",
"Params",
".",
"ByName",
"(",
"\"",
"\"",
")",
"\n"... | // handleLUCIBuild renders a LUCI build. | [
"handleLUCIBuild",
"renders",
"a",
"LUCI",
"build",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/view_build.go#L48-L82 |
131,425 | luci/luci-go | milo/frontend/view_build.go | renderBuild | func renderBuild(c *router.Context, bp *ui.BuildPage, err error) error {
if err != nil {
return err
}
bp.StepDisplayPref = getStepDisplayPrefCookie(c)
templates.MustRender(c.Context, c.Writer, "pages/build.html", templates.Args{
"BuildPage": bp,
})
return nil
} | go | func renderBuild(c *router.Context, bp *ui.BuildPage, err error) error {
if err != nil {
return err
}
bp.StepDisplayPref = getStepDisplayPrefCookie(c)
templates.MustRender(c.Context, c.Writer, "pages/build.html", templates.Args{
"BuildPage": bp,
})
return nil
} | [
"func",
"renderBuild",
"(",
"c",
"*",
"router",
".",
"Context",
",",
"bp",
"*",
"ui",
".",
"BuildPage",
",",
"err",
"error",
")",
"error",
"{",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"bp",
".",
"StepDisplayPref",
"=",
"g... | // renderBuild is a shortcut for rendering build or returning err if it is not nil. | [
"renderBuild",
"is",
"a",
"shortcut",
"for",
"rendering",
"build",
"or",
"returning",
"err",
"if",
"it",
"is",
"not",
"nil",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/view_build.go#L85-L96 |
131,426 | luci/luci-go | server/auth/openid/json_web_keys.go | NewJSONWebKeySet | func NewJSONWebKeySet(parsed *JSONWebKeySetStruct) (*JSONWebKeySet, error) {
// Pick keys used to verify RS256 signatures.
keys := make(map[string]rsa.PublicKey, len(parsed.Keys))
for _, k := range parsed.Keys {
if k.Kty != "RSA" || k.Alg != "RS256" || k.Use != "sig" {
continue // not an RSA public key
}
if... | go | func NewJSONWebKeySet(parsed *JSONWebKeySetStruct) (*JSONWebKeySet, error) {
// Pick keys used to verify RS256 signatures.
keys := make(map[string]rsa.PublicKey, len(parsed.Keys))
for _, k := range parsed.Keys {
if k.Kty != "RSA" || k.Alg != "RS256" || k.Use != "sig" {
continue // not an RSA public key
}
if... | [
"func",
"NewJSONWebKeySet",
"(",
"parsed",
"*",
"JSONWebKeySetStruct",
")",
"(",
"*",
"JSONWebKeySet",
",",
"error",
")",
"{",
"// Pick keys used to verify RS256 signatures.",
"keys",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"rsa",
".",
"PublicKey",
",",
"l... | // NewJSONWebKeySet makes the keyset from raw JSON Web Key set struct. | [
"NewJSONWebKeySet",
"makes",
"the",
"keyset",
"from",
"raw",
"JSON",
"Web",
"Key",
"set",
"struct",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/server/auth/openid/json_web_keys.go#L60-L84 |
131,427 | luci/luci-go | server/auth/openid/json_web_keys.go | VerifyJWT | func (k *JSONWebKeySet) VerifyJWT(jwt string) (body []byte, err error) {
chunks := strings.Split(jwt, ".")
if len(chunks) != 3 {
return nil, fmt.Errorf("bad JWT - expected 3 components separated by '.'")
}
// Check the header, grab the corresponding public key.
var hdr struct {
Alg string `json:"alg"`
Kid s... | go | func (k *JSONWebKeySet) VerifyJWT(jwt string) (body []byte, err error) {
chunks := strings.Split(jwt, ".")
if len(chunks) != 3 {
return nil, fmt.Errorf("bad JWT - expected 3 components separated by '.'")
}
// Check the header, grab the corresponding public key.
var hdr struct {
Alg string `json:"alg"`
Kid s... | [
"func",
"(",
"k",
"*",
"JSONWebKeySet",
")",
"VerifyJWT",
"(",
"jwt",
"string",
")",
"(",
"body",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"chunks",
":=",
"strings",
".",
"Split",
"(",
"jwt",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
... | // VerifyJWT checks JWT signature and returns the token body.
//
// Supports only non-encrypted RS256-signed JWTs. See RFC7519. | [
"VerifyJWT",
"checks",
"JWT",
"signature",
"and",
"returns",
"the",
"token",
"body",
".",
"Supports",
"only",
"non",
"-",
"encrypted",
"RS256",
"-",
"signed",
"JWTs",
".",
"See",
"RFC7519",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/server/auth/openid/json_web_keys.go#L89-L136 |
131,428 | luci/luci-go | common/logging/gkelogger/logger.go | GetFactory | func GetFactory(out io.Writer) func(context.Context) logging.Logger {
lock := sync.Mutex{}
return func(c context.Context) logging.Logger {
return &jsonLogger{
ctx: c,
lock: &lock,
out: out,
}
}
} | go | func GetFactory(out io.Writer) func(context.Context) logging.Logger {
lock := sync.Mutex{}
return func(c context.Context) logging.Logger {
return &jsonLogger{
ctx: c,
lock: &lock,
out: out,
}
}
} | [
"func",
"GetFactory",
"(",
"out",
"io",
".",
"Writer",
")",
"func",
"(",
"context",
".",
"Context",
")",
"logging",
".",
"Logger",
"{",
"lock",
":=",
"sync",
".",
"Mutex",
"{",
"}",
"\n",
"return",
"func",
"(",
"c",
"context",
".",
"Context",
")",
... | // GetFactory creates a goroutine safe gkelogger that writes into out. | [
"GetFactory",
"creates",
"a",
"goroutine",
"safe",
"gkelogger",
"that",
"writes",
"into",
"out",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/logging/gkelogger/logger.go#L30-L39 |
131,429 | luci/luci-go | common/iotools/chainreader.go | Remaining | func (cr ChainReader) Remaining() int64 {
result, err := cr.RemainingErr()
if err != nil {
panic(err)
}
return result
} | go | func (cr ChainReader) Remaining() int64 {
result, err := cr.RemainingErr()
if err != nil {
panic(err)
}
return result
} | [
"func",
"(",
"cr",
"ChainReader",
")",
"Remaining",
"(",
")",
"int64",
"{",
"result",
",",
"err",
":=",
"cr",
".",
"RemainingErr",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"result",
"\n",
... | // Remaining calculates the amount of data left in the ChainReader. It will
// panic if an error condition in RemainingErr is encountered. | [
"Remaining",
"calculates",
"the",
"amount",
"of",
"data",
"left",
"in",
"the",
"ChainReader",
".",
"It",
"will",
"panic",
"if",
"an",
"error",
"condition",
"in",
"RemainingErr",
"is",
"encountered",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/iotools/chainreader.go#L77-L83 |
131,430 | luci/luci-go | common/iotools/chainreader.go | RemainingErr | func (cr ChainReader) RemainingErr() (int64, error) {
result := int64(0)
for _, source := range cr {
if source == nil {
continue
}
r, ok := source.(interface {
Len() int
})
if !ok {
return 0, errors.New("chainreader: can only calculate Remaining for instances implementing Len()")
}
result += in... | go | func (cr ChainReader) RemainingErr() (int64, error) {
result := int64(0)
for _, source := range cr {
if source == nil {
continue
}
r, ok := source.(interface {
Len() int
})
if !ok {
return 0, errors.New("chainreader: can only calculate Remaining for instances implementing Len()")
}
result += in... | [
"func",
"(",
"cr",
"ChainReader",
")",
"RemainingErr",
"(",
")",
"(",
"int64",
",",
"error",
")",
"{",
"result",
":=",
"int64",
"(",
"0",
")",
"\n",
"for",
"_",
",",
"source",
":=",
"range",
"cr",
"{",
"if",
"source",
"==",
"nil",
"{",
"continue",
... | // RemainingErr returns the amount of data left in the ChainReader. An error is
// returned if any reader in the chain is not either nil or a bytes.Reader.
//
// Note that this method iterates over all readers in the chain each time that
// it's called. | [
"RemainingErr",
"returns",
"the",
"amount",
"of",
"data",
"left",
"in",
"the",
"ChainReader",
".",
"An",
"error",
"is",
"returned",
"if",
"any",
"reader",
"in",
"the",
"chain",
"is",
"not",
"either",
"nil",
"or",
"a",
"bytes",
".",
"Reader",
".",
"Note",... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/iotools/chainreader.go#L90-L105 |
131,431 | luci/luci-go | logdog/client/butler/streamserver/namedPipe_posix.go | NewUNIXDomainSocketServer | func NewUNIXDomainSocketServer(ctx context.Context, path string) (StreamServer, error) {
switch l := len(path); {
case l == 0:
return nil, errors.New("cannot have empty path")
case l > maxPOSIXNamedSocketLength:
return nil, errors.Reason("path exceeds maximum length %d", maxPOSIXNamedSocketLength).
InternalRe... | go | func NewUNIXDomainSocketServer(ctx context.Context, path string) (StreamServer, error) {
switch l := len(path); {
case l == 0:
return nil, errors.New("cannot have empty path")
case l > maxPOSIXNamedSocketLength:
return nil, errors.Reason("path exceeds maximum length %d", maxPOSIXNamedSocketLength).
InternalRe... | [
"func",
"NewUNIXDomainSocketServer",
"(",
"ctx",
"context",
".",
"Context",
",",
"path",
"string",
")",
"(",
"StreamServer",
",",
"error",
")",
"{",
"switch",
"l",
":=",
"len",
"(",
"path",
")",
";",
"{",
"case",
"l",
"==",
"0",
":",
"return",
"nil",
... | // NewUNIXDomainSocketServer instantiates a new POSIX domain soecket server
// instance.
//
// No resources are actually created until methods are called on the returned
// server. | [
"NewUNIXDomainSocketServer",
"instantiates",
"a",
"new",
"POSIX",
"domain",
"soecket",
"server",
"instance",
".",
"No",
"resources",
"are",
"actually",
"created",
"until",
"methods",
"are",
"called",
"on",
"the",
"returned",
"server",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/client/butler/streamserver/namedPipe_posix.go#L39-L83 |
131,432 | luci/luci-go | grpc/internal/svctool/tool.go | ParseArgs | func (t *Tool) ParseArgs(args []string) {
args = t.parseFlags(args)
switch len(args) {
case 0:
args = []string{"."}
fallthrough
case 1:
info, err := os.Stat(args[0])
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(2)
}
if info.IsDir() {
t.Dir = args[0]
t.FileNames, err = goFilesIn(arg... | go | func (t *Tool) ParseArgs(args []string) {
args = t.parseFlags(args)
switch len(args) {
case 0:
args = []string{"."}
fallthrough
case 1:
info, err := os.Stat(args[0])
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(2)
}
if info.IsDir() {
t.Dir = args[0]
t.FileNames, err = goFilesIn(arg... | [
"func",
"(",
"t",
"*",
"Tool",
")",
"ParseArgs",
"(",
"args",
"[",
"]",
"string",
")",
"{",
"args",
"=",
"t",
".",
"parseFlags",
"(",
"args",
")",
"\n\n",
"switch",
"len",
"(",
"args",
")",
"{",
"case",
"0",
":",
"args",
"=",
"[",
"]",
"string"... | // ParseArgs parses command arguments. Exits if they are invalid. | [
"ParseArgs",
"parses",
"command",
"arguments",
".",
"Exits",
"if",
"they",
"are",
"invalid",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/grpc/internal/svctool/tool.go#L107-L136 |
131,433 | luci/luci-go | grpc/internal/svctool/tool.go | Run | func (t *Tool) Run(c context.Context, f Generator) error {
// Validate arguments.
if len(t.FileNames) == 0 {
return fmt.Errorf("files not specified")
}
if len(t.Types) == 0 {
return fmt.Errorf("types not specified")
}
// Determine output file name.
outputName := t.Output
if outputName == "" {
if t.Dir ==... | go | func (t *Tool) Run(c context.Context, f Generator) error {
// Validate arguments.
if len(t.FileNames) == 0 {
return fmt.Errorf("files not specified")
}
if len(t.Types) == 0 {
return fmt.Errorf("types not specified")
}
// Determine output file name.
outputName := t.Output
if outputName == "" {
if t.Dir ==... | [
"func",
"(",
"t",
"*",
"Tool",
")",
"Run",
"(",
"c",
"context",
".",
"Context",
",",
"f",
"Generator",
")",
"error",
"{",
"// Validate arguments.",
"if",
"len",
"(",
"t",
".",
"FileNames",
")",
"==",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"... | // Run parses Go files and generates a new file using f. | [
"Run",
"parses",
"Go",
"files",
"and",
"generates",
"a",
"new",
"file",
"using",
"f",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/grpc/internal/svctool/tool.go#L162-L214 |
131,434 | luci/luci-go | grpc/internal/svctool/tool.go | goFilesIn | func goFilesIn(dir string) ([]string, error) {
pkg, err := build.ImportDir(dir, 0)
if err != nil {
return nil, fmt.Errorf("cannot process directory %s: %s", dir, err)
}
var names []string
names = append(names, pkg.GoFiles...)
names = append(names, pkg.CgoFiles...)
names = prefixDirectory(dir, names)
return na... | go | func goFilesIn(dir string) ([]string, error) {
pkg, err := build.ImportDir(dir, 0)
if err != nil {
return nil, fmt.Errorf("cannot process directory %s: %s", dir, err)
}
var names []string
names = append(names, pkg.GoFiles...)
names = append(names, pkg.CgoFiles...)
names = prefixDirectory(dir, names)
return na... | [
"func",
"goFilesIn",
"(",
"dir",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"pkg",
",",
"err",
":=",
"build",
".",
"ImportDir",
"(",
"dir",
",",
"0",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".... | // goFilesIn lists .go files in dir. | [
"goFilesIn",
"lists",
".",
"go",
"files",
"in",
"dir",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/grpc/internal/svctool/tool.go#L230-L240 |
131,435 | luci/luci-go | appengine/gaemiddleware/settings.go | reportDSCacheDisabled | func reportDSCacheDisabled(c context.Context) {
dsCacheDisabled.Set(c, bool(fetchCachedSettings(c).DisableDSCache))
} | go | func reportDSCacheDisabled(c context.Context) {
dsCacheDisabled.Set(c, bool(fetchCachedSettings(c).DisableDSCache))
} | [
"func",
"reportDSCacheDisabled",
"(",
"c",
"context",
".",
"Context",
")",
"{",
"dsCacheDisabled",
".",
"Set",
"(",
"c",
",",
"bool",
"(",
"fetchCachedSettings",
"(",
"c",
")",
".",
"DisableDSCache",
")",
")",
"\n",
"}"
] | // reportDSCacheDisabled reports the value of DSCacheDisabled in settings to
// tsmon. | [
"reportDSCacheDisabled",
"reports",
"the",
"value",
"of",
"DSCacheDisabled",
"in",
"settings",
"to",
"tsmon",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/appengine/gaemiddleware/settings.go#L87-L89 |
131,436 | luci/luci-go | logdog/server/archivist/archivist.go | ArchiveTask | func (a *Archivist) ArchiveTask(c context.Context, task *logdog.ArchiveTask) error {
c = log.SetFields(c, log.Fields{
"project": task.Project,
"id": task.Id,
})
log.Debugf(c, "Received archival task.")
err := a.archiveTaskImpl(c, task)
failure := isFailure(err)
log.Fields{
log.ErrorKey: err,
"failu... | go | func (a *Archivist) ArchiveTask(c context.Context, task *logdog.ArchiveTask) error {
c = log.SetFields(c, log.Fields{
"project": task.Project,
"id": task.Id,
})
log.Debugf(c, "Received archival task.")
err := a.archiveTaskImpl(c, task)
failure := isFailure(err)
log.Fields{
log.ErrorKey: err,
"failu... | [
"func",
"(",
"a",
"*",
"Archivist",
")",
"ArchiveTask",
"(",
"c",
"context",
".",
"Context",
",",
"task",
"*",
"logdog",
".",
"ArchiveTask",
")",
"error",
"{",
"c",
"=",
"log",
".",
"SetFields",
"(",
"c",
",",
"log",
".",
"Fields",
"{",
"\"",
"\"",... | // ArchiveTask processes and executes a single log stream archive task.
//
// If the supplied Context is Done, operation may terminate before completion,
// returning the Context's error. | [
"ArchiveTask",
"processes",
"and",
"executes",
"a",
"single",
"log",
"stream",
"archive",
"task",
".",
"If",
"the",
"supplied",
"Context",
"is",
"Done",
"operation",
"may",
"terminate",
"before",
"completion",
"returning",
"the",
"Context",
"s",
"error",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/server/archivist/archivist.go#L163-L182 |
131,437 | luci/luci-go | logdog/server/archivist/archivist.go | loadSettings | func (a *Archivist) loadSettings(c context.Context, project types.ProjectName) (*Settings, error) {
if a.SettingsLoader == nil {
panic("no settings loader configured")
}
st, err := a.SettingsLoader(c, project)
switch {
case err != nil:
return nil, err
case st.GSBase.Bucket() == "":
log.Fields{
log.Erro... | go | func (a *Archivist) loadSettings(c context.Context, project types.ProjectName) (*Settings, error) {
if a.SettingsLoader == nil {
panic("no settings loader configured")
}
st, err := a.SettingsLoader(c, project)
switch {
case err != nil:
return nil, err
case st.GSBase.Bucket() == "":
log.Fields{
log.Erro... | [
"func",
"(",
"a",
"*",
"Archivist",
")",
"loadSettings",
"(",
"c",
"context",
".",
"Context",
",",
"project",
"types",
".",
"ProjectName",
")",
"(",
"*",
"Settings",
",",
"error",
")",
"{",
"if",
"a",
".",
"SettingsLoader",
"==",
"nil",
"{",
"panic",
... | // loadSettings loads and validates archival settings. | [
"loadSettings",
"loads",
"and",
"validates",
"archival",
"settings",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/server/archivist/archivist.go#L323-L350 |
131,438 | luci/luci-go | logdog/server/archivist/archivist.go | checkComplete | func (sa *stagedArchival) checkComplete(c context.Context) error {
if sa.terminalIndex < 0 {
log.Warningf(c, "Cannot archive complete stream with no terminal index.")
return statusErr(errors.New("completeness required, but stream has no terminal index"))
}
sreq := storage.GetRequest{
Project: sa.project,
P... | go | func (sa *stagedArchival) checkComplete(c context.Context) error {
if sa.terminalIndex < 0 {
log.Warningf(c, "Cannot archive complete stream with no terminal index.")
return statusErr(errors.New("completeness required, but stream has no terminal index"))
}
sreq := storage.GetRequest{
Project: sa.project,
P... | [
"func",
"(",
"sa",
"*",
"stagedArchival",
")",
"checkComplete",
"(",
"c",
"context",
".",
"Context",
")",
"error",
"{",
"if",
"sa",
".",
"terminalIndex",
"<",
"0",
"{",
"log",
".",
"Warningf",
"(",
"c",
",",
"\"",
"\"",
")",
"\n",
"return",
"statusEr... | // checkComplete performs a quick scan of intermediate storage to ensure that
// all of the log stream's records are available. | [
"checkComplete",
"performs",
"a",
"quick",
"scan",
"of",
"intermediate",
"storage",
"to",
"ensure",
"that",
"all",
"of",
"the",
"log",
"stream",
"s",
"records",
"are",
"available",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/server/archivist/archivist.go#L437-L479 |
131,439 | luci/luci-go | common/tsmon/target/target.go | NewFromFlags | func NewFromFlags(fl *Flags) (types.Target, error) {
if fl.TargetType == "task" {
if fl.TaskServiceName == "" {
return nil, errors.New(
"--ts-mon-task-service-name must be provided when using --ts-mon-target-type=task")
}
if fl.TaskJobName == "" {
return nil, errors.New(
"--ts-mon-task-job-name mus... | go | func NewFromFlags(fl *Flags) (types.Target, error) {
if fl.TargetType == "task" {
if fl.TaskServiceName == "" {
return nil, errors.New(
"--ts-mon-task-service-name must be provided when using --ts-mon-target-type=task")
}
if fl.TaskJobName == "" {
return nil, errors.New(
"--ts-mon-task-job-name mus... | [
"func",
"NewFromFlags",
"(",
"fl",
"*",
"Flags",
")",
"(",
"types",
".",
"Target",
",",
"error",
")",
"{",
"if",
"fl",
".",
"TargetType",
"==",
"\"",
"\"",
"{",
"if",
"fl",
".",
"TaskServiceName",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"error... | // NewFromFlags returns a Target configured from commandline flags. | [
"NewFromFlags",
"returns",
"a",
"Target",
"configured",
"from",
"commandline",
"flags",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/tsmon/target/target.go#L83-L111 |
131,440 | luci/luci-go | common/data/stringset/stringset.go | NewFromSlice | func NewFromSlice(vals ...string) Set {
ret := make(Set, len(vals))
for _, k := range vals {
ret[k] = struct{}{}
}
return ret
} | go | func NewFromSlice(vals ...string) Set {
ret := make(Set, len(vals))
for _, k := range vals {
ret[k] = struct{}{}
}
return ret
} | [
"func",
"NewFromSlice",
"(",
"vals",
"...",
"string",
")",
"Set",
"{",
"ret",
":=",
"make",
"(",
"Set",
",",
"len",
"(",
"vals",
")",
")",
"\n",
"for",
"_",
",",
"k",
":=",
"range",
"vals",
"{",
"ret",
"[",
"k",
"]",
"=",
"struct",
"{",
"}",
... | // NewFromSlice returns a new string Set implementation,
// initialized with the values in the provided slice. | [
"NewFromSlice",
"returns",
"a",
"new",
"string",
"Set",
"implementation",
"initialized",
"with",
"the",
"values",
"in",
"the",
"provided",
"slice",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/stringset/stringset.go#L27-L33 |
131,441 | luci/luci-go | common/data/stringset/stringset.go | Has | func (s Set) Has(value string) bool {
_, ret := s[value]
return ret
} | go | func (s Set) Has(value string) bool {
_, ret := s[value]
return ret
} | [
"func",
"(",
"s",
"Set",
")",
"Has",
"(",
"value",
"string",
")",
"bool",
"{",
"_",
",",
"ret",
":=",
"s",
"[",
"value",
"]",
"\n",
"return",
"ret",
"\n",
"}"
] | // Has returns true iff the Set contains value. | [
"Has",
"returns",
"true",
"iff",
"the",
"Set",
"contains",
"value",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/stringset/stringset.go#L36-L39 |
131,442 | luci/luci-go | common/data/stringset/stringset.go | HasAll | func (s Set) HasAll(values ...string) bool {
for _, v := range values {
if !s.Has(v) {
return false
}
}
return true
} | go | func (s Set) HasAll(values ...string) bool {
for _, v := range values {
if !s.Has(v) {
return false
}
}
return true
} | [
"func",
"(",
"s",
"Set",
")",
"HasAll",
"(",
"values",
"...",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"v",
":=",
"range",
"values",
"{",
"if",
"!",
"s",
".",
"Has",
"(",
"v",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n",
"retu... | // HasAll returns true iff the Set contains all the given values. | [
"HasAll",
"returns",
"true",
"iff",
"the",
"Set",
"contains",
"all",
"the",
"given",
"values",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/stringset/stringset.go#L42-L49 |
131,443 | luci/luci-go | common/data/stringset/stringset.go | Iter | func (s Set) Iter(cb func(string) bool) {
for k := range s {
if !cb(k) {
break
}
}
} | go | func (s Set) Iter(cb func(string) bool) {
for k := range s {
if !cb(k) {
break
}
}
} | [
"func",
"(",
"s",
"Set",
")",
"Iter",
"(",
"cb",
"func",
"(",
"string",
")",
"bool",
")",
"{",
"for",
"k",
":=",
"range",
"s",
"{",
"if",
"!",
"cb",
"(",
"k",
")",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] | // Iter calls `cb` for each item in the set. If `cb` returns false, the
// iteration stops. | [
"Iter",
"calls",
"cb",
"for",
"each",
"item",
"in",
"the",
"set",
".",
"If",
"cb",
"returns",
"false",
"the",
"iteration",
"stops",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/stringset/stringset.go#L92-L98 |
131,444 | luci/luci-go | common/data/stringset/stringset.go | Dup | func (s Set) Dup() Set {
ret := make(Set, len(s))
for k := range s {
ret[k] = struct{}{}
}
return ret
} | go | func (s Set) Dup() Set {
ret := make(Set, len(s))
for k := range s {
ret[k] = struct{}{}
}
return ret
} | [
"func",
"(",
"s",
"Set",
")",
"Dup",
"(",
")",
"Set",
"{",
"ret",
":=",
"make",
"(",
"Set",
",",
"len",
"(",
"s",
")",
")",
"\n",
"for",
"k",
":=",
"range",
"s",
"{",
"ret",
"[",
"k",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"... | // Dup returns a duplicate set. | [
"Dup",
"returns",
"a",
"duplicate",
"set",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/stringset/stringset.go#L106-L112 |
131,445 | luci/luci-go | common/data/stringset/stringset.go | ToSlice | func (s Set) ToSlice() []string {
ret := make([]string, 0, len(s))
for k := range s {
ret = append(ret, k)
}
return ret
} | go | func (s Set) ToSlice() []string {
ret := make([]string, 0, len(s))
for k := range s {
ret = append(ret, k)
}
return ret
} | [
"func",
"(",
"s",
"Set",
")",
"ToSlice",
"(",
")",
"[",
"]",
"string",
"{",
"ret",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"s",
")",
")",
"\n",
"for",
"k",
":=",
"range",
"s",
"{",
"ret",
"=",
"append",
"(",
"ret",... | // ToSlice renders this set to a slice of all values. | [
"ToSlice",
"renders",
"this",
"set",
"to",
"a",
"slice",
"of",
"all",
"values",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/stringset/stringset.go#L115-L121 |
131,446 | luci/luci-go | common/data/stringset/stringset.go | Intersect | func (s Set) Intersect(other Set) Set {
smallLen := len(s)
if lo := len(other); lo < smallLen {
smallLen = lo
}
ret := make(Set, smallLen)
for k := range s {
if _, ok := other[k]; ok {
ret[k] = struct{}{}
}
}
return ret
} | go | func (s Set) Intersect(other Set) Set {
smallLen := len(s)
if lo := len(other); lo < smallLen {
smallLen = lo
}
ret := make(Set, smallLen)
for k := range s {
if _, ok := other[k]; ok {
ret[k] = struct{}{}
}
}
return ret
} | [
"func",
"(",
"s",
"Set",
")",
"Intersect",
"(",
"other",
"Set",
")",
"Set",
"{",
"smallLen",
":=",
"len",
"(",
"s",
")",
"\n",
"if",
"lo",
":=",
"len",
"(",
"other",
")",
";",
"lo",
"<",
"smallLen",
"{",
"smallLen",
"=",
"lo",
"\n",
"}",
"\n",
... | // Intersect returns a new Set which is the intersection of this set with the
// other set.
//
// `other` must have the same underlying type as the current set, or this will
// panic. | [
"Intersect",
"returns",
"a",
"new",
"Set",
"which",
"is",
"the",
"intersection",
"of",
"this",
"set",
"with",
"the",
"other",
"set",
".",
"other",
"must",
"have",
"the",
"same",
"underlying",
"type",
"as",
"the",
"current",
"set",
"or",
"this",
"will",
"... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/stringset/stringset.go#L128-L140 |
131,447 | luci/luci-go | common/data/stringset/stringset.go | Union | func (s Set) Union(other Set) Set {
ret := make(Set, len(s))
for k := range s {
ret[k] = struct{}{}
}
for k := range other {
ret[k] = struct{}{}
}
return ret
} | go | func (s Set) Union(other Set) Set {
ret := make(Set, len(s))
for k := range s {
ret[k] = struct{}{}
}
for k := range other {
ret[k] = struct{}{}
}
return ret
} | [
"func",
"(",
"s",
"Set",
")",
"Union",
"(",
"other",
"Set",
")",
"Set",
"{",
"ret",
":=",
"make",
"(",
"Set",
",",
"len",
"(",
"s",
")",
")",
"\n",
"for",
"k",
":=",
"range",
"s",
"{",
"ret",
"[",
"k",
"]",
"=",
"struct",
"{",
"}",
"{",
"... | // Union returns a new Set which contains all element from this set, as well
// as all elements from the other set.
//
// `other` must have the same underlying type as the current set, or this will
// panic. | [
"Union",
"returns",
"a",
"new",
"Set",
"which",
"contains",
"all",
"element",
"from",
"this",
"set",
"as",
"well",
"as",
"all",
"elements",
"from",
"the",
"other",
"set",
".",
"other",
"must",
"have",
"the",
"same",
"underlying",
"type",
"as",
"the",
"cu... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/stringset/stringset.go#L162-L171 |
131,448 | luci/luci-go | common/data/stringset/stringset.go | Contains | func (s Set) Contains(other Set) bool {
for k := range other {
if !s.Has(k) {
return false
}
}
return true
} | go | func (s Set) Contains(other Set) bool {
for k := range other {
if !s.Has(k) {
return false
}
}
return true
} | [
"func",
"(",
"s",
"Set",
")",
"Contains",
"(",
"other",
"Set",
")",
"bool",
"{",
"for",
"k",
":=",
"range",
"other",
"{",
"if",
"!",
"s",
".",
"Has",
"(",
"k",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"... | // Contains returns true iff the given set contains all elements from the other set. | [
"Contains",
"returns",
"true",
"iff",
"the",
"given",
"set",
"contains",
"all",
"elements",
"from",
"the",
"other",
"set",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/stringset/stringset.go#L174-L181 |
131,449 | luci/luci-go | cipd/appengine/impl/repo/processing/client_extractor.go | GetClientPackage | func GetClientPackage(platform string) (string, error) {
pkg := clientPkgPrefix + platform
if err := common.ValidatePackageName(pkg); err != nil {
return "", err
}
return pkg, nil
} | go | func GetClientPackage(platform string) (string, error) {
pkg := clientPkgPrefix + platform
if err := common.ValidatePackageName(pkg); err != nil {
return "", err
}
return pkg, nil
} | [
"func",
"GetClientPackage",
"(",
"platform",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"pkg",
":=",
"clientPkgPrefix",
"+",
"platform",
"\n",
"if",
"err",
":=",
"common",
".",
"ValidatePackageName",
"(",
"pkg",
")",
";",
"err",
"!=",
"nil",
"... | // GetClientPackage returns the name of the client package for CIPD client for
// the given platform.
//
// Returns an error if the platform name is invalid. | [
"GetClientPackage",
"returns",
"the",
"name",
"of",
"the",
"client",
"package",
"for",
"CIPD",
"client",
"for",
"the",
"given",
"platform",
".",
"Returns",
"an",
"error",
"if",
"the",
"platform",
"name",
"is",
"invalid",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/repo/processing/client_extractor.go#L47-L53 |
131,450 | luci/luci-go | cipd/appengine/impl/repo/processing/client_extractor.go | ToObjectRef | func (r *ClientExtractorResult) ToObjectRef() (*api.ObjectRef, error) {
algo := api.HashAlgo_value[r.ClientBinary.HashAlgo]
if algo == 0 {
// Note: this means OLD version of the server may not be able to serve
// NEW ClientExtractorResult entries due to unknown hash algo. Many other
// things will also break in... | go | func (r *ClientExtractorResult) ToObjectRef() (*api.ObjectRef, error) {
algo := api.HashAlgo_value[r.ClientBinary.HashAlgo]
if algo == 0 {
// Note: this means OLD version of the server may not be able to serve
// NEW ClientExtractorResult entries due to unknown hash algo. Many other
// things will also break in... | [
"func",
"(",
"r",
"*",
"ClientExtractorResult",
")",
"ToObjectRef",
"(",
")",
"(",
"*",
"api",
".",
"ObjectRef",
",",
"error",
")",
"{",
"algo",
":=",
"api",
".",
"HashAlgo_value",
"[",
"r",
".",
"ClientBinary",
".",
"HashAlgo",
"]",
"\n",
"if",
"algo"... | // ToObjectRef returns a reference to the extracted client binary in CAS.
//
// The returned ObjectRef is validated to be syntactically correct already. | [
"ToObjectRef",
"returns",
"a",
"reference",
"to",
"the",
"extracted",
"client",
"binary",
"in",
"CAS",
".",
"The",
"returned",
"ObjectRef",
"is",
"validated",
"to",
"be",
"syntactically",
"correct",
"already",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/repo/processing/client_extractor.go#L99-L117 |
131,451 | luci/luci-go | cipd/appengine/impl/repo/processing/client_extractor.go | ObjectRefAliases | func (r *ClientExtractorResult) ObjectRefAliases() []*api.ObjectRef {
all := r.ClientBinary.AllHashDigests
// Older entries do not have AllHashDigests field at all.
if len(all) == 0 {
ref := &api.ObjectRef{
HashAlgo: api.HashAlgo(api.HashAlgo_value[r.ClientBinary.HashAlgo]),
HexDigest: r.ClientBinary.HashD... | go | func (r *ClientExtractorResult) ObjectRefAliases() []*api.ObjectRef {
all := r.ClientBinary.AllHashDigests
// Older entries do not have AllHashDigests field at all.
if len(all) == 0 {
ref := &api.ObjectRef{
HashAlgo: api.HashAlgo(api.HashAlgo_value[r.ClientBinary.HashAlgo]),
HexDigest: r.ClientBinary.HashD... | [
"func",
"(",
"r",
"*",
"ClientExtractorResult",
")",
"ObjectRefAliases",
"(",
")",
"[",
"]",
"*",
"api",
".",
"ObjectRef",
"{",
"all",
":=",
"r",
".",
"ClientBinary",
".",
"AllHashDigests",
"\n\n",
"// Older entries do not have AllHashDigests field at all.",
"if",
... | // ObjectRefAliases is list of ObjectRefs calculated using all hash algos known
// to the server when the client binary was extracted.
//
// Additionally all algos not understood by the server right NOW are skipped
// too. This may arise if the server was rolled back, but some files have
// already been uploaded with a... | [
"ObjectRefAliases",
"is",
"list",
"of",
"ObjectRefs",
"calculated",
"using",
"all",
"hash",
"algos",
"known",
"to",
"the",
"server",
"when",
"the",
"client",
"binary",
"was",
"extracted",
".",
"Additionally",
"all",
"algos",
"not",
"understood",
"by",
"the",
"... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/repo/processing/client_extractor.go#L125-L153 |
131,452 | luci/luci-go | cipd/appengine/impl/repo/processing/client_extractor.go | Applicable | func (e *ClientExtractor) Applicable(inst *model.Instance) bool {
return IsClientPackage(inst.Package.StringID())
} | go | func (e *ClientExtractor) Applicable(inst *model.Instance) bool {
return IsClientPackage(inst.Package.StringID())
} | [
"func",
"(",
"e",
"*",
"ClientExtractor",
")",
"Applicable",
"(",
"inst",
"*",
"model",
".",
"Instance",
")",
"bool",
"{",
"return",
"IsClientPackage",
"(",
"inst",
".",
"Package",
".",
"StringID",
"(",
")",
")",
"\n",
"}"
] | // Applicable is part of Processor interface. | [
"Applicable",
"is",
"part",
"of",
"Processor",
"interface",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/repo/processing/client_extractor.go#L178-L180 |
131,453 | luci/luci-go | cipd/appengine/impl/cas/cas.go | Internal | func Internal(d *tq.Dispatcher) StorageServer {
impl := &storageImpl{
tq: d,
getGS: gs.Get,
settings: settings.Get,
getSignedURL: getSignedURL,
}
impl.registerTasks()
return impl
} | go | func Internal(d *tq.Dispatcher) StorageServer {
impl := &storageImpl{
tq: d,
getGS: gs.Get,
settings: settings.Get,
getSignedURL: getSignedURL,
}
impl.registerTasks()
return impl
} | [
"func",
"Internal",
"(",
"d",
"*",
"tq",
".",
"Dispatcher",
")",
"StorageServer",
"{",
"impl",
":=",
"&",
"storageImpl",
"{",
"tq",
":",
"d",
",",
"getGS",
":",
"gs",
".",
"Get",
",",
"settings",
":",
"settings",
".",
"Get",
",",
"getSignedURL",
":",... | // Internal returns non-ACLed implementation of StorageService.
//
// It can be used internally by the backend. Assumes ACL checks are already
// done.
//
// Registers some task queue tasks in the given dispatcher. | [
"Internal",
"returns",
"non",
"-",
"ACLed",
"implementation",
"of",
"StorageService",
".",
"It",
"can",
"be",
"used",
"internally",
"by",
"the",
"backend",
".",
"Assumes",
"ACL",
"checks",
"are",
"already",
"done",
".",
"Registers",
"some",
"task",
"queue",
... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/cas/cas.go#L71-L80 |
131,454 | luci/luci-go | cipd/appengine/impl/cas/cas.go | GetReader | func (s *storageImpl) GetReader(c context.Context, ref *api.ObjectRef) (r gs.Reader, err error) {
defer func() { err = grpcutil.GRPCifyAndLogErr(c, err) }()
if err = common.ValidateObjectRef(ref, common.KnownHash); err != nil {
return nil, errors.Annotate(err, "bad ref").Err()
}
cfg, err := s.settings(c)
if er... | go | func (s *storageImpl) GetReader(c context.Context, ref *api.ObjectRef) (r gs.Reader, err error) {
defer func() { err = grpcutil.GRPCifyAndLogErr(c, err) }()
if err = common.ValidateObjectRef(ref, common.KnownHash); err != nil {
return nil, errors.Annotate(err, "bad ref").Err()
}
cfg, err := s.settings(c)
if er... | [
"func",
"(",
"s",
"*",
"storageImpl",
")",
"GetReader",
"(",
"c",
"context",
".",
"Context",
",",
"ref",
"*",
"api",
".",
"ObjectRef",
")",
"(",
"r",
"gs",
".",
"Reader",
",",
"err",
"error",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"err",
"=",
... | // GetReader is part of StorageServer interface. | [
"GetReader",
"is",
"part",
"of",
"StorageServer",
"interface",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/cas/cas.go#L106-L127 |
131,455 | luci/luci-go | cipd/appengine/impl/cas/cas.go | GetObjectURL | func (s *storageImpl) GetObjectURL(c context.Context, r *api.GetObjectURLRequest) (resp *api.ObjectURL, err error) {
defer func() { err = grpcutil.GRPCifyAndLogErr(c, err) }()
if err := common.ValidateObjectRef(r.Object, common.KnownHash); err != nil {
return nil, errors.Annotate(err, "bad 'object' field").Err()
... | go | func (s *storageImpl) GetObjectURL(c context.Context, r *api.GetObjectURLRequest) (resp *api.ObjectURL, err error) {
defer func() { err = grpcutil.GRPCifyAndLogErr(c, err) }()
if err := common.ValidateObjectRef(r.Object, common.KnownHash); err != nil {
return nil, errors.Annotate(err, "bad 'object' field").Err()
... | [
"func",
"(",
"s",
"*",
"storageImpl",
")",
"GetObjectURL",
"(",
"c",
"context",
".",
"Context",
",",
"r",
"*",
"api",
".",
"GetObjectURLRequest",
")",
"(",
"resp",
"*",
"api",
".",
"ObjectURL",
",",
"err",
"error",
")",
"{",
"defer",
"func",
"(",
")"... | // GetObjectURL implements the corresponding RPC method, see the proto doc. | [
"GetObjectURL",
"implements",
"the",
"corresponding",
"RPC",
"method",
"see",
"the",
"proto",
"doc",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/cas/cas.go#L130-L161 |
131,456 | luci/luci-go | cipd/appengine/impl/cas/cas.go | FinishUpload | func (s *storageImpl) FinishUpload(c context.Context, r *api.FinishUploadRequest) (resp *api.UploadOperation, err error) {
defer func() { err = grpcutil.GRPCifyAndLogErr(c, err) }()
if r.ForceHash != nil {
if err := common.ValidateObjectRef(r.ForceHash, common.KnownHash); err != nil {
return nil, errors.Annotat... | go | func (s *storageImpl) FinishUpload(c context.Context, r *api.FinishUploadRequest) (resp *api.UploadOperation, err error) {
defer func() { err = grpcutil.GRPCifyAndLogErr(c, err) }()
if r.ForceHash != nil {
if err := common.ValidateObjectRef(r.ForceHash, common.KnownHash); err != nil {
return nil, errors.Annotat... | [
"func",
"(",
"s",
"*",
"storageImpl",
")",
"FinishUpload",
"(",
"c",
"context",
".",
"Context",
",",
"r",
"*",
"api",
".",
"FinishUploadRequest",
")",
"(",
"resp",
"*",
"api",
".",
"UploadOperation",
",",
"err",
"error",
")",
"{",
"defer",
"func",
"(",... | // FinishUpload implements the corresponding RPC method, see the proto doc. | [
"FinishUpload",
"implements",
"the",
"corresponding",
"RPC",
"method",
"see",
"the",
"proto",
"doc",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/cas/cas.go#L260-L303 |
131,457 | luci/luci-go | cipd/appengine/impl/cas/cas.go | CancelUpload | func (s *storageImpl) CancelUpload(c context.Context, r *api.CancelUploadRequest) (resp *api.UploadOperation, err error) {
defer func() { err = grpcutil.GRPCifyAndLogErr(c, err) }()
handleOpStatus := func(op *upload.Operation) (*api.UploadOperation, error) {
if op.Status == api.UploadStatus_ERRORED || op.Status ==... | go | func (s *storageImpl) CancelUpload(c context.Context, r *api.CancelUploadRequest) (resp *api.UploadOperation, err error) {
defer func() { err = grpcutil.GRPCifyAndLogErr(c, err) }()
handleOpStatus := func(op *upload.Operation) (*api.UploadOperation, error) {
if op.Status == api.UploadStatus_ERRORED || op.Status ==... | [
"func",
"(",
"s",
"*",
"storageImpl",
")",
"CancelUpload",
"(",
"c",
"context",
".",
"Context",
",",
"r",
"*",
"api",
".",
"CancelUploadRequest",
")",
"(",
"resp",
"*",
"api",
".",
"UploadOperation",
",",
"err",
"error",
")",
"{",
"defer",
"func",
"(",... | // CancelUpload implements the corresponding RPC method, see the proto doc. | [
"CancelUpload",
"implements",
"the",
"corresponding",
"RPC",
"method",
"see",
"the",
"proto",
"doc",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/cas/cas.go#L306-L342 |
131,458 | luci/luci-go | cipd/appengine/impl/cas/cas.go | fetchOp | func fetchOp(c context.Context, wrappedOpID string) (*upload.Operation, error) {
opID, err := upload.UnwrapOpID(c, wrappedOpID, auth.CurrentIdentity(c))
if err != nil {
if transient.Tag.In(err) {
return nil, errors.Annotate(err, "failed to check HMAC on upload_operation_id").Err()
}
return nil, errors.Reason... | go | func fetchOp(c context.Context, wrappedOpID string) (*upload.Operation, error) {
opID, err := upload.UnwrapOpID(c, wrappedOpID, auth.CurrentIdentity(c))
if err != nil {
if transient.Tag.In(err) {
return nil, errors.Annotate(err, "failed to check HMAC on upload_operation_id").Err()
}
return nil, errors.Reason... | [
"func",
"fetchOp",
"(",
"c",
"context",
".",
"Context",
",",
"wrappedOpID",
"string",
")",
"(",
"*",
"upload",
".",
"Operation",
",",
"error",
")",
"{",
"opID",
",",
"err",
":=",
"upload",
".",
"UnwrapOpID",
"(",
"c",
",",
"wrappedOpID",
",",
"auth",
... | // fethcOp unwraps upload operation ID and fetches upload.Operation entity.
//
// Returns an grpc-tagged error on failure that can be returned to the RPC
// caller right away. | [
"fethcOp",
"unwraps",
"upload",
"operation",
"ID",
"and",
"fetches",
"upload",
".",
"Operation",
"entity",
".",
"Returns",
"an",
"grpc",
"-",
"tagged",
"error",
"on",
"failure",
"that",
"can",
"be",
"returned",
"to",
"the",
"RPC",
"caller",
"right",
"away",
... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/cas/cas.go#L348-L370 |
131,459 | luci/luci-go | cipd/appengine/impl/cas/cas.go | finishAndForcedHash | func (s *storageImpl) finishAndForcedHash(c context.Context, op *upload.Operation, hash *api.ObjectRef) (*upload.Operation, error) {
gs := s.getGS(c)
cfg, err := s.settings(c)
if err != nil {
return nil, err
}
// Try to move the object into the final location. This may fail
// transiently, in which case we ask... | go | func (s *storageImpl) finishAndForcedHash(c context.Context, op *upload.Operation, hash *api.ObjectRef) (*upload.Operation, error) {
gs := s.getGS(c)
cfg, err := s.settings(c)
if err != nil {
return nil, err
}
// Try to move the object into the final location. This may fail
// transiently, in which case we ask... | [
"func",
"(",
"s",
"*",
"storageImpl",
")",
"finishAndForcedHash",
"(",
"c",
"context",
".",
"Context",
",",
"op",
"*",
"upload",
".",
"Operation",
",",
"hash",
"*",
"api",
".",
"ObjectRef",
")",
"(",
"*",
"upload",
".",
"Operation",
",",
"error",
")",
... | // finishAndForcedHash finalizes uploads that use ForceHash field.
//
// It publishes the object immediately, skipping the verification. | [
"finishAndForcedHash",
"finalizes",
"uploads",
"that",
"use",
"ForceHash",
"field",
".",
"It",
"publishes",
"the",
"object",
"immediately",
"skipping",
"the",
"verification",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/cas/cas.go#L375-L410 |
131,460 | luci/luci-go | cipd/appengine/impl/cas/cas.go | cleanupUploadTask | func (s *storageImpl) cleanupUploadTask(c context.Context, task *tasks.CleanupUpload) (err error) {
gs := s.getGS(c)
if err := gs.CancelUpload(c, task.UploadUrl); err != nil {
if transient.Tag.In(err) {
return errors.Annotate(err, "transient error when canceling the resumable upload").Err()
}
logging.WithEr... | go | func (s *storageImpl) cleanupUploadTask(c context.Context, task *tasks.CleanupUpload) (err error) {
gs := s.getGS(c)
if err := gs.CancelUpload(c, task.UploadUrl); err != nil {
if transient.Tag.In(err) {
return errors.Annotate(err, "transient error when canceling the resumable upload").Err()
}
logging.WithEr... | [
"func",
"(",
"s",
"*",
"storageImpl",
")",
"cleanupUploadTask",
"(",
"c",
"context",
".",
"Context",
",",
"task",
"*",
"tasks",
".",
"CleanupUpload",
")",
"(",
"err",
"error",
")",
"{",
"gs",
":=",
"s",
".",
"getGS",
"(",
"c",
")",
"\n\n",
"if",
"e... | // cleanupUploadTask is called to clean up after a canceled upload.
//
// Best effort. If the temporary file can't be deleted from GS due to some
// non-transient error, logs the error and ignores it, since retrying won't
// help. | [
"cleanupUploadTask",
"is",
"called",
"to",
"clean",
"up",
"after",
"a",
"canceled",
"upload",
".",
"Best",
"effort",
".",
"If",
"the",
"temporary",
"file",
"can",
"t",
"be",
"deleted",
"from",
"GS",
"due",
"to",
"some",
"non",
"-",
"transient",
"error",
... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/cipd/appengine/impl/cas/cas.go#L555-L573 |
131,461 | luci/luci-go | milo/common/config.go | ProjectID | func (c *Console) ProjectID() string {
if c.Parent == nil {
return ""
}
return c.Parent.StringID()
} | go | func (c *Console) ProjectID() string {
if c.Parent == nil {
return ""
}
return c.Parent.StringID()
} | [
"func",
"(",
"c",
"*",
"Console",
")",
"ProjectID",
"(",
")",
"string",
"{",
"if",
"c",
".",
"Parent",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"c",
".",
"Parent",
".",
"StringID",
"(",
")",
"\n",
"}"
] | // ProjectID retrieves the project ID string of the console out of the Console's
// parent key. | [
"ProjectID",
"retrieves",
"the",
"project",
"ID",
"string",
"of",
"the",
"console",
"out",
"of",
"the",
"Console",
"s",
"parent",
"key",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L93-L98 |
131,462 | luci/luci-go | milo/common/config.go | FilterBuilders | func (c *Console) FilterBuilders(perms access.Permissions) {
okBuilderIDs := make([]string, 0, len(c.Builders))
for _, id := range c.Builders {
if bucket := extractBucket(id); bucket != "" && !perms.Can(bucket, access.AccessBucket) {
continue
}
okBuilderIDs = append(okBuilderIDs, id)
}
c.Builders = okBuild... | go | func (c *Console) FilterBuilders(perms access.Permissions) {
okBuilderIDs := make([]string, 0, len(c.Builders))
for _, id := range c.Builders {
if bucket := extractBucket(id); bucket != "" && !perms.Can(bucket, access.AccessBucket) {
continue
}
okBuilderIDs = append(okBuilderIDs, id)
}
c.Builders = okBuild... | [
"func",
"(",
"c",
"*",
"Console",
")",
"FilterBuilders",
"(",
"perms",
"access",
".",
"Permissions",
")",
"{",
"okBuilderIDs",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"c",
".",
"Builders",
")",
")",
"\n",
"for",
"_",
",",
... | // FilterBuilders uses an access.Permissions to filter out builder IDs and builders
// from the definition, and builders in the definition's header, which are not
// allowed by the permissions. | [
"FilterBuilders",
"uses",
"an",
"access",
".",
"Permissions",
"to",
"filter",
"out",
"builder",
"IDs",
"and",
"builders",
"from",
"the",
"definition",
"and",
"builders",
"in",
"the",
"definition",
"s",
"header",
"which",
"are",
"not",
"allowed",
"by",
"the",
... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L103-L128 |
131,463 | luci/luci-go | milo/common/config.go | Buckets | func (c *Console) Buckets() stringset.Set {
buckets := stringset.New(1)
for _, id := range c.Builders {
if bucket := extractBucket(id); bucket != "" {
buckets.Add(bucket)
}
}
return buckets
} | go | func (c *Console) Buckets() stringset.Set {
buckets := stringset.New(1)
for _, id := range c.Builders {
if bucket := extractBucket(id); bucket != "" {
buckets.Add(bucket)
}
}
return buckets
} | [
"func",
"(",
"c",
"*",
"Console",
")",
"Buckets",
"(",
")",
"stringset",
".",
"Set",
"{",
"buckets",
":=",
"stringset",
".",
"New",
"(",
"1",
")",
"\n",
"for",
"_",
",",
"id",
":=",
"range",
"c",
".",
"Builders",
"{",
"if",
"bucket",
":=",
"extra... | // Buckets returns all buckets referenced by this Console's Builders. | [
"Buckets",
"returns",
"all",
"buckets",
"referenced",
"by",
"this",
"Console",
"s",
"Builders",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L131-L139 |
131,464 | luci/luci-go | milo/common/config.go | SetID | func (id *ConsoleID) SetID(c context.Context, console *Console) *Console {
if console == nil {
console = &Console{}
}
console.Parent = datastore.MakeKey(c, "Project", id.Project)
console.ID = id.ID
return console
} | go | func (id *ConsoleID) SetID(c context.Context, console *Console) *Console {
if console == nil {
console = &Console{}
}
console.Parent = datastore.MakeKey(c, "Project", id.Project)
console.ID = id.ID
return console
} | [
"func",
"(",
"id",
"*",
"ConsoleID",
")",
"SetID",
"(",
"c",
"context",
".",
"Context",
",",
"console",
"*",
"Console",
")",
"*",
"Console",
"{",
"if",
"console",
"==",
"nil",
"{",
"console",
"=",
"&",
"Console",
"{",
"}",
"\n",
"}",
"\n",
"console... | // NewEntity returns an empty Console datastore entity keyed with itself. | [
"NewEntity",
"returns",
"an",
"empty",
"Console",
"datastore",
"entity",
"keyed",
"with",
"itself",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L180-L187 |
131,465 | luci/luci-go | milo/common/config.go | LuciConfigURL | func LuciConfigURL(c context.Context, configSet, path, revision string) string {
// TODO(hinoka): This shouldn't be hardcoded, instead we should get the
// luci-config instance from the context. But we only use this instance at
// the moment so it is okay for now.
// TODO(hinoka): The UI doesn't allow specifying p... | go | func LuciConfigURL(c context.Context, configSet, path, revision string) string {
// TODO(hinoka): This shouldn't be hardcoded, instead we should get the
// luci-config instance from the context. But we only use this instance at
// the moment so it is okay for now.
// TODO(hinoka): The UI doesn't allow specifying p... | [
"func",
"LuciConfigURL",
"(",
"c",
"context",
".",
"Context",
",",
"configSet",
",",
"path",
",",
"revision",
"string",
")",
"string",
"{",
"// TODO(hinoka): This shouldn't be hardcoded, instead we should get the",
"// luci-config instance from the context. But we only use this ... | // LuciConfigURL returns a user friendly URL that specifies where to view
// this console definition. | [
"LuciConfigURL",
"returns",
"a",
"user",
"friendly",
"URL",
"that",
"specifies",
"where",
"to",
"view",
"this",
"console",
"definition",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L200-L207 |
131,466 | luci/luci-go | milo/common/config.go | GetCurrentServiceConfig | func GetCurrentServiceConfig(c context.Context) (*ServiceConfig, error) {
// This maker function is used to do the actual fetch of the ServiceConfig
// from datastore. It is called if the ServiceConfig is not in proc cache.
item, err := serviceCfgCache.Fetch(c, func(interface{}) (interface{}, time.Duration, error) ... | go | func GetCurrentServiceConfig(c context.Context) (*ServiceConfig, error) {
// This maker function is used to do the actual fetch of the ServiceConfig
// from datastore. It is called if the ServiceConfig is not in proc cache.
item, err := serviceCfgCache.Fetch(c, func(interface{}) (interface{}, time.Duration, error) ... | [
"func",
"GetCurrentServiceConfig",
"(",
"c",
"context",
".",
"Context",
")",
"(",
"*",
"ServiceConfig",
",",
"error",
")",
"{",
"// This maker function is used to do the actual fetch of the ServiceConfig",
"// from datastore. It is called if the ServiceConfig is not in proc cache.",... | // GetCurrentServiceConfig gets the service config for the instance from either
// process cache or datastore cache. | [
"GetCurrentServiceConfig",
"gets",
"the",
"service",
"config",
"for",
"the",
"instance",
"from",
"either",
"process",
"cache",
"or",
"datastore",
"cache",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L278-L298 |
131,467 | luci/luci-go | milo/common/config.go | UpdateServiceConfig | func UpdateServiceConfig(c context.Context) (*config.Settings, error) {
// Load the settings from luci-config.
cs := cfgclient.CurrentServiceConfigSet(c)
// Acquire the raw config client.
lucicfg := backend.Get(c).GetConfigInterface(c, backend.AsService)
cfg, err := lucicfg.GetConfig(c, cs, globalConfigFilename, f... | go | func UpdateServiceConfig(c context.Context) (*config.Settings, error) {
// Load the settings from luci-config.
cs := cfgclient.CurrentServiceConfigSet(c)
// Acquire the raw config client.
lucicfg := backend.Get(c).GetConfigInterface(c, backend.AsService)
cfg, err := lucicfg.GetConfig(c, cs, globalConfigFilename, f... | [
"func",
"UpdateServiceConfig",
"(",
"c",
"context",
".",
"Context",
")",
"(",
"*",
"config",
".",
"Settings",
",",
"error",
")",
"{",
"// Load the settings from luci-config.",
"cs",
":=",
"cfgclient",
".",
"CurrentServiceConfigSet",
"(",
"c",
")",
"\n",
"// Acqu... | // UpdateServiceConfig fetches the service config from luci-config
// and then stores a snapshot of the configuration in datastore. | [
"UpdateServiceConfig",
"fetches",
"the",
"service",
"config",
"from",
"luci",
"-",
"config",
"and",
"then",
"stores",
"a",
"snapshot",
"of",
"the",
"configuration",
"in",
"datastore",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L304-L359 |
131,468 | luci/luci-go | milo/common/config.go | updateProjectConsoles | func updateProjectConsoles(c context.Context, projectID string, cfg *configInterface.Config) (stringset.Set, error) {
proj := config.Project{}
if err := protoutil.UnmarshalTextML(cfg.Content, &proj); err != nil {
return nil, errors.Annotate(err, "unmarshalling proto").Err()
}
// Extract the headers into a map fo... | go | func updateProjectConsoles(c context.Context, projectID string, cfg *configInterface.Config) (stringset.Set, error) {
proj := config.Project{}
if err := protoutil.UnmarshalTextML(cfg.Content, &proj); err != nil {
return nil, errors.Annotate(err, "unmarshalling proto").Err()
}
// Extract the headers into a map fo... | [
"func",
"updateProjectConsoles",
"(",
"c",
"context",
".",
"Context",
",",
"projectID",
"string",
",",
"cfg",
"*",
"configInterface",
".",
"Config",
")",
"(",
"stringset",
".",
"Set",
",",
"error",
")",
"{",
"proj",
":=",
"config",
".",
"Project",
"{",
"... | // updateProjectConsoles updates all of the consoles for a given project,
// and then returns a set of known console names. | [
"updateProjectConsoles",
"updates",
"all",
"of",
"the",
"consoles",
"for",
"a",
"given",
"project",
"and",
"then",
"returns",
"a",
"set",
"of",
"known",
"console",
"names",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L363-L427 |
131,469 | luci/luci-go | milo/common/config.go | UpdateConsoles | func UpdateConsoles(c context.Context) error {
cfgName := info.AppID(c) + ".cfg"
logging.Debugf(c, "fetching configs for %s", cfgName)
// Acquire the raw config client.
lucicfg := backend.Get(c).GetConfigInterface(c, backend.AsService)
// Project configs for Milo contains console definitions.
configs, err := luc... | go | func UpdateConsoles(c context.Context) error {
cfgName := info.AppID(c) + ".cfg"
logging.Debugf(c, "fetching configs for %s", cfgName)
// Acquire the raw config client.
lucicfg := backend.Get(c).GetConfigInterface(c, backend.AsService)
// Project configs for Milo contains console definitions.
configs, err := luc... | [
"func",
"UpdateConsoles",
"(",
"c",
"context",
".",
"Context",
")",
"error",
"{",
"cfgName",
":=",
"info",
".",
"AppID",
"(",
"c",
")",
"+",
"\"",
"\"",
"\n\n",
"logging",
".",
"Debugf",
"(",
"c",
",",
"\"",
"\"",
",",
"cfgName",
")",
"\n",
"// Acq... | // UpdateConsoles updates internal console definitions entities based off luci-config. | [
"UpdateConsoles",
"updates",
"internal",
"console",
"definitions",
"entities",
"based",
"off",
"luci",
"-",
"config",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L430-L507 |
131,470 | luci/luci-go | milo/common/config.go | GetAllProjects | func GetAllProjects(c context.Context) ([]Project, error) {
q := datastore.NewQuery("Project")
projs := []Project{}
if err := datastore.GetAll(c, q, &projs); err != nil {
return nil, errors.Annotate(err, "getting projects").Err()
}
result := []Project{}
for _, proj := range projs {
switch allowed, err := IsA... | go | func GetAllProjects(c context.Context) ([]Project, error) {
q := datastore.NewQuery("Project")
projs := []Project{}
if err := datastore.GetAll(c, q, &projs); err != nil {
return nil, errors.Annotate(err, "getting projects").Err()
}
result := []Project{}
for _, proj := range projs {
switch allowed, err := IsA... | [
"func",
"GetAllProjects",
"(",
"c",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"Project",
",",
"error",
")",
"{",
"q",
":=",
"datastore",
".",
"NewQuery",
"(",
"\"",
"\"",
")",
"\n",
"projs",
":=",
"[",
"]",
"Project",
"{",
"}",
"\n\n",
"if",
... | // GetAllProjects returns all projects the current user has access to. | [
"GetAllProjects",
"returns",
"all",
"projects",
"the",
"current",
"user",
"has",
"access",
"to",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L551-L568 |
131,471 | luci/luci-go | milo/common/config.go | GetProjectConsoles | func GetProjectConsoles(c context.Context, projectID string) ([]*Console, error) {
// Query datastore for consoles related to the project.
q := datastore.NewQuery("Console")
parentKey := datastore.MakeKey(c, "Project", projectID)
q = q.Ancestor(parentKey)
con := []*Console{}
err := datastore.GetAll(c, q, &con)
s... | go | func GetProjectConsoles(c context.Context, projectID string) ([]*Console, error) {
// Query datastore for consoles related to the project.
q := datastore.NewQuery("Console")
parentKey := datastore.MakeKey(c, "Project", projectID)
q = q.Ancestor(parentKey)
con := []*Console{}
err := datastore.GetAll(c, q, &con)
s... | [
"func",
"GetProjectConsoles",
"(",
"c",
"context",
".",
"Context",
",",
"projectID",
"string",
")",
"(",
"[",
"]",
"*",
"Console",
",",
"error",
")",
"{",
"// Query datastore for consoles related to the project.",
"q",
":=",
"datastore",
".",
"NewQuery",
"(",
"\... | // GetProjectConsoles returns all consoles for the given project ordered as in config. | [
"GetProjectConsoles",
"returns",
"all",
"consoles",
"for",
"the",
"given",
"project",
"ordered",
"as",
"in",
"config",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L571-L580 |
131,472 | luci/luci-go | milo/common/config.go | init | func init() {
// Milo is only responsible for validating the config matching the instance's
// appID in a project config.
validation.Rules.Add("regex:projects/.*", "${appid}.cfg", validateProjectCfg)
validation.Rules.Add("services/${appid}", globalConfigFilename, validateServiceCfg)
} | go | func init() {
// Milo is only responsible for validating the config matching the instance's
// appID in a project config.
validation.Rules.Add("regex:projects/.*", "${appid}.cfg", validateProjectCfg)
validation.Rules.Add("services/${appid}", globalConfigFilename, validateServiceCfg)
} | [
"func",
"init",
"(",
")",
"{",
"// Milo is only responsible for validating the config matching the instance's",
"// appID in a project config.",
"validation",
".",
"Rules",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"validateProjectCfg",
")",
"\n",
"validation",
... | // Config validation rules go here. | [
"Config",
"validation",
"rules",
"go",
"here",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/common/config.go#L617-L622 |
131,473 | luci/luci-go | lucictx/local_auth.go | GetLocalAuth | func GetLocalAuth(ctx context.Context) *LocalAuth {
ret := LocalAuth{}
ok, err := Lookup(ctx, "local_auth", &ret)
if err != nil {
panic(err)
}
if !ok {
return nil
}
return &ret
} | go | func GetLocalAuth(ctx context.Context) *LocalAuth {
ret := LocalAuth{}
ok, err := Lookup(ctx, "local_auth", &ret)
if err != nil {
panic(err)
}
if !ok {
return nil
}
return &ret
} | [
"func",
"GetLocalAuth",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"LocalAuth",
"{",
"ret",
":=",
"LocalAuth",
"{",
"}",
"\n",
"ok",
",",
"err",
":=",
"Lookup",
"(",
"ctx",
",",
"\"",
"\"",
",",
"&",
"ret",
")",
"\n",
"if",
"err",
"!=",
"ni... | // GetLocalAuth calls Lookup and returns a copy of the current LocalAuth from
// LUCI_CONTEXT if it was present. If no LocalAuth is in the context, this
// returns nil. | [
"GetLocalAuth",
"calls",
"Lookup",
"and",
"returns",
"a",
"copy",
"of",
"the",
"current",
"LocalAuth",
"from",
"LUCI_CONTEXT",
"if",
"it",
"was",
"present",
".",
"If",
"no",
"LocalAuth",
"is",
"in",
"the",
"context",
"this",
"returns",
"nil",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucictx/local_auth.go#L52-L62 |
131,474 | luci/luci-go | lucictx/local_auth.go | SetLocalAuth | func SetLocalAuth(ctx context.Context, la *LocalAuth) context.Context {
var raw interface{}
if la != nil {
raw = la
}
ctx, err := Set(ctx, "local_auth", raw)
if err != nil {
panic(fmt.Errorf("impossible: %s", err))
}
return ctx
} | go | func SetLocalAuth(ctx context.Context, la *LocalAuth) context.Context {
var raw interface{}
if la != nil {
raw = la
}
ctx, err := Set(ctx, "local_auth", raw)
if err != nil {
panic(fmt.Errorf("impossible: %s", err))
}
return ctx
} | [
"func",
"SetLocalAuth",
"(",
"ctx",
"context",
".",
"Context",
",",
"la",
"*",
"LocalAuth",
")",
"context",
".",
"Context",
"{",
"var",
"raw",
"interface",
"{",
"}",
"\n",
"if",
"la",
"!=",
"nil",
"{",
"raw",
"=",
"la",
"\n",
"}",
"\n",
"ctx",
",",... | // SetLocalAuth sets the LocalAuth in the LUCI_CONTEXT. | [
"SetLocalAuth",
"sets",
"the",
"LocalAuth",
"in",
"the",
"LUCI_CONTEXT",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucictx/local_auth.go#L65-L75 |
131,475 | luci/luci-go | logdog/client/bootstrapResult/result.go | WriteJSON | func (r *Result) WriteJSON(path string) error {
fd, err := os.Create(path)
if err != nil {
return err
}
defer fd.Close()
return json.NewEncoder(fd).Encode(r)
} | go | func (r *Result) WriteJSON(path string) error {
fd, err := os.Create(path)
if err != nil {
return err
}
defer fd.Close()
return json.NewEncoder(fd).Encode(r)
} | [
"func",
"(",
"r",
"*",
"Result",
")",
"WriteJSON",
"(",
"path",
"string",
")",
"error",
"{",
"fd",
",",
"err",
":=",
"os",
".",
"Create",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"fd",
".... | // WriteJSON writes Result as a JSON document to the specified path. | [
"WriteJSON",
"writes",
"Result",
"as",
"a",
"JSON",
"document",
"to",
"the",
"specified",
"path",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/client/bootstrapResult/result.go#L33-L40 |
131,476 | luci/luci-go | tokenserver/appengine/impl/utils/policy/entities.go | updateImportedPolicy | func updateImportedPolicy(c context.Context, name, rev, sha256 string, serialized []byte) error {
header := &importedPolicyHeader{
Name: name,
Revision: rev,
SHA256: sha256,
}
body := &importedPolicyBody{
Parent: datastore.KeyForObj(c, header),
Revision: rev,
SHA256: sha256,
Data: seriali... | go | func updateImportedPolicy(c context.Context, name, rev, sha256 string, serialized []byte) error {
header := &importedPolicyHeader{
Name: name,
Revision: rev,
SHA256: sha256,
}
body := &importedPolicyBody{
Parent: datastore.KeyForObj(c, header),
Revision: rev,
SHA256: sha256,
Data: seriali... | [
"func",
"updateImportedPolicy",
"(",
"c",
"context",
".",
"Context",
",",
"name",
",",
"rev",
",",
"sha256",
"string",
",",
"serialized",
"[",
"]",
"byte",
")",
"error",
"{",
"header",
":=",
"&",
"importedPolicyHeader",
"{",
"Name",
":",
"name",
",",
"Re... | // updateImportedPolicy replaces the currently stored policy.
//
// It transactionally updates both importedPolicyHeader and importedPolicyBody. | [
"updateImportedPolicy",
"replaces",
"the",
"currently",
"stored",
"policy",
".",
"It",
"transactionally",
"updates",
"both",
"importedPolicyHeader",
"and",
"importedPolicyBody",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/tokenserver/appengine/impl/utils/policy/entities.go#L56-L71 |
131,477 | luci/luci-go | common/flag/multiflag/multiflag.go | GetOutput | func (mf *MultiFlag) GetOutput() io.Writer {
if w := mf.Output; w != nil {
return w
}
return os.Stderr
} | go | func (mf *MultiFlag) GetOutput() io.Writer {
if w := mf.Output; w != nil {
return w
}
return os.Stderr
} | [
"func",
"(",
"mf",
"*",
"MultiFlag",
")",
"GetOutput",
"(",
")",
"io",
".",
"Writer",
"{",
"if",
"w",
":=",
"mf",
".",
"Output",
";",
"w",
"!=",
"nil",
"{",
"return",
"w",
"\n",
"}",
"\n",
"return",
"os",
".",
"Stderr",
"\n",
"}"
] | // GetOutput returns the output Writer used for help output. | [
"GetOutput",
"returns",
"the",
"output",
"Writer",
"used",
"for",
"help",
"output",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/flag/multiflag/multiflag.go#L92-L97 |
131,478 | luci/luci-go | common/flag/multiflag/multiflag.go | GetOptionFor | func (mf *MultiFlag) GetOptionFor(name string) Option {
for _, option := range mf.Options {
if option.Descriptor().Name == name {
return option
}
}
return nil
} | go | func (mf *MultiFlag) GetOptionFor(name string) Option {
for _, option := range mf.Options {
if option.Descriptor().Name == name {
return option
}
}
return nil
} | [
"func",
"(",
"mf",
"*",
"MultiFlag",
")",
"GetOptionFor",
"(",
"name",
"string",
")",
"Option",
"{",
"for",
"_",
",",
"option",
":=",
"range",
"mf",
".",
"Options",
"{",
"if",
"option",
".",
"Descriptor",
"(",
")",
".",
"Name",
"==",
"name",
"{",
"... | // GetOptionFor returns the Option associated with the specified name, or nil
// if one isn't defined. | [
"GetOptionFor",
"returns",
"the",
"Option",
"associated",
"with",
"the",
"specified",
"name",
"or",
"nil",
"if",
"one",
"isn",
"t",
"defined",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/flag/multiflag/multiflag.go#L131-L138 |
131,479 | luci/luci-go | common/flag/multiflag/multiflag.go | OptionNames | func (mf MultiFlag) OptionNames() []string {
optionNames := make([]string, 0, len(mf.Options))
for _, opt := range mf.Options {
optionNames = append(optionNames, opt.Descriptor().Name)
}
return optionNames
} | go | func (mf MultiFlag) OptionNames() []string {
optionNames := make([]string, 0, len(mf.Options))
for _, opt := range mf.Options {
optionNames = append(optionNames, opt.Descriptor().Name)
}
return optionNames
} | [
"func",
"(",
"mf",
"MultiFlag",
")",
"OptionNames",
"(",
")",
"[",
"]",
"string",
"{",
"optionNames",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"mf",
".",
"Options",
")",
")",
"\n",
"for",
"_",
",",
"opt",
":=",
"range",
... | // OptionNames returns a list of the option names registered with a MultiFlag. | [
"OptionNames",
"returns",
"a",
"list",
"of",
"the",
"option",
"names",
"registered",
"with",
"a",
"MultiFlag",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/flag/multiflag/multiflag.go#L141-L147 |
131,480 | luci/luci-go | common/flag/multiflag/multiflag.go | PrintHelp | func (mf *MultiFlag) PrintHelp() error {
descriptors := make(optionDescriptorSlice, len(mf.Options))
for idx, opt := range mf.Options {
descriptors[idx] = opt.Descriptor()
}
sort.Sort(descriptors)
fmt.Fprintln(mf.Output, mf.Description)
return writeAlignedOptionDescriptors(mf.Output, []*OptionDescriptor(descri... | go | func (mf *MultiFlag) PrintHelp() error {
descriptors := make(optionDescriptorSlice, len(mf.Options))
for idx, opt := range mf.Options {
descriptors[idx] = opt.Descriptor()
}
sort.Sort(descriptors)
fmt.Fprintln(mf.Output, mf.Description)
return writeAlignedOptionDescriptors(mf.Output, []*OptionDescriptor(descri... | [
"func",
"(",
"mf",
"*",
"MultiFlag",
")",
"PrintHelp",
"(",
")",
"error",
"{",
"descriptors",
":=",
"make",
"(",
"optionDescriptorSlice",
",",
"len",
"(",
"mf",
".",
"Options",
")",
")",
"\n",
"for",
"idx",
",",
"opt",
":=",
"range",
"mf",
".",
"Opti... | // PrintHelp prints a formatted help string for a MultiFlag. This help string
// details the Options registered with the MultiFlag. | [
"PrintHelp",
"prints",
"a",
"formatted",
"help",
"string",
"for",
"a",
"MultiFlag",
".",
"This",
"help",
"string",
"details",
"the",
"Options",
"registered",
"with",
"the",
"MultiFlag",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/flag/multiflag/multiflag.go#L151-L160 |
131,481 | luci/luci-go | common/flag/multiflag/multiflag.go | Descriptor | func (o *FlagOption) Descriptor() *OptionDescriptor {
return &OptionDescriptor{
Name: o.Name,
Description: o.Description,
Pinned: o.Pinned,
}
} | go | func (o *FlagOption) Descriptor() *OptionDescriptor {
return &OptionDescriptor{
Name: o.Name,
Description: o.Description,
Pinned: o.Pinned,
}
} | [
"func",
"(",
"o",
"*",
"FlagOption",
")",
"Descriptor",
"(",
")",
"*",
"OptionDescriptor",
"{",
"return",
"&",
"OptionDescriptor",
"{",
"Name",
":",
"o",
".",
"Name",
",",
"Description",
":",
"o",
".",
"Description",
",",
"Pinned",
":",
"o",
".",
"Pinn... | // Descriptor implements Option. | [
"Descriptor",
"implements",
"Option",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/flag/multiflag/multiflag.go#L180-L186 |
131,482 | luci/luci-go | common/flag/multiflag/multiflag.go | PrintHelp | func (o *FlagOption) PrintHelp(output io.Writer) {
flags := o.Flags()
flags.SetOutput(output)
flags.PrintDefaults()
} | go | func (o *FlagOption) PrintHelp(output io.Writer) {
flags := o.Flags()
flags.SetOutput(output)
flags.PrintDefaults()
} | [
"func",
"(",
"o",
"*",
"FlagOption",
")",
"PrintHelp",
"(",
"output",
"io",
".",
"Writer",
")",
"{",
"flags",
":=",
"o",
".",
"Flags",
"(",
")",
"\n",
"flags",
".",
"SetOutput",
"(",
"output",
")",
"\n",
"flags",
".",
"PrintDefaults",
"(",
")",
"\n... | // PrintHelp implements Option. | [
"PrintHelp",
"implements",
"Option",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/flag/multiflag/multiflag.go#L189-L193 |
131,483 | luci/luci-go | common/flag/multiflag/multiflag.go | Run | func (o *FlagOption) Run(value string) error {
if err := o.flags.Parse(value); err != nil {
return err
}
return nil
} | go | func (o *FlagOption) Run(value string) error {
if err := o.flags.Parse(value); err != nil {
return err
}
return nil
} | [
"func",
"(",
"o",
"*",
"FlagOption",
")",
"Run",
"(",
"value",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"o",
".",
"flags",
".",
"Parse",
"(",
"value",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
... | // Run implements Option. | [
"Run",
"implements",
"Option",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/flag/multiflag/multiflag.go#L201-L206 |
131,484 | luci/luci-go | common/flag/multiflag/multiflag.go | writeAlignedOptionDescriptors | func writeAlignedOptionDescriptors(w io.Writer, descriptors []*OptionDescriptor) error {
tw := tabwriter.NewWriter(w, 0, 4, 2, ' ', 0)
for _, desc := range descriptors {
fmt.Fprintf(tw, "%s\t%s\n", desc.Name, desc.Description)
}
if err := tw.Flush(); err != nil {
return err
}
return nil
} | go | func writeAlignedOptionDescriptors(w io.Writer, descriptors []*OptionDescriptor) error {
tw := tabwriter.NewWriter(w, 0, 4, 2, ' ', 0)
for _, desc := range descriptors {
fmt.Fprintf(tw, "%s\t%s\n", desc.Name, desc.Description)
}
if err := tw.Flush(); err != nil {
return err
}
return nil
} | [
"func",
"writeAlignedOptionDescriptors",
"(",
"w",
"io",
".",
"Writer",
",",
"descriptors",
"[",
"]",
"*",
"OptionDescriptor",
")",
"error",
"{",
"tw",
":=",
"tabwriter",
".",
"NewWriter",
"(",
"w",
",",
"0",
",",
"4",
",",
"2",
",",
"' '",
",",
"0",
... | // writeAlignedOptionDescriptors writes help entries for a series of Options. | [
"writeAlignedOptionDescriptors",
"writes",
"help",
"entries",
"for",
"a",
"series",
"of",
"Options",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/flag/multiflag/multiflag.go#L297-L308 |
131,485 | luci/luci-go | milo/buildsource/buildbot/grpc.go | GetBuildbotBuildJSON | func (s *Service) GetBuildbotBuildJSON(c context.Context, req *milo.BuildbotBuildRequest) (
*milo.BuildbotBuildJSON, error) {
apiUsage.Add(c, 1, "GetBuildbotBuildJSON", req.Master, req.Builder, req.ExcludeDeprecated, false)
if req.Master == "" {
return nil, status.Errorf(codes.InvalidArgument, "No master specifi... | go | func (s *Service) GetBuildbotBuildJSON(c context.Context, req *milo.BuildbotBuildRequest) (
*milo.BuildbotBuildJSON, error) {
apiUsage.Add(c, 1, "GetBuildbotBuildJSON", req.Master, req.Builder, req.ExcludeDeprecated, false)
if req.Master == "" {
return nil, status.Errorf(codes.InvalidArgument, "No master specifi... | [
"func",
"(",
"s",
"*",
"Service",
")",
"GetBuildbotBuildJSON",
"(",
"c",
"context",
".",
"Context",
",",
"req",
"*",
"milo",
".",
"BuildbotBuildRequest",
")",
"(",
"*",
"milo",
".",
"BuildbotBuildJSON",
",",
"error",
")",
"{",
"apiUsage",
".",
"Add",
"("... | // GetBuildbotBuildJSON implements milo.BuildbotServer. | [
"GetBuildbotBuildJSON",
"implements",
"milo",
".",
"BuildbotServer",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/buildbot/grpc.go#L55-L99 |
131,486 | luci/luci-go | milo/buildsource/buildbot/grpc.go | GetBuildbotBuildsJSON | func (s *Service) GetBuildbotBuildsJSON(c context.Context, req *milo.BuildbotBuildsRequest) (
*milo.BuildbotBuildsJSON, error) {
apiUsage.Add(c, 1, "GetBuildbotBuildsJSON", req.Master, req.Builder, req.ExcludeDeprecated, req.NoEmulation)
if req.Master == "" {
return nil, status.Errorf(codes.InvalidArgument, "No ... | go | func (s *Service) GetBuildbotBuildsJSON(c context.Context, req *milo.BuildbotBuildsRequest) (
*milo.BuildbotBuildsJSON, error) {
apiUsage.Add(c, 1, "GetBuildbotBuildsJSON", req.Master, req.Builder, req.ExcludeDeprecated, req.NoEmulation)
if req.Master == "" {
return nil, status.Errorf(codes.InvalidArgument, "No ... | [
"func",
"(",
"s",
"*",
"Service",
")",
"GetBuildbotBuildsJSON",
"(",
"c",
"context",
".",
"Context",
",",
"req",
"*",
"milo",
".",
"BuildbotBuildsRequest",
")",
"(",
"*",
"milo",
".",
"BuildbotBuildsJSON",
",",
"error",
")",
"{",
"apiUsage",
".",
"Add",
... | // GetBuildbotBuildsJSON implements milo.BuildbotServer. | [
"GetBuildbotBuildsJSON",
"implements",
"milo",
".",
"BuildbotServer",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/buildbot/grpc.go#L102-L157 |
131,487 | luci/luci-go | milo/buildsource/buildbot/grpc.go | GetCompressedMasterJSON | func (s *Service) GetCompressedMasterJSON(c context.Context, req *milo.MasterRequest) (
*milo.CompressedMasterJSON, error) {
if req.Name == "" {
return nil, status.Errorf(codes.InvalidArgument, "No master specified")
}
apiUsage.Add(c, 1, "GetCompressedMasterJSON", req.Name, "", req.ExcludeDeprecated, req.NoEmul... | go | func (s *Service) GetCompressedMasterJSON(c context.Context, req *milo.MasterRequest) (
*milo.CompressedMasterJSON, error) {
if req.Name == "" {
return nil, status.Errorf(codes.InvalidArgument, "No master specified")
}
apiUsage.Add(c, 1, "GetCompressedMasterJSON", req.Name, "", req.ExcludeDeprecated, req.NoEmul... | [
"func",
"(",
"s",
"*",
"Service",
")",
"GetCompressedMasterJSON",
"(",
"c",
"context",
".",
"Context",
",",
"req",
"*",
"milo",
".",
"MasterRequest",
")",
"(",
"*",
"milo",
".",
"CompressedMasterJSON",
",",
"error",
")",
"{",
"if",
"req",
".",
"Name",
... | // GetCompressedMasterJSON assembles a CompressedMasterJSON object from the
// provided MasterRequest. | [
"GetCompressedMasterJSON",
"assembles",
"a",
"CompressedMasterJSON",
"object",
"from",
"the",
"provided",
"MasterRequest",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/buildsource/buildbot/grpc.go#L161-L215 |
131,488 | luci/luci-go | buildbucket/cli/collect.go | dedupInt64s | func dedupInt64s(nums []int64) []int64 {
seen := make(map[int64]struct{}, len(nums))
res := make([]int64, 0, len(nums))
for _, x := range nums {
if _, ok := seen[x]; !ok {
seen[x] = struct{}{}
res = append(res, x)
}
}
return res
} | go | func dedupInt64s(nums []int64) []int64 {
seen := make(map[int64]struct{}, len(nums))
res := make([]int64, 0, len(nums))
for _, x := range nums {
if _, ok := seen[x]; !ok {
seen[x] = struct{}{}
res = append(res, x)
}
}
return res
} | [
"func",
"dedupInt64s",
"(",
"nums",
"[",
"]",
"int64",
")",
"[",
"]",
"int64",
"{",
"seen",
":=",
"make",
"(",
"map",
"[",
"int64",
"]",
"struct",
"{",
"}",
",",
"len",
"(",
"nums",
")",
")",
"\n",
"res",
":=",
"make",
"(",
"[",
"]",
"int64",
... | // dedupInt64s dedups int64s. | [
"dedupInt64s",
"dedups",
"int64s",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/cli/collect.go#L94-L104 |
131,489 | luci/luci-go | buildbucket/access/acl.go | Can | func (p Permissions) Can(bucket string, action Action) bool {
return (p[bucket] & action) == action
} | go | func (p Permissions) Can(bucket string, action Action) bool {
return (p[bucket] & action) == action
} | [
"func",
"(",
"p",
"Permissions",
")",
"Can",
"(",
"bucket",
"string",
",",
"action",
"Action",
")",
"bool",
"{",
"return",
"(",
"p",
"[",
"bucket",
"]",
"&",
"action",
")",
"==",
"action",
"\n",
"}"
] | // Can checks whether an Action is allowed for a given bucket. | [
"Can",
"checks",
"whether",
"an",
"Action",
"is",
"allowed",
"for",
"a",
"given",
"bucket",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/access/acl.go#L36-L38 |
131,490 | luci/luci-go | buildbucket/access/acl.go | FromProto | func (p Permissions) FromProto(resp *access.PermittedActionsResponse) error {
// Clean up p before we populate it.
for bucket := range p {
delete(p, bucket)
}
for bucket, actions := range resp.Permitted {
newActions := Action(0)
for _, action := range actions.Actions {
newAction, err := ParseAction(action)... | go | func (p Permissions) FromProto(resp *access.PermittedActionsResponse) error {
// Clean up p before we populate it.
for bucket := range p {
delete(p, bucket)
}
for bucket, actions := range resp.Permitted {
newActions := Action(0)
for _, action := range actions.Actions {
newAction, err := ParseAction(action)... | [
"func",
"(",
"p",
"Permissions",
")",
"FromProto",
"(",
"resp",
"*",
"access",
".",
"PermittedActionsResponse",
")",
"error",
"{",
"// Clean up p before we populate it.",
"for",
"bucket",
":=",
"range",
"p",
"{",
"delete",
"(",
"p",
",",
"bucket",
")",
"\n",
... | // FromProto populates a Permissions from an access.PermittedActionsResponse. | [
"FromProto",
"populates",
"a",
"Permissions",
"from",
"an",
"access",
".",
"PermittedActionsResponse",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/access/acl.go#L41-L58 |
131,491 | luci/luci-go | buildbucket/access/acl.go | ToProto | func (p Permissions) ToProto(validTime time.Duration) *access.PermittedActionsResponse {
perms := make(map[string]*access.PermittedActionsResponse_ResourcePermissions, len(p))
for bucket, action := range p {
var actions []string
for a, name := range actionToName {
if action&a == a {
actions = append(action... | go | func (p Permissions) ToProto(validTime time.Duration) *access.PermittedActionsResponse {
perms := make(map[string]*access.PermittedActionsResponse_ResourcePermissions, len(p))
for bucket, action := range p {
var actions []string
for a, name := range actionToName {
if action&a == a {
actions = append(action... | [
"func",
"(",
"p",
"Permissions",
")",
"ToProto",
"(",
"validTime",
"time",
".",
"Duration",
")",
"*",
"access",
".",
"PermittedActionsResponse",
"{",
"perms",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"access",
".",
"PermittedActionsResponse_ResourceP... | // ToProto converts a Permissions into a PermittedActionsResponse. | [
"ToProto",
"converts",
"a",
"Permissions",
"into",
"a",
"PermittedActionsResponse",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/access/acl.go#L61-L77 |
131,492 | luci/luci-go | buildbucket/access/acl.go | NewClient | func NewClient(host string, client *http.Client) access.AccessClient {
return access.NewAccessPRPCClient(&prpc.Client{
Host: host,
C: client,
})
} | go | func NewClient(host string, client *http.Client) access.AccessClient {
return access.NewAccessPRPCClient(&prpc.Client{
Host: host,
C: client,
})
} | [
"func",
"NewClient",
"(",
"host",
"string",
",",
"client",
"*",
"http",
".",
"Client",
")",
"access",
".",
"AccessClient",
"{",
"return",
"access",
".",
"NewAccessPRPCClient",
"(",
"&",
"prpc",
".",
"Client",
"{",
"Host",
":",
"host",
",",
"C",
":",
"c... | // NewClient returns a new AccessClient which can be used to talk to
// buildbucket's access API. | [
"NewClient",
"returns",
"a",
"new",
"AccessClient",
"which",
"can",
"be",
"used",
"to",
"talk",
"to",
"buildbucket",
"s",
"access",
"API",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/access/acl.go#L81-L86 |
131,493 | luci/luci-go | buildbucket/access/acl.go | BucketPermissions | func BucketPermissions(c context.Context, client access.AccessClient, buckets []string) (Permissions, time.Duration, error) {
// Make permitted actions call.
req := access.PermittedActionsRequest{
ResourceKind: "bucket",
ResourceIds: buckets,
}
resp, err := client.PermittedActions(c, &req)
if err != nil {
r... | go | func BucketPermissions(c context.Context, client access.AccessClient, buckets []string) (Permissions, time.Duration, error) {
// Make permitted actions call.
req := access.PermittedActionsRequest{
ResourceKind: "bucket",
ResourceIds: buckets,
}
resp, err := client.PermittedActions(c, &req)
if err != nil {
r... | [
"func",
"BucketPermissions",
"(",
"c",
"context",
".",
"Context",
",",
"client",
"access",
".",
"AccessClient",
",",
"buckets",
"[",
"]",
"string",
")",
"(",
"Permissions",
",",
"time",
".",
"Duration",
",",
"error",
")",
"{",
"// Make permitted actions call."... | // BucketPermissions retrieves permitted actions for a set of buckets, for the
// identity specified in the client. It also returns the duration for which the
// client is allowed to cache the permissions. | [
"BucketPermissions",
"retrieves",
"permitted",
"actions",
"for",
"a",
"set",
"of",
"buckets",
"for",
"the",
"identity",
"specified",
"in",
"the",
"client",
".",
"It",
"also",
"returns",
"the",
"duration",
"for",
"which",
"the",
"client",
"is",
"allowed",
"to",... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/buildbucket/access/acl.go#L91-L112 |
131,494 | luci/luci-go | logdog/client/butlerlib/streamproto/tee.go | Writer | func (t TeeType) Writer() io.Writer {
switch t {
case TeeNone:
return nil
case TeeStdout:
return os.Stdout
case TeeStderr:
return os.Stderr
default:
panic(fmt.Errorf("streamproto: unknown tee type [%v]", t))
}
} | go | func (t TeeType) Writer() io.Writer {
switch t {
case TeeNone:
return nil
case TeeStdout:
return os.Stdout
case TeeStderr:
return os.Stderr
default:
panic(fmt.Errorf("streamproto: unknown tee type [%v]", t))
}
} | [
"func",
"(",
"t",
"TeeType",
")",
"Writer",
"(",
")",
"io",
".",
"Writer",
"{",
"switch",
"t",
"{",
"case",
"TeeNone",
":",
"return",
"nil",
"\n\n",
"case",
"TeeStdout",
":",
"return",
"os",
".",
"Stdout",
"\n\n",
"case",
"TeeStderr",
":",
"return",
... | // Writer returns the io.Writer object | [
"Writer",
"returns",
"the",
"io",
".",
"Writer",
"object"
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/logdog/client/butlerlib/streamproto/tee.go#L46-L60 |
131,495 | luci/luci-go | vpython/options.go | ResolveSpec | func (o *Options) ResolveSpec(c context.Context) error {
if o.CommandLine == nil {
panic("a CommandLine must be specified")
}
// If a spec is explicitly provided, we're done.
if o.EnvConfig.Spec != nil {
return nil
}
o.EnvConfig.Spec = &o.DefaultSpec
// If we're running a Python script, assert that the ta... | go | func (o *Options) ResolveSpec(c context.Context) error {
if o.CommandLine == nil {
panic("a CommandLine must be specified")
}
// If a spec is explicitly provided, we're done.
if o.EnvConfig.Spec != nil {
return nil
}
o.EnvConfig.Spec = &o.DefaultSpec
// If we're running a Python script, assert that the ta... | [
"func",
"(",
"o",
"*",
"Options",
")",
"ResolveSpec",
"(",
"c",
"context",
".",
"Context",
")",
"error",
"{",
"if",
"o",
".",
"CommandLine",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// If a spec is explicitly provided, we're don... | // ResolveSpec resolves the configured environment specification. The resulting
// spec is installed into o's EnvConfig.Spec field. | [
"ResolveSpec",
"resolves",
"the",
"configured",
"environment",
"specification",
".",
"The",
"resulting",
"spec",
"is",
"installed",
"into",
"o",
"s",
"EnvConfig",
".",
"Spec",
"field",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/vpython/options.go#L111-L168 |
131,496 | luci/luci-go | milo/frontend/view_logs.go | HandleSwarmingLog | func HandleSwarmingLog(c *router.Context) error {
log, closed, err := swarming.GetLog(
c.Context,
c.Request.FormValue("server"),
c.Params.ByName("id"),
c.Params.ByName("logname"))
if err != nil {
return err
}
templates.MustRender(c.Context, c.Writer, "pages/log.html", templates.Args{
"Log": log,
"... | go | func HandleSwarmingLog(c *router.Context) error {
log, closed, err := swarming.GetLog(
c.Context,
c.Request.FormValue("server"),
c.Params.ByName("id"),
c.Params.ByName("logname"))
if err != nil {
return err
}
templates.MustRender(c.Context, c.Writer, "pages/log.html", templates.Args{
"Log": log,
"... | [
"func",
"HandleSwarmingLog",
"(",
"c",
"*",
"router",
".",
"Context",
")",
"error",
"{",
"log",
",",
"closed",
",",
"err",
":=",
"swarming",
".",
"GetLog",
"(",
"c",
".",
"Context",
",",
"c",
".",
"Request",
".",
"FormValue",
"(",
"\"",
"\"",
")",
... | // HandleSwarmingLog renders a step log from a swarming build. | [
"HandleSwarmingLog",
"renders",
"a",
"step",
"log",
"from",
"a",
"swarming",
"build",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/milo/frontend/view_logs.go#L15-L30 |
131,497 | luci/luci-go | lucicfg/normalize/buildbucket.go | Buildbucket | func Buildbucket(c context.Context, cfg *pb.BuildbucketCfg) error {
// Install or update 'flatten_buildbucket_cfg' tool.
bin, err := installFlattenBuildbucketCfg(c)
if err != nil {
return fmt.Errorf("failed to install buildbucket config flattener: %s", err)
}
// 'flatten_buildbucket_cfg' wants a real file as in... | go | func Buildbucket(c context.Context, cfg *pb.BuildbucketCfg) error {
// Install or update 'flatten_buildbucket_cfg' tool.
bin, err := installFlattenBuildbucketCfg(c)
if err != nil {
return fmt.Errorf("failed to install buildbucket config flattener: %s", err)
}
// 'flatten_buildbucket_cfg' wants a real file as in... | [
"func",
"Buildbucket",
"(",
"c",
"context",
".",
"Context",
",",
"cfg",
"*",
"pb",
".",
"BuildbucketCfg",
")",
"error",
"{",
"// Install or update 'flatten_buildbucket_cfg' tool.",
"bin",
",",
"err",
":=",
"installFlattenBuildbucketCfg",
"(",
"c",
")",
"\n",
"if",... | // Buildbucket normalizes cr-buildbucket.cfg config. | [
"Buildbucket",
"normalizes",
"cr",
"-",
"buildbucket",
".",
"cfg",
"config",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/lucicfg/normalize/buildbucket.go#L38-L76 |
131,498 | luci/luci-go | common/data/chunkstream/buffer.go | Append | func (b *Buffer) Append(c ...Chunk) {
for _, chunk := range c {
b.appendChunk(chunk)
}
} | go | func (b *Buffer) Append(c ...Chunk) {
for _, chunk := range c {
b.appendChunk(chunk)
}
} | [
"func",
"(",
"b",
"*",
"Buffer",
")",
"Append",
"(",
"c",
"...",
"Chunk",
")",
"{",
"for",
"_",
",",
"chunk",
":=",
"range",
"c",
"{",
"b",
".",
"appendChunk",
"(",
"chunk",
")",
"\n",
"}",
"\n",
"}"
] | // Append adds additional Chunks to the buffer.
//
// After completion, the Chunk is now owned by the Buffer and should not be used
// anymore externally. | [
"Append",
"adds",
"additional",
"Chunks",
"to",
"the",
"buffer",
".",
"After",
"completion",
"the",
"Chunk",
"is",
"now",
"owned",
"by",
"the",
"Buffer",
"and",
"should",
"not",
"be",
"used",
"anymore",
"externally",
"."
] | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/chunkstream/buffer.go#L46-L50 |
131,499 | luci/luci-go | common/data/chunkstream/buffer.go | Bytes | func (b *Buffer) Bytes() []byte {
if b.Len() == 0 {
return nil
}
m := make([]byte, 0, b.Len())
idx := b.fidx
for cur := b.first; cur != nil; cur = cur.next {
m = append(m, cur.Bytes()[idx:]...)
idx = 0
}
return m
} | go | func (b *Buffer) Bytes() []byte {
if b.Len() == 0 {
return nil
}
m := make([]byte, 0, b.Len())
idx := b.fidx
for cur := b.first; cur != nil; cur = cur.next {
m = append(m, cur.Bytes()[idx:]...)
idx = 0
}
return m
} | [
"func",
"(",
"b",
"*",
"Buffer",
")",
"Bytes",
"(",
")",
"[",
"]",
"byte",
"{",
"if",
"b",
".",
"Len",
"(",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"m",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
",",
"b",
".",
"Len",... | // Bytes constructs a byte slice containing the contents of the Buffer.
//
// This is a potentially expensive operation, and should generally be used only
// for debugging and tests, as it defeats most of the purpose of this package. | [
"Bytes",
"constructs",
"a",
"byte",
"slice",
"containing",
"the",
"contents",
"of",
"the",
"Buffer",
".",
"This",
"is",
"a",
"potentially",
"expensive",
"operation",
"and",
"should",
"generally",
"be",
"used",
"only",
"for",
"debugging",
"and",
"tests",
"as",
... | f6cef429871eee3be7c6903af88d3ee884eaf683 | https://github.com/luci/luci-go/blob/f6cef429871eee3be7c6903af88d3ee884eaf683/common/data/chunkstream/buffer.go#L75-L87 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.