repo stringlengths 5 67 | path stringlengths 4 218 | func_name stringlengths 0 151 | original_string stringlengths 52 373k | language stringclasses 6
values | code stringlengths 52 373k | code_tokens listlengths 10 512 | docstring stringlengths 3 47.2k | docstring_tokens listlengths 3 234 | sha stringlengths 40 40 | url stringlengths 85 339 | partition stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
pachyderm/pachyderm | src/server/pkg/serviceenv/config.go | NewConfiguration | func NewConfiguration(config interface{}) *Configuration {
configuration := &Configuration{}
switch config.(type) {
case *GlobalConfiguration:
configuration.GlobalConfiguration = config.(*GlobalConfiguration)
return configuration
case *PachdFullConfiguration:
configuration.GlobalConfiguration = &config.(*Pach... | go | func NewConfiguration(config interface{}) *Configuration {
configuration := &Configuration{}
switch config.(type) {
case *GlobalConfiguration:
configuration.GlobalConfiguration = config.(*GlobalConfiguration)
return configuration
case *PachdFullConfiguration:
configuration.GlobalConfiguration = &config.(*Pach... | [
"func",
"NewConfiguration",
"(",
"config",
"interface",
"{",
"}",
")",
"*",
"Configuration",
"{",
"configuration",
":=",
"&",
"Configuration",
"{",
"}",
"\n",
"switch",
"config",
".",
"(",
"type",
")",
"{",
"case",
"*",
"GlobalConfiguration",
":",
"configura... | // NewConfiguration creates a generic configuration from a specific type of configuration. | [
"NewConfiguration",
"creates",
"a",
"generic",
"configuration",
"from",
"a",
"specific",
"type",
"of",
"configuration",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/serviceenv/config.go#L83-L100 | test |
pachyderm/pachyderm | src/server/pkg/pfsdb/pfsdb.go | Repos | func Repos(etcdClient *etcd.Client, etcdPrefix string) col.Collection {
return col.NewCollection(
etcdClient,
path.Join(etcdPrefix, reposPrefix),
nil,
&pfs.RepoInfo{},
nil,
nil,
)
} | go | func Repos(etcdClient *etcd.Client, etcdPrefix string) col.Collection {
return col.NewCollection(
etcdClient,
path.Join(etcdPrefix, reposPrefix),
nil,
&pfs.RepoInfo{},
nil,
nil,
)
} | [
"func",
"Repos",
"(",
"etcdClient",
"*",
"etcd",
".",
"Client",
",",
"etcdPrefix",
"string",
")",
"col",
".",
"Collection",
"{",
"return",
"col",
".",
"NewCollection",
"(",
"etcdClient",
",",
"path",
".",
"Join",
"(",
"etcdPrefix",
",",
"reposPrefix",
")",... | // Repos returns a collection of repos | [
"Repos",
"returns",
"a",
"collection",
"of",
"repos"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/pfsdb/pfsdb.go#L28-L37 | test |
pachyderm/pachyderm | src/server/pkg/pfsdb/pfsdb.go | PutFileRecords | func PutFileRecords(etcdClient *etcd.Client, etcdPrefix string) col.Collection {
return col.NewCollection(
etcdClient,
path.Join(etcdPrefix, putFileRecordsPrefix),
nil,
&pfs.PutFileRecords{},
nil,
nil,
)
} | go | func PutFileRecords(etcdClient *etcd.Client, etcdPrefix string) col.Collection {
return col.NewCollection(
etcdClient,
path.Join(etcdPrefix, putFileRecordsPrefix),
nil,
&pfs.PutFileRecords{},
nil,
nil,
)
} | [
"func",
"PutFileRecords",
"(",
"etcdClient",
"*",
"etcd",
".",
"Client",
",",
"etcdPrefix",
"string",
")",
"col",
".",
"Collection",
"{",
"return",
"col",
".",
"NewCollection",
"(",
"etcdClient",
",",
"path",
".",
"Join",
"(",
"etcdPrefix",
",",
"putFileReco... | // PutFileRecords returns a collection of putFileRecords | [
"PutFileRecords",
"returns",
"a",
"collection",
"of",
"putFileRecords"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/pfsdb/pfsdb.go#L40-L49 | test |
pachyderm/pachyderm | src/server/pkg/pfsdb/pfsdb.go | Commits | func Commits(etcdClient *etcd.Client, etcdPrefix string, repo string) col.Collection {
return col.NewCollection(
etcdClient,
path.Join(etcdPrefix, commitsPrefix, repo),
[]*col.Index{ProvenanceIndex},
&pfs.CommitInfo{},
nil,
nil,
)
} | go | func Commits(etcdClient *etcd.Client, etcdPrefix string, repo string) col.Collection {
return col.NewCollection(
etcdClient,
path.Join(etcdPrefix, commitsPrefix, repo),
[]*col.Index{ProvenanceIndex},
&pfs.CommitInfo{},
nil,
nil,
)
} | [
"func",
"Commits",
"(",
"etcdClient",
"*",
"etcd",
".",
"Client",
",",
"etcdPrefix",
"string",
",",
"repo",
"string",
")",
"col",
".",
"Collection",
"{",
"return",
"col",
".",
"NewCollection",
"(",
"etcdClient",
",",
"path",
".",
"Join",
"(",
"etcdPrefix",... | // Commits returns a collection of commits | [
"Commits",
"returns",
"a",
"collection",
"of",
"commits"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/pfsdb/pfsdb.go#L52-L61 | test |
pachyderm/pachyderm | src/server/pkg/pfsdb/pfsdb.go | Branches | func Branches(etcdClient *etcd.Client, etcdPrefix string, repo string) col.Collection {
return col.NewCollection(
etcdClient,
path.Join(etcdPrefix, branchesPrefix, repo),
nil,
&pfs.BranchInfo{},
func(key string) error {
if uuid.IsUUIDWithoutDashes(key) {
return fmt.Errorf("branch name cannot be a UUID... | go | func Branches(etcdClient *etcd.Client, etcdPrefix string, repo string) col.Collection {
return col.NewCollection(
etcdClient,
path.Join(etcdPrefix, branchesPrefix, repo),
nil,
&pfs.BranchInfo{},
func(key string) error {
if uuid.IsUUIDWithoutDashes(key) {
return fmt.Errorf("branch name cannot be a UUID... | [
"func",
"Branches",
"(",
"etcdClient",
"*",
"etcd",
".",
"Client",
",",
"etcdPrefix",
"string",
",",
"repo",
"string",
")",
"col",
".",
"Collection",
"{",
"return",
"col",
".",
"NewCollection",
"(",
"etcdClient",
",",
"path",
".",
"Join",
"(",
"etcdPrefix"... | // Branches returns a collection of branches | [
"Branches",
"returns",
"a",
"collection",
"of",
"branches"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/pfsdb/pfsdb.go#L64-L78 | test |
pachyderm/pachyderm | src/server/pkg/pfsdb/pfsdb.go | OpenCommits | func OpenCommits(etcdClient *etcd.Client, etcdPrefix string) col.Collection {
return col.NewCollection(
etcdClient,
path.Join(etcdPrefix, openCommitsPrefix),
nil,
&pfs.Commit{},
nil,
nil,
)
} | go | func OpenCommits(etcdClient *etcd.Client, etcdPrefix string) col.Collection {
return col.NewCollection(
etcdClient,
path.Join(etcdPrefix, openCommitsPrefix),
nil,
&pfs.Commit{},
nil,
nil,
)
} | [
"func",
"OpenCommits",
"(",
"etcdClient",
"*",
"etcd",
".",
"Client",
",",
"etcdPrefix",
"string",
")",
"col",
".",
"Collection",
"{",
"return",
"col",
".",
"NewCollection",
"(",
"etcdClient",
",",
"path",
".",
"Join",
"(",
"etcdPrefix",
",",
"openCommitsPre... | // OpenCommits returns a collection of open commits | [
"OpenCommits",
"returns",
"a",
"collection",
"of",
"open",
"commits"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/pfsdb/pfsdb.go#L81-L90 | test |
pachyderm/pachyderm | src/server/pkg/dag/dag.go | NewDAG | func NewDAG(nodes map[string][]string) *DAG {
result := &DAG{
parents: make(map[string][]string),
children: make(map[string][]string),
leaves: make(map[string]bool),
}
for id, parents := range nodes {
result.NewNode(id, parents)
}
return result
} | go | func NewDAG(nodes map[string][]string) *DAG {
result := &DAG{
parents: make(map[string][]string),
children: make(map[string][]string),
leaves: make(map[string]bool),
}
for id, parents := range nodes {
result.NewNode(id, parents)
}
return result
} | [
"func",
"NewDAG",
"(",
"nodes",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
")",
"*",
"DAG",
"{",
"result",
":=",
"&",
"DAG",
"{",
"parents",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
")",
",",
"children",
":",
"make",
... | // NewDAG creates a DAG and populates it with the given nodes. | [
"NewDAG",
"creates",
"a",
"DAG",
"and",
"populates",
"it",
"with",
"the",
"given",
"nodes",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/dag/dag.go#L11-L21 | test |
pachyderm/pachyderm | src/server/pkg/dag/dag.go | NewNode | func (d *DAG) NewNode(id string, parents []string) {
d.parents[id] = parents
for _, parentID := range parents {
d.children[parentID] = append(d.children[parentID], id)
d.leaves[parentID] = false
}
if _, ok := d.leaves[id]; !ok {
d.leaves[id] = true
}
} | go | func (d *DAG) NewNode(id string, parents []string) {
d.parents[id] = parents
for _, parentID := range parents {
d.children[parentID] = append(d.children[parentID], id)
d.leaves[parentID] = false
}
if _, ok := d.leaves[id]; !ok {
d.leaves[id] = true
}
} | [
"func",
"(",
"d",
"*",
"DAG",
")",
"NewNode",
"(",
"id",
"string",
",",
"parents",
"[",
"]",
"string",
")",
"{",
"d",
".",
"parents",
"[",
"id",
"]",
"=",
"parents",
"\n",
"for",
"_",
",",
"parentID",
":=",
"range",
"parents",
"{",
"d",
".",
"c... | // NewNode adds a node to d. | [
"NewNode",
"adds",
"a",
"node",
"to",
"d",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/dag/dag.go#L24-L33 | test |
pachyderm/pachyderm | src/server/pkg/dag/dag.go | Sorted | func (d *DAG) Sorted() []string {
seen := make(map[string]bool)
var result []string
for id := range d.parents {
result = append(result, dfs(id, d.parents, seen)...)
}
return result
} | go | func (d *DAG) Sorted() []string {
seen := make(map[string]bool)
var result []string
for id := range d.parents {
result = append(result, dfs(id, d.parents, seen)...)
}
return result
} | [
"func",
"(",
"d",
"*",
"DAG",
")",
"Sorted",
"(",
")",
"[",
"]",
"string",
"{",
"seen",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"var",
"result",
"[",
"]",
"string",
"\n",
"for",
"id",
":=",
"range",
"d",
".",
"parents",... | // Sorted returns all nodes in a topologically sorted order | [
"Sorted",
"returns",
"all",
"nodes",
"in",
"a",
"topologically",
"sorted",
"order"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/dag/dag.go#L36-L43 | test |
pachyderm/pachyderm | src/server/pkg/dag/dag.go | Leaves | func (d *DAG) Leaves() []string {
var result []string
for id, isLeaf := range d.leaves {
// isLeaf might be false, explicit mark nodes as non leaves
if isLeaf {
result = append(result, id)
}
}
return result
} | go | func (d *DAG) Leaves() []string {
var result []string
for id, isLeaf := range d.leaves {
// isLeaf might be false, explicit mark nodes as non leaves
if isLeaf {
result = append(result, id)
}
}
return result
} | [
"func",
"(",
"d",
"*",
"DAG",
")",
"Leaves",
"(",
")",
"[",
"]",
"string",
"{",
"var",
"result",
"[",
"]",
"string",
"\n",
"for",
"id",
",",
"isLeaf",
":=",
"range",
"d",
".",
"leaves",
"{",
"if",
"isLeaf",
"{",
"result",
"=",
"append",
"(",
"r... | // Leaves returns a slice containing all leaves in d. | [
"Leaves",
"returns",
"a",
"slice",
"containing",
"all",
"leaves",
"in",
"d",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/dag/dag.go#L46-L55 | test |
pachyderm/pachyderm | src/server/pkg/dag/dag.go | Ancestors | func (d *DAG) Ancestors(id string, from []string) []string {
seen := make(map[string]bool)
for _, fromID := range from {
seen[fromID] = true
}
return dfs(id, d.parents, seen)
} | go | func (d *DAG) Ancestors(id string, from []string) []string {
seen := make(map[string]bool)
for _, fromID := range from {
seen[fromID] = true
}
return dfs(id, d.parents, seen)
} | [
"func",
"(",
"d",
"*",
"DAG",
")",
"Ancestors",
"(",
"id",
"string",
",",
"from",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"seen",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"for",
"_",
",",
"fromID",
":=",
"range... | // Ancestors returns a slice containing all ancestors of a node, 'id',
// in d which are a descendant of at least one of the nodes in 'from'. | [
"Ancestors",
"returns",
"a",
"slice",
"containing",
"all",
"ancestors",
"of",
"a",
"node",
"id",
"in",
"d",
"which",
"are",
"a",
"descendant",
"of",
"at",
"least",
"one",
"of",
"the",
"nodes",
"in",
"from",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/dag/dag.go#L59-L65 | test |
pachyderm/pachyderm | src/server/pkg/dag/dag.go | Descendants | func (d *DAG) Descendants(id string, to []string) []string {
seen := make(map[string]bool)
for _, toID := range to {
seen[toID] = true
}
return bfs(id, d.children, seen)
} | go | func (d *DAG) Descendants(id string, to []string) []string {
seen := make(map[string]bool)
for _, toID := range to {
seen[toID] = true
}
return bfs(id, d.children, seen)
} | [
"func",
"(",
"d",
"*",
"DAG",
")",
"Descendants",
"(",
"id",
"string",
",",
"to",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"seen",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"for",
"_",
",",
"toID",
":=",
"range",... | // Descendants returns a slice containing all descendants of a node, 'id',
// in d which are an ancestor of at least one of the nodes in 'to'. | [
"Descendants",
"returns",
"a",
"slice",
"containing",
"all",
"descendants",
"of",
"a",
"node",
"id",
"in",
"d",
"which",
"are",
"an",
"ancestor",
"of",
"at",
"least",
"one",
"of",
"the",
"nodes",
"in",
"to",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/dag/dag.go#L69-L75 | test |
pachyderm/pachyderm | src/server/pkg/dag/dag.go | Ghosts | func (d *DAG) Ghosts() []string {
var result []string
for id := range d.children {
if _, ok := d.parents[id]; !ok {
result = append(result, id)
}
}
return result
} | go | func (d *DAG) Ghosts() []string {
var result []string
for id := range d.children {
if _, ok := d.parents[id]; !ok {
result = append(result, id)
}
}
return result
} | [
"func",
"(",
"d",
"*",
"DAG",
")",
"Ghosts",
"(",
")",
"[",
"]",
"string",
"{",
"var",
"result",
"[",
"]",
"string",
"\n",
"for",
"id",
":=",
"range",
"d",
".",
"children",
"{",
"if",
"_",
",",
"ok",
":=",
"d",
".",
"parents",
"[",
"id",
"]",... | // Ghosts returns nodes that were referenced as parents but never created. | [
"Ghosts",
"returns",
"nodes",
"that",
"were",
"referenced",
"as",
"parents",
"but",
"never",
"created",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/dag/dag.go#L78-L86 | test |
pachyderm/pachyderm | src/client/portforwarder.go | NewPortForwarder | func NewPortForwarder(namespace string) (*PortForwarder, error) {
if namespace == "" {
namespace = "default"
}
rules := clientcmd.NewDefaultClientConfigLoadingRules()
overrides := &clientcmd.ConfigOverrides{}
kubeConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(rules, overrides)
config, err := ... | go | func NewPortForwarder(namespace string) (*PortForwarder, error) {
if namespace == "" {
namespace = "default"
}
rules := clientcmd.NewDefaultClientConfigLoadingRules()
overrides := &clientcmd.ConfigOverrides{}
kubeConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(rules, overrides)
config, err := ... | [
"func",
"NewPortForwarder",
"(",
"namespace",
"string",
")",
"(",
"*",
"PortForwarder",
",",
"error",
")",
"{",
"if",
"namespace",
"==",
"\"\"",
"{",
"namespace",
"=",
"\"default\"",
"\n",
"}",
"\n",
"rules",
":=",
"clientcmd",
".",
"NewDefaultClientConfigLoad... | // NewPortForwarder creates a new port forwarder | [
"NewPortForwarder",
"creates",
"a",
"new",
"port",
"forwarder"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/portforwarder.go#L49-L79 | test |
pachyderm/pachyderm | src/client/portforwarder.go | Run | func (f *PortForwarder) Run(appName string, localPort, remotePort uint16) error {
podNameSelector := map[string]string{
"suite": "pachyderm",
"app": appName,
}
podList, err := f.core.Pods(f.namespace).List(metav1.ListOptions{
LabelSelector: metav1.FormatLabelSelector(metav1.SetAsLabelSelector(podNameSelecto... | go | func (f *PortForwarder) Run(appName string, localPort, remotePort uint16) error {
podNameSelector := map[string]string{
"suite": "pachyderm",
"app": appName,
}
podList, err := f.core.Pods(f.namespace).List(metav1.ListOptions{
LabelSelector: metav1.FormatLabelSelector(metav1.SetAsLabelSelector(podNameSelecto... | [
"func",
"(",
"f",
"*",
"PortForwarder",
")",
"Run",
"(",
"appName",
"string",
",",
"localPort",
",",
"remotePort",
"uint16",
")",
"error",
"{",
"podNameSelector",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"\"suite\"",
":",
"\"pachyderm\"",
",",
"\"ap... | // Run starts the port forwarder. Returns after initialization is begun,
// returning any initialization errors. | [
"Run",
"starts",
"the",
"port",
"forwarder",
".",
"Returns",
"after",
"initialization",
"is",
"begun",
"returning",
"any",
"initialization",
"errors",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/portforwarder.go#L83-L147 | test |
pachyderm/pachyderm | src/client/portforwarder.go | RunForDaemon | func (f *PortForwarder) RunForDaemon(localPort, remotePort uint16) error {
if localPort == 0 {
localPort = pachdLocalPort
}
if remotePort == 0 {
remotePort = pachdRemotePort
}
return f.Run("pachd", localPort, remotePort)
} | go | func (f *PortForwarder) RunForDaemon(localPort, remotePort uint16) error {
if localPort == 0 {
localPort = pachdLocalPort
}
if remotePort == 0 {
remotePort = pachdRemotePort
}
return f.Run("pachd", localPort, remotePort)
} | [
"func",
"(",
"f",
"*",
"PortForwarder",
")",
"RunForDaemon",
"(",
"localPort",
",",
"remotePort",
"uint16",
")",
"error",
"{",
"if",
"localPort",
"==",
"0",
"{",
"localPort",
"=",
"pachdLocalPort",
"\n",
"}",
"\n",
"if",
"remotePort",
"==",
"0",
"{",
"re... | // RunForDaemon creates a port forwarder for the pachd daemon. | [
"RunForDaemon",
"creates",
"a",
"port",
"forwarder",
"for",
"the",
"pachd",
"daemon",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/portforwarder.go#L150-L158 | test |
pachyderm/pachyderm | src/client/portforwarder.go | RunForSAMLACS | func (f *PortForwarder) RunForSAMLACS(localPort uint16) error {
if localPort == 0 {
localPort = samlAcsLocalPort
}
return f.Run("pachd", localPort, 654)
} | go | func (f *PortForwarder) RunForSAMLACS(localPort uint16) error {
if localPort == 0 {
localPort = samlAcsLocalPort
}
return f.Run("pachd", localPort, 654)
} | [
"func",
"(",
"f",
"*",
"PortForwarder",
")",
"RunForSAMLACS",
"(",
"localPort",
"uint16",
")",
"error",
"{",
"if",
"localPort",
"==",
"0",
"{",
"localPort",
"=",
"samlAcsLocalPort",
"\n",
"}",
"\n",
"return",
"f",
".",
"Run",
"(",
"\"pachd\"",
",",
"loca... | // RunForSAMLACS creates a port forwarder for SAML ACS. | [
"RunForSAMLACS",
"creates",
"a",
"port",
"forwarder",
"for",
"SAML",
"ACS",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/portforwarder.go#L161-L166 | test |
pachyderm/pachyderm | src/client/portforwarder.go | RunForDashUI | func (f *PortForwarder) RunForDashUI(localPort uint16) error {
if localPort == 0 {
localPort = dashUILocalPort
}
return f.Run("dash", localPort, 8080)
} | go | func (f *PortForwarder) RunForDashUI(localPort uint16) error {
if localPort == 0 {
localPort = dashUILocalPort
}
return f.Run("dash", localPort, 8080)
} | [
"func",
"(",
"f",
"*",
"PortForwarder",
")",
"RunForDashUI",
"(",
"localPort",
"uint16",
")",
"error",
"{",
"if",
"localPort",
"==",
"0",
"{",
"localPort",
"=",
"dashUILocalPort",
"\n",
"}",
"\n",
"return",
"f",
".",
"Run",
"(",
"\"dash\"",
",",
"localPo... | // RunForDashUI creates a port forwarder for the dash UI. | [
"RunForDashUI",
"creates",
"a",
"port",
"forwarder",
"for",
"the",
"dash",
"UI",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/portforwarder.go#L169-L174 | test |
pachyderm/pachyderm | src/client/portforwarder.go | RunForDashWebSocket | func (f *PortForwarder) RunForDashWebSocket(localPort uint16) error {
if localPort == 0 {
localPort = dashWebSocketLocalPort
}
return f.Run("dash", localPort, 8081)
} | go | func (f *PortForwarder) RunForDashWebSocket(localPort uint16) error {
if localPort == 0 {
localPort = dashWebSocketLocalPort
}
return f.Run("dash", localPort, 8081)
} | [
"func",
"(",
"f",
"*",
"PortForwarder",
")",
"RunForDashWebSocket",
"(",
"localPort",
"uint16",
")",
"error",
"{",
"if",
"localPort",
"==",
"0",
"{",
"localPort",
"=",
"dashWebSocketLocalPort",
"\n",
"}",
"\n",
"return",
"f",
".",
"Run",
"(",
"\"dash\"",
"... | // RunForDashWebSocket creates a port forwarder for the dash websocket. | [
"RunForDashWebSocket",
"creates",
"a",
"port",
"forwarder",
"for",
"the",
"dash",
"websocket",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/portforwarder.go#L177-L182 | test |
pachyderm/pachyderm | src/client/portforwarder.go | RunForPFS | func (f *PortForwarder) RunForPFS(localPort uint16) error {
if localPort == 0 {
localPort = pfsLocalPort
}
return f.Run("pachd", localPort, 30652)
} | go | func (f *PortForwarder) RunForPFS(localPort uint16) error {
if localPort == 0 {
localPort = pfsLocalPort
}
return f.Run("pachd", localPort, 30652)
} | [
"func",
"(",
"f",
"*",
"PortForwarder",
")",
"RunForPFS",
"(",
"localPort",
"uint16",
")",
"error",
"{",
"if",
"localPort",
"==",
"0",
"{",
"localPort",
"=",
"pfsLocalPort",
"\n",
"}",
"\n",
"return",
"f",
".",
"Run",
"(",
"\"pachd\"",
",",
"localPort",
... | // RunForPFS creates a port forwarder for PFS over HTTP. | [
"RunForPFS",
"creates",
"a",
"port",
"forwarder",
"for",
"PFS",
"over",
"HTTP",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/portforwarder.go#L185-L190 | test |
pachyderm/pachyderm | src/client/portforwarder.go | RunForS3Gateway | func (f *PortForwarder) RunForS3Gateway(localPort uint16) error {
if localPort == 0 {
localPort = s3gatewayLocalPort
}
return f.Run("pachd", localPort, 600)
} | go | func (f *PortForwarder) RunForS3Gateway(localPort uint16) error {
if localPort == 0 {
localPort = s3gatewayLocalPort
}
return f.Run("pachd", localPort, 600)
} | [
"func",
"(",
"f",
"*",
"PortForwarder",
")",
"RunForS3Gateway",
"(",
"localPort",
"uint16",
")",
"error",
"{",
"if",
"localPort",
"==",
"0",
"{",
"localPort",
"=",
"s3gatewayLocalPort",
"\n",
"}",
"\n",
"return",
"f",
".",
"Run",
"(",
"\"pachd\"",
",",
"... | // RunForS3Gateway creates a port forwarder for the s3gateway. | [
"RunForS3Gateway",
"creates",
"a",
"port",
"forwarder",
"for",
"the",
"s3gateway",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/portforwarder.go#L193-L198 | test |
pachyderm/pachyderm | src/client/portforwarder.go | Lock | func (f *PortForwarder) Lock() error {
pidfile.SetPidfilePath(path.Join(os.Getenv("HOME"), ".pachyderm/port-forward.pid"))
return pidfile.Write()
} | go | func (f *PortForwarder) Lock() error {
pidfile.SetPidfilePath(path.Join(os.Getenv("HOME"), ".pachyderm/port-forward.pid"))
return pidfile.Write()
} | [
"func",
"(",
"f",
"*",
"PortForwarder",
")",
"Lock",
"(",
")",
"error",
"{",
"pidfile",
".",
"SetPidfilePath",
"(",
"path",
".",
"Join",
"(",
"os",
".",
"Getenv",
"(",
"\"HOME\"",
")",
",",
"\".pachyderm/port-forward.pid\"",
")",
")",
"\n",
"return",
"pi... | // Lock uses pidfiles to ensure that only one port forwarder is running across
// one or more `pachctl` instances | [
"Lock",
"uses",
"pidfiles",
"to",
"ensure",
"that",
"only",
"one",
"port",
"forwarder",
"is",
"running",
"across",
"one",
"or",
"more",
"pachctl",
"instances"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/portforwarder.go#L202-L205 | test |
pachyderm/pachyderm | src/client/portforwarder.go | Close | func (f *PortForwarder) Close() {
defer f.logger.Close()
f.stopChansLock.Lock()
defer f.stopChansLock.Unlock()
if f.shutdown {
panic("port forwarder already shutdown")
}
f.shutdown = true
for _, stopChan := range f.stopChans {
close(stopChan)
}
} | go | func (f *PortForwarder) Close() {
defer f.logger.Close()
f.stopChansLock.Lock()
defer f.stopChansLock.Unlock()
if f.shutdown {
panic("port forwarder already shutdown")
}
f.shutdown = true
for _, stopChan := range f.stopChans {
close(stopChan)
}
} | [
"func",
"(",
"f",
"*",
"PortForwarder",
")",
"Close",
"(",
")",
"{",
"defer",
"f",
".",
"logger",
".",
"Close",
"(",
")",
"\n",
"f",
".",
"stopChansLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"f",
".",
"stopChansLock",
".",
"Unlock",
"(",
")",
"... | // Close shuts down port forwarding. | [
"Close",
"shuts",
"down",
"port",
"forwarding",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/portforwarder.go#L208-L223 | test |
pachyderm/pachyderm | src/server/pkg/watch/watch.go | Unmarshal | func (e *Event) Unmarshal(key *string, val proto.Message) error {
if err := CheckType(e.Template, val); err != nil {
return err
}
*key = string(e.Key)
return proto.Unmarshal(e.Value, val)
} | go | func (e *Event) Unmarshal(key *string, val proto.Message) error {
if err := CheckType(e.Template, val); err != nil {
return err
}
*key = string(e.Key)
return proto.Unmarshal(e.Value, val)
} | [
"func",
"(",
"e",
"*",
"Event",
")",
"Unmarshal",
"(",
"key",
"*",
"string",
",",
"val",
"proto",
".",
"Message",
")",
"error",
"{",
"if",
"err",
":=",
"CheckType",
"(",
"e",
".",
"Template",
",",
"val",
")",
";",
"err",
"!=",
"nil",
"{",
"return... | // Unmarshal unmarshals the item in an event into a protobuf message. | [
"Unmarshal",
"unmarshals",
"the",
"item",
"in",
"an",
"event",
"into",
"a",
"protobuf",
"message",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/watch/watch.go#L41-L47 | test |
pachyderm/pachyderm | src/server/pkg/watch/watch.go | UnmarshalPrev | func (e *Event) UnmarshalPrev(key *string, val proto.Message) error {
if err := CheckType(e.Template, val); err != nil {
return err
}
*key = string(e.PrevKey)
return proto.Unmarshal(e.PrevValue, val)
} | go | func (e *Event) UnmarshalPrev(key *string, val proto.Message) error {
if err := CheckType(e.Template, val); err != nil {
return err
}
*key = string(e.PrevKey)
return proto.Unmarshal(e.PrevValue, val)
} | [
"func",
"(",
"e",
"*",
"Event",
")",
"UnmarshalPrev",
"(",
"key",
"*",
"string",
",",
"val",
"proto",
".",
"Message",
")",
"error",
"{",
"if",
"err",
":=",
"CheckType",
"(",
"e",
".",
"Template",
",",
"val",
")",
";",
"err",
"!=",
"nil",
"{",
"re... | // UnmarshalPrev unmarshals the prev item in an event into a protobuf
// message. | [
"UnmarshalPrev",
"unmarshals",
"the",
"prev",
"item",
"in",
"an",
"event",
"into",
"a",
"protobuf",
"message",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/watch/watch.go#L51-L57 | test |
pachyderm/pachyderm | src/server/pkg/watch/watch.go | MakeWatcher | func MakeWatcher(eventCh chan *Event, done chan struct{}) Watcher {
return &watcher{
eventCh: eventCh,
done: done,
}
} | go | func MakeWatcher(eventCh chan *Event, done chan struct{}) Watcher {
return &watcher{
eventCh: eventCh,
done: done,
}
} | [
"func",
"MakeWatcher",
"(",
"eventCh",
"chan",
"*",
"Event",
",",
"done",
"chan",
"struct",
"{",
"}",
")",
"Watcher",
"{",
"return",
"&",
"watcher",
"{",
"eventCh",
":",
"eventCh",
",",
"done",
":",
"done",
",",
"}",
"\n",
"}"
] | // MakeWatcher returns a Watcher that uses the given event channel and done
// channel internally to deliver events and signal closure, respectively. | [
"MakeWatcher",
"returns",
"a",
"Watcher",
"that",
"uses",
"the",
"given",
"event",
"channel",
"and",
"done",
"channel",
"internally",
"to",
"deliver",
"events",
"and",
"signal",
"closure",
"respectively",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/watch/watch.go#L195-L200 | test |
pachyderm/pachyderm | src/server/pkg/watch/watch.go | CheckType | func CheckType(template proto.Message, val interface{}) error {
if template != nil {
valType, templateType := reflect.TypeOf(val), reflect.TypeOf(template)
if valType != templateType {
return fmt.Errorf("invalid type, got: %s, expected: %s", valType, templateType)
}
}
return nil
} | go | func CheckType(template proto.Message, val interface{}) error {
if template != nil {
valType, templateType := reflect.TypeOf(val), reflect.TypeOf(template)
if valType != templateType {
return fmt.Errorf("invalid type, got: %s, expected: %s", valType, templateType)
}
}
return nil
} | [
"func",
"CheckType",
"(",
"template",
"proto",
".",
"Message",
",",
"val",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"template",
"!=",
"nil",
"{",
"valType",
",",
"templateType",
":=",
"reflect",
".",
"TypeOf",
"(",
"val",
")",
",",
"reflect",
".... | // CheckType checks to make sure val has the same type as template, unless
// template is nil in which case it always returns nil. | [
"CheckType",
"checks",
"to",
"make",
"sure",
"val",
"has",
"the",
"same",
"type",
"as",
"template",
"unless",
"template",
"is",
"nil",
"in",
"which",
"case",
"it",
"always",
"returns",
"nil",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/watch/watch.go#L204-L212 | test |
pachyderm/pachyderm | src/server/pkg/pool/pool.go | NewPool | func NewPool(kubeClient *kube.Clientset, namespace string, serviceName string, port int, queueSize int64, opts ...grpc.DialOption) (*Pool, error) {
endpointsInterface := kubeClient.CoreV1().Endpoints(namespace)
watch, err := endpointsInterface.Watch(metav1.ListOptions{
LabelSelector: metav1.FormatLabelSelector(met... | go | func NewPool(kubeClient *kube.Clientset, namespace string, serviceName string, port int, queueSize int64, opts ...grpc.DialOption) (*Pool, error) {
endpointsInterface := kubeClient.CoreV1().Endpoints(namespace)
watch, err := endpointsInterface.Watch(metav1.ListOptions{
LabelSelector: metav1.FormatLabelSelector(met... | [
"func",
"NewPool",
"(",
"kubeClient",
"*",
"kube",
".",
"Clientset",
",",
"namespace",
"string",
",",
"serviceName",
"string",
",",
"port",
"int",
",",
"queueSize",
"int64",
",",
"opts",
"...",
"grpc",
".",
"DialOption",
")",
"(",
"*",
"Pool",
",",
"erro... | // NewPool creates a new connection pool with connections to pods in the
// given service. | [
"NewPool",
"creates",
"a",
"new",
"connection",
"pool",
"with",
"connections",
"to",
"pods",
"in",
"the",
"given",
"service",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/pool/pool.go#L38-L61 | test |
pachyderm/pachyderm | src/server/pkg/pool/pool.go | Do | func (p *Pool) Do(ctx context.Context, f func(cc *grpc.ClientConn) error) error {
var conn *connCount
if err := func() error {
p.connsLock.Lock()
defer p.connsLock.Unlock()
for {
for addr, mapConn := range p.conns {
if mapConn.cc == nil {
cc, err := grpc.DialContext(ctx, addr, p.opts...)
if err... | go | func (p *Pool) Do(ctx context.Context, f func(cc *grpc.ClientConn) error) error {
var conn *connCount
if err := func() error {
p.connsLock.Lock()
defer p.connsLock.Unlock()
for {
for addr, mapConn := range p.conns {
if mapConn.cc == nil {
cc, err := grpc.DialContext(ctx, addr, p.opts...)
if err... | [
"func",
"(",
"p",
"*",
"Pool",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
",",
"f",
"func",
"(",
"cc",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
")",
"error",
"{",
"var",
"conn",
"*",
"connCount",
"\n",
"if",
"err",
":=",
"func",
"(",
... | // Do allows you to do something with a grpc.ClientConn.
// Errors returned from f will be returned by Do. | [
"Do",
"allows",
"you",
"to",
"do",
"something",
"with",
"a",
"grpc",
".",
"ClientConn",
".",
"Errors",
"returned",
"from",
"f",
"will",
"be",
"returned",
"by",
"Do",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/pool/pool.go#L102-L140 | test |
pachyderm/pachyderm | src/server/pkg/pool/pool.go | Close | func (p *Pool) Close() error {
close(p.done)
var retErr error
for _, conn := range p.conns {
if conn.cc != nil {
if err := conn.cc.Close(); err != nil {
retErr = err
}
}
}
return retErr
} | go | func (p *Pool) Close() error {
close(p.done)
var retErr error
for _, conn := range p.conns {
if conn.cc != nil {
if err := conn.cc.Close(); err != nil {
retErr = err
}
}
}
return retErr
} | [
"func",
"(",
"p",
"*",
"Pool",
")",
"Close",
"(",
")",
"error",
"{",
"close",
"(",
"p",
".",
"done",
")",
"\n",
"var",
"retErr",
"error",
"\n",
"for",
"_",
",",
"conn",
":=",
"range",
"p",
".",
"conns",
"{",
"if",
"conn",
".",
"cc",
"!=",
"ni... | // Close closes all connections stored in the pool, it returns an error if any
// of the calls to Close error. | [
"Close",
"closes",
"all",
"connections",
"stored",
"in",
"the",
"pool",
"it",
"returns",
"an",
"error",
"if",
"any",
"of",
"the",
"calls",
"to",
"Close",
"error",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/pool/pool.go#L144-L155 | test |
pachyderm/pachyderm | src/server/pps/cmds/cmds.go | buildImage | func buildImage(client *docker.Client, repo string, contextDir string, dockerfile string, destTag string) error {
destImage := fmt.Sprintf("%s:%s", repo, destTag)
fmt.Printf("Building %s, this may take a while.\n", destImage)
err := client.BuildImage(docker.BuildImageOptions{
Name: destImage,
ContextDi... | go | func buildImage(client *docker.Client, repo string, contextDir string, dockerfile string, destTag string) error {
destImage := fmt.Sprintf("%s:%s", repo, destTag)
fmt.Printf("Building %s, this may take a while.\n", destImage)
err := client.BuildImage(docker.BuildImageOptions{
Name: destImage,
ContextDi... | [
"func",
"buildImage",
"(",
"client",
"*",
"docker",
".",
"Client",
",",
"repo",
"string",
",",
"contextDir",
"string",
",",
"dockerfile",
"string",
",",
"destTag",
"string",
")",
"error",
"{",
"destImage",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"%s:%s\"",
","... | // buildImage builds a new docker image. | [
"buildImage",
"builds",
"a",
"new",
"docker",
"image",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pps/cmds/cmds.go#L898-L915 | test |
pachyderm/pachyderm | src/server/pps/cmds/cmds.go | pushImage | func pushImage(client *docker.Client, authConfig docker.AuthConfiguration, repo string, sourceTag string, destTag string) (string, error) {
sourceImage := fmt.Sprintf("%s:%s", repo, sourceTag)
destImage := fmt.Sprintf("%s:%s", repo, destTag)
fmt.Printf("Tagging/pushing %s, this may take a while.\n", destImage)
if... | go | func pushImage(client *docker.Client, authConfig docker.AuthConfiguration, repo string, sourceTag string, destTag string) (string, error) {
sourceImage := fmt.Sprintf("%s:%s", repo, sourceTag)
destImage := fmt.Sprintf("%s:%s", repo, destTag)
fmt.Printf("Tagging/pushing %s, this may take a while.\n", destImage)
if... | [
"func",
"pushImage",
"(",
"client",
"*",
"docker",
".",
"Client",
",",
"authConfig",
"docker",
".",
"AuthConfiguration",
",",
"repo",
"string",
",",
"sourceTag",
"string",
",",
"destTag",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"sourceImage",
... | // pushImage pushes a docker image. | [
"pushImage",
"pushes",
"a",
"docker",
"image",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pps/cmds/cmds.go#L918-L945 | test |
pachyderm/pachyderm | src/server/pkg/obj/minio_client.go | newMinioClient | func newMinioClient(endpoint, bucket, id, secret string, secure bool) (*minioClient, error) {
mclient, err := minio.New(endpoint, id, secret, secure)
if err != nil {
return nil, err
}
return &minioClient{
bucket: bucket,
Client: mclient,
}, nil
} | go | func newMinioClient(endpoint, bucket, id, secret string, secure bool) (*minioClient, error) {
mclient, err := minio.New(endpoint, id, secret, secure)
if err != nil {
return nil, err
}
return &minioClient{
bucket: bucket,
Client: mclient,
}, nil
} | [
"func",
"newMinioClient",
"(",
"endpoint",
",",
"bucket",
",",
"id",
",",
"secret",
"string",
",",
"secure",
"bool",
")",
"(",
"*",
"minioClient",
",",
"error",
")",
"{",
"mclient",
",",
"err",
":=",
"minio",
".",
"New",
"(",
"endpoint",
",",
"id",
"... | // Creates a new minioClient structure and returns | [
"Creates",
"a",
"new",
"minioClient",
"structure",
"and",
"returns"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/obj/minio_client.go#L19-L28 | test |
pachyderm/pachyderm | src/server/pkg/obj/minio_client.go | newMinioClientV2 | func newMinioClientV2(endpoint, bucket, id, secret string, secure bool) (*minioClient, error) {
mclient, err := minio.NewV2(endpoint, id, secret, secure)
if err != nil {
return nil, err
}
return &minioClient{
bucket: bucket,
Client: mclient,
}, nil
} | go | func newMinioClientV2(endpoint, bucket, id, secret string, secure bool) (*minioClient, error) {
mclient, err := minio.NewV2(endpoint, id, secret, secure)
if err != nil {
return nil, err
}
return &minioClient{
bucket: bucket,
Client: mclient,
}, nil
} | [
"func",
"newMinioClientV2",
"(",
"endpoint",
",",
"bucket",
",",
"id",
",",
"secret",
"string",
",",
"secure",
"bool",
")",
"(",
"*",
"minioClient",
",",
"error",
")",
"{",
"mclient",
",",
"err",
":=",
"minio",
".",
"NewV2",
"(",
"endpoint",
",",
"id",... | // Creates a new minioClient S3V2 structure and returns | [
"Creates",
"a",
"new",
"minioClient",
"S3V2",
"structure",
"and",
"returns"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/obj/minio_client.go#L31-L40 | test |
pachyderm/pachyderm | src/server/pkg/obj/minio_client.go | newMinioWriter | func newMinioWriter(ctx context.Context, client *minioClient, name string) *minioWriter {
reader, writer := io.Pipe()
w := &minioWriter{
ctx: ctx,
errChan: make(chan error),
pipe: writer,
}
go func() {
_, err := client.PutObject(client.bucket, name, reader, "application/octet-stream")
if err != nil... | go | func newMinioWriter(ctx context.Context, client *minioClient, name string) *minioWriter {
reader, writer := io.Pipe()
w := &minioWriter{
ctx: ctx,
errChan: make(chan error),
pipe: writer,
}
go func() {
_, err := client.PutObject(client.bucket, name, reader, "application/octet-stream")
if err != nil... | [
"func",
"newMinioWriter",
"(",
"ctx",
"context",
".",
"Context",
",",
"client",
"*",
"minioClient",
",",
"name",
"string",
")",
"*",
"minioWriter",
"{",
"reader",
",",
"writer",
":=",
"io",
".",
"Pipe",
"(",
")",
"\n",
"w",
":=",
"&",
"minioWriter",
"{... | // Creates a new minio writer and a go routine to upload objects to minio server | [
"Creates",
"a",
"new",
"minio",
"writer",
"and",
"a",
"go",
"routine",
"to",
"upload",
"objects",
"to",
"minio",
"server"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/obj/minio_client.go#L50-L65 | test |
pachyderm/pachyderm | src/server/pkg/obj/minio_client.go | Close | func (w *minioWriter) Close() error {
span, _ := tracing.AddSpanToAnyExisting(w.ctx, "minioWriter.Close")
defer tracing.FinishAnySpan(span)
if err := w.pipe.Close(); err != nil {
return err
}
return <-w.errChan
} | go | func (w *minioWriter) Close() error {
span, _ := tracing.AddSpanToAnyExisting(w.ctx, "minioWriter.Close")
defer tracing.FinishAnySpan(span)
if err := w.pipe.Close(); err != nil {
return err
}
return <-w.errChan
} | [
"func",
"(",
"w",
"*",
"minioWriter",
")",
"Close",
"(",
")",
"error",
"{",
"span",
",",
"_",
":=",
"tracing",
".",
"AddSpanToAnyExisting",
"(",
"w",
".",
"ctx",
",",
"\"minioWriter.Close\"",
")",
"\n",
"defer",
"tracing",
".",
"FinishAnySpan",
"(",
"spa... | // This will block till upload is done | [
"This",
"will",
"block",
"till",
"upload",
"is",
"done"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/obj/minio_client.go#L74-L81 | test |
pachyderm/pachyderm | src/server/pkg/ppsutil/util.go | PipelineRepo | func PipelineRepo(pipeline *ppsclient.Pipeline) *pfs.Repo {
return &pfs.Repo{Name: pipeline.Name}
} | go | func PipelineRepo(pipeline *ppsclient.Pipeline) *pfs.Repo {
return &pfs.Repo{Name: pipeline.Name}
} | [
"func",
"PipelineRepo",
"(",
"pipeline",
"*",
"ppsclient",
".",
"Pipeline",
")",
"*",
"pfs",
".",
"Repo",
"{",
"return",
"&",
"pfs",
".",
"Repo",
"{",
"Name",
":",
"pipeline",
".",
"Name",
"}",
"\n",
"}"
] | // PipelineRepo creates a pfs repo for a given pipeline. | [
"PipelineRepo",
"creates",
"a",
"pfs",
"repo",
"for",
"a",
"given",
"pipeline",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/ppsutil/util.go#L51-L53 | test |
pachyderm/pachyderm | src/server/pkg/ppsutil/util.go | PipelineRcName | func PipelineRcName(name string, version uint64) string {
// k8s won't allow RC names that contain upper-case letters
// or underscores
// TODO: deal with name collision
name = strings.Replace(name, "_", "-", -1)
return fmt.Sprintf("pipeline-%s-v%d", strings.ToLower(name), version)
} | go | func PipelineRcName(name string, version uint64) string {
// k8s won't allow RC names that contain upper-case letters
// or underscores
// TODO: deal with name collision
name = strings.Replace(name, "_", "-", -1)
return fmt.Sprintf("pipeline-%s-v%d", strings.ToLower(name), version)
} | [
"func",
"PipelineRcName",
"(",
"name",
"string",
",",
"version",
"uint64",
")",
"string",
"{",
"name",
"=",
"strings",
".",
"Replace",
"(",
"name",
",",
"\"_\"",
",",
"\"-\"",
",",
"-",
"1",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"pipeline-... | // PipelineRcName generates the name of the k8s replication controller that
// manages a pipeline's workers | [
"PipelineRcName",
"generates",
"the",
"name",
"of",
"the",
"k8s",
"replication",
"controller",
"that",
"manages",
"a",
"pipeline",
"s",
"workers"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/ppsutil/util.go#L57-L63 | test |
pachyderm/pachyderm | src/server/pkg/ppsutil/util.go | GetRequestsResourceListFromPipeline | func GetRequestsResourceListFromPipeline(pipelineInfo *pps.PipelineInfo) (*v1.ResourceList, error) {
return getResourceListFromSpec(pipelineInfo.ResourceRequests, pipelineInfo.CacheSize)
} | go | func GetRequestsResourceListFromPipeline(pipelineInfo *pps.PipelineInfo) (*v1.ResourceList, error) {
return getResourceListFromSpec(pipelineInfo.ResourceRequests, pipelineInfo.CacheSize)
} | [
"func",
"GetRequestsResourceListFromPipeline",
"(",
"pipelineInfo",
"*",
"pps",
".",
"PipelineInfo",
")",
"(",
"*",
"v1",
".",
"ResourceList",
",",
"error",
")",
"{",
"return",
"getResourceListFromSpec",
"(",
"pipelineInfo",
".",
"ResourceRequests",
",",
"pipelineIn... | // GetRequestsResourceListFromPipeline returns a list of resources that the pipeline,
// minimally requires. | [
"GetRequestsResourceListFromPipeline",
"returns",
"a",
"list",
"of",
"resources",
"that",
"the",
"pipeline",
"minimally",
"requires",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/ppsutil/util.go#L67-L69 | test |
pachyderm/pachyderm | src/server/pkg/ppsutil/util.go | GetLimitsResourceListFromPipeline | func GetLimitsResourceListFromPipeline(pipelineInfo *pps.PipelineInfo) (*v1.ResourceList, error) {
return getResourceListFromSpec(pipelineInfo.ResourceLimits, pipelineInfo.CacheSize)
} | go | func GetLimitsResourceListFromPipeline(pipelineInfo *pps.PipelineInfo) (*v1.ResourceList, error) {
return getResourceListFromSpec(pipelineInfo.ResourceLimits, pipelineInfo.CacheSize)
} | [
"func",
"GetLimitsResourceListFromPipeline",
"(",
"pipelineInfo",
"*",
"pps",
".",
"PipelineInfo",
")",
"(",
"*",
"v1",
".",
"ResourceList",
",",
"error",
")",
"{",
"return",
"getResourceListFromSpec",
"(",
"pipelineInfo",
".",
"ResourceLimits",
",",
"pipelineInfo",... | // GetLimitsResourceListFromPipeline returns a list of resources that the pipeline,
// maximally is limited to. | [
"GetLimitsResourceListFromPipeline",
"returns",
"a",
"list",
"of",
"resources",
"that",
"the",
"pipeline",
"maximally",
"is",
"limited",
"to",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/ppsutil/util.go#L121-L123 | test |
pachyderm/pachyderm | src/server/pkg/ppsutil/util.go | getNumNodes | func getNumNodes(kubeClient *kube.Clientset) (int, error) {
nodeList, err := kubeClient.CoreV1().Nodes().List(metav1.ListOptions{})
if err != nil {
return 0, fmt.Errorf("unable to retrieve node list from k8s to determine parallelism: %v", err)
}
if len(nodeList.Items) == 0 {
return 0, fmt.Errorf("pachyderm.pps.... | go | func getNumNodes(kubeClient *kube.Clientset) (int, error) {
nodeList, err := kubeClient.CoreV1().Nodes().List(metav1.ListOptions{})
if err != nil {
return 0, fmt.Errorf("unable to retrieve node list from k8s to determine parallelism: %v", err)
}
if len(nodeList.Items) == 0 {
return 0, fmt.Errorf("pachyderm.pps.... | [
"func",
"getNumNodes",
"(",
"kubeClient",
"*",
"kube",
".",
"Clientset",
")",
"(",
"int",
",",
"error",
")",
"{",
"nodeList",
",",
"err",
":=",
"kubeClient",
".",
"CoreV1",
"(",
")",
".",
"Nodes",
"(",
")",
".",
"List",
"(",
"metav1",
".",
"ListOptio... | // getNumNodes attempts to retrieve the number of nodes in the current k8s
// cluster | [
"getNumNodes",
"attempts",
"to",
"retrieve",
"the",
"number",
"of",
"nodes",
"in",
"the",
"current",
"k8s",
"cluster"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/ppsutil/util.go#L127-L136 | test |
pachyderm/pachyderm | src/server/pkg/ppsutil/util.go | GetExpectedNumWorkers | func GetExpectedNumWorkers(kubeClient *kube.Clientset, spec *ppsclient.ParallelismSpec) (int, error) {
if spec == nil || (spec.Constant == 0 && spec.Coefficient == 0) {
return 1, nil
} else if spec.Constant > 0 && spec.Coefficient == 0 {
return int(spec.Constant), nil
} else if spec.Constant == 0 && spec.Coeffic... | go | func GetExpectedNumWorkers(kubeClient *kube.Clientset, spec *ppsclient.ParallelismSpec) (int, error) {
if spec == nil || (spec.Constant == 0 && spec.Coefficient == 0) {
return 1, nil
} else if spec.Constant > 0 && spec.Coefficient == 0 {
return int(spec.Constant), nil
} else if spec.Constant == 0 && spec.Coeffic... | [
"func",
"GetExpectedNumWorkers",
"(",
"kubeClient",
"*",
"kube",
".",
"Clientset",
",",
"spec",
"*",
"ppsclient",
".",
"ParallelismSpec",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"spec",
"==",
"nil",
"||",
"(",
"spec",
".",
"Constant",
"==",
"0",
... | // GetExpectedNumWorkers computes the expected number of workers that
// pachyderm will start given the ParallelismSpec 'spec'.
//
// This is only exported for testing | [
"GetExpectedNumWorkers",
"computes",
"the",
"expected",
"number",
"of",
"workers",
"that",
"pachyderm",
"will",
"start",
"given",
"the",
"ParallelismSpec",
"spec",
".",
"This",
"is",
"only",
"exported",
"for",
"testing"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/ppsutil/util.go#L142-L157 | test |
pachyderm/pachyderm | src/server/pkg/ppsutil/util.go | GetExpectedNumHashtrees | func GetExpectedNumHashtrees(spec *ppsclient.HashtreeSpec) (int64, error) {
if spec == nil || spec.Constant == 0 {
return 1, nil
} else if spec.Constant > 0 {
return int64(spec.Constant), nil
}
return 0, fmt.Errorf("unable to interpret HashtreeSpec %+v", spec)
} | go | func GetExpectedNumHashtrees(spec *ppsclient.HashtreeSpec) (int64, error) {
if spec == nil || spec.Constant == 0 {
return 1, nil
} else if spec.Constant > 0 {
return int64(spec.Constant), nil
}
return 0, fmt.Errorf("unable to interpret HashtreeSpec %+v", spec)
} | [
"func",
"GetExpectedNumHashtrees",
"(",
"spec",
"*",
"ppsclient",
".",
"HashtreeSpec",
")",
"(",
"int64",
",",
"error",
")",
"{",
"if",
"spec",
"==",
"nil",
"||",
"spec",
".",
"Constant",
"==",
"0",
"{",
"return",
"1",
",",
"nil",
"\n",
"}",
"else",
... | // GetExpectedNumHashtrees computes the expected number of hashtrees that
// Pachyderm will create given the HashtreeSpec 'spec'. | [
"GetExpectedNumHashtrees",
"computes",
"the",
"expected",
"number",
"of",
"hashtrees",
"that",
"Pachyderm",
"will",
"create",
"given",
"the",
"HashtreeSpec",
"spec",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/ppsutil/util.go#L161-L168 | test |
pachyderm/pachyderm | src/server/pkg/ppsutil/util.go | FailPipeline | func FailPipeline(ctx context.Context, etcdClient *etcd.Client, pipelinesCollection col.Collection, pipelineName string, reason string) error {
_, err := col.NewSTM(ctx, etcdClient, func(stm col.STM) error {
pipelines := pipelinesCollection.ReadWrite(stm)
pipelinePtr := new(pps.EtcdPipelineInfo)
if err := pipeli... | go | func FailPipeline(ctx context.Context, etcdClient *etcd.Client, pipelinesCollection col.Collection, pipelineName string, reason string) error {
_, err := col.NewSTM(ctx, etcdClient, func(stm col.STM) error {
pipelines := pipelinesCollection.ReadWrite(stm)
pipelinePtr := new(pps.EtcdPipelineInfo)
if err := pipeli... | [
"func",
"FailPipeline",
"(",
"ctx",
"context",
".",
"Context",
",",
"etcdClient",
"*",
"etcd",
".",
"Client",
",",
"pipelinesCollection",
"col",
".",
"Collection",
",",
"pipelineName",
"string",
",",
"reason",
"string",
")",
"error",
"{",
"_",
",",
"err",
... | // FailPipeline updates the pipeline's state to failed and sets the failure reason | [
"FailPipeline",
"updates",
"the",
"pipeline",
"s",
"state",
"to",
"failed",
"and",
"sets",
"the",
"failure",
"reason"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/ppsutil/util.go#L192-L205 | test |
pachyderm/pachyderm | src/server/pkg/ppsutil/util.go | JobInput | func JobInput(pipelineInfo *pps.PipelineInfo, outputCommitInfo *pfs.CommitInfo) *pps.Input {
// branchToCommit maps strings of the form "<repo>/<branch>" to PFS commits
branchToCommit := make(map[string]*pfs.Commit)
key := path.Join
for _, prov := range outputCommitInfo.Provenance {
branchToCommit[key(prov.Commit... | go | func JobInput(pipelineInfo *pps.PipelineInfo, outputCommitInfo *pfs.CommitInfo) *pps.Input {
// branchToCommit maps strings of the form "<repo>/<branch>" to PFS commits
branchToCommit := make(map[string]*pfs.Commit)
key := path.Join
for _, prov := range outputCommitInfo.Provenance {
branchToCommit[key(prov.Commit... | [
"func",
"JobInput",
"(",
"pipelineInfo",
"*",
"pps",
".",
"PipelineInfo",
",",
"outputCommitInfo",
"*",
"pfs",
".",
"CommitInfo",
")",
"*",
"pps",
".",
"Input",
"{",
"branchToCommit",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"pfs",
".",
"Commit... | // JobInput fills in the commits for a JobInfo | [
"JobInput",
"fills",
"in",
"the",
"commits",
"for",
"a",
"JobInfo"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/ppsutil/util.go#L208-L234 | test |
pachyderm/pachyderm | src/server/pkg/ppsutil/util.go | PipelineReqFromInfo | func PipelineReqFromInfo(pipelineInfo *ppsclient.PipelineInfo) *ppsclient.CreatePipelineRequest {
return &ppsclient.CreatePipelineRequest{
Pipeline: pipelineInfo.Pipeline,
Transform: pipelineInfo.Transform,
ParallelismSpec: pipelineInfo.ParallelismSpec,
HashtreeSpec: pipelineInfo.Ha... | go | func PipelineReqFromInfo(pipelineInfo *ppsclient.PipelineInfo) *ppsclient.CreatePipelineRequest {
return &ppsclient.CreatePipelineRequest{
Pipeline: pipelineInfo.Pipeline,
Transform: pipelineInfo.Transform,
ParallelismSpec: pipelineInfo.ParallelismSpec,
HashtreeSpec: pipelineInfo.Ha... | [
"func",
"PipelineReqFromInfo",
"(",
"pipelineInfo",
"*",
"ppsclient",
".",
"PipelineInfo",
")",
"*",
"ppsclient",
".",
"CreatePipelineRequest",
"{",
"return",
"&",
"ppsclient",
".",
"CreatePipelineRequest",
"{",
"Pipeline",
":",
"pipelineInfo",
".",
"Pipeline",
",",... | // PipelineReqFromInfo converts a PipelineInfo into a CreatePipelineRequest. | [
"PipelineReqFromInfo",
"converts",
"a",
"PipelineInfo",
"into",
"a",
"CreatePipelineRequest",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/ppsutil/util.go#L237-L260 | test |
pachyderm/pachyderm | src/server/pkg/ppsutil/util.go | NewPipelineManifestReader | func NewPipelineManifestReader(path string) (result *PipelineManifestReader, retErr error) {
result = &PipelineManifestReader{}
var pipelineReader io.Reader
if path == "-" {
pipelineReader = io.TeeReader(os.Stdin, &result.buf)
fmt.Print("Reading from stdin.\n")
} else if url, err := url.Parse(path); err == nil ... | go | func NewPipelineManifestReader(path string) (result *PipelineManifestReader, retErr error) {
result = &PipelineManifestReader{}
var pipelineReader io.Reader
if path == "-" {
pipelineReader = io.TeeReader(os.Stdin, &result.buf)
fmt.Print("Reading from stdin.\n")
} else if url, err := url.Parse(path); err == nil ... | [
"func",
"NewPipelineManifestReader",
"(",
"path",
"string",
")",
"(",
"result",
"*",
"PipelineManifestReader",
",",
"retErr",
"error",
")",
"{",
"result",
"=",
"&",
"PipelineManifestReader",
"{",
"}",
"\n",
"var",
"pipelineReader",
"io",
".",
"Reader",
"\n",
"... | // NewPipelineManifestReader creates a new manifest reader from a path. | [
"NewPipelineManifestReader",
"creates",
"a",
"new",
"manifest",
"reader",
"from",
"a",
"path",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/ppsutil/util.go#L270-L301 | test |
pachyderm/pachyderm | src/server/pkg/ppsutil/util.go | NextCreatePipelineRequest | func (r *PipelineManifestReader) NextCreatePipelineRequest() (*ppsclient.CreatePipelineRequest, error) {
var result ppsclient.CreatePipelineRequest
if err := jsonpb.UnmarshalNext(r.decoder, &result); err != nil {
if err == io.EOF {
return nil, err
}
return nil, fmt.Errorf("malformed pipeline spec: %s", err)
... | go | func (r *PipelineManifestReader) NextCreatePipelineRequest() (*ppsclient.CreatePipelineRequest, error) {
var result ppsclient.CreatePipelineRequest
if err := jsonpb.UnmarshalNext(r.decoder, &result); err != nil {
if err == io.EOF {
return nil, err
}
return nil, fmt.Errorf("malformed pipeline spec: %s", err)
... | [
"func",
"(",
"r",
"*",
"PipelineManifestReader",
")",
"NextCreatePipelineRequest",
"(",
")",
"(",
"*",
"ppsclient",
".",
"CreatePipelineRequest",
",",
"error",
")",
"{",
"var",
"result",
"ppsclient",
".",
"CreatePipelineRequest",
"\n",
"if",
"err",
":=",
"jsonpb... | // NextCreatePipelineRequest gets the next request from the manifest reader. | [
"NextCreatePipelineRequest",
"gets",
"the",
"next",
"request",
"from",
"the",
"manifest",
"reader",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/ppsutil/util.go#L304-L313 | test |
pachyderm/pachyderm | src/server/pkg/ppsutil/util.go | DescribeSyntaxError | func DescribeSyntaxError(originalErr error, parsedBuffer bytes.Buffer) error {
sErr, ok := originalErr.(*json.SyntaxError)
if !ok {
return originalErr
}
buffer := make([]byte, sErr.Offset)
parsedBuffer.Read(buffer)
lineOffset := strings.LastIndex(string(buffer[:len(buffer)-1]), "\n")
if lineOffset == -1 {
... | go | func DescribeSyntaxError(originalErr error, parsedBuffer bytes.Buffer) error {
sErr, ok := originalErr.(*json.SyntaxError)
if !ok {
return originalErr
}
buffer := make([]byte, sErr.Offset)
parsedBuffer.Read(buffer)
lineOffset := strings.LastIndex(string(buffer[:len(buffer)-1]), "\n")
if lineOffset == -1 {
... | [
"func",
"DescribeSyntaxError",
"(",
"originalErr",
"error",
",",
"parsedBuffer",
"bytes",
".",
"Buffer",
")",
"error",
"{",
"sErr",
",",
"ok",
":=",
"originalErr",
".",
"(",
"*",
"json",
".",
"SyntaxError",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"ori... | // DescribeSyntaxError describes a syntax error encountered parsing json. | [
"DescribeSyntaxError",
"describes",
"a",
"syntax",
"error",
"encountered",
"parsing",
"json",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/ppsutil/util.go#L316-L342 | test |
pachyderm/pachyderm | src/server/pkg/ppsutil/util.go | UpdateJobState | func UpdateJobState(pipelines col.ReadWriteCollection, jobs col.ReadWriteCollection, jobPtr *pps.EtcdJobInfo, state pps.JobState, reason string) error {
// Update pipeline
pipelinePtr := &pps.EtcdPipelineInfo{}
if err := pipelines.Get(jobPtr.Pipeline.Name, pipelinePtr); err != nil {
return err
}
if pipelinePtr.J... | go | func UpdateJobState(pipelines col.ReadWriteCollection, jobs col.ReadWriteCollection, jobPtr *pps.EtcdJobInfo, state pps.JobState, reason string) error {
// Update pipeline
pipelinePtr := &pps.EtcdPipelineInfo{}
if err := pipelines.Get(jobPtr.Pipeline.Name, pipelinePtr); err != nil {
return err
}
if pipelinePtr.J... | [
"func",
"UpdateJobState",
"(",
"pipelines",
"col",
".",
"ReadWriteCollection",
",",
"jobs",
"col",
".",
"ReadWriteCollection",
",",
"jobPtr",
"*",
"pps",
".",
"EtcdJobInfo",
",",
"state",
"pps",
".",
"JobState",
",",
"reason",
"string",
")",
"error",
"{",
"p... | // UpdateJobState performs the operations involved with a job state transition. | [
"UpdateJobState",
"performs",
"the",
"operations",
"involved",
"with",
"a",
"job",
"state",
"transition",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/ppsutil/util.go#L359-L390 | test |
pachyderm/pachyderm | src/server/pkg/uuid/uuid.go | New | func New() string {
var result string
backoff.RetryNotify(func() error {
uuid, err := uuid.NewV4()
if err != nil {
return err
}
result = uuid.String()
return nil
}, backoff.NewInfiniteBackOff(), func(err error, d time.Duration) error {
fmt.Printf("error from uuid.NewV4: %v", err)
return nil
})
ret... | go | func New() string {
var result string
backoff.RetryNotify(func() error {
uuid, err := uuid.NewV4()
if err != nil {
return err
}
result = uuid.String()
return nil
}, backoff.NewInfiniteBackOff(), func(err error, d time.Duration) error {
fmt.Printf("error from uuid.NewV4: %v", err)
return nil
})
ret... | [
"func",
"New",
"(",
")",
"string",
"{",
"var",
"result",
"string",
"\n",
"backoff",
".",
"RetryNotify",
"(",
"func",
"(",
")",
"error",
"{",
"uuid",
",",
"err",
":=",
"uuid",
".",
"NewV4",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
... | // New returns a new uuid. | [
"New",
"returns",
"a",
"new",
"uuid",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/uuid/uuid.go#L14-L28 | test |
pachyderm/pachyderm | src/server/pkg/errutil/http.go | Code | func (h *HTTPError) Code() int {
if h == nil {
return http.StatusOK
}
return h.code
} | go | func (h *HTTPError) Code() int {
if h == nil {
return http.StatusOK
}
return h.code
} | [
"func",
"(",
"h",
"*",
"HTTPError",
")",
"Code",
"(",
")",
"int",
"{",
"if",
"h",
"==",
"nil",
"{",
"return",
"http",
".",
"StatusOK",
"\n",
"}",
"\n",
"return",
"h",
".",
"code",
"\n",
"}"
] | // Code returns the HTTP error code associated with 'h' | [
"Code",
"returns",
"the",
"HTTP",
"error",
"code",
"associated",
"with",
"h"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/errutil/http.go#L25-L30 | test |
pachyderm/pachyderm | src/server/pkg/errutil/http.go | NewHTTPError | func NewHTTPError(code int, formatStr string, args ...interface{}) *HTTPError {
return &HTTPError{
code: code,
err: fmt.Sprintf(formatStr, args...),
}
} | go | func NewHTTPError(code int, formatStr string, args ...interface{}) *HTTPError {
return &HTTPError{
code: code,
err: fmt.Sprintf(formatStr, args...),
}
} | [
"func",
"NewHTTPError",
"(",
"code",
"int",
",",
"formatStr",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"*",
"HTTPError",
"{",
"return",
"&",
"HTTPError",
"{",
"code",
":",
"code",
",",
"err",
":",
"fmt",
".",
"Sprintf",
"(",
"formatStr... | // NewHTTPError returns a new HTTPError where the HTTP error code is 'code' and
// the error message is based on 'formatStr' and 'args' | [
"NewHTTPError",
"returns",
"a",
"new",
"HTTPError",
"where",
"the",
"HTTP",
"error",
"code",
"is",
"code",
"and",
"the",
"error",
"message",
"is",
"based",
"on",
"formatStr",
"and",
"args"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/errutil/http.go#L41-L46 | test |
pachyderm/pachyderm | src/server/pkg/storage/chunk/storage.go | NewStorage | func NewStorage(objC obj.Client, prefix string) *Storage {
return &Storage{
objC: objC,
prefix: prefix,
}
} | go | func NewStorage(objC obj.Client, prefix string) *Storage {
return &Storage{
objC: objC,
prefix: prefix,
}
} | [
"func",
"NewStorage",
"(",
"objC",
"obj",
".",
"Client",
",",
"prefix",
"string",
")",
"*",
"Storage",
"{",
"return",
"&",
"Storage",
"{",
"objC",
":",
"objC",
",",
"prefix",
":",
"prefix",
",",
"}",
"\n",
"}"
] | // NewStorage creates a new Storage. | [
"NewStorage",
"creates",
"a",
"new",
"Storage",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/storage/chunk/storage.go#L19-L24 | test |
pachyderm/pachyderm | src/server/pkg/storage/chunk/storage.go | DeleteAll | func (s *Storage) DeleteAll(ctx context.Context) error {
return s.objC.Walk(ctx, s.prefix, func(hash string) error {
return s.objC.Delete(ctx, hash)
})
} | go | func (s *Storage) DeleteAll(ctx context.Context) error {
return s.objC.Walk(ctx, s.prefix, func(hash string) error {
return s.objC.Delete(ctx, hash)
})
} | [
"func",
"(",
"s",
"*",
"Storage",
")",
"DeleteAll",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"return",
"s",
".",
"objC",
".",
"Walk",
"(",
"ctx",
",",
"s",
".",
"prefix",
",",
"func",
"(",
"hash",
"string",
")",
"error",
"{",
"re... | // DeleteAll deletes all of the chunks in object storage. | [
"DeleteAll",
"deletes",
"all",
"of",
"the",
"chunks",
"in",
"object",
"storage",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/storage/chunk/storage.go#L46-L50 | test |
pachyderm/pachyderm | src/client/pkg/grpcutil/stream.go | Chunk | func Chunk(data []byte, chunkSize int) [][]byte {
var result [][]byte
for i := 0; i < len(data); i += chunkSize {
end := i + chunkSize
if end > len(data) {
end = len(data)
}
result = append(result, data[i:end])
}
return result
} | go | func Chunk(data []byte, chunkSize int) [][]byte {
var result [][]byte
for i := 0; i < len(data); i += chunkSize {
end := i + chunkSize
if end > len(data) {
end = len(data)
}
result = append(result, data[i:end])
}
return result
} | [
"func",
"Chunk",
"(",
"data",
"[",
"]",
"byte",
",",
"chunkSize",
"int",
")",
"[",
"]",
"[",
"]",
"byte",
"{",
"var",
"result",
"[",
"]",
"[",
"]",
"byte",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"data",
")",
";",
"i",
"+=",... | // Chunk splits a piece of data up, this is useful for splitting up data that's
// bigger than MaxMsgSize | [
"Chunk",
"splits",
"a",
"piece",
"of",
"data",
"up",
"this",
"is",
"useful",
"for",
"splitting",
"up",
"data",
"that",
"s",
"bigger",
"than",
"MaxMsgSize"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/grpcutil/stream.go#L18-L28 | test |
pachyderm/pachyderm | src/client/pkg/grpcutil/stream.go | ChunkReader | func ChunkReader(r io.Reader, f func([]byte) error) (int, error) {
var total int
buf := GetBuffer()
defer PutBuffer(buf)
for {
n, err := r.Read(buf)
if n == 0 && err != nil {
if err == io.EOF {
return total, nil
}
return total, err
}
if err := f(buf[:n]); err != nil {
return total, err
}
... | go | func ChunkReader(r io.Reader, f func([]byte) error) (int, error) {
var total int
buf := GetBuffer()
defer PutBuffer(buf)
for {
n, err := r.Read(buf)
if n == 0 && err != nil {
if err == io.EOF {
return total, nil
}
return total, err
}
if err := f(buf[:n]); err != nil {
return total, err
}
... | [
"func",
"ChunkReader",
"(",
"r",
"io",
".",
"Reader",
",",
"f",
"func",
"(",
"[",
"]",
"byte",
")",
"error",
")",
"(",
"int",
",",
"error",
")",
"{",
"var",
"total",
"int",
"\n",
"buf",
":=",
"GetBuffer",
"(",
")",
"\n",
"defer",
"PutBuffer",
"("... | // ChunkReader splits a reader into reasonably sized chunks for the purpose
// of transmitting the chunks over gRPC. For each chunk, it calls the given
// function. | [
"ChunkReader",
"splits",
"a",
"reader",
"into",
"reasonably",
"sized",
"chunks",
"for",
"the",
"purpose",
"of",
"transmitting",
"the",
"chunks",
"over",
"gRPC",
".",
"For",
"each",
"chunk",
"it",
"calls",
"the",
"given",
"function",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/grpcutil/stream.go#L33-L50 | test |
pachyderm/pachyderm | src/client/pkg/grpcutil/stream.go | NewStreamingBytesReader | func NewStreamingBytesReader(streamingBytesClient StreamingBytesClient, cancel context.CancelFunc) io.ReadCloser {
return &streamingBytesReader{streamingBytesClient: streamingBytesClient, cancel: cancel}
} | go | func NewStreamingBytesReader(streamingBytesClient StreamingBytesClient, cancel context.CancelFunc) io.ReadCloser {
return &streamingBytesReader{streamingBytesClient: streamingBytesClient, cancel: cancel}
} | [
"func",
"NewStreamingBytesReader",
"(",
"streamingBytesClient",
"StreamingBytesClient",
",",
"cancel",
"context",
".",
"CancelFunc",
")",
"io",
".",
"ReadCloser",
"{",
"return",
"&",
"streamingBytesReader",
"{",
"streamingBytesClient",
":",
"streamingBytesClient",
",",
... | // NewStreamingBytesReader returns an io.Reader for a StreamingBytesClient. | [
"NewStreamingBytesReader",
"returns",
"an",
"io",
".",
"Reader",
"for",
"a",
"StreamingBytesClient",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/grpcutil/stream.go#L65-L67 | test |
pachyderm/pachyderm | src/client/pkg/grpcutil/stream.go | WriteToStreamingBytesServer | func WriteToStreamingBytesServer(reader io.Reader, streamingBytesServer StreamingBytesServer) error {
buf := GetBuffer()
defer PutBuffer(buf)
_, err := io.CopyBuffer(NewStreamingBytesWriter(streamingBytesServer), ReaderWrapper{reader}, buf)
return err
} | go | func WriteToStreamingBytesServer(reader io.Reader, streamingBytesServer StreamingBytesServer) error {
buf := GetBuffer()
defer PutBuffer(buf)
_, err := io.CopyBuffer(NewStreamingBytesWriter(streamingBytesServer), ReaderWrapper{reader}, buf)
return err
} | [
"func",
"WriteToStreamingBytesServer",
"(",
"reader",
"io",
".",
"Reader",
",",
"streamingBytesServer",
"StreamingBytesServer",
")",
"error",
"{",
"buf",
":=",
"GetBuffer",
"(",
")",
"\n",
"defer",
"PutBuffer",
"(",
"buf",
")",
"\n",
"_",
",",
"err",
":=",
"... | // WriteToStreamingBytesServer writes the data from the io.Reader to the StreamingBytesServer. | [
"WriteToStreamingBytesServer",
"writes",
"the",
"data",
"from",
"the",
"io",
".",
"Reader",
"to",
"the",
"StreamingBytesServer",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/grpcutil/stream.go#L131-L136 | test |
pachyderm/pachyderm | src/client/pkg/grpcutil/stream.go | WriteFromStreamingBytesClient | func WriteFromStreamingBytesClient(streamingBytesClient StreamingBytesClient, writer io.Writer) error {
for bytesValue, err := streamingBytesClient.Recv(); err != io.EOF; bytesValue, err = streamingBytesClient.Recv() {
if err != nil {
return err
}
if _, err = writer.Write(bytesValue.Value); err != nil {
re... | go | func WriteFromStreamingBytesClient(streamingBytesClient StreamingBytesClient, writer io.Writer) error {
for bytesValue, err := streamingBytesClient.Recv(); err != io.EOF; bytesValue, err = streamingBytesClient.Recv() {
if err != nil {
return err
}
if _, err = writer.Write(bytesValue.Value); err != nil {
re... | [
"func",
"WriteFromStreamingBytesClient",
"(",
"streamingBytesClient",
"StreamingBytesClient",
",",
"writer",
"io",
".",
"Writer",
")",
"error",
"{",
"for",
"bytesValue",
",",
"err",
":=",
"streamingBytesClient",
".",
"Recv",
"(",
")",
";",
"err",
"!=",
"io",
"."... | // WriteFromStreamingBytesClient writes from the StreamingBytesClient to the io.Writer. | [
"WriteFromStreamingBytesClient",
"writes",
"from",
"the",
"StreamingBytesClient",
"to",
"the",
"io",
".",
"Writer",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/grpcutil/stream.go#L139-L149 | test |
pachyderm/pachyderm | src/server/pps/server/server.go | NewSidecarAPIServer | func NewSidecarAPIServer(
env *serviceenv.ServiceEnv,
etcdPrefix string,
iamRole string,
reporter *metrics.Reporter,
workerGrpcPort uint16,
pprofPort uint16,
httpPort uint16,
peerPort uint16,
) (ppsclient.APIServer, error) {
apiServer := &apiServer{
Logger: log.NewLogger("pps.API"),
env: ... | go | func NewSidecarAPIServer(
env *serviceenv.ServiceEnv,
etcdPrefix string,
iamRole string,
reporter *metrics.Reporter,
workerGrpcPort uint16,
pprofPort uint16,
httpPort uint16,
peerPort uint16,
) (ppsclient.APIServer, error) {
apiServer := &apiServer{
Logger: log.NewLogger("pps.API"),
env: ... | [
"func",
"NewSidecarAPIServer",
"(",
"env",
"*",
"serviceenv",
".",
"ServiceEnv",
",",
"etcdPrefix",
"string",
",",
"iamRole",
"string",
",",
"reporter",
"*",
"metrics",
".",
"Reporter",
",",
"workerGrpcPort",
"uint16",
",",
"pprofPort",
"uint16",
",",
"httpPort"... | // NewSidecarAPIServer creates an APIServer that has limited functionalities
// and is meant to be run as a worker sidecar. It cannot, for instance,
// create pipelines. | [
"NewSidecarAPIServer",
"creates",
"an",
"APIServer",
"that",
"has",
"limited",
"functionalities",
"and",
"is",
"meant",
"to",
"be",
"run",
"as",
"a",
"worker",
"sidecar",
".",
"It",
"cannot",
"for",
"instance",
"create",
"pipelines",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pps/server/server.go#L66-L91 | test |
pachyderm/pachyderm | src/server/enterprise/server/api_server.go | NewEnterpriseServer | func NewEnterpriseServer(env *serviceenv.ServiceEnv, etcdPrefix string) (ec.APIServer, error) {
s := &apiServer{
pachLogger: log.NewLogger("enterprise.API"),
env: env,
enterpriseToken: col.NewCollection(
env.GetEtcdClient(),
etcdPrefix, // only one collection--no extra prefix needed
nil,
&ec.E... | go | func NewEnterpriseServer(env *serviceenv.ServiceEnv, etcdPrefix string) (ec.APIServer, error) {
s := &apiServer{
pachLogger: log.NewLogger("enterprise.API"),
env: env,
enterpriseToken: col.NewCollection(
env.GetEtcdClient(),
etcdPrefix, // only one collection--no extra prefix needed
nil,
&ec.E... | [
"func",
"NewEnterpriseServer",
"(",
"env",
"*",
"serviceenv",
".",
"ServiceEnv",
",",
"etcdPrefix",
"string",
")",
"(",
"ec",
".",
"APIServer",
",",
"error",
")",
"{",
"s",
":=",
"&",
"apiServer",
"{",
"pachLogger",
":",
"log",
".",
"NewLogger",
"(",
"\"... | // NewEnterpriseServer returns an implementation of ec.APIServer. | [
"NewEnterpriseServer",
"returns",
"an",
"implementation",
"of",
"ec",
".",
"APIServer",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/enterprise/server/api_server.go#L72-L88 | test |
pachyderm/pachyderm | src/server/enterprise/server/api_server.go | validateActivationCode | func validateActivationCode(code string) (expiration time.Time, err error) {
// Parse the public key. If these steps fail, something is seriously
// wrong and we should crash the service by panicking.
block, _ := pem.Decode([]byte(publicKey))
if block == nil {
return time.Time{}, fmt.Errorf("failed to pem decode... | go | func validateActivationCode(code string) (expiration time.Time, err error) {
// Parse the public key. If these steps fail, something is seriously
// wrong and we should crash the service by panicking.
block, _ := pem.Decode([]byte(publicKey))
if block == nil {
return time.Time{}, fmt.Errorf("failed to pem decode... | [
"func",
"validateActivationCode",
"(",
"code",
"string",
")",
"(",
"expiration",
"time",
".",
"Time",
",",
"err",
"error",
")",
"{",
"block",
",",
"_",
":=",
"pem",
".",
"Decode",
"(",
"[",
"]",
"byte",
"(",
"publicKey",
")",
")",
"\n",
"if",
"block"... | // validateActivationCode checks the validity of an activation code | [
"validateActivationCode",
"checks",
"the",
"validity",
"of",
"an",
"activation",
"code"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/enterprise/server/api_server.go#L143-L202 | test |
pachyderm/pachyderm | src/server/enterprise/server/api_server.go | Activate | func (a *apiServer) Activate(ctx context.Context, req *ec.ActivateRequest) (resp *ec.ActivateResponse, retErr error) {
a.LogReq(req)
defer func(start time.Time) { a.pachLogger.Log(req, resp, retErr, time.Since(start)) }(time.Now())
// Validate the activation code
expiration, err := validateActivationCode(req.Activ... | go | func (a *apiServer) Activate(ctx context.Context, req *ec.ActivateRequest) (resp *ec.ActivateResponse, retErr error) {
a.LogReq(req)
defer func(start time.Time) { a.pachLogger.Log(req, resp, retErr, time.Since(start)) }(time.Now())
// Validate the activation code
expiration, err := validateActivationCode(req.Activ... | [
"func",
"(",
"a",
"*",
"apiServer",
")",
"Activate",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"ec",
".",
"ActivateRequest",
")",
"(",
"resp",
"*",
"ec",
".",
"ActivateResponse",
",",
"retErr",
"error",
")",
"{",
"a",
".",
"LogReq",
"("... | // Activate implements the Activate RPC | [
"Activate",
"implements",
"the",
"Activate",
"RPC"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/enterprise/server/api_server.go#L205-L252 | test |
pachyderm/pachyderm | src/server/enterprise/server/api_server.go | Deactivate | func (a *apiServer) Deactivate(ctx context.Context, req *ec.DeactivateRequest) (resp *ec.DeactivateResponse, retErr error) {
a.LogReq(req)
defer func(start time.Time) { a.pachLogger.Log(req, resp, retErr, time.Since(start)) }(time.Now())
pachClient := a.env.GetPachClient(ctx)
if err := pachClient.DeleteAll(); err ... | go | func (a *apiServer) Deactivate(ctx context.Context, req *ec.DeactivateRequest) (resp *ec.DeactivateResponse, retErr error) {
a.LogReq(req)
defer func(start time.Time) { a.pachLogger.Log(req, resp, retErr, time.Since(start)) }(time.Now())
pachClient := a.env.GetPachClient(ctx)
if err := pachClient.DeleteAll(); err ... | [
"func",
"(",
"a",
"*",
"apiServer",
")",
"Deactivate",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"ec",
".",
"DeactivateRequest",
")",
"(",
"resp",
"*",
"ec",
".",
"DeactivateResponse",
",",
"retErr",
"error",
")",
"{",
"a",
".",
"LogReq",... | // Deactivate deletes the current cluster's enterprise token, and puts the
// cluster in the "NONE" enterprise state. It also deletes all data in the
// cluster, to avoid invalid cluster states. This call only makes sense for
// testing | [
"Deactivate",
"deletes",
"the",
"current",
"cluster",
"s",
"enterprise",
"token",
"and",
"puts",
"the",
"cluster",
"in",
"the",
"NONE",
"enterprise",
"state",
".",
"It",
"also",
"deletes",
"all",
"data",
"in",
"the",
"cluster",
"to",
"avoid",
"invalid",
"clu... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/enterprise/server/api_server.go#L287-L315 | test |
pachyderm/pachyderm | src/server/pkg/exec/exec.go | lookExtensions | func lookExtensions(path, dir string) (string, error) {
if filepath.Base(path) == path {
path = filepath.Join(".", path)
}
if dir == "" {
return exec.LookPath(path)
}
if filepath.VolumeName(path) != "" {
return exec.LookPath(path)
}
if len(path) > 1 && os.IsPathSeparator(path[0]) {
return exec.LookPath(p... | go | func lookExtensions(path, dir string) (string, error) {
if filepath.Base(path) == path {
path = filepath.Join(".", path)
}
if dir == "" {
return exec.LookPath(path)
}
if filepath.VolumeName(path) != "" {
return exec.LookPath(path)
}
if len(path) > 1 && os.IsPathSeparator(path[0]) {
return exec.LookPath(p... | [
"func",
"lookExtensions",
"(",
"path",
",",
"dir",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"filepath",
".",
"Base",
"(",
"path",
")",
"==",
"path",
"{",
"path",
"=",
"filepath",
".",
"Join",
"(",
"\".\"",
",",
"path",
")",
"\n",... | // lookExtensions finds windows executable by its dir and path.
// It uses LookPath to try appropriate extensions.
// lookExtensions does not search PATH, instead it converts `prog` into `.\prog`. | [
"lookExtensions",
"finds",
"windows",
"executable",
"by",
"its",
"dir",
"and",
"path",
".",
"It",
"uses",
"LookPath",
"to",
"try",
"appropriate",
"extensions",
".",
"lookExtensions",
"does",
"not",
"search",
"PATH",
"instead",
"it",
"converts",
"prog",
"into",
... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/exec/exec.go#L296-L317 | test |
pachyderm/pachyderm | src/server/pkg/exec/exec.go | Start | func (c *Cmd) Start() error {
if c.lookPathErr != nil {
c.closeDescriptors(c.closeAfterStart)
c.closeDescriptors(c.closeAfterWait)
return c.lookPathErr
}
if runtime.GOOS == "windows" {
lp, err := lookExtensions(c.Path, c.Dir)
if err != nil {
c.closeDescriptors(c.closeAfterStart)
c.closeDescriptors(c.... | go | func (c *Cmd) Start() error {
if c.lookPathErr != nil {
c.closeDescriptors(c.closeAfterStart)
c.closeDescriptors(c.closeAfterWait)
return c.lookPathErr
}
if runtime.GOOS == "windows" {
lp, err := lookExtensions(c.Path, c.Dir)
if err != nil {
c.closeDescriptors(c.closeAfterStart)
c.closeDescriptors(c.... | [
"func",
"(",
"c",
"*",
"Cmd",
")",
"Start",
"(",
")",
"error",
"{",
"if",
"c",
".",
"lookPathErr",
"!=",
"nil",
"{",
"c",
".",
"closeDescriptors",
"(",
"c",
".",
"closeAfterStart",
")",
"\n",
"c",
".",
"closeDescriptors",
"(",
"c",
".",
"closeAfterWa... | // Start starts the specified command but does not wait for it to complete.
//
// The Wait method will return the exit code and release associated resources
// once the command exits. | [
"Start",
"starts",
"the",
"specified",
"command",
"but",
"does",
"not",
"wait",
"for",
"it",
"to",
"complete",
".",
"The",
"Wait",
"method",
"will",
"return",
"the",
"exit",
"code",
"and",
"release",
"associated",
"resources",
"once",
"the",
"command",
"exit... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/exec/exec.go#L323-L397 | test |
pachyderm/pachyderm | src/server/pkg/exec/exec.go | CombinedOutput | func (c *Cmd) CombinedOutput() ([]byte, error) {
if c.Stdout != nil {
return nil, errors.New("exec: Stdout already set")
}
if c.Stderr != nil {
return nil, errors.New("exec: Stderr already set")
}
var b bytes.Buffer
c.Stdout = &b
c.Stderr = &b
err := c.Run()
return b.Bytes(), err
} | go | func (c *Cmd) CombinedOutput() ([]byte, error) {
if c.Stdout != nil {
return nil, errors.New("exec: Stdout already set")
}
if c.Stderr != nil {
return nil, errors.New("exec: Stderr already set")
}
var b bytes.Buffer
c.Stdout = &b
c.Stderr = &b
err := c.Run()
return b.Bytes(), err
} | [
"func",
"(",
"c",
"*",
"Cmd",
")",
"CombinedOutput",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"c",
".",
"Stdout",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"exec: Stdout already set\"",
")",
"\n",
"}... | // CombinedOutput runs the command and returns its combined standard
// output and standard error. | [
"CombinedOutput",
"runs",
"the",
"command",
"and",
"returns",
"its",
"combined",
"standard",
"output",
"and",
"standard",
"error",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/exec/exec.go#L500-L512 | test |
pachyderm/pachyderm | src/server/pkg/exec/exec.go | StdinPipe | func (c *Cmd) StdinPipe() (io.WriteCloser, error) {
if c.Stdin != nil {
return nil, errors.New("exec: Stdin already set")
}
if c.Process != nil {
return nil, errors.New("exec: StdinPipe after process started")
}
pr, pw, err := os.Pipe()
if err != nil {
return nil, err
}
c.Stdin = pr
c.closeAfterStart = a... | go | func (c *Cmd) StdinPipe() (io.WriteCloser, error) {
if c.Stdin != nil {
return nil, errors.New("exec: Stdin already set")
}
if c.Process != nil {
return nil, errors.New("exec: StdinPipe after process started")
}
pr, pw, err := os.Pipe()
if err != nil {
return nil, err
}
c.Stdin = pr
c.closeAfterStart = a... | [
"func",
"(",
"c",
"*",
"Cmd",
")",
"StdinPipe",
"(",
")",
"(",
"io",
".",
"WriteCloser",
",",
"error",
")",
"{",
"if",
"c",
".",
"Stdin",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"exec: Stdin already set\"",
")",
"\n",
"... | // StdinPipe returns a pipe that will be connected to the command's
// standard input when the command starts.
// The pipe will be closed automatically after Wait sees the command exit.
// A caller need only call Close to force the pipe to close sooner.
// For example, if the command being run will not exit until stand... | [
"StdinPipe",
"returns",
"a",
"pipe",
"that",
"will",
"be",
"connected",
"to",
"the",
"command",
"s",
"standard",
"input",
"when",
"the",
"command",
"starts",
".",
"The",
"pipe",
"will",
"be",
"closed",
"automatically",
"after",
"Wait",
"sees",
"the",
"comman... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/exec/exec.go#L520-L536 | test |
pachyderm/pachyderm | src/server/pkg/exec/exec.go | StdoutPipe | func (c *Cmd) StdoutPipe() (io.ReadCloser, error) {
if c.Stdout != nil {
return nil, errors.New("exec: Stdout already set")
}
if c.Process != nil {
return nil, errors.New("exec: StdoutPipe after process started")
}
pr, pw, err := os.Pipe()
if err != nil {
return nil, err
}
c.Stdout = pw
c.closeAfterStart... | go | func (c *Cmd) StdoutPipe() (io.ReadCloser, error) {
if c.Stdout != nil {
return nil, errors.New("exec: Stdout already set")
}
if c.Process != nil {
return nil, errors.New("exec: StdoutPipe after process started")
}
pr, pw, err := os.Pipe()
if err != nil {
return nil, err
}
c.Stdout = pw
c.closeAfterStart... | [
"func",
"(",
"c",
"*",
"Cmd",
")",
"StdoutPipe",
"(",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"if",
"c",
".",
"Stdout",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"exec: Stdout already set\"",
")",
"\n",
... | // StdoutPipe returns a pipe that will be connected to the command's
// standard output when the command starts.
//
// Wait will close the pipe after seeing the command exit, so most callers
// need not close the pipe themselves; however, an implication is that
// it is incorrect to call Wait before all reads from the ... | [
"StdoutPipe",
"returns",
"a",
"pipe",
"that",
"will",
"be",
"connected",
"to",
"the",
"command",
"s",
"standard",
"output",
"when",
"the",
"command",
"starts",
".",
"Wait",
"will",
"close",
"the",
"pipe",
"after",
"seeing",
"the",
"command",
"exit",
"so",
... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/exec/exec.go#L612-L627 | test |
pachyderm/pachyderm | src/server/pkg/exec/exec.go | dedupEnvCase | func dedupEnvCase(caseInsensitive bool, env []string) []string {
out := make([]string, 0, len(env))
saw := map[string]int{} // key => index into out
for _, kv := range env {
eq := strings.Index(kv, "=")
if eq < 0 {
out = append(out, kv)
continue
}
k := kv[:eq]
if caseInsensitive {
k = strings.ToLo... | go | func dedupEnvCase(caseInsensitive bool, env []string) []string {
out := make([]string, 0, len(env))
saw := map[string]int{} // key => index into out
for _, kv := range env {
eq := strings.Index(kv, "=")
if eq < 0 {
out = append(out, kv)
continue
}
k := kv[:eq]
if caseInsensitive {
k = strings.ToLo... | [
"func",
"dedupEnvCase",
"(",
"caseInsensitive",
"bool",
",",
"env",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"out",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"env",
")",
")",
"\n",
"saw",
":=",
"map",
"[",
"string... | // dedupEnvCase is dedupEnv with a case option for testing.
// If caseInsensitive is true, the case of keys is ignored. | [
"dedupEnvCase",
"is",
"dedupEnv",
"with",
"a",
"case",
"option",
"for",
"testing",
".",
"If",
"caseInsensitive",
"is",
"true",
"the",
"case",
"of",
"keys",
"is",
"ignored",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/exec/exec.go#L740-L761 | test |
pachyderm/pachyderm | src/client/pps/util.go | InputName | func InputName(input *Input) string {
switch {
case input == nil:
return ""
case input.Pfs != nil:
return input.Pfs.Name
case input.Cross != nil:
if len(input.Cross) > 0 {
return InputName(input.Cross[0])
}
case input.Union != nil:
if len(input.Union) > 0 {
return InputName(input.Union[0])
}
}
... | go | func InputName(input *Input) string {
switch {
case input == nil:
return ""
case input.Pfs != nil:
return input.Pfs.Name
case input.Cross != nil:
if len(input.Cross) > 0 {
return InputName(input.Cross[0])
}
case input.Union != nil:
if len(input.Union) > 0 {
return InputName(input.Union[0])
}
}
... | [
"func",
"InputName",
"(",
"input",
"*",
"Input",
")",
"string",
"{",
"switch",
"{",
"case",
"input",
"==",
"nil",
":",
"return",
"\"\"",
"\n",
"case",
"input",
".",
"Pfs",
"!=",
"nil",
":",
"return",
"input",
".",
"Pfs",
".",
"Name",
"\n",
"case",
... | // InputName computes the name of an Input. | [
"InputName",
"computes",
"the",
"name",
"of",
"an",
"Input",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pps/util.go#L31-L47 | test |
pachyderm/pachyderm | src/client/pps/util.go | SortInput | func SortInput(input *Input) {
VisitInput(input, func(input *Input) {
SortInputs := func(inputs []*Input) {
sort.SliceStable(inputs, func(i, j int) bool { return InputName(inputs[i]) < InputName(inputs[j]) })
}
switch {
case input.Cross != nil:
SortInputs(input.Cross)
case input.Union != nil:
SortIn... | go | func SortInput(input *Input) {
VisitInput(input, func(input *Input) {
SortInputs := func(inputs []*Input) {
sort.SliceStable(inputs, func(i, j int) bool { return InputName(inputs[i]) < InputName(inputs[j]) })
}
switch {
case input.Cross != nil:
SortInputs(input.Cross)
case input.Union != nil:
SortIn... | [
"func",
"SortInput",
"(",
"input",
"*",
"Input",
")",
"{",
"VisitInput",
"(",
"input",
",",
"func",
"(",
"input",
"*",
"Input",
")",
"{",
"SortInputs",
":=",
"func",
"(",
"inputs",
"[",
"]",
"*",
"Input",
")",
"{",
"sort",
".",
"SliceStable",
"(",
... | // SortInput sorts an Input. | [
"SortInput",
"sorts",
"an",
"Input",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pps/util.go#L50-L62 | test |
pachyderm/pachyderm | src/client/pps/util.go | InputBranches | func InputBranches(input *Input) []*pfs.Branch {
var result []*pfs.Branch
VisitInput(input, func(input *Input) {
if input.Pfs != nil {
result = append(result, &pfs.Branch{
Repo: &pfs.Repo{Name: input.Pfs.Repo},
Name: input.Pfs.Branch,
})
}
if input.Cron != nil {
result = append(result, &pfs.Bra... | go | func InputBranches(input *Input) []*pfs.Branch {
var result []*pfs.Branch
VisitInput(input, func(input *Input) {
if input.Pfs != nil {
result = append(result, &pfs.Branch{
Repo: &pfs.Repo{Name: input.Pfs.Repo},
Name: input.Pfs.Branch,
})
}
if input.Cron != nil {
result = append(result, &pfs.Bra... | [
"func",
"InputBranches",
"(",
"input",
"*",
"Input",
")",
"[",
"]",
"*",
"pfs",
".",
"Branch",
"{",
"var",
"result",
"[",
"]",
"*",
"pfs",
".",
"Branch",
"\n",
"VisitInput",
"(",
"input",
",",
"func",
"(",
"input",
"*",
"Input",
")",
"{",
"if",
"... | // InputBranches returns the branches in an Input. | [
"InputBranches",
"returns",
"the",
"branches",
"in",
"an",
"Input",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pps/util.go#L65-L88 | test |
pachyderm/pachyderm | src/client/pps/util.go | ValidateGitCloneURL | func ValidateGitCloneURL(url string) error {
exampleURL := "https://github.com/org/foo.git"
if url == "" {
return fmt.Errorf("clone URL is missing (example clone URL %v)", exampleURL)
}
// Use the git client's validator to make sure its a valid URL
o := &git.CloneOptions{
URL: url,
}
if err := o.Validate(); ... | go | func ValidateGitCloneURL(url string) error {
exampleURL := "https://github.com/org/foo.git"
if url == "" {
return fmt.Errorf("clone URL is missing (example clone URL %v)", exampleURL)
}
// Use the git client's validator to make sure its a valid URL
o := &git.CloneOptions{
URL: url,
}
if err := o.Validate(); ... | [
"func",
"ValidateGitCloneURL",
"(",
"url",
"string",
")",
"error",
"{",
"exampleURL",
":=",
"\"https://github.com/org/foo.git\"",
"\n",
"if",
"url",
"==",
"\"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"clone URL is missing (example clone URL %v)\"",
",",
"exampl... | // ValidateGitCloneURL returns an error if the provided URL is invalid | [
"ValidateGitCloneURL",
"returns",
"an",
"error",
"if",
"the",
"provided",
"URL",
"is",
"invalid"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pps/util.go#L91-L122 | test |
pachyderm/pachyderm | src/server/pkg/deploy/cmds/cmds.go | containsEmpty | func containsEmpty(vals []string) bool {
for _, val := range vals {
if val == "" {
return true
}
}
return false
} | go | func containsEmpty(vals []string) bool {
for _, val := range vals {
if val == "" {
return true
}
}
return false
} | [
"func",
"containsEmpty",
"(",
"vals",
"[",
"]",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"val",
":=",
"range",
"vals",
"{",
"if",
"val",
"==",
"\"\"",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // containsEmpty is a helper function used for validation (particularly for
// validating that creds arguments aren't empty | [
"containsEmpty",
"is",
"a",
"helper",
"function",
"used",
"for",
"validation",
"(",
"particularly",
"for",
"validating",
"that",
"creds",
"arguments",
"aren",
"t",
"empty"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/cmds/cmds.go#L139-L146 | test |
pachyderm/pachyderm | src/server/admin/server/server.go | NewAPIServer | func NewAPIServer(address string, storageRoot string, clusterInfo *admin.ClusterInfo) APIServer {
return &apiServer{
Logger: log.NewLogger("admin.API"),
address: address,
storageRoot: storageRoot,
clusterInfo: clusterInfo,
}
} | go | func NewAPIServer(address string, storageRoot string, clusterInfo *admin.ClusterInfo) APIServer {
return &apiServer{
Logger: log.NewLogger("admin.API"),
address: address,
storageRoot: storageRoot,
clusterInfo: clusterInfo,
}
} | [
"func",
"NewAPIServer",
"(",
"address",
"string",
",",
"storageRoot",
"string",
",",
"clusterInfo",
"*",
"admin",
".",
"ClusterInfo",
")",
"APIServer",
"{",
"return",
"&",
"apiServer",
"{",
"Logger",
":",
"log",
".",
"NewLogger",
"(",
"\"admin.API\"",
")",
"... | // NewAPIServer returns a new admin.APIServer | [
"NewAPIServer",
"returns",
"a",
"new",
"admin",
".",
"APIServer"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/admin/server/server.go#L14-L21 | test |
pachyderm/pachyderm | src/server/pkg/pretty/pretty.go | Ago | func Ago(timestamp *types.Timestamp) string {
t, _ := types.TimestampFromProto(timestamp)
if t.Equal(time.Time{}) {
return ""
}
return fmt.Sprintf("%s ago", units.HumanDuration(time.Since(t)))
} | go | func Ago(timestamp *types.Timestamp) string {
t, _ := types.TimestampFromProto(timestamp)
if t.Equal(time.Time{}) {
return ""
}
return fmt.Sprintf("%s ago", units.HumanDuration(time.Since(t)))
} | [
"func",
"Ago",
"(",
"timestamp",
"*",
"types",
".",
"Timestamp",
")",
"string",
"{",
"t",
",",
"_",
":=",
"types",
".",
"TimestampFromProto",
"(",
"timestamp",
")",
"\n",
"if",
"t",
".",
"Equal",
"(",
"time",
".",
"Time",
"{",
"}",
")",
"{",
"retur... | // Ago pretty-prints the amount of time that has passed
// since timestamp as a human-readable string. | [
"Ago",
"pretty",
"-",
"prints",
"the",
"amount",
"of",
"time",
"that",
"has",
"passed",
"since",
"timestamp",
"as",
"a",
"human",
"-",
"readable",
"string",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/pretty/pretty.go#L21-L27 | test |
pachyderm/pachyderm | src/server/pkg/pretty/pretty.go | TimeDifference | func TimeDifference(from *types.Timestamp, to *types.Timestamp) string {
tFrom, _ := types.TimestampFromProto(from)
tTo, _ := types.TimestampFromProto(to)
return units.HumanDuration(tTo.Sub(tFrom))
} | go | func TimeDifference(from *types.Timestamp, to *types.Timestamp) string {
tFrom, _ := types.TimestampFromProto(from)
tTo, _ := types.TimestampFromProto(to)
return units.HumanDuration(tTo.Sub(tFrom))
} | [
"func",
"TimeDifference",
"(",
"from",
"*",
"types",
".",
"Timestamp",
",",
"to",
"*",
"types",
".",
"Timestamp",
")",
"string",
"{",
"tFrom",
",",
"_",
":=",
"types",
".",
"TimestampFromProto",
"(",
"from",
")",
"\n",
"tTo",
",",
"_",
":=",
"types",
... | // TimeDifference pretty-prints the duration of time between from
// and to as a human-reabable string. | [
"TimeDifference",
"pretty",
"-",
"prints",
"the",
"duration",
"of",
"time",
"between",
"from",
"and",
"to",
"as",
"a",
"human",
"-",
"reabable",
"string",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/pretty/pretty.go#L31-L35 | test |
pachyderm/pachyderm | src/server/pkg/pretty/pretty.go | Duration | func Duration(d *types.Duration) string {
duration, _ := types.DurationFromProto(d)
return units.HumanDuration(duration)
} | go | func Duration(d *types.Duration) string {
duration, _ := types.DurationFromProto(d)
return units.HumanDuration(duration)
} | [
"func",
"Duration",
"(",
"d",
"*",
"types",
".",
"Duration",
")",
"string",
"{",
"duration",
",",
"_",
":=",
"types",
".",
"DurationFromProto",
"(",
"d",
")",
"\n",
"return",
"units",
".",
"HumanDuration",
"(",
"duration",
")",
"\n",
"}"
] | // Duration pretty prints a duration in a human readable way. | [
"Duration",
"pretty",
"prints",
"a",
"duration",
"in",
"a",
"human",
"readable",
"way",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/pretty/pretty.go#L38-L41 | test |
pachyderm/pachyderm | src/client/admin.go | InspectCluster | func (c APIClient) InspectCluster() (*admin.ClusterInfo, error) {
clusterInfo, err := c.AdminAPIClient.InspectCluster(c.Ctx(), &types.Empty{})
if err != nil {
return nil, grpcutil.ScrubGRPC(err)
}
return clusterInfo, nil
} | go | func (c APIClient) InspectCluster() (*admin.ClusterInfo, error) {
clusterInfo, err := c.AdminAPIClient.InspectCluster(c.Ctx(), &types.Empty{})
if err != nil {
return nil, grpcutil.ScrubGRPC(err)
}
return clusterInfo, nil
} | [
"func",
"(",
"c",
"APIClient",
")",
"InspectCluster",
"(",
")",
"(",
"*",
"admin",
".",
"ClusterInfo",
",",
"error",
")",
"{",
"clusterInfo",
",",
"err",
":=",
"c",
".",
"AdminAPIClient",
".",
"InspectCluster",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&... | // InspectCluster retrieves cluster state | [
"InspectCluster",
"retrieves",
"cluster",
"state"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/admin.go#L15-L21 | test |
pachyderm/pachyderm | src/client/admin.go | Extract | func (c APIClient) Extract(objects bool, f func(op *admin.Op) error) error {
extractClient, err := c.AdminAPIClient.Extract(c.Ctx(), &admin.ExtractRequest{NoObjects: !objects})
if err != nil {
return grpcutil.ScrubGRPC(err)
}
for {
op, err := extractClient.Recv()
if err == io.EOF {
break
}
if err != ni... | go | func (c APIClient) Extract(objects bool, f func(op *admin.Op) error) error {
extractClient, err := c.AdminAPIClient.Extract(c.Ctx(), &admin.ExtractRequest{NoObjects: !objects})
if err != nil {
return grpcutil.ScrubGRPC(err)
}
for {
op, err := extractClient.Recv()
if err == io.EOF {
break
}
if err != ni... | [
"func",
"(",
"c",
"APIClient",
")",
"Extract",
"(",
"objects",
"bool",
",",
"f",
"func",
"(",
"op",
"*",
"admin",
".",
"Op",
")",
"error",
")",
"error",
"{",
"extractClient",
",",
"err",
":=",
"c",
".",
"AdminAPIClient",
".",
"Extract",
"(",
"c",
"... | // Extract all cluster state, call f with each operation. | [
"Extract",
"all",
"cluster",
"state",
"call",
"f",
"with",
"each",
"operation",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/admin.go#L24-L42 | test |
pachyderm/pachyderm | src/client/admin.go | ExtractAll | func (c APIClient) ExtractAll(objects bool) ([]*admin.Op, error) {
var result []*admin.Op
if err := c.Extract(objects, func(op *admin.Op) error {
result = append(result, op)
return nil
}); err != nil {
return nil, err
}
return result, nil
} | go | func (c APIClient) ExtractAll(objects bool) ([]*admin.Op, error) {
var result []*admin.Op
if err := c.Extract(objects, func(op *admin.Op) error {
result = append(result, op)
return nil
}); err != nil {
return nil, err
}
return result, nil
} | [
"func",
"(",
"c",
"APIClient",
")",
"ExtractAll",
"(",
"objects",
"bool",
")",
"(",
"[",
"]",
"*",
"admin",
".",
"Op",
",",
"error",
")",
"{",
"var",
"result",
"[",
"]",
"*",
"admin",
".",
"Op",
"\n",
"if",
"err",
":=",
"c",
".",
"Extract",
"("... | // ExtractAll cluster state as a slice of operations. | [
"ExtractAll",
"cluster",
"state",
"as",
"a",
"slice",
"of",
"operations",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/admin.go#L45-L54 | test |
pachyderm/pachyderm | src/client/admin.go | ExtractWriter | func (c APIClient) ExtractWriter(objects bool, w io.Writer) error {
writer := pbutil.NewWriter(w)
return c.Extract(objects, func(op *admin.Op) error {
_, err := writer.Write(op)
return err
})
} | go | func (c APIClient) ExtractWriter(objects bool, w io.Writer) error {
writer := pbutil.NewWriter(w)
return c.Extract(objects, func(op *admin.Op) error {
_, err := writer.Write(op)
return err
})
} | [
"func",
"(",
"c",
"APIClient",
")",
"ExtractWriter",
"(",
"objects",
"bool",
",",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"writer",
":=",
"pbutil",
".",
"NewWriter",
"(",
"w",
")",
"\n",
"return",
"c",
".",
"Extract",
"(",
"objects",
",",
"func"... | // ExtractWriter extracts all cluster state and marshals it to w. | [
"ExtractWriter",
"extracts",
"all",
"cluster",
"state",
"and",
"marshals",
"it",
"to",
"w",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/admin.go#L57-L63 | test |
pachyderm/pachyderm | src/client/admin.go | ExtractURL | func (c APIClient) ExtractURL(url string) error {
extractClient, err := c.AdminAPIClient.Extract(c.Ctx(), &admin.ExtractRequest{URL: url})
if err != nil {
return grpcutil.ScrubGRPC(err)
}
resp, err := extractClient.Recv()
if err == nil {
return fmt.Errorf("unexpected response from extract: %v", resp)
}
if er... | go | func (c APIClient) ExtractURL(url string) error {
extractClient, err := c.AdminAPIClient.Extract(c.Ctx(), &admin.ExtractRequest{URL: url})
if err != nil {
return grpcutil.ScrubGRPC(err)
}
resp, err := extractClient.Recv()
if err == nil {
return fmt.Errorf("unexpected response from extract: %v", resp)
}
if er... | [
"func",
"(",
"c",
"APIClient",
")",
"ExtractURL",
"(",
"url",
"string",
")",
"error",
"{",
"extractClient",
",",
"err",
":=",
"c",
".",
"AdminAPIClient",
".",
"Extract",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"admin",
".",
"ExtractRequest",
"{",
"... | // ExtractURL extracts all cluster state and marshalls it to object storage. | [
"ExtractURL",
"extracts",
"all",
"cluster",
"state",
"and",
"marshalls",
"it",
"to",
"object",
"storage",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/admin.go#L66-L79 | test |
pachyderm/pachyderm | src/client/admin.go | ExtractPipeline | func (c APIClient) ExtractPipeline(pipelineName string) (*pps.CreatePipelineRequest, error) {
op, err := c.AdminAPIClient.ExtractPipeline(c.Ctx(), &admin.ExtractPipelineRequest{Pipeline: NewPipeline(pipelineName)})
if err != nil {
return nil, grpcutil.ScrubGRPC(err)
}
if op.Op1_9 == nil || op.Op1_9.Pipeline == ni... | go | func (c APIClient) ExtractPipeline(pipelineName string) (*pps.CreatePipelineRequest, error) {
op, err := c.AdminAPIClient.ExtractPipeline(c.Ctx(), &admin.ExtractPipelineRequest{Pipeline: NewPipeline(pipelineName)})
if err != nil {
return nil, grpcutil.ScrubGRPC(err)
}
if op.Op1_9 == nil || op.Op1_9.Pipeline == ni... | [
"func",
"(",
"c",
"APIClient",
")",
"ExtractPipeline",
"(",
"pipelineName",
"string",
")",
"(",
"*",
"pps",
".",
"CreatePipelineRequest",
",",
"error",
")",
"{",
"op",
",",
"err",
":=",
"c",
".",
"AdminAPIClient",
".",
"ExtractPipeline",
"(",
"c",
".",
"... | // ExtractPipeline extracts a single pipeline. | [
"ExtractPipeline",
"extracts",
"a",
"single",
"pipeline",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/admin.go#L82-L91 | test |
pachyderm/pachyderm | src/client/admin.go | Restore | func (c APIClient) Restore(ops []*admin.Op) (retErr error) {
restoreClient, err := c.AdminAPIClient.Restore(c.Ctx())
if err != nil {
return grpcutil.ScrubGRPC(err)
}
defer func() {
if _, err := restoreClient.CloseAndRecv(); err != nil && retErr == nil {
retErr = grpcutil.ScrubGRPC(err)
}
}()
for _, op :=... | go | func (c APIClient) Restore(ops []*admin.Op) (retErr error) {
restoreClient, err := c.AdminAPIClient.Restore(c.Ctx())
if err != nil {
return grpcutil.ScrubGRPC(err)
}
defer func() {
if _, err := restoreClient.CloseAndRecv(); err != nil && retErr == nil {
retErr = grpcutil.ScrubGRPC(err)
}
}()
for _, op :=... | [
"func",
"(",
"c",
"APIClient",
")",
"Restore",
"(",
"ops",
"[",
"]",
"*",
"admin",
".",
"Op",
")",
"(",
"retErr",
"error",
")",
"{",
"restoreClient",
",",
"err",
":=",
"c",
".",
"AdminAPIClient",
".",
"Restore",
"(",
"c",
".",
"Ctx",
"(",
")",
")... | // Restore cluster state from an extract series of operations. | [
"Restore",
"cluster",
"state",
"from",
"an",
"extract",
"series",
"of",
"operations",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/admin.go#L94-L110 | test |
pachyderm/pachyderm | src/client/admin.go | RestoreReader | func (c APIClient) RestoreReader(r io.Reader) (retErr error) {
restoreClient, err := c.AdminAPIClient.Restore(c.Ctx())
if err != nil {
return grpcutil.ScrubGRPC(err)
}
defer func() {
if _, err := restoreClient.CloseAndRecv(); err != nil && retErr == nil {
retErr = grpcutil.ScrubGRPC(err)
}
}()
reader := ... | go | func (c APIClient) RestoreReader(r io.Reader) (retErr error) {
restoreClient, err := c.AdminAPIClient.Restore(c.Ctx())
if err != nil {
return grpcutil.ScrubGRPC(err)
}
defer func() {
if _, err := restoreClient.CloseAndRecv(); err != nil && retErr == nil {
retErr = grpcutil.ScrubGRPC(err)
}
}()
reader := ... | [
"func",
"(",
"c",
"APIClient",
")",
"RestoreReader",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"retErr",
"error",
")",
"{",
"restoreClient",
",",
"err",
":=",
"c",
".",
"AdminAPIClient",
".",
"Restore",
"(",
"c",
".",
"Ctx",
"(",
")",
")",
"\n",
"if... | // RestoreReader restores cluster state from a reader containing marshaled ops.
// Such as those written by ExtractWriter. | [
"RestoreReader",
"restores",
"cluster",
"state",
"from",
"a",
"reader",
"containing",
"marshaled",
"ops",
".",
"Such",
"as",
"those",
"written",
"by",
"ExtractWriter",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/admin.go#L114-L138 | test |
pachyderm/pachyderm | src/client/admin.go | RestoreFrom | func (c APIClient) RestoreFrom(objects bool, otherC *APIClient) (retErr error) {
restoreClient, err := c.AdminAPIClient.Restore(c.Ctx())
if err != nil {
return grpcutil.ScrubGRPC(err)
}
defer func() {
if _, err := restoreClient.CloseAndRecv(); err != nil && retErr == nil {
retErr = grpcutil.ScrubGRPC(err)
... | go | func (c APIClient) RestoreFrom(objects bool, otherC *APIClient) (retErr error) {
restoreClient, err := c.AdminAPIClient.Restore(c.Ctx())
if err != nil {
return grpcutil.ScrubGRPC(err)
}
defer func() {
if _, err := restoreClient.CloseAndRecv(); err != nil && retErr == nil {
retErr = grpcutil.ScrubGRPC(err)
... | [
"func",
"(",
"c",
"APIClient",
")",
"RestoreFrom",
"(",
"objects",
"bool",
",",
"otherC",
"*",
"APIClient",
")",
"(",
"retErr",
"error",
")",
"{",
"restoreClient",
",",
"err",
":=",
"c",
".",
"AdminAPIClient",
".",
"Restore",
"(",
"c",
".",
"Ctx",
"(",... | // RestoreFrom restores state from another cluster which can be access through otherC. | [
"RestoreFrom",
"restores",
"state",
"from",
"another",
"cluster",
"which",
"can",
"be",
"access",
"through",
"otherC",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/admin.go#L141-L154 | test |
pachyderm/pachyderm | src/client/admin.go | RestoreURL | func (c APIClient) RestoreURL(url string) (retErr error) {
restoreClient, err := c.AdminAPIClient.Restore(c.Ctx())
if err != nil {
return grpcutil.ScrubGRPC(err)
}
defer func() {
if _, err := restoreClient.CloseAndRecv(); err != nil && retErr == nil {
retErr = grpcutil.ScrubGRPC(err)
}
}()
return grpcuti... | go | func (c APIClient) RestoreURL(url string) (retErr error) {
restoreClient, err := c.AdminAPIClient.Restore(c.Ctx())
if err != nil {
return grpcutil.ScrubGRPC(err)
}
defer func() {
if _, err := restoreClient.CloseAndRecv(); err != nil && retErr == nil {
retErr = grpcutil.ScrubGRPC(err)
}
}()
return grpcuti... | [
"func",
"(",
"c",
"APIClient",
")",
"RestoreURL",
"(",
"url",
"string",
")",
"(",
"retErr",
"error",
")",
"{",
"restoreClient",
",",
"err",
":=",
"c",
".",
"AdminAPIClient",
".",
"Restore",
"(",
"c",
".",
"Ctx",
"(",
")",
")",
"\n",
"if",
"err",
"!... | // RestoreURL restures cluster state from object storage. | [
"RestoreURL",
"restures",
"cluster",
"state",
"from",
"object",
"storage",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/admin.go#L157-L168 | test |
google/go-cmp | cmp/cmpopts/ignore.go | IgnoreTypes | func IgnoreTypes(typs ...interface{}) cmp.Option {
tf := newTypeFilter(typs...)
return cmp.FilterPath(tf.filter, cmp.Ignore())
} | go | func IgnoreTypes(typs ...interface{}) cmp.Option {
tf := newTypeFilter(typs...)
return cmp.FilterPath(tf.filter, cmp.Ignore())
} | [
"func",
"IgnoreTypes",
"(",
"typs",
"...",
"interface",
"{",
"}",
")",
"cmp",
".",
"Option",
"{",
"tf",
":=",
"newTypeFilter",
"(",
"typs",
"...",
")",
"\n",
"return",
"cmp",
".",
"FilterPath",
"(",
"tf",
".",
"filter",
",",
"cmp",
".",
"Ignore",
"("... | // IgnoreTypes returns an Option that ignores all values assignable to
// certain types, which are specified by passing in a value of each type. | [
"IgnoreTypes",
"returns",
"an",
"Option",
"that",
"ignores",
"all",
"values",
"assignable",
"to",
"certain",
"types",
"which",
"are",
"specified",
"by",
"passing",
"in",
"a",
"value",
"of",
"each",
"type",
"."
] | 6f77996f0c42f7b84e5a2b252227263f93432e9b | https://github.com/google/go-cmp/blob/6f77996f0c42f7b84e5a2b252227263f93432e9b/cmp/cmpopts/ignore.go#L32-L35 | test |
google/go-cmp | cmp/report_text.go | AppendEllipsis | func (s *textList) AppendEllipsis(ds diffStats) {
hasStats := ds != diffStats{}
if len(*s) == 0 || !(*s)[len(*s)-1].Value.Equal(textEllipsis) {
if hasStats {
*s = append(*s, textRecord{Value: textEllipsis, Comment: ds})
} else {
*s = append(*s, textRecord{Value: textEllipsis})
}
return
}
if hasStats {... | go | func (s *textList) AppendEllipsis(ds diffStats) {
hasStats := ds != diffStats{}
if len(*s) == 0 || !(*s)[len(*s)-1].Value.Equal(textEllipsis) {
if hasStats {
*s = append(*s, textRecord{Value: textEllipsis, Comment: ds})
} else {
*s = append(*s, textRecord{Value: textEllipsis})
}
return
}
if hasStats {... | [
"func",
"(",
"s",
"*",
"textList",
")",
"AppendEllipsis",
"(",
"ds",
"diffStats",
")",
"{",
"hasStats",
":=",
"ds",
"!=",
"diffStats",
"{",
"}",
"\n",
"if",
"len",
"(",
"*",
"s",
")",
"==",
"0",
"||",
"!",
"(",
"*",
"s",
")",
"[",
"len",
"(",
... | // AppendEllipsis appends a new ellipsis node to the list if none already
// exists at the end. If cs is non-zero it coalesces the statistics with the
// previous diffStats. | [
"AppendEllipsis",
"appends",
"a",
"new",
"ellipsis",
"node",
"to",
"the",
"list",
"if",
"none",
"already",
"exists",
"at",
"the",
"end",
".",
"If",
"cs",
"is",
"non",
"-",
"zero",
"it",
"coalesces",
"the",
"statistics",
"with",
"the",
"previous",
"diffStat... | 6f77996f0c42f7b84e5a2b252227263f93432e9b | https://github.com/google/go-cmp/blob/6f77996f0c42f7b84e5a2b252227263f93432e9b/cmp/report_text.go#L143-L156 | test |
google/go-cmp | cmp/internal/function/func.go | IsType | func IsType(t reflect.Type, ft funcType) bool {
if t == nil || t.Kind() != reflect.Func || t.IsVariadic() {
return false
}
ni, no := t.NumIn(), t.NumOut()
switch ft {
case tbFunc: // func(T) bool
if ni == 1 && no == 1 && t.Out(0) == boolType {
return true
}
case ttbFunc: // func(T, T) bool
if ni == 2 &... | go | func IsType(t reflect.Type, ft funcType) bool {
if t == nil || t.Kind() != reflect.Func || t.IsVariadic() {
return false
}
ni, no := t.NumIn(), t.NumOut()
switch ft {
case tbFunc: // func(T) bool
if ni == 1 && no == 1 && t.Out(0) == boolType {
return true
}
case ttbFunc: // func(T, T) bool
if ni == 2 &... | [
"func",
"IsType",
"(",
"t",
"reflect",
".",
"Type",
",",
"ft",
"funcType",
")",
"bool",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Func",
"||",
"t",
".",
"IsVariadic",
"(",
")",
"{",
"return",
"false",
... | // IsType reports whether the reflect.Type is of the specified function type. | [
"IsType",
"reports",
"whether",
"the",
"reflect",
".",
"Type",
"is",
"of",
"the",
"specified",
"function",
"type",
"."
] | 6f77996f0c42f7b84e5a2b252227263f93432e9b | https://github.com/google/go-cmp/blob/6f77996f0c42f7b84e5a2b252227263f93432e9b/cmp/internal/function/func.go#L38-L66 | test |
google/go-cmp | cmp/internal/function/func.go | NameOf | func NameOf(v reflect.Value) string {
fnc := runtime.FuncForPC(v.Pointer())
if fnc == nil {
return "<unknown>"
}
fullName := fnc.Name() // e.g., "long/path/name/mypkg.(*MyType).(long/path/name/mypkg.myMethod)-fm"
// Method closures have a "-fm" suffix.
fullName = strings.TrimSuffix(fullName, "-fm")
var name ... | go | func NameOf(v reflect.Value) string {
fnc := runtime.FuncForPC(v.Pointer())
if fnc == nil {
return "<unknown>"
}
fullName := fnc.Name() // e.g., "long/path/name/mypkg.(*MyType).(long/path/name/mypkg.myMethod)-fm"
// Method closures have a "-fm" suffix.
fullName = strings.TrimSuffix(fullName, "-fm")
var name ... | [
"func",
"NameOf",
"(",
"v",
"reflect",
".",
"Value",
")",
"string",
"{",
"fnc",
":=",
"runtime",
".",
"FuncForPC",
"(",
"v",
".",
"Pointer",
"(",
")",
")",
"\n",
"if",
"fnc",
"==",
"nil",
"{",
"return",
"\"<unknown>\"",
"\n",
"}",
"\n",
"fullName",
... | // NameOf returns the name of the function value. | [
"NameOf",
"returns",
"the",
"name",
"of",
"the",
"function",
"value",
"."
] | 6f77996f0c42f7b84e5a2b252227263f93432e9b | https://github.com/google/go-cmp/blob/6f77996f0c42f7b84e5a2b252227263f93432e9b/cmp/internal/function/func.go#L71-L99 | test |
google/go-cmp | cmp/internal/value/pointer_unsafe.go | PointerOf | func PointerOf(v reflect.Value) Pointer {
// The proper representation of a pointer is unsafe.Pointer,
// which is necessary if the GC ever uses a moving collector.
return Pointer{unsafe.Pointer(v.Pointer()), v.Type()}
} | go | func PointerOf(v reflect.Value) Pointer {
// The proper representation of a pointer is unsafe.Pointer,
// which is necessary if the GC ever uses a moving collector.
return Pointer{unsafe.Pointer(v.Pointer()), v.Type()}
} | [
"func",
"PointerOf",
"(",
"v",
"reflect",
".",
"Value",
")",
"Pointer",
"{",
"return",
"Pointer",
"{",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"Pointer",
"(",
")",
")",
",",
"v",
".",
"Type",
"(",
")",
"}",
"\n",
"}"
] | // PointerOf returns a Pointer from v, which must be a
// reflect.Ptr, reflect.Slice, or reflect.Map. | [
"PointerOf",
"returns",
"a",
"Pointer",
"from",
"v",
"which",
"must",
"be",
"a",
"reflect",
".",
"Ptr",
"reflect",
".",
"Slice",
"or",
"reflect",
".",
"Map",
"."
] | 6f77996f0c42f7b84e5a2b252227263f93432e9b | https://github.com/google/go-cmp/blob/6f77996f0c42f7b84e5a2b252227263f93432e9b/cmp/internal/value/pointer_unsafe.go#L22-L26 | test |
google/go-cmp | cmp/internal/diff/diff.go | String | func (es EditScript) String() string {
b := make([]byte, len(es))
for i, e := range es {
switch e {
case Identity:
b[i] = '.'
case UniqueX:
b[i] = 'X'
case UniqueY:
b[i] = 'Y'
case Modified:
b[i] = 'M'
default:
panic("invalid edit-type")
}
}
return string(b)
} | go | func (es EditScript) String() string {
b := make([]byte, len(es))
for i, e := range es {
switch e {
case Identity:
b[i] = '.'
case UniqueX:
b[i] = 'X'
case UniqueY:
b[i] = 'Y'
case Modified:
b[i] = 'M'
default:
panic("invalid edit-type")
}
}
return string(b)
} | [
"func",
"(",
"es",
"EditScript",
")",
"String",
"(",
")",
"string",
"{",
"b",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"len",
"(",
"es",
")",
")",
"\n",
"for",
"i",
",",
"e",
":=",
"range",
"es",
"{",
"switch",
"e",
"{",
"case",
"Identity",
... | // String returns a human-readable string representing the edit-script where
// Identity, UniqueX, UniqueY, and Modified are represented by the
// '.', 'X', 'Y', and 'M' characters, respectively. | [
"String",
"returns",
"a",
"human",
"-",
"readable",
"string",
"representing",
"the",
"edit",
"-",
"script",
"where",
"Identity",
"UniqueX",
"UniqueY",
"and",
"Modified",
"are",
"represented",
"by",
"the",
".",
"X",
"Y",
"and",
"M",
"characters",
"respectively"... | 6f77996f0c42f7b84e5a2b252227263f93432e9b | https://github.com/google/go-cmp/blob/6f77996f0c42f7b84e5a2b252227263f93432e9b/cmp/internal/diff/diff.go#L35-L52 | test |
google/go-cmp | cmp/internal/diff/diff.go | stats | func (es EditScript) stats() (s struct{ NI, NX, NY, NM int }) {
for _, e := range es {
switch e {
case Identity:
s.NI++
case UniqueX:
s.NX++
case UniqueY:
s.NY++
case Modified:
s.NM++
default:
panic("invalid edit-type")
}
}
return
} | go | func (es EditScript) stats() (s struct{ NI, NX, NY, NM int }) {
for _, e := range es {
switch e {
case Identity:
s.NI++
case UniqueX:
s.NX++
case UniqueY:
s.NY++
case Modified:
s.NM++
default:
panic("invalid edit-type")
}
}
return
} | [
"func",
"(",
"es",
"EditScript",
")",
"stats",
"(",
")",
"(",
"s",
"struct",
"{",
"NI",
",",
"NX",
",",
"NY",
",",
"NM",
"int",
"}",
")",
"{",
"for",
"_",
",",
"e",
":=",
"range",
"es",
"{",
"switch",
"e",
"{",
"case",
"Identity",
":",
"s",
... | // stats returns a histogram of the number of each type of edit operation. | [
"stats",
"returns",
"a",
"histogram",
"of",
"the",
"number",
"of",
"each",
"type",
"of",
"edit",
"operation",
"."
] | 6f77996f0c42f7b84e5a2b252227263f93432e9b | https://github.com/google/go-cmp/blob/6f77996f0c42f7b84e5a2b252227263f93432e9b/cmp/internal/diff/diff.go#L55-L71 | test |
google/go-cmp | cmp/internal/diff/diff.go | connect | func (p *path) connect(dst point, f EqualFunc) {
if p.dir > 0 {
// Connect in forward direction.
for dst.X > p.X && dst.Y > p.Y {
switch r := f(p.X, p.Y); {
case r.Equal():
p.append(Identity)
case r.Similar():
p.append(Modified)
case dst.X-p.X >= dst.Y-p.Y:
p.append(UniqueX)
default:
... | go | func (p *path) connect(dst point, f EqualFunc) {
if p.dir > 0 {
// Connect in forward direction.
for dst.X > p.X && dst.Y > p.Y {
switch r := f(p.X, p.Y); {
case r.Equal():
p.append(Identity)
case r.Similar():
p.append(Modified)
case dst.X-p.X >= dst.Y-p.Y:
p.append(UniqueX)
default:
... | [
"func",
"(",
"p",
"*",
"path",
")",
"connect",
"(",
"dst",
"point",
",",
"f",
"EqualFunc",
")",
"{",
"if",
"p",
".",
"dir",
">",
"0",
"{",
"for",
"dst",
".",
"X",
">",
"p",
".",
"X",
"&&",
"dst",
".",
"Y",
">",
"p",
".",
"Y",
"{",
"switch... | // connect appends any necessary Identity, Modified, UniqueX, or UniqueY types
// to the edit-script to connect p.point to dst. | [
"connect",
"appends",
"any",
"necessary",
"Identity",
"Modified",
"UniqueX",
"or",
"UniqueY",
"types",
"to",
"the",
"edit",
"-",
"script",
"to",
"connect",
"p",
".",
"point",
"to",
"dst",
"."
] | 6f77996f0c42f7b84e5a2b252227263f93432e9b | https://github.com/google/go-cmp/blob/6f77996f0c42f7b84e5a2b252227263f93432e9b/cmp/internal/diff/diff.go#L304-L346 | test |
google/go-cmp | cmp/cmpopts/equate.go | EquateNaNs | func EquateNaNs() cmp.Option {
return cmp.Options{
cmp.FilterValues(areNaNsF64s, cmp.Comparer(equateAlways)),
cmp.FilterValues(areNaNsF32s, cmp.Comparer(equateAlways)),
}
} | go | func EquateNaNs() cmp.Option {
return cmp.Options{
cmp.FilterValues(areNaNsF64s, cmp.Comparer(equateAlways)),
cmp.FilterValues(areNaNsF32s, cmp.Comparer(equateAlways)),
}
} | [
"func",
"EquateNaNs",
"(",
")",
"cmp",
".",
"Option",
"{",
"return",
"cmp",
".",
"Options",
"{",
"cmp",
".",
"FilterValues",
"(",
"areNaNsF64s",
",",
"cmp",
".",
"Comparer",
"(",
"equateAlways",
")",
")",
",",
"cmp",
".",
"FilterValues",
"(",
"areNaNsF32... | // EquateNaNs returns a Comparer option that determines float32 and float64
// NaN values to be equal.
//
// EquateNaNs can be used in conjunction with EquateApprox. | [
"EquateNaNs",
"returns",
"a",
"Comparer",
"option",
"that",
"determines",
"float32",
"and",
"float64",
"NaN",
"values",
"to",
"be",
"equal",
".",
"EquateNaNs",
"can",
"be",
"used",
"in",
"conjunction",
"with",
"EquateApprox",
"."
] | 6f77996f0c42f7b84e5a2b252227263f93432e9b | https://github.com/google/go-cmp/blob/6f77996f0c42f7b84e5a2b252227263f93432e9b/cmp/cmpopts/equate.go#L77-L82 | test |
google/go-cmp | cmp/path.go | Index | func (pa Path) Index(i int) PathStep {
if i < 0 {
i = len(pa) + i
}
if i < 0 || i >= len(pa) {
return pathStep{}
}
return pa[i]
} | go | func (pa Path) Index(i int) PathStep {
if i < 0 {
i = len(pa) + i
}
if i < 0 || i >= len(pa) {
return pathStep{}
}
return pa[i]
} | [
"func",
"(",
"pa",
"Path",
")",
"Index",
"(",
"i",
"int",
")",
"PathStep",
"{",
"if",
"i",
"<",
"0",
"{",
"i",
"=",
"len",
"(",
"pa",
")",
"+",
"i",
"\n",
"}",
"\n",
"if",
"i",
"<",
"0",
"||",
"i",
">=",
"len",
"(",
"pa",
")",
"{",
"ret... | // Index returns the ith step in the Path and supports negative indexing.
// A negative index starts counting from the tail of the Path such that -1
// refers to the last step, -2 refers to the second-to-last step, and so on.
// If index is invalid, this returns a non-nil PathStep that reports a nil Type. | [
"Index",
"returns",
"the",
"ith",
"step",
"in",
"the",
"Path",
"and",
"supports",
"negative",
"indexing",
".",
"A",
"negative",
"index",
"starts",
"counting",
"from",
"the",
"tail",
"of",
"the",
"Path",
"such",
"that",
"-",
"1",
"refers",
"to",
"the",
"l... | 6f77996f0c42f7b84e5a2b252227263f93432e9b | https://github.com/google/go-cmp/blob/6f77996f0c42f7b84e5a2b252227263f93432e9b/cmp/path.go#L81-L89 | test |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.