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/auth/server/api_server.go | getOneTimePassword | func (a *apiServer) getOneTimePassword(ctx context.Context, username string, expiration time.Time) (code string, err error) {
// Create OTPInfo that will be stored
otpInfo := &authclient.OTPInfo{
Subject: username,
}
if !expiration.IsZero() {
expirationProto, err := types.TimestampProto(expiration)
if err != ... | go | func (a *apiServer) getOneTimePassword(ctx context.Context, username string, expiration time.Time) (code string, err error) {
// Create OTPInfo that will be stored
otpInfo := &authclient.OTPInfo{
Subject: username,
}
if !expiration.IsZero() {
expirationProto, err := types.TimestampProto(expiration)
if err != ... | [
"func",
"(",
"a",
"*",
"apiServer",
")",
"getOneTimePassword",
"(",
"ctx",
"context",
".",
"Context",
",",
"username",
"string",
",",
"expiration",
"time",
".",
"Time",
")",
"(",
"code",
"string",
",",
"err",
"error",
")",
"{",
"otpInfo",
":=",
"&",
"a... | // getOneTimePassword contains the implementation of GetOneTimePassword,
// but is also called directly by handleSAMLREsponse. It generates a
// short-lived authentication code for 'username', writes it to
// a.authenticationCodes, and returns it | [
"getOneTimePassword",
"contains",
"the",
"implementation",
"of",
"GetOneTimePassword",
"but",
"is",
"also",
"called",
"directly",
"by",
"handleSAMLREsponse",
".",
"It",
"generates",
"a",
"short",
"-",
"lived",
"authentication",
"code",
"for",
"username",
"writes",
"... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/auth/server/api_server.go#L1019-L1042 | test |
pachyderm/pachyderm | src/server/auth/server/api_server.go | hashToken | func hashToken(token string) string {
sum := sha256.Sum256([]byte(token))
return fmt.Sprintf("%x", sum)
} | go | func hashToken(token string) string {
sum := sha256.Sum256([]byte(token))
return fmt.Sprintf("%x", sum)
} | [
"func",
"hashToken",
"(",
"token",
"string",
")",
"string",
"{",
"sum",
":=",
"sha256",
".",
"Sum256",
"(",
"[",
"]",
"byte",
"(",
"token",
")",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"%x\"",
",",
"sum",
")",
"\n",
"}"
] | // hashToken converts a token to a cryptographic hash.
// We don't want to store tokens verbatim in the database, as then whoever
// that has access to the database has access to all tokens. | [
"hashToken",
"converts",
"a",
"token",
"to",
"a",
"cryptographic",
"hash",
".",
"We",
"don",
"t",
"want",
"to",
"store",
"tokens",
"verbatim",
"in",
"the",
"database",
"as",
"then",
"whoever",
"that",
"has",
"access",
"to",
"the",
"database",
"has",
"acces... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/auth/server/api_server.go#L2146-L2149 | test |
pachyderm/pachyderm | src/server/auth/server/api_server.go | getAuthToken | func getAuthToken(ctx context.Context) (string, error) {
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
return "", authclient.ErrNoMetadata
}
if len(md[authclient.ContextTokenKey]) > 1 {
return "", fmt.Errorf("multiple authentication token keys found in context")
} else if len(md[authclient.ContextTokenK... | go | func getAuthToken(ctx context.Context) (string, error) {
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
return "", authclient.ErrNoMetadata
}
if len(md[authclient.ContextTokenKey]) > 1 {
return "", fmt.Errorf("multiple authentication token keys found in context")
} else if len(md[authclient.ContextTokenK... | [
"func",
"getAuthToken",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"string",
",",
"error",
")",
"{",
"md",
",",
"ok",
":=",
"metadata",
".",
"FromIncomingContext",
"(",
"ctx",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"\"",
",",
"authclient",
... | // getAuthToken extracts the auth token embedded in 'ctx', if there is on | [
"getAuthToken",
"extracts",
"the",
"auth",
"token",
"embedded",
"in",
"ctx",
"if",
"there",
"is",
"on"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/auth/server/api_server.go#L2152-L2163 | test |
pachyderm/pachyderm | src/server/auth/server/api_server.go | canonicalizeSubjects | func (a *apiServer) canonicalizeSubjects(ctx context.Context, subjects []string) ([]string, error) {
if subjects == nil {
return []string{}, nil
}
eg := &errgroup.Group{}
canonicalizedSubjects := make([]string, len(subjects))
for i, subject := range subjects {
i, subject := i, subject
eg.Go(func() error {
... | go | func (a *apiServer) canonicalizeSubjects(ctx context.Context, subjects []string) ([]string, error) {
if subjects == nil {
return []string{}, nil
}
eg := &errgroup.Group{}
canonicalizedSubjects := make([]string, len(subjects))
for i, subject := range subjects {
i, subject := i, subject
eg.Go(func() error {
... | [
"func",
"(",
"a",
"*",
"apiServer",
")",
"canonicalizeSubjects",
"(",
"ctx",
"context",
".",
"Context",
",",
"subjects",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"if",
"subjects",
"==",
"nil",
"{",
"return",
"[",
"]",... | // canonicalizeSubjects applies canonicalizeSubject to a list | [
"canonicalizeSubjects",
"applies",
"canonicalizeSubject",
"to",
"a",
"list"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/auth/server/api_server.go#L2195-L2218 | test |
pachyderm/pachyderm | src/client/pkg/require/require.go | Matches | func Matches(tb testing.TB, expectedMatch string, actual string, msgAndArgs ...interface{}) {
tb.Helper()
r, err := regexp.Compile(expectedMatch)
if err != nil {
fatal(tb, msgAndArgs, "Match string provided (%v) is invalid", expectedMatch)
}
if !r.MatchString(actual) {
fatal(tb, msgAndArgs, "Actual string (%v)... | go | func Matches(tb testing.TB, expectedMatch string, actual string, msgAndArgs ...interface{}) {
tb.Helper()
r, err := regexp.Compile(expectedMatch)
if err != nil {
fatal(tb, msgAndArgs, "Match string provided (%v) is invalid", expectedMatch)
}
if !r.MatchString(actual) {
fatal(tb, msgAndArgs, "Actual string (%v)... | [
"func",
"Matches",
"(",
"tb",
"testing",
".",
"TB",
",",
"expectedMatch",
"string",
",",
"actual",
"string",
",",
"msgAndArgs",
"...",
"interface",
"{",
"}",
")",
"{",
"tb",
".",
"Helper",
"(",
")",
"\n",
"r",
",",
"err",
":=",
"regexp",
".",
"Compil... | // Matches checks that a string matches a regular-expression. | [
"Matches",
"checks",
"that",
"a",
"string",
"matches",
"a",
"regular",
"-",
"expression",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/require/require.go#L13-L22 | test |
pachyderm/pachyderm | src/client/pkg/require/require.go | OneOfMatches | func OneOfMatches(tb testing.TB, expectedMatch string, actuals []string, msgAndArgs ...interface{}) {
tb.Helper()
r, err := regexp.Compile(expectedMatch)
if err != nil {
fatal(tb, msgAndArgs, "Match string provided (%v) is invalid", expectedMatch)
}
for _, actual := range actuals {
if r.MatchString(actual) {
... | go | func OneOfMatches(tb testing.TB, expectedMatch string, actuals []string, msgAndArgs ...interface{}) {
tb.Helper()
r, err := regexp.Compile(expectedMatch)
if err != nil {
fatal(tb, msgAndArgs, "Match string provided (%v) is invalid", expectedMatch)
}
for _, actual := range actuals {
if r.MatchString(actual) {
... | [
"func",
"OneOfMatches",
"(",
"tb",
"testing",
".",
"TB",
",",
"expectedMatch",
"string",
",",
"actuals",
"[",
"]",
"string",
",",
"msgAndArgs",
"...",
"interface",
"{",
"}",
")",
"{",
"tb",
".",
"Helper",
"(",
")",
"\n",
"r",
",",
"err",
":=",
"regex... | // OneOfMatches checks whether one element of a slice matches a regular-expression. | [
"OneOfMatches",
"checks",
"whether",
"one",
"element",
"of",
"a",
"slice",
"matches",
"a",
"regular",
"-",
"expression",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/require/require.go#L25-L38 | test |
pachyderm/pachyderm | src/client/pkg/require/require.go | Equal | func Equal(tb testing.TB, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
tb.Helper()
eV, aV := reflect.ValueOf(expected), reflect.ValueOf(actual)
if eV.Type() != aV.Type() {
fatal(
tb,
msgAndArgs,
"Not equal: %T(%#v) (expected)\n"+
" != %T(%#v) (actual)", expected, expec... | go | func Equal(tb testing.TB, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
tb.Helper()
eV, aV := reflect.ValueOf(expected), reflect.ValueOf(actual)
if eV.Type() != aV.Type() {
fatal(
tb,
msgAndArgs,
"Not equal: %T(%#v) (expected)\n"+
" != %T(%#v) (actual)", expected, expec... | [
"func",
"Equal",
"(",
"tb",
"testing",
".",
"TB",
",",
"expected",
"interface",
"{",
"}",
",",
"actual",
"interface",
"{",
"}",
",",
"msgAndArgs",
"...",
"interface",
"{",
"}",
")",
"{",
"tb",
".",
"Helper",
"(",
")",
"\n",
"eV",
",",
"aV",
":=",
... | // Equal checks equality of two values. | [
"Equal",
"checks",
"equality",
"of",
"two",
"values",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/require/require.go#L41-L58 | test |
pachyderm/pachyderm | src/client/pkg/require/require.go | NotEqual | func NotEqual(tb testing.TB, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
tb.Helper()
if reflect.DeepEqual(expected, actual) {
fatal(
tb,
msgAndArgs,
"Equal: %#v (expected)\n"+
" == %#v (actual)", expected, actual)
}
} | go | func NotEqual(tb testing.TB, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
tb.Helper()
if reflect.DeepEqual(expected, actual) {
fatal(
tb,
msgAndArgs,
"Equal: %#v (expected)\n"+
" == %#v (actual)", expected, actual)
}
} | [
"func",
"NotEqual",
"(",
"tb",
"testing",
".",
"TB",
",",
"expected",
"interface",
"{",
"}",
",",
"actual",
"interface",
"{",
"}",
",",
"msgAndArgs",
"...",
"interface",
"{",
"}",
")",
"{",
"tb",
".",
"Helper",
"(",
")",
"\n",
"if",
"reflect",
".",
... | // NotEqual checks inequality of two values. | [
"NotEqual",
"checks",
"inequality",
"of",
"two",
"values",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/require/require.go#L61-L70 | test |
pachyderm/pachyderm | src/client/pkg/require/require.go | oneOfEquals | func oneOfEquals(sliceName string, slice interface{}, elem interface{}) (bool, error) {
e := reflect.ValueOf(elem)
sl := reflect.ValueOf(slice)
if slice == nil || sl.IsNil() {
sl = reflect.MakeSlice(reflect.SliceOf(e.Type()), 0, 0)
}
if sl.Kind() != reflect.Slice {
return false, fmt.Errorf("\"%s\" must a be a ... | go | func oneOfEquals(sliceName string, slice interface{}, elem interface{}) (bool, error) {
e := reflect.ValueOf(elem)
sl := reflect.ValueOf(slice)
if slice == nil || sl.IsNil() {
sl = reflect.MakeSlice(reflect.SliceOf(e.Type()), 0, 0)
}
if sl.Kind() != reflect.Slice {
return false, fmt.Errorf("\"%s\" must a be a ... | [
"func",
"oneOfEquals",
"(",
"sliceName",
"string",
",",
"slice",
"interface",
"{",
"}",
",",
"elem",
"interface",
"{",
"}",
")",
"(",
"bool",
",",
"error",
")",
"{",
"e",
":=",
"reflect",
".",
"ValueOf",
"(",
"elem",
")",
"\n",
"sl",
":=",
"reflect",... | // oneOfEquals is a helper function for EqualOneOf, OneOfEquals and NoneEquals, that simply
// returns a bool indicating whether 'elem' is in 'slice'. 'sliceName' is used for errors | [
"oneOfEquals",
"is",
"a",
"helper",
"function",
"for",
"EqualOneOf",
"OneOfEquals",
"and",
"NoneEquals",
"that",
"simply",
"returns",
"a",
"bool",
"indicating",
"whether",
"elem",
"is",
"in",
"slice",
".",
"sliceName",
"is",
"used",
"for",
"errors"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/require/require.go#L235-L256 | test |
pachyderm/pachyderm | src/client/pkg/require/require.go | NoneEquals | func NoneEquals(tb testing.TB, expected interface{}, actuals interface{}, msgAndArgs ...interface{}) {
tb.Helper()
equal, err := oneOfEquals("actuals", actuals, expected)
if err != nil {
fatal(tb, msgAndArgs, err.Error())
}
if equal {
fatal(tb, msgAndArgs,
"Equal : %#v (expected)\n == one of %#v (actuals)",... | go | func NoneEquals(tb testing.TB, expected interface{}, actuals interface{}, msgAndArgs ...interface{}) {
tb.Helper()
equal, err := oneOfEquals("actuals", actuals, expected)
if err != nil {
fatal(tb, msgAndArgs, err.Error())
}
if equal {
fatal(tb, msgAndArgs,
"Equal : %#v (expected)\n == one of %#v (actuals)",... | [
"func",
"NoneEquals",
"(",
"tb",
"testing",
".",
"TB",
",",
"expected",
"interface",
"{",
"}",
",",
"actuals",
"interface",
"{",
"}",
",",
"msgAndArgs",
"...",
"interface",
"{",
"}",
")",
"{",
"tb",
".",
"Helper",
"(",
")",
"\n",
"equal",
",",
"err",... | // NoneEquals checks one element of a slice equals a value. Like
// EqualsOneOf, NoneEquals unwraps pointers. | [
"NoneEquals",
"checks",
"one",
"element",
"of",
"a",
"slice",
"equals",
"a",
"value",
".",
"Like",
"EqualsOneOf",
"NoneEquals",
"unwraps",
"pointers",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/require/require.go#L294-L304 | test |
pachyderm/pachyderm | src/client/pkg/require/require.go | NoError | func NoError(tb testing.TB, err error, msgAndArgs ...interface{}) {
tb.Helper()
if err != nil {
fatal(tb, msgAndArgs, "No error is expected but got %s", err.Error())
}
} | go | func NoError(tb testing.TB, err error, msgAndArgs ...interface{}) {
tb.Helper()
if err != nil {
fatal(tb, msgAndArgs, "No error is expected but got %s", err.Error())
}
} | [
"func",
"NoError",
"(",
"tb",
"testing",
".",
"TB",
",",
"err",
"error",
",",
"msgAndArgs",
"...",
"interface",
"{",
"}",
")",
"{",
"tb",
".",
"Helper",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fatal",
"(",
"tb",
",",
"msgAndArgs",
",",
"\... | // NoError checks for no error. | [
"NoError",
"checks",
"for",
"no",
"error",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/require/require.go#L307-L312 | test |
pachyderm/pachyderm | src/client/pkg/require/require.go | NoErrorWithinT | func NoErrorWithinT(tb testing.TB, t time.Duration, f func() error, msgAndArgs ...interface{}) {
tb.Helper()
errCh := make(chan error)
go func() {
// This goro will leak if the timeout is exceeded, but it's okay because the
// test is failing anyway
errCh <- f()
}()
select {
case err := <-errCh:
if err !=... | go | func NoErrorWithinT(tb testing.TB, t time.Duration, f func() error, msgAndArgs ...interface{}) {
tb.Helper()
errCh := make(chan error)
go func() {
// This goro will leak if the timeout is exceeded, but it's okay because the
// test is failing anyway
errCh <- f()
}()
select {
case err := <-errCh:
if err !=... | [
"func",
"NoErrorWithinT",
"(",
"tb",
"testing",
".",
"TB",
",",
"t",
"time",
".",
"Duration",
",",
"f",
"func",
"(",
")",
"error",
",",
"msgAndArgs",
"...",
"interface",
"{",
"}",
")",
"{",
"tb",
".",
"Helper",
"(",
")",
"\n",
"errCh",
":=",
"make"... | // NoErrorWithinT checks that 'f' finishes within time 't' and does not emit an
// error | [
"NoErrorWithinT",
"checks",
"that",
"f",
"finishes",
"within",
"time",
"t",
"and",
"does",
"not",
"emit",
"an",
"error"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/require/require.go#L316-L332 | test |
pachyderm/pachyderm | src/client/pkg/require/require.go | NoErrorWithinTRetry | func NoErrorWithinTRetry(tb testing.TB, t time.Duration, f func() error, msgAndArgs ...interface{}) {
tb.Helper()
doneCh := make(chan struct{})
timeout := false
var err error
go func() {
for !timeout {
if err = f(); err == nil {
close(doneCh)
break
}
}
}()
select {
case <-doneCh:
case <-time.... | go | func NoErrorWithinTRetry(tb testing.TB, t time.Duration, f func() error, msgAndArgs ...interface{}) {
tb.Helper()
doneCh := make(chan struct{})
timeout := false
var err error
go func() {
for !timeout {
if err = f(); err == nil {
close(doneCh)
break
}
}
}()
select {
case <-doneCh:
case <-time.... | [
"func",
"NoErrorWithinTRetry",
"(",
"tb",
"testing",
".",
"TB",
",",
"t",
"time",
".",
"Duration",
",",
"f",
"func",
"(",
")",
"error",
",",
"msgAndArgs",
"...",
"interface",
"{",
"}",
")",
"{",
"tb",
".",
"Helper",
"(",
")",
"\n",
"doneCh",
":=",
... | // NoErrorWithinTRetry checks that 'f' finishes within time 't' and does not
// emit an error. Unlike NoErrorWithinT if f does error, it will retry it. | [
"NoErrorWithinTRetry",
"checks",
"that",
"f",
"finishes",
"within",
"time",
"t",
"and",
"does",
"not",
"emit",
"an",
"error",
".",
"Unlike",
"NoErrorWithinT",
"if",
"f",
"does",
"error",
"it",
"will",
"retry",
"it",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/require/require.go#L336-L355 | test |
pachyderm/pachyderm | src/client/pkg/require/require.go | YesError | func YesError(tb testing.TB, err error, msgAndArgs ...interface{}) {
tb.Helper()
if err == nil {
fatal(tb, msgAndArgs, "Error is expected but got %v", err)
}
} | go | func YesError(tb testing.TB, err error, msgAndArgs ...interface{}) {
tb.Helper()
if err == nil {
fatal(tb, msgAndArgs, "Error is expected but got %v", err)
}
} | [
"func",
"YesError",
"(",
"tb",
"testing",
".",
"TB",
",",
"err",
"error",
",",
"msgAndArgs",
"...",
"interface",
"{",
"}",
")",
"{",
"tb",
".",
"Helper",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"fatal",
"(",
"tb",
",",
"msgAndArgs",
",",
"... | // YesError checks for an error. | [
"YesError",
"checks",
"for",
"an",
"error",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/require/require.go#L358-L363 | test |
pachyderm/pachyderm | src/client/pkg/require/require.go | NotNil | func NotNil(tb testing.TB, object interface{}, msgAndArgs ...interface{}) {
tb.Helper()
success := true
if object == nil {
success = false
} else {
value := reflect.ValueOf(object)
kind := value.Kind()
if kind >= reflect.Chan && kind <= reflect.Slice && value.IsNil() {
success = false
}
}
if !succe... | go | func NotNil(tb testing.TB, object interface{}, msgAndArgs ...interface{}) {
tb.Helper()
success := true
if object == nil {
success = false
} else {
value := reflect.ValueOf(object)
kind := value.Kind()
if kind >= reflect.Chan && kind <= reflect.Slice && value.IsNil() {
success = false
}
}
if !succe... | [
"func",
"NotNil",
"(",
"tb",
"testing",
".",
"TB",
",",
"object",
"interface",
"{",
"}",
",",
"msgAndArgs",
"...",
"interface",
"{",
"}",
")",
"{",
"tb",
".",
"Helper",
"(",
")",
"\n",
"success",
":=",
"true",
"\n",
"if",
"object",
"==",
"nil",
"{"... | // NotNil checks a value is non-nil. | [
"NotNil",
"checks",
"a",
"value",
"is",
"non",
"-",
"nil",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/require/require.go#L366-L383 | test |
pachyderm/pachyderm | src/client/pkg/require/require.go | Nil | func Nil(tb testing.TB, object interface{}, msgAndArgs ...interface{}) {
tb.Helper()
if object == nil {
return
}
value := reflect.ValueOf(object)
kind := value.Kind()
if kind >= reflect.Chan && kind <= reflect.Slice && value.IsNil() {
return
}
fatal(tb, msgAndArgs, "Expected value to be nil, but was %v", o... | go | func Nil(tb testing.TB, object interface{}, msgAndArgs ...interface{}) {
tb.Helper()
if object == nil {
return
}
value := reflect.ValueOf(object)
kind := value.Kind()
if kind >= reflect.Chan && kind <= reflect.Slice && value.IsNil() {
return
}
fatal(tb, msgAndArgs, "Expected value to be nil, but was %v", o... | [
"func",
"Nil",
"(",
"tb",
"testing",
".",
"TB",
",",
"object",
"interface",
"{",
"}",
",",
"msgAndArgs",
"...",
"interface",
"{",
"}",
")",
"{",
"tb",
".",
"Helper",
"(",
")",
"\n",
"if",
"object",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"va... | // Nil checks a value is nil. | [
"Nil",
"checks",
"a",
"value",
"is",
"nil",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/require/require.go#L386-L398 | test |
pachyderm/pachyderm | src/client/pkg/require/require.go | False | func False(tb testing.TB, value bool, msgAndArgs ...interface{}) {
tb.Helper()
if value {
fatal(tb, msgAndArgs, "Should be false.")
}
} | go | func False(tb testing.TB, value bool, msgAndArgs ...interface{}) {
tb.Helper()
if value {
fatal(tb, msgAndArgs, "Should be false.")
}
} | [
"func",
"False",
"(",
"tb",
"testing",
".",
"TB",
",",
"value",
"bool",
",",
"msgAndArgs",
"...",
"interface",
"{",
"}",
")",
"{",
"tb",
".",
"Helper",
"(",
")",
"\n",
"if",
"value",
"{",
"fatal",
"(",
"tb",
",",
"msgAndArgs",
",",
"\"Should be false... | // False checks a value is false. | [
"False",
"checks",
"a",
"value",
"is",
"false",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/require/require.go#L409-L414 | test |
pachyderm/pachyderm | src/server/pkg/collection/transaction.go | NewSTM | func NewSTM(ctx context.Context, c *v3.Client, apply func(STM) error) (*v3.TxnResponse, error) {
return newSTMSerializable(ctx, c, apply, false)
} | go | func NewSTM(ctx context.Context, c *v3.Client, apply func(STM) error) (*v3.TxnResponse, error) {
return newSTMSerializable(ctx, c, apply, false)
} | [
"func",
"NewSTM",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"v3",
".",
"Client",
",",
"apply",
"func",
"(",
"STM",
")",
"error",
")",
"(",
"*",
"v3",
".",
"TxnResponse",
",",
"error",
")",
"{",
"return",
"newSTMSerializable",
"(",
"ctx",
... | // NewSTM intiates a new STM operation. It uses a serializable model. | [
"NewSTM",
"intiates",
"a",
"new",
"STM",
"operation",
".",
"It",
"uses",
"a",
"serializable",
"model",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/collection/transaction.go#L63-L65 | test |
pachyderm/pachyderm | src/server/pkg/collection/transaction.go | NewDryrunSTM | func NewDryrunSTM(ctx context.Context, c *v3.Client, apply func(STM) error) error {
_, err := newSTMSerializable(ctx, c, apply, true)
return err
} | go | func NewDryrunSTM(ctx context.Context, c *v3.Client, apply func(STM) error) error {
_, err := newSTMSerializable(ctx, c, apply, true)
return err
} | [
"func",
"NewDryrunSTM",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"v3",
".",
"Client",
",",
"apply",
"func",
"(",
"STM",
")",
"error",
")",
"error",
"{",
"_",
",",
"err",
":=",
"newSTMSerializable",
"(",
"ctx",
",",
"c",
",",
"apply",
"... | // NewDryrunSTM intiates a new STM operation, but the final commit is skipped.
// It uses a serializable model. | [
"NewDryrunSTM",
"intiates",
"a",
"new",
"STM",
"operation",
"but",
"the",
"final",
"commit",
"is",
"skipped",
".",
"It",
"uses",
"a",
"serializable",
"model",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/collection/transaction.go#L69-L72 | test |
pachyderm/pachyderm | src/server/pkg/collection/transaction.go | newSTMRepeatable | func newSTMRepeatable(ctx context.Context, c *v3.Client, apply func(STM) error) (*v3.TxnResponse, error) {
s := &stm{client: c, ctx: ctx, getOpts: []v3.OpOption{v3.WithSerializable()}}
return runSTM(s, apply, false)
} | go | func newSTMRepeatable(ctx context.Context, c *v3.Client, apply func(STM) error) (*v3.TxnResponse, error) {
s := &stm{client: c, ctx: ctx, getOpts: []v3.OpOption{v3.WithSerializable()}}
return runSTM(s, apply, false)
} | [
"func",
"newSTMRepeatable",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"v3",
".",
"Client",
",",
"apply",
"func",
"(",
"STM",
")",
"error",
")",
"(",
"*",
"v3",
".",
"TxnResponse",
",",
"error",
")",
"{",
"s",
":=",
"&",
"stm",
"{",
"c... | // newSTMRepeatable initiates new repeatable read transaction; reads within
// the same transaction attempt to always return the same data. | [
"newSTMRepeatable",
"initiates",
"new",
"repeatable",
"read",
"transaction",
";",
"reads",
"within",
"the",
"same",
"transaction",
"attempt",
"to",
"always",
"return",
"the",
"same",
"data",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/collection/transaction.go#L76-L79 | test |
pachyderm/pachyderm | src/server/pkg/collection/transaction.go | newSTMSerializable | func newSTMSerializable(ctx context.Context, c *v3.Client, apply func(STM) error, dryrun bool) (*v3.TxnResponse, error) {
s := &stmSerializable{
stm: stm{client: c, ctx: ctx},
prefetch: make(map[string]*v3.GetResponse),
}
return runSTM(s, apply, dryrun)
} | go | func newSTMSerializable(ctx context.Context, c *v3.Client, apply func(STM) error, dryrun bool) (*v3.TxnResponse, error) {
s := &stmSerializable{
stm: stm{client: c, ctx: ctx},
prefetch: make(map[string]*v3.GetResponse),
}
return runSTM(s, apply, dryrun)
} | [
"func",
"newSTMSerializable",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"v3",
".",
"Client",
",",
"apply",
"func",
"(",
"STM",
")",
"error",
",",
"dryrun",
"bool",
")",
"(",
"*",
"v3",
".",
"TxnResponse",
",",
"error",
")",
"{",
"s",
":... | // newSTMSerializable initiates a new serialized transaction; reads within the
// same transaction attempt to return data from the revision of the first read. | [
"newSTMSerializable",
"initiates",
"a",
"new",
"serialized",
"transaction",
";",
"reads",
"within",
"the",
"same",
"transaction",
"attempt",
"to",
"return",
"data",
"from",
"the",
"revision",
"of",
"the",
"first",
"read",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/collection/transaction.go#L83-L89 | test |
pachyderm/pachyderm | src/server/pkg/collection/transaction.go | newSTMReadCommitted | func newSTMReadCommitted(ctx context.Context, c *v3.Client, apply func(STM) error) (*v3.TxnResponse, error) {
s := &stmReadCommitted{stm{client: c, ctx: ctx, getOpts: []v3.OpOption{v3.WithSerializable()}}}
return runSTM(s, apply, true)
} | go | func newSTMReadCommitted(ctx context.Context, c *v3.Client, apply func(STM) error) (*v3.TxnResponse, error) {
s := &stmReadCommitted{stm{client: c, ctx: ctx, getOpts: []v3.OpOption{v3.WithSerializable()}}}
return runSTM(s, apply, true)
} | [
"func",
"newSTMReadCommitted",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"v3",
".",
"Client",
",",
"apply",
"func",
"(",
"STM",
")",
"error",
")",
"(",
"*",
"v3",
".",
"TxnResponse",
",",
"error",
")",
"{",
"s",
":=",
"&",
"stmReadCommitt... | // newSTMReadCommitted initiates a new read committed transaction. | [
"newSTMReadCommitted",
"initiates",
"a",
"new",
"read",
"committed",
"transaction",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/collection/transaction.go#L92-L95 | test |
pachyderm/pachyderm | src/server/pkg/collection/transaction.go | commit | func (s *stmReadCommitted) commit() *v3.TxnResponse {
s.rset = nil
return s.stm.commit()
} | go | func (s *stmReadCommitted) commit() *v3.TxnResponse {
s.rset = nil
return s.stm.commit()
} | [
"func",
"(",
"s",
"*",
"stmReadCommitted",
")",
"commit",
"(",
")",
"*",
"v3",
".",
"TxnResponse",
"{",
"s",
".",
"rset",
"=",
"nil",
"\n",
"return",
"s",
".",
"stm",
".",
"commit",
"(",
")",
"\n",
"}"
] | // commit always goes through when read committed | [
"commit",
"always",
"goes",
"through",
"when",
"read",
"committed"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/collection/transaction.go#L360-L363 | test |
pachyderm/pachyderm | src/server/pkg/ppsdb/ppsdb.go | Pipelines | func Pipelines(etcdClient *etcd.Client, etcdPrefix string) col.Collection {
return col.NewCollection(
etcdClient,
path.Join(etcdPrefix, pipelinesPrefix),
nil,
&pps.EtcdPipelineInfo{},
nil,
nil,
)
} | go | func Pipelines(etcdClient *etcd.Client, etcdPrefix string) col.Collection {
return col.NewCollection(
etcdClient,
path.Join(etcdPrefix, pipelinesPrefix),
nil,
&pps.EtcdPipelineInfo{},
nil,
nil,
)
} | [
"func",
"Pipelines",
"(",
"etcdClient",
"*",
"etcd",
".",
"Client",
",",
"etcdPrefix",
"string",
")",
"col",
".",
"Collection",
"{",
"return",
"col",
".",
"NewCollection",
"(",
"etcdClient",
",",
"path",
".",
"Join",
"(",
"etcdPrefix",
",",
"pipelinesPrefix"... | // Pipelines returns a Collection of pipelines | [
"Pipelines",
"returns",
"a",
"Collection",
"of",
"pipelines"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/ppsdb/ppsdb.go#L31-L40 | test |
pachyderm/pachyderm | src/server/pkg/ppsdb/ppsdb.go | Jobs | func Jobs(etcdClient *etcd.Client, etcdPrefix string) col.Collection {
return col.NewCollection(
etcdClient,
path.Join(etcdPrefix, jobsPrefix),
[]*col.Index{JobsPipelineIndex, JobsOutputIndex},
&pps.EtcdJobInfo{},
nil,
nil,
)
} | go | func Jobs(etcdClient *etcd.Client, etcdPrefix string) col.Collection {
return col.NewCollection(
etcdClient,
path.Join(etcdPrefix, jobsPrefix),
[]*col.Index{JobsPipelineIndex, JobsOutputIndex},
&pps.EtcdJobInfo{},
nil,
nil,
)
} | [
"func",
"Jobs",
"(",
"etcdClient",
"*",
"etcd",
".",
"Client",
",",
"etcdPrefix",
"string",
")",
"col",
".",
"Collection",
"{",
"return",
"col",
".",
"NewCollection",
"(",
"etcdClient",
",",
"path",
".",
"Join",
"(",
"etcdPrefix",
",",
"jobsPrefix",
")",
... | // Jobs returns a Collection of jobs | [
"Jobs",
"returns",
"a",
"Collection",
"of",
"jobs"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/ppsdb/ppsdb.go#L43-L52 | test |
pachyderm/pachyderm | src/server/pkg/backoff/ticker.go | NewTicker | func NewTicker(b BackOff) *Ticker {
c := make(chan time.Time)
t := &Ticker{
C: c,
c: c,
b: b,
stop: make(chan struct{}),
}
go t.run()
runtime.SetFinalizer(t, (*Ticker).Stop)
return t
} | go | func NewTicker(b BackOff) *Ticker {
c := make(chan time.Time)
t := &Ticker{
C: c,
c: c,
b: b,
stop: make(chan struct{}),
}
go t.run()
runtime.SetFinalizer(t, (*Ticker).Stop)
return t
} | [
"func",
"NewTicker",
"(",
"b",
"BackOff",
")",
"*",
"Ticker",
"{",
"c",
":=",
"make",
"(",
"chan",
"time",
".",
"Time",
")",
"\n",
"t",
":=",
"&",
"Ticker",
"{",
"C",
":",
"c",
",",
"c",
":",
"c",
",",
"b",
":",
"b",
",",
"stop",
":",
"make... | // NewTicker returns a new Ticker containing a channel that will send the time at times
// specified by the BackOff argument. Ticker is guaranteed to tick at least once.
// The channel is closed when Stop method is called or BackOff stops. | [
"NewTicker",
"returns",
"a",
"new",
"Ticker",
"containing",
"a",
"channel",
"that",
"will",
"send",
"the",
"time",
"at",
"times",
"specified",
"by",
"the",
"BackOff",
"argument",
".",
"Ticker",
"is",
"guaranteed",
"to",
"tick",
"at",
"least",
"once",
".",
... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/backoff/ticker.go#L24-L35 | test |
pachyderm/pachyderm | src/client/pkg/discovery/etcd_client.go | nodeToMap | func nodeToMap(node *etcd.Node, out map[string]string) bool {
key := strings.TrimPrefix(node.Key, "/")
if !node.Dir {
if node.Value == "" {
if _, ok := out[key]; ok {
delete(out, key)
return true
}
return false
}
if value, ok := out[key]; !ok || value != node.Value {
out[key] = node.Value
... | go | func nodeToMap(node *etcd.Node, out map[string]string) bool {
key := strings.TrimPrefix(node.Key, "/")
if !node.Dir {
if node.Value == "" {
if _, ok := out[key]; ok {
delete(out, key)
return true
}
return false
}
if value, ok := out[key]; !ok || value != node.Value {
out[key] = node.Value
... | [
"func",
"nodeToMap",
"(",
"node",
"*",
"etcd",
".",
"Node",
",",
"out",
"map",
"[",
"string",
"]",
"string",
")",
"bool",
"{",
"key",
":=",
"strings",
".",
"TrimPrefix",
"(",
"node",
".",
"Key",
",",
"\"/\"",
")",
"\n",
"if",
"!",
"node",
".",
"D... | // nodeToMap translates the contents of a node into a map
// nodeToMap can be called on the same map with successive results from watch
// to accumulate a value
// nodeToMap returns true if out was modified | [
"nodeToMap",
"translates",
"the",
"contents",
"of",
"a",
"node",
"into",
"a",
"map",
"nodeToMap",
"can",
"be",
"called",
"on",
"the",
"same",
"map",
"with",
"successive",
"results",
"from",
"watch",
"to",
"accumulate",
"a",
"value",
"nodeToMap",
"returns",
"... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/discovery/etcd_client.go#L186-L207 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | ServiceAccount | func ServiceAccount(opts *AssetOpts) *v1.ServiceAccount {
return &v1.ServiceAccount{
TypeMeta: metav1.TypeMeta{
Kind: "ServiceAccount",
APIVersion: "v1",
},
ObjectMeta: objectMeta(ServiceAccountName, labels(""), nil, opts.Namespace),
}
} | go | func ServiceAccount(opts *AssetOpts) *v1.ServiceAccount {
return &v1.ServiceAccount{
TypeMeta: metav1.TypeMeta{
Kind: "ServiceAccount",
APIVersion: "v1",
},
ObjectMeta: objectMeta(ServiceAccountName, labels(""), nil, opts.Namespace),
}
} | [
"func",
"ServiceAccount",
"(",
"opts",
"*",
"AssetOpts",
")",
"*",
"v1",
".",
"ServiceAccount",
"{",
"return",
"&",
"v1",
".",
"ServiceAccount",
"{",
"TypeMeta",
":",
"metav1",
".",
"TypeMeta",
"{",
"Kind",
":",
"\"ServiceAccount\"",
",",
"APIVersion",
":",
... | // ServiceAccount returns a kubernetes service account for use with Pachyderm. | [
"ServiceAccount",
"returns",
"a",
"kubernetes",
"service",
"account",
"for",
"use",
"with",
"Pachyderm",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L283-L291 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | ClusterRole | func ClusterRole(opts *AssetOpts) *rbacv1.ClusterRole {
return &rbacv1.ClusterRole{
TypeMeta: metav1.TypeMeta{
Kind: "ClusterRole",
APIVersion: "rbac.authorization.k8s.io/v1",
},
ObjectMeta: objectMeta(roleName, labels(""), nil, opts.Namespace),
Rules: rolePolicyRules,
}
} | go | func ClusterRole(opts *AssetOpts) *rbacv1.ClusterRole {
return &rbacv1.ClusterRole{
TypeMeta: metav1.TypeMeta{
Kind: "ClusterRole",
APIVersion: "rbac.authorization.k8s.io/v1",
},
ObjectMeta: objectMeta(roleName, labels(""), nil, opts.Namespace),
Rules: rolePolicyRules,
}
} | [
"func",
"ClusterRole",
"(",
"opts",
"*",
"AssetOpts",
")",
"*",
"rbacv1",
".",
"ClusterRole",
"{",
"return",
"&",
"rbacv1",
".",
"ClusterRole",
"{",
"TypeMeta",
":",
"metav1",
".",
"TypeMeta",
"{",
"Kind",
":",
"\"ClusterRole\"",
",",
"APIVersion",
":",
"\... | // ClusterRole returns a ClusterRole that should be bound to the Pachyderm service account. | [
"ClusterRole",
"returns",
"a",
"ClusterRole",
"that",
"should",
"be",
"bound",
"to",
"the",
"Pachyderm",
"service",
"account",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L294-L303 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | RoleBinding | func RoleBinding(opts *AssetOpts) *rbacv1.RoleBinding {
return &rbacv1.RoleBinding{
TypeMeta: metav1.TypeMeta{
Kind: "RoleBinding",
APIVersion: "rbac.authorization.k8s.io/v1",
},
ObjectMeta: objectMeta(roleBindingName, labels(""), nil, opts.Namespace),
Subjects: []rbacv1.Subject{{
Kind: "Se... | go | func RoleBinding(opts *AssetOpts) *rbacv1.RoleBinding {
return &rbacv1.RoleBinding{
TypeMeta: metav1.TypeMeta{
Kind: "RoleBinding",
APIVersion: "rbac.authorization.k8s.io/v1",
},
ObjectMeta: objectMeta(roleBindingName, labels(""), nil, opts.Namespace),
Subjects: []rbacv1.Subject{{
Kind: "Se... | [
"func",
"RoleBinding",
"(",
"opts",
"*",
"AssetOpts",
")",
"*",
"rbacv1",
".",
"RoleBinding",
"{",
"return",
"&",
"rbacv1",
".",
"RoleBinding",
"{",
"TypeMeta",
":",
"metav1",
".",
"TypeMeta",
"{",
"Kind",
":",
"\"RoleBinding\"",
",",
"APIVersion",
":",
"\... | // RoleBinding returns a RoleBinding that binds Pachyderm's Role to its
// ServiceAccount. | [
"RoleBinding",
"returns",
"a",
"RoleBinding",
"that",
"binds",
"Pachyderm",
"s",
"Role",
"to",
"its",
"ServiceAccount",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L340-L357 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | GetSecretEnvVars | func GetSecretEnvVars(storageBackend string) []v1.EnvVar {
var envVars []v1.EnvVar
if storageBackend != "" {
envVars = append(envVars, v1.EnvVar{
Name: obj.StorageBackendEnvVar,
Value: storageBackend,
})
}
trueVal := true
for envVar, secretKey := range obj.EnvVarToSecretKey {
envVars = append(envVars,... | go | func GetSecretEnvVars(storageBackend string) []v1.EnvVar {
var envVars []v1.EnvVar
if storageBackend != "" {
envVars = append(envVars, v1.EnvVar{
Name: obj.StorageBackendEnvVar,
Value: storageBackend,
})
}
trueVal := true
for envVar, secretKey := range obj.EnvVarToSecretKey {
envVars = append(envVars,... | [
"func",
"GetSecretEnvVars",
"(",
"storageBackend",
"string",
")",
"[",
"]",
"v1",
".",
"EnvVar",
"{",
"var",
"envVars",
"[",
"]",
"v1",
".",
"EnvVar",
"\n",
"if",
"storageBackend",
"!=",
"\"\"",
"{",
"envVars",
"=",
"append",
"(",
"envVars",
",",
"v1",
... | // GetSecretEnvVars returns the environment variable specs for the storage secret. | [
"GetSecretEnvVars",
"returns",
"the",
"environment",
"variable",
"specs",
"for",
"the",
"storage",
"secret",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L377-L401 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | PachdService | func PachdService(opts *AssetOpts) *v1.Service {
prometheusAnnotations := map[string]string{
"prometheus.io/scrape": "true",
"prometheus.io/port": strconv.Itoa(PrometheusPort),
}
return &v1.Service{
TypeMeta: metav1.TypeMeta{
Kind: "Service",
APIVersion: "v1",
},
ObjectMeta: objectMeta(pachdN... | go | func PachdService(opts *AssetOpts) *v1.Service {
prometheusAnnotations := map[string]string{
"prometheus.io/scrape": "true",
"prometheus.io/port": strconv.Itoa(PrometheusPort),
}
return &v1.Service{
TypeMeta: metav1.TypeMeta{
Kind: "Service",
APIVersion: "v1",
},
ObjectMeta: objectMeta(pachdN... | [
"func",
"PachdService",
"(",
"opts",
"*",
"AssetOpts",
")",
"*",
"v1",
".",
"Service",
"{",
"prometheusAnnotations",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"\"prometheus.io/scrape\"",
":",
"\"true\"",
",",
"\"prometheus.io/port\"",
":",
"strconv",
".",
... | // PachdService returns a pachd service. | [
"PachdService",
"returns",
"a",
"pachd",
"service",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L613-L663 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | GithookService | func GithookService(namespace string) *v1.Service {
name := "githook"
return &v1.Service{
TypeMeta: metav1.TypeMeta{
Kind: "Service",
APIVersion: "v1",
},
ObjectMeta: objectMeta(name, labels(name), nil, namespace),
Spec: v1.ServiceSpec{
Type: v1.ServiceTypeLoadBalancer,
Selector: map[string]... | go | func GithookService(namespace string) *v1.Service {
name := "githook"
return &v1.Service{
TypeMeta: metav1.TypeMeta{
Kind: "Service",
APIVersion: "v1",
},
ObjectMeta: objectMeta(name, labels(name), nil, namespace),
Spec: v1.ServiceSpec{
Type: v1.ServiceTypeLoadBalancer,
Selector: map[string]... | [
"func",
"GithookService",
"(",
"namespace",
"string",
")",
"*",
"v1",
".",
"Service",
"{",
"name",
":=",
"\"githook\"",
"\n",
"return",
"&",
"v1",
".",
"Service",
"{",
"TypeMeta",
":",
"metav1",
".",
"TypeMeta",
"{",
"Kind",
":",
"\"Service\"",
",",
"API... | // GithookService returns a k8s service that exposes a public IP | [
"GithookService",
"returns",
"a",
"k8s",
"service",
"that",
"exposes",
"a",
"public",
"IP"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L666-L688 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | EtcdDeployment | func EtcdDeployment(opts *AssetOpts, hostPath string) *apps.Deployment {
cpu := resource.MustParse(opts.EtcdCPURequest)
mem := resource.MustParse(opts.EtcdMemRequest)
var volumes []v1.Volume
if hostPath == "" {
volumes = []v1.Volume{
{
Name: "etcd-storage",
VolumeSource: v1.VolumeSource{
Persisten... | go | func EtcdDeployment(opts *AssetOpts, hostPath string) *apps.Deployment {
cpu := resource.MustParse(opts.EtcdCPURequest)
mem := resource.MustParse(opts.EtcdMemRequest)
var volumes []v1.Volume
if hostPath == "" {
volumes = []v1.Volume{
{
Name: "etcd-storage",
VolumeSource: v1.VolumeSource{
Persisten... | [
"func",
"EtcdDeployment",
"(",
"opts",
"*",
"AssetOpts",
",",
"hostPath",
"string",
")",
"*",
"apps",
".",
"Deployment",
"{",
"cpu",
":=",
"resource",
".",
"MustParse",
"(",
"opts",
".",
"EtcdCPURequest",
")",
"\n",
"mem",
":=",
"resource",
".",
"MustParse... | // EtcdDeployment returns an etcd k8s Deployment. | [
"EtcdDeployment",
"returns",
"an",
"etcd",
"k8s",
"Deployment",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L691-L782 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | EtcdStorageClass | func EtcdStorageClass(opts *AssetOpts, backend backend) (interface{}, error) {
sc := map[string]interface{}{
"apiVersion": "storage.k8s.io/v1beta1",
"kind": "StorageClass",
"metadata": map[string]interface{}{
"name": defaultEtcdStorageClassName,
"labels": labels(etcdName),
"namespace": opt... | go | func EtcdStorageClass(opts *AssetOpts, backend backend) (interface{}, error) {
sc := map[string]interface{}{
"apiVersion": "storage.k8s.io/v1beta1",
"kind": "StorageClass",
"metadata": map[string]interface{}{
"name": defaultEtcdStorageClassName,
"labels": labels(etcdName),
"namespace": opt... | [
"func",
"EtcdStorageClass",
"(",
"opts",
"*",
"AssetOpts",
",",
"backend",
"backend",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"sc",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"apiVersion\"",
":",
"\"storage.k8s.io/v1bet... | // EtcdStorageClass creates a storage class used for dynamic volume
// provisioning. Currently dynamic volume provisioning only works
// on AWS and GCE. | [
"EtcdStorageClass",
"creates",
"a",
"storage",
"class",
"used",
"for",
"dynamic",
"volume",
"provisioning",
".",
"Currently",
"dynamic",
"volume",
"provisioning",
"only",
"works",
"on",
"AWS",
"and",
"GCE",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L787-L812 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | EtcdVolume | func EtcdVolume(persistentDiskBackend backend, opts *AssetOpts,
hostPath string, name string, size int) (*v1.PersistentVolume, error) {
spec := &v1.PersistentVolume{
TypeMeta: metav1.TypeMeta{
Kind: "PersistentVolume",
APIVersion: "v1",
},
ObjectMeta: objectMeta(etcdVolumeName, labels(etcdName), nil... | go | func EtcdVolume(persistentDiskBackend backend, opts *AssetOpts,
hostPath string, name string, size int) (*v1.PersistentVolume, error) {
spec := &v1.PersistentVolume{
TypeMeta: metav1.TypeMeta{
Kind: "PersistentVolume",
APIVersion: "v1",
},
ObjectMeta: objectMeta(etcdVolumeName, labels(etcdName), nil... | [
"func",
"EtcdVolume",
"(",
"persistentDiskBackend",
"backend",
",",
"opts",
"*",
"AssetOpts",
",",
"hostPath",
"string",
",",
"name",
"string",
",",
"size",
"int",
")",
"(",
"*",
"v1",
".",
"PersistentVolume",
",",
"error",
")",
"{",
"spec",
":=",
"&",
"... | // EtcdVolume creates a persistent volume backed by a volume with name "name" | [
"EtcdVolume",
"creates",
"a",
"persistent",
"volume",
"backed",
"by",
"a",
"volume",
"with",
"name",
"name"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L815-L870 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | EtcdNodePortService | func EtcdNodePortService(local bool, opts *AssetOpts) *v1.Service {
var clientNodePort int32
if local {
clientNodePort = 32379
}
return &v1.Service{
TypeMeta: metav1.TypeMeta{
Kind: "Service",
APIVersion: "v1",
},
ObjectMeta: objectMeta(etcdName, labels(etcdName), nil, opts.Namespace),
Spec: v... | go | func EtcdNodePortService(local bool, opts *AssetOpts) *v1.Service {
var clientNodePort int32
if local {
clientNodePort = 32379
}
return &v1.Service{
TypeMeta: metav1.TypeMeta{
Kind: "Service",
APIVersion: "v1",
},
ObjectMeta: objectMeta(etcdName, labels(etcdName), nil, opts.Namespace),
Spec: v... | [
"func",
"EtcdNodePortService",
"(",
"local",
"bool",
",",
"opts",
"*",
"AssetOpts",
")",
"*",
"v1",
".",
"Service",
"{",
"var",
"clientNodePort",
"int32",
"\n",
"if",
"local",
"{",
"clientNodePort",
"=",
"32379",
"\n",
"}",
"\n",
"return",
"&",
"v1",
"."... | // EtcdNodePortService returns a NodePort etcd service. This will let non-etcd
// pods talk to etcd | [
"EtcdNodePortService",
"returns",
"a",
"NodePort",
"etcd",
"service",
".",
"This",
"will",
"let",
"non",
"-",
"etcd",
"pods",
"talk",
"to",
"etcd"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L897-L922 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | EtcdHeadlessService | func EtcdHeadlessService(opts *AssetOpts) *v1.Service {
return &v1.Service{
TypeMeta: metav1.TypeMeta{
Kind: "Service",
APIVersion: "v1",
},
ObjectMeta: objectMeta(etcdHeadlessServiceName, labels(etcdName), nil, opts.Namespace),
Spec: v1.ServiceSpec{
Selector: map[string]string{
"app": etcdN... | go | func EtcdHeadlessService(opts *AssetOpts) *v1.Service {
return &v1.Service{
TypeMeta: metav1.TypeMeta{
Kind: "Service",
APIVersion: "v1",
},
ObjectMeta: objectMeta(etcdHeadlessServiceName, labels(etcdName), nil, opts.Namespace),
Spec: v1.ServiceSpec{
Selector: map[string]string{
"app": etcdN... | [
"func",
"EtcdHeadlessService",
"(",
"opts",
"*",
"AssetOpts",
")",
"*",
"v1",
".",
"Service",
"{",
"return",
"&",
"v1",
".",
"Service",
"{",
"TypeMeta",
":",
"metav1",
".",
"TypeMeta",
"{",
"Kind",
":",
"\"Service\"",
",",
"APIVersion",
":",
"\"v1\"",
",... | // EtcdHeadlessService returns a headless etcd service, which is only for DNS
// resolution. | [
"EtcdHeadlessService",
"returns",
"a",
"headless",
"etcd",
"service",
"which",
"is",
"only",
"for",
"DNS",
"resolution",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L926-L946 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | EtcdStatefulSet | func EtcdStatefulSet(opts *AssetOpts, backend backend, diskSpace int) interface{} {
mem := resource.MustParse(opts.EtcdMemRequest)
cpu := resource.MustParse(opts.EtcdCPURequest)
initialCluster := make([]string, 0, opts.EtcdNodes)
for i := 0; i < opts.EtcdNodes; i++ {
url := fmt.Sprintf("http://etcd-%d.etcd-headle... | go | func EtcdStatefulSet(opts *AssetOpts, backend backend, diskSpace int) interface{} {
mem := resource.MustParse(opts.EtcdMemRequest)
cpu := resource.MustParse(opts.EtcdCPURequest)
initialCluster := make([]string, 0, opts.EtcdNodes)
for i := 0; i < opts.EtcdNodes; i++ {
url := fmt.Sprintf("http://etcd-%d.etcd-headle... | [
"func",
"EtcdStatefulSet",
"(",
"opts",
"*",
"AssetOpts",
",",
"backend",
"backend",
",",
"diskSpace",
"int",
")",
"interface",
"{",
"}",
"{",
"mem",
":=",
"resource",
".",
"MustParse",
"(",
"opts",
".",
"EtcdMemRequest",
")",
"\n",
"cpu",
":=",
"resource"... | // EtcdStatefulSet returns a stateful set that manages an etcd cluster | [
"EtcdStatefulSet",
"returns",
"a",
"stateful",
"set",
"that",
"manages",
"an",
"etcd",
"cluster"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L949-L1108 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | DashDeployment | func DashDeployment(opts *AssetOpts) *apps.Deployment {
return &apps.Deployment{
TypeMeta: metav1.TypeMeta{
Kind: "Deployment",
APIVersion: "apps/v1beta1",
},
ObjectMeta: objectMeta(dashName, labels(dashName), nil, opts.Namespace),
Spec: apps.DeploymentSpec{
Selector: &metav1.LabelSelector{
... | go | func DashDeployment(opts *AssetOpts) *apps.Deployment {
return &apps.Deployment{
TypeMeta: metav1.TypeMeta{
Kind: "Deployment",
APIVersion: "apps/v1beta1",
},
ObjectMeta: objectMeta(dashName, labels(dashName), nil, opts.Namespace),
Spec: apps.DeploymentSpec{
Selector: &metav1.LabelSelector{
... | [
"func",
"DashDeployment",
"(",
"opts",
"*",
"AssetOpts",
")",
"*",
"apps",
".",
"Deployment",
"{",
"return",
"&",
"apps",
".",
"Deployment",
"{",
"TypeMeta",
":",
"metav1",
".",
"TypeMeta",
"{",
"Kind",
":",
"\"Deployment\"",
",",
"APIVersion",
":",
"\"app... | // DashDeployment creates a Deployment for the pachyderm dashboard. | [
"DashDeployment",
"creates",
"a",
"Deployment",
"for",
"the",
"pachyderm",
"dashboard",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L1111-L1154 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | DashService | func DashService(opts *AssetOpts) *v1.Service {
return &v1.Service{
TypeMeta: metav1.TypeMeta{
Kind: "Service",
APIVersion: "v1",
},
ObjectMeta: objectMeta(dashName, labels(dashName), nil, opts.Namespace),
Spec: v1.ServiceSpec{
Type: v1.ServiceTypeNodePort,
Selector: labels(dashName),
... | go | func DashService(opts *AssetOpts) *v1.Service {
return &v1.Service{
TypeMeta: metav1.TypeMeta{
Kind: "Service",
APIVersion: "v1",
},
ObjectMeta: objectMeta(dashName, labels(dashName), nil, opts.Namespace),
Spec: v1.ServiceSpec{
Type: v1.ServiceTypeNodePort,
Selector: labels(dashName),
... | [
"func",
"DashService",
"(",
"opts",
"*",
"AssetOpts",
")",
"*",
"v1",
".",
"Service",
"{",
"return",
"&",
"v1",
".",
"Service",
"{",
"TypeMeta",
":",
"metav1",
".",
"TypeMeta",
"{",
"Kind",
":",
"\"Service\"",
",",
"APIVersion",
":",
"\"v1\"",
",",
"}"... | // DashService creates a Service for the pachyderm dashboard. | [
"DashService",
"creates",
"a",
"Service",
"for",
"the",
"pachyderm",
"dashboard",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L1157-L1181 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | WriteSecret | func WriteSecret(encoder Encoder, data map[string][]byte, opts *AssetOpts) error {
if opts.DashOnly {
return nil
}
secret := &v1.Secret{
TypeMeta: metav1.TypeMeta{
Kind: "Secret",
APIVersion: "v1",
},
ObjectMeta: objectMeta(client.StorageSecretName, labels(client.StorageSecretName), nil, opts.Nam... | go | func WriteSecret(encoder Encoder, data map[string][]byte, opts *AssetOpts) error {
if opts.DashOnly {
return nil
}
secret := &v1.Secret{
TypeMeta: metav1.TypeMeta{
Kind: "Secret",
APIVersion: "v1",
},
ObjectMeta: objectMeta(client.StorageSecretName, labels(client.StorageSecretName), nil, opts.Nam... | [
"func",
"WriteSecret",
"(",
"encoder",
"Encoder",
",",
"data",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
",",
"opts",
"*",
"AssetOpts",
")",
"error",
"{",
"if",
"opts",
".",
"DashOnly",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"secret",
":=",
"&",
... | // WriteSecret writes a JSON-encoded k8s secret to the given writer.
// The secret uses the given map as data. | [
"WriteSecret",
"writes",
"a",
"JSON",
"-",
"encoded",
"k8s",
"secret",
"to",
"the",
"given",
"writer",
".",
"The",
"secret",
"uses",
"the",
"given",
"map",
"as",
"data",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L1211-L1224 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | GoogleSecret | func GoogleSecret(bucket string, cred string) map[string][]byte {
return map[string][]byte{
"google-bucket": []byte(bucket),
"google-cred": []byte(cred),
}
} | go | func GoogleSecret(bucket string, cred string) map[string][]byte {
return map[string][]byte{
"google-bucket": []byte(bucket),
"google-cred": []byte(cred),
}
} | [
"func",
"GoogleSecret",
"(",
"bucket",
"string",
",",
"cred",
"string",
")",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
"{",
"return",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
"{",
"\"google-bucket\"",
":",
"[",
"]",
"byte",
"(",
"bucket",
")",... | // GoogleSecret creates a google secret with a bucket name. | [
"GoogleSecret",
"creates",
"a",
"google",
"secret",
"with",
"a",
"bucket",
"name",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L1280-L1285 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | WriteDashboardAssets | func WriteDashboardAssets(encoder Encoder, opts *AssetOpts) error {
if err := encoder.Encode(DashService(opts)); err != nil {
return err
}
return encoder.Encode(DashDeployment(opts))
} | go | func WriteDashboardAssets(encoder Encoder, opts *AssetOpts) error {
if err := encoder.Encode(DashService(opts)); err != nil {
return err
}
return encoder.Encode(DashDeployment(opts))
} | [
"func",
"WriteDashboardAssets",
"(",
"encoder",
"Encoder",
",",
"opts",
"*",
"AssetOpts",
")",
"error",
"{",
"if",
"err",
":=",
"encoder",
".",
"Encode",
"(",
"DashService",
"(",
"opts",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}... | // WriteDashboardAssets writes the k8s config for deploying the Pachyderm
// dashboard to 'encoder' | [
"WriteDashboardAssets",
"writes",
"the",
"k8s",
"config",
"for",
"deploying",
"the",
"Pachyderm",
"dashboard",
"to",
"encoder"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L1301-L1306 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | WriteLocalAssets | func WriteLocalAssets(encoder Encoder, opts *AssetOpts, hostPath string) error {
if err := WriteAssets(encoder, opts, localBackend, localBackend, 1 /* = volume size (gb) */, hostPath); err != nil {
return err
}
if secretErr := WriteSecret(encoder, LocalSecret(), opts); secretErr != nil {
return secretErr
}
ret... | go | func WriteLocalAssets(encoder Encoder, opts *AssetOpts, hostPath string) error {
if err := WriteAssets(encoder, opts, localBackend, localBackend, 1 /* = volume size (gb) */, hostPath); err != nil {
return err
}
if secretErr := WriteSecret(encoder, LocalSecret(), opts); secretErr != nil {
return secretErr
}
ret... | [
"func",
"WriteLocalAssets",
"(",
"encoder",
"Encoder",
",",
"opts",
"*",
"AssetOpts",
",",
"hostPath",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"WriteAssets",
"(",
"encoder",
",",
"opts",
",",
"localBackend",
",",
"localBackend",
",",
"1",
",",
"hos... | // WriteLocalAssets writes assets to a local backend. | [
"WriteLocalAssets",
"writes",
"assets",
"to",
"a",
"local",
"backend",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L1463-L1471 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | WriteCustomAssets | func WriteCustomAssets(encoder Encoder, opts *AssetOpts, args []string, objectStoreBackend string,
persistentDiskBackend string, secure, isS3V2 bool) error {
switch objectStoreBackend {
case "s3":
if len(args) != s3CustomArgs {
return fmt.Errorf("Expected %d arguments for disk+s3 backend", s3CustomArgs)
}
v... | go | func WriteCustomAssets(encoder Encoder, opts *AssetOpts, args []string, objectStoreBackend string,
persistentDiskBackend string, secure, isS3V2 bool) error {
switch objectStoreBackend {
case "s3":
if len(args) != s3CustomArgs {
return fmt.Errorf("Expected %d arguments for disk+s3 backend", s3CustomArgs)
}
v... | [
"func",
"WriteCustomAssets",
"(",
"encoder",
"Encoder",
",",
"opts",
"*",
"AssetOpts",
",",
"args",
"[",
"]",
"string",
",",
"objectStoreBackend",
"string",
",",
"persistentDiskBackend",
"string",
",",
"secure",
",",
"isS3V2",
"bool",
")",
"error",
"{",
"switc... | // WriteCustomAssets writes assets to a custom combination of object-store and persistent disk. | [
"WriteCustomAssets",
"writes",
"assets",
"to",
"a",
"custom",
"combination",
"of",
"object",
"-",
"store",
"and",
"persistent",
"disk",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L1474-L1505 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | WriteAmazonAssets | func WriteAmazonAssets(encoder Encoder, opts *AssetOpts, region string, bucket string, volumeSize int, creds *AmazonCreds, cloudfrontDistro string) error {
if err := WriteAssets(encoder, opts, amazonBackend, amazonBackend, volumeSize, ""); err != nil {
return err
}
var secret map[string][]byte
if creds == nil {
... | go | func WriteAmazonAssets(encoder Encoder, opts *AssetOpts, region string, bucket string, volumeSize int, creds *AmazonCreds, cloudfrontDistro string) error {
if err := WriteAssets(encoder, opts, amazonBackend, amazonBackend, volumeSize, ""); err != nil {
return err
}
var secret map[string][]byte
if creds == nil {
... | [
"func",
"WriteAmazonAssets",
"(",
"encoder",
"Encoder",
",",
"opts",
"*",
"AssetOpts",
",",
"region",
"string",
",",
"bucket",
"string",
",",
"volumeSize",
"int",
",",
"creds",
"*",
"AmazonCreds",
",",
"cloudfrontDistro",
"string",
")",
"error",
"{",
"if",
"... | // WriteAmazonAssets writes assets to an amazon backend. | [
"WriteAmazonAssets",
"writes",
"assets",
"to",
"an",
"amazon",
"backend",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L1523-L1536 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | WriteGoogleAssets | func WriteGoogleAssets(encoder Encoder, opts *AssetOpts, bucket string, cred string, volumeSize int) error {
if err := WriteAssets(encoder, opts, googleBackend, googleBackend, volumeSize, ""); err != nil {
return err
}
return WriteSecret(encoder, GoogleSecret(bucket, cred), opts)
} | go | func WriteGoogleAssets(encoder Encoder, opts *AssetOpts, bucket string, cred string, volumeSize int) error {
if err := WriteAssets(encoder, opts, googleBackend, googleBackend, volumeSize, ""); err != nil {
return err
}
return WriteSecret(encoder, GoogleSecret(bucket, cred), opts)
} | [
"func",
"WriteGoogleAssets",
"(",
"encoder",
"Encoder",
",",
"opts",
"*",
"AssetOpts",
",",
"bucket",
"string",
",",
"cred",
"string",
",",
"volumeSize",
"int",
")",
"error",
"{",
"if",
"err",
":=",
"WriteAssets",
"(",
"encoder",
",",
"opts",
",",
"googleB... | // WriteGoogleAssets writes assets to a google backend. | [
"WriteGoogleAssets",
"writes",
"assets",
"to",
"a",
"google",
"backend",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L1539-L1544 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | WriteMicrosoftAssets | func WriteMicrosoftAssets(encoder Encoder, opts *AssetOpts, container string, id string, secret string, volumeSize int) error {
if err := WriteAssets(encoder, opts, microsoftBackend, microsoftBackend, volumeSize, ""); err != nil {
return err
}
return WriteSecret(encoder, MicrosoftSecret(container, id, secret), opt... | go | func WriteMicrosoftAssets(encoder Encoder, opts *AssetOpts, container string, id string, secret string, volumeSize int) error {
if err := WriteAssets(encoder, opts, microsoftBackend, microsoftBackend, volumeSize, ""); err != nil {
return err
}
return WriteSecret(encoder, MicrosoftSecret(container, id, secret), opt... | [
"func",
"WriteMicrosoftAssets",
"(",
"encoder",
"Encoder",
",",
"opts",
"*",
"AssetOpts",
",",
"container",
"string",
",",
"id",
"string",
",",
"secret",
"string",
",",
"volumeSize",
"int",
")",
"error",
"{",
"if",
"err",
":=",
"WriteAssets",
"(",
"encoder",... | // WriteMicrosoftAssets writes assets to a microsoft backend | [
"WriteMicrosoftAssets",
"writes",
"assets",
"to",
"a",
"microsoft",
"backend"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L1547-L1552 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | Images | func Images(opts *AssetOpts) []string {
return []string{
versionedWorkerImage(opts),
etcdImage,
grpcProxyImage,
pauseImage,
versionedPachdImage(opts),
opts.DashImage,
}
} | go | func Images(opts *AssetOpts) []string {
return []string{
versionedWorkerImage(opts),
etcdImage,
grpcProxyImage,
pauseImage,
versionedPachdImage(opts),
opts.DashImage,
}
} | [
"func",
"Images",
"(",
"opts",
"*",
"AssetOpts",
")",
"[",
"]",
"string",
"{",
"return",
"[",
"]",
"string",
"{",
"versionedWorkerImage",
"(",
"opts",
")",
",",
"etcdImage",
",",
"grpcProxyImage",
",",
"pauseImage",
",",
"versionedPachdImage",
"(",
"opts",
... | // Images returns a list of all the images that are used by a pachyderm deployment. | [
"Images",
"returns",
"a",
"list",
"of",
"all",
"the",
"images",
"that",
"are",
"used",
"by",
"a",
"pachyderm",
"deployment",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L1555-L1564 | test |
pachyderm/pachyderm | src/server/pkg/deploy/assets/assets.go | AddRegistry | func AddRegistry(registry string, imageName string) string {
if registry == "" {
return imageName
}
parts := strings.Split(imageName, "/")
if len(parts) == 3 {
parts = parts[1:]
}
return path.Join(registry, parts[0], parts[1])
} | go | func AddRegistry(registry string, imageName string) string {
if registry == "" {
return imageName
}
parts := strings.Split(imageName, "/")
if len(parts) == 3 {
parts = parts[1:]
}
return path.Join(registry, parts[0], parts[1])
} | [
"func",
"AddRegistry",
"(",
"registry",
"string",
",",
"imageName",
"string",
")",
"string",
"{",
"if",
"registry",
"==",
"\"\"",
"{",
"return",
"imageName",
"\n",
"}",
"\n",
"parts",
":=",
"strings",
".",
"Split",
"(",
"imageName",
",",
"\"/\"",
")",
"\... | // AddRegistry switches the registry that an image is targeting, unless registry is blank | [
"AddRegistry",
"switches",
"the",
"registry",
"that",
"an",
"image",
"is",
"targeting",
"unless",
"registry",
"is",
"blank"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L1583-L1592 | test |
pachyderm/pachyderm | src/server/pkg/backoff/exponential.go | withCanonicalRandomizationFactor | func (b *ExponentialBackOff) withCanonicalRandomizationFactor() *ExponentialBackOff {
if b.RandomizationFactor < 0 {
b.RandomizationFactor = 0
} else if b.RandomizationFactor > 1 {
b.RandomizationFactor = 1
}
return b
} | go | func (b *ExponentialBackOff) withCanonicalRandomizationFactor() *ExponentialBackOff {
if b.RandomizationFactor < 0 {
b.RandomizationFactor = 0
} else if b.RandomizationFactor > 1 {
b.RandomizationFactor = 1
}
return b
} | [
"func",
"(",
"b",
"*",
"ExponentialBackOff",
")",
"withCanonicalRandomizationFactor",
"(",
")",
"*",
"ExponentialBackOff",
"{",
"if",
"b",
".",
"RandomizationFactor",
"<",
"0",
"{",
"b",
".",
"RandomizationFactor",
"=",
"0",
"\n",
"}",
"else",
"if",
"b",
"."... | // withCanonicalRandomizationFactor is a utility function used by all
// NewXYZBackoff functions to clamp b.RandomizationFactor to either 0 or 1 | [
"withCanonicalRandomizationFactor",
"is",
"a",
"utility",
"function",
"used",
"by",
"all",
"NewXYZBackoff",
"functions",
"to",
"clamp",
"b",
".",
"RandomizationFactor",
"to",
"either",
"0",
"or",
"1"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/backoff/exponential.go#L84-L91 | test |
pachyderm/pachyderm | src/server/pkg/backoff/exponential.go | Reset | func (b *ExponentialBackOff) Reset() {
b.currentInterval = b.InitialInterval
b.startTime = b.Clock.Now()
} | go | func (b *ExponentialBackOff) Reset() {
b.currentInterval = b.InitialInterval
b.startTime = b.Clock.Now()
} | [
"func",
"(",
"b",
"*",
"ExponentialBackOff",
")",
"Reset",
"(",
")",
"{",
"b",
".",
"currentInterval",
"=",
"b",
".",
"InitialInterval",
"\n",
"b",
".",
"startTime",
"=",
"b",
".",
"Clock",
".",
"Now",
"(",
")",
"\n",
"}"
] | // Reset the interval back to the initial retry interval and restarts the timer. | [
"Reset",
"the",
"interval",
"back",
"to",
"the",
"initial",
"retry",
"interval",
"and",
"restarts",
"the",
"timer",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/backoff/exponential.go#L169-L172 | test |
pachyderm/pachyderm | src/server/pkg/backoff/exponential.go | incrementCurrentInterval | func (b *ExponentialBackOff) incrementCurrentInterval() {
// Check for overflow, if overflow is detected set the current interval to the max interval.
if float64(b.currentInterval) >= float64(b.MaxInterval)/b.Multiplier {
b.currentInterval = b.MaxInterval
} else {
b.currentInterval = time.Duration(float64(b.curr... | go | func (b *ExponentialBackOff) incrementCurrentInterval() {
// Check for overflow, if overflow is detected set the current interval to the max interval.
if float64(b.currentInterval) >= float64(b.MaxInterval)/b.Multiplier {
b.currentInterval = b.MaxInterval
} else {
b.currentInterval = time.Duration(float64(b.curr... | [
"func",
"(",
"b",
"*",
"ExponentialBackOff",
")",
"incrementCurrentInterval",
"(",
")",
"{",
"if",
"float64",
"(",
"b",
".",
"currentInterval",
")",
">=",
"float64",
"(",
"b",
".",
"MaxInterval",
")",
"/",
"b",
".",
"Multiplier",
"{",
"b",
".",
"currentI... | // Increments the current interval by multiplying it with the multiplier. | [
"Increments",
"the",
"current",
"interval",
"by",
"multiplying",
"it",
"with",
"the",
"multiplier",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/backoff/exponential.go#L194-L201 | test |
pachyderm/pachyderm | src/server/pfs/server/server.go | NewBlockAPIServer | func NewBlockAPIServer(dir string, cacheBytes int64, backend string, etcdAddress string) (BlockAPIServer, error) {
switch backend {
case MinioBackendEnvVar:
// S3 compatible doesn't like leading slashes
if len(dir) > 0 && dir[0] == '/' {
dir = dir[1:]
}
blockAPIServer, err := newMinioBlockAPIServer(dir, ca... | go | func NewBlockAPIServer(dir string, cacheBytes int64, backend string, etcdAddress string) (BlockAPIServer, error) {
switch backend {
case MinioBackendEnvVar:
// S3 compatible doesn't like leading slashes
if len(dir) > 0 && dir[0] == '/' {
dir = dir[1:]
}
blockAPIServer, err := newMinioBlockAPIServer(dir, ca... | [
"func",
"NewBlockAPIServer",
"(",
"dir",
"string",
",",
"cacheBytes",
"int64",
",",
"backend",
"string",
",",
"etcdAddress",
"string",
")",
"(",
"BlockAPIServer",
",",
"error",
")",
"{",
"switch",
"backend",
"{",
"case",
"MinioBackendEnvVar",
":",
"if",
"len",... | // NewBlockAPIServer creates a BlockAPIServer using the credentials it finds in
// the environment | [
"NewBlockAPIServer",
"creates",
"a",
"BlockAPIServer",
"using",
"the",
"credentials",
"it",
"finds",
"in",
"the",
"environment"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/server/server.go#L35-L79 | test |
pachyderm/pachyderm | src/server/pkg/storage/chunk/util.go | LocalStorage | func LocalStorage(tb testing.TB) (obj.Client, *Storage) {
wd, err := os.Getwd()
require.NoError(tb, err)
objC, err := obj.NewLocalClient(wd)
require.NoError(tb, err)
return objC, NewStorage(objC, Prefix)
} | go | func LocalStorage(tb testing.TB) (obj.Client, *Storage) {
wd, err := os.Getwd()
require.NoError(tb, err)
objC, err := obj.NewLocalClient(wd)
require.NoError(tb, err)
return objC, NewStorage(objC, Prefix)
} | [
"func",
"LocalStorage",
"(",
"tb",
"testing",
".",
"TB",
")",
"(",
"obj",
".",
"Client",
",",
"*",
"Storage",
")",
"{",
"wd",
",",
"err",
":=",
"os",
".",
"Getwd",
"(",
")",
"\n",
"require",
".",
"NoError",
"(",
"tb",
",",
"err",
")",
"\n",
"ob... | // LocalStorage creates a local chunk storage instance.
// Useful for storage layer tests. | [
"LocalStorage",
"creates",
"a",
"local",
"chunk",
"storage",
"instance",
".",
"Useful",
"for",
"storage",
"layer",
"tests",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/storage/chunk/util.go#L18-L24 | test |
pachyderm/pachyderm | src/server/worker/master.go | deleteJob | func (a *APIServer) deleteJob(stm col.STM, jobPtr *pps.EtcdJobInfo) error {
pipelinePtr := &pps.EtcdPipelineInfo{}
if err := a.pipelines.ReadWrite(stm).Update(jobPtr.Pipeline.Name, pipelinePtr, func() error {
if pipelinePtr.JobCounts == nil {
pipelinePtr.JobCounts = make(map[int32]int32)
}
if pipelinePtr.Job... | go | func (a *APIServer) deleteJob(stm col.STM, jobPtr *pps.EtcdJobInfo) error {
pipelinePtr := &pps.EtcdPipelineInfo{}
if err := a.pipelines.ReadWrite(stm).Update(jobPtr.Pipeline.Name, pipelinePtr, func() error {
if pipelinePtr.JobCounts == nil {
pipelinePtr.JobCounts = make(map[int32]int32)
}
if pipelinePtr.Job... | [
"func",
"(",
"a",
"*",
"APIServer",
")",
"deleteJob",
"(",
"stm",
"col",
".",
"STM",
",",
"jobPtr",
"*",
"pps",
".",
"EtcdJobInfo",
")",
"error",
"{",
"pipelinePtr",
":=",
"&",
"pps",
".",
"EtcdPipelineInfo",
"{",
"}",
"\n",
"if",
"err",
":=",
"a",
... | // deleteJob is identical to updateJobState, except that jobPtr points to a job
// that should be deleted rather than marked failed. Jobs may be deleted if
// their output commit is deleted. | [
"deleteJob",
"is",
"identical",
"to",
"updateJobState",
"except",
"that",
"jobPtr",
"points",
"to",
"a",
"job",
"that",
"should",
"be",
"deleted",
"rather",
"than",
"marked",
"failed",
".",
"Jobs",
"may",
"be",
"deleted",
"if",
"their",
"output",
"commit",
"... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/worker/master.go#L766-L780 | test |
pachyderm/pachyderm | src/server/pfs/s3/util.go | writeXML | func writeXML(w http.ResponseWriter, r *http.Request, code int, v interface{}) {
w.Header().Set("Content-Type", "application/xml")
w.WriteHeader(code)
encoder := xml.NewEncoder(w)
if err := encoder.Encode(v); err != nil {
// just log a message since a response has already been partially
// written
requestLogg... | go | func writeXML(w http.ResponseWriter, r *http.Request, code int, v interface{}) {
w.Header().Set("Content-Type", "application/xml")
w.WriteHeader(code)
encoder := xml.NewEncoder(w)
if err := encoder.Encode(v); err != nil {
// just log a message since a response has already been partially
// written
requestLogg... | [
"func",
"writeXML",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"code",
"int",
",",
"v",
"interface",
"{",
"}",
")",
"{",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"Content-Type\"",
",",
"\"application/... | // writeXML serializes a struct to a response as XML | [
"writeXML",
"serializes",
"a",
"struct",
"to",
"a",
"response",
"as",
"XML"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/s3/util.go#L24-L33 | test |
pachyderm/pachyderm | src/server/admin/server/convert1_7.go | clean1_7HashtreePath | func clean1_7HashtreePath(p string) string {
if !strings.HasPrefix(p, "/") {
p = "/" + p
}
return default1_7HashtreeRoot(pathlib.Clean(p))
} | go | func clean1_7HashtreePath(p string) string {
if !strings.HasPrefix(p, "/") {
p = "/" + p
}
return default1_7HashtreeRoot(pathlib.Clean(p))
} | [
"func",
"clean1_7HashtreePath",
"(",
"p",
"string",
")",
"string",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"p",
",",
"\"/\"",
")",
"{",
"p",
"=",
"\"/\"",
"+",
"p",
"\n",
"}",
"\n",
"return",
"default1_7HashtreeRoot",
"(",
"pathlib",
".",
"Cl... | // clean canonicalizes 'path' for a Pachyderm 1.7 hashtree | [
"clean",
"canonicalizes",
"path",
"for",
"a",
"Pachyderm",
"1",
".",
"7",
"hashtree"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/admin/server/convert1_7.go#L303-L308 | test |
pachyderm/pachyderm | src/client/client.go | NewFromAddress | func NewFromAddress(addr string, options ...Option) (*APIClient, error) {
// Apply creation options
settings := clientSettings{
maxConcurrentStreams: DefaultMaxConcurrentStreams,
dialTimeout: DefaultDialTimeout,
}
for _, option := range options {
if err := option(&settings); err != nil {
return ni... | go | func NewFromAddress(addr string, options ...Option) (*APIClient, error) {
// Apply creation options
settings := clientSettings{
maxConcurrentStreams: DefaultMaxConcurrentStreams,
dialTimeout: DefaultDialTimeout,
}
for _, option := range options {
if err := option(&settings); err != nil {
return ni... | [
"func",
"NewFromAddress",
"(",
"addr",
"string",
",",
"options",
"...",
"Option",
")",
"(",
"*",
"APIClient",
",",
"error",
")",
"{",
"settings",
":=",
"clientSettings",
"{",
"maxConcurrentStreams",
":",
"DefaultMaxConcurrentStreams",
",",
"dialTimeout",
":",
"D... | // NewFromAddress constructs a new APIClient for the server at addr. | [
"NewFromAddress",
"constructs",
"a",
"new",
"APIClient",
"for",
"the",
"server",
"at",
"addr",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/client.go#L147-L167 | test |
pachyderm/pachyderm | src/client/client.go | getUserMachineAddrAndOpts | func getUserMachineAddrAndOpts(cfg *config.Config) (string, []Option, error) {
// 1) PACHD_ADDRESS environment variable (shell-local) overrides global config
if envAddr, ok := os.LookupEnv("PACHD_ADDRESS"); ok {
if !strings.Contains(envAddr, ":") {
envAddr = fmt.Sprintf("%s:%s", envAddr, DefaultPachdNodePort)
... | go | func getUserMachineAddrAndOpts(cfg *config.Config) (string, []Option, error) {
// 1) PACHD_ADDRESS environment variable (shell-local) overrides global config
if envAddr, ok := os.LookupEnv("PACHD_ADDRESS"); ok {
if !strings.Contains(envAddr, ":") {
envAddr = fmt.Sprintf("%s:%s", envAddr, DefaultPachdNodePort)
... | [
"func",
"getUserMachineAddrAndOpts",
"(",
"cfg",
"*",
"config",
".",
"Config",
")",
"(",
"string",
",",
"[",
"]",
"Option",
",",
"error",
")",
"{",
"if",
"envAddr",
",",
"ok",
":=",
"os",
".",
"LookupEnv",
"(",
"\"PACHD_ADDRESS\"",
")",
";",
"ok",
"{",... | // getUserMachineAddrAndOpts is a helper for NewOnUserMachine that uses
// environment variables, config files, etc to figure out which address a user
// running a command should connect to. | [
"getUserMachineAddrAndOpts",
"is",
"a",
"helper",
"for",
"NewOnUserMachine",
"that",
"uses",
"environment",
"variables",
"config",
"files",
"etc",
"to",
"figure",
"out",
"which",
"address",
"a",
"user",
"running",
"a",
"command",
"should",
"connect",
"to",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/client.go#L276-L308 | test |
pachyderm/pachyderm | src/client/client.go | NewInCluster | func NewInCluster(options ...Option) (*APIClient, error) {
host, ok := os.LookupEnv("PACHD_SERVICE_HOST")
if !ok {
return nil, fmt.Errorf("PACHD_SERVICE_HOST not set")
}
port, ok := os.LookupEnv("PACHD_SERVICE_PORT")
if !ok {
return nil, fmt.Errorf("PACHD_SERVICE_PORT not set")
}
// create new pachctl client... | go | func NewInCluster(options ...Option) (*APIClient, error) {
host, ok := os.LookupEnv("PACHD_SERVICE_HOST")
if !ok {
return nil, fmt.Errorf("PACHD_SERVICE_HOST not set")
}
port, ok := os.LookupEnv("PACHD_SERVICE_PORT")
if !ok {
return nil, fmt.Errorf("PACHD_SERVICE_PORT not set")
}
// create new pachctl client... | [
"func",
"NewInCluster",
"(",
"options",
"...",
"Option",
")",
"(",
"*",
"APIClient",
",",
"error",
")",
"{",
"host",
",",
"ok",
":=",
"os",
".",
"LookupEnv",
"(",
"\"PACHD_SERVICE_HOST\"",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
... | // NewInCluster constructs a new APIClient using env vars that Kubernetes creates.
// This should be used to access Pachyderm from within a Kubernetes cluster
// with Pachyderm running on it. | [
"NewInCluster",
"constructs",
"a",
"new",
"APIClient",
"using",
"env",
"vars",
"that",
"Kubernetes",
"creates",
".",
"This",
"should",
"be",
"used",
"to",
"access",
"Pachyderm",
"from",
"within",
"a",
"Kubernetes",
"cluster",
"with",
"Pachyderm",
"running",
"on"... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/client.go#L415-L426 | test |
pachyderm/pachyderm | src/client/client.go | Close | func (c *APIClient) Close() error {
if err := c.clientConn.Close(); err != nil {
return err
}
if c.portForwarder != nil {
c.portForwarder.Close()
}
return nil
} | go | func (c *APIClient) Close() error {
if err := c.clientConn.Close(); err != nil {
return err
}
if c.portForwarder != nil {
c.portForwarder.Close()
}
return nil
} | [
"func",
"(",
"c",
"*",
"APIClient",
")",
"Close",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"c",
".",
"clientConn",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"c",
".",
"portForwarder",
"!=",
... | // Close the connection to gRPC | [
"Close",
"the",
"connection",
"to",
"gRPC"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/client.go#L429-L439 | test |
pachyderm/pachyderm | src/client/client.go | DeleteAll | func (c APIClient) DeleteAll() error {
if _, err := c.AuthAPIClient.Deactivate(
c.Ctx(),
&auth.DeactivateRequest{},
); err != nil && !auth.IsErrNotActivated(err) {
return grpcutil.ScrubGRPC(err)
}
if _, err := c.PpsAPIClient.DeleteAll(
c.Ctx(),
&types.Empty{},
); err != nil {
return grpcutil.ScrubGRPC(... | go | func (c APIClient) DeleteAll() error {
if _, err := c.AuthAPIClient.Deactivate(
c.Ctx(),
&auth.DeactivateRequest{},
); err != nil && !auth.IsErrNotActivated(err) {
return grpcutil.ScrubGRPC(err)
}
if _, err := c.PpsAPIClient.DeleteAll(
c.Ctx(),
&types.Empty{},
); err != nil {
return grpcutil.ScrubGRPC(... | [
"func",
"(",
"c",
"APIClient",
")",
"DeleteAll",
"(",
")",
"error",
"{",
"if",
"_",
",",
"err",
":=",
"c",
".",
"AuthAPIClient",
".",
"Deactivate",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"auth",
".",
"DeactivateRequest",
"{",
"}",
",",
")",
";... | // DeleteAll deletes everything in the cluster.
// Use with caution, there is no undo. | [
"DeleteAll",
"deletes",
"everything",
"in",
"the",
"cluster",
".",
"Use",
"with",
"caution",
"there",
"is",
"no",
"undo",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/client.go#L443-L463 | test |
pachyderm/pachyderm | src/client/client.go | SetMaxConcurrentStreams | func (c APIClient) SetMaxConcurrentStreams(n int) {
c.limiter = limit.New(n)
} | go | func (c APIClient) SetMaxConcurrentStreams(n int) {
c.limiter = limit.New(n)
} | [
"func",
"(",
"c",
"APIClient",
")",
"SetMaxConcurrentStreams",
"(",
"n",
"int",
")",
"{",
"c",
".",
"limiter",
"=",
"limit",
".",
"New",
"(",
"n",
")",
"\n",
"}"
] | // SetMaxConcurrentStreams Sets the maximum number of concurrent streams the
// client can have. It is not safe to call this operations while operations are
// outstanding. | [
"SetMaxConcurrentStreams",
"Sets",
"the",
"maximum",
"number",
"of",
"concurrent",
"streams",
"the",
"client",
"can",
"have",
".",
"It",
"is",
"not",
"safe",
"to",
"call",
"this",
"operations",
"while",
"operations",
"are",
"outstanding",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/client.go#L468-L470 | test |
pachyderm/pachyderm | src/client/client.go | WithCtx | func (c *APIClient) WithCtx(ctx context.Context) *APIClient {
result := *c // copy c
result.ctx = ctx
return &result
} | go | func (c *APIClient) WithCtx(ctx context.Context) *APIClient {
result := *c // copy c
result.ctx = ctx
return &result
} | [
"func",
"(",
"c",
"*",
"APIClient",
")",
"WithCtx",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"APIClient",
"{",
"result",
":=",
"*",
"c",
"\n",
"result",
".",
"ctx",
"=",
"ctx",
"\n",
"return",
"&",
"result",
"\n",
"}"
] | // WithCtx returns a new APIClient that uses ctx for requests it sends. Note
// that the new APIClient will still use the authentication token and metrics
// metadata of this client, so this is only useful for propagating other
// context-associated metadata. | [
"WithCtx",
"returns",
"a",
"new",
"APIClient",
"that",
"uses",
"ctx",
"for",
"requests",
"it",
"sends",
".",
"Note",
"that",
"the",
"new",
"APIClient",
"will",
"still",
"use",
"the",
"authentication",
"token",
"and",
"metrics",
"metadata",
"of",
"this",
"cli... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/client.go#L578-L582 | test |
pachyderm/pachyderm | src/server/pkg/dlock/dlock.go | NewDLock | func NewDLock(client *etcd.Client, prefix string) DLock {
return &etcdImpl{
client: client,
prefix: prefix,
}
} | go | func NewDLock(client *etcd.Client, prefix string) DLock {
return &etcdImpl{
client: client,
prefix: prefix,
}
} | [
"func",
"NewDLock",
"(",
"client",
"*",
"etcd",
".",
"Client",
",",
"prefix",
"string",
")",
"DLock",
"{",
"return",
"&",
"etcdImpl",
"{",
"client",
":",
"client",
",",
"prefix",
":",
"prefix",
",",
"}",
"\n",
"}"
] | // NewDLock attempts to acquire a distributed lock that locks a given prefix
// in the data store. | [
"NewDLock",
"attempts",
"to",
"acquire",
"a",
"distributed",
"lock",
"that",
"locks",
"a",
"given",
"prefix",
"in",
"the",
"data",
"store",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/dlock/dlock.go#L32-L37 | test |
pachyderm/pachyderm | src/server/worker/api_server.go | DatumID | func (a *APIServer) DatumID(data []*Input) string {
hash := sha256.New()
for _, d := range data {
hash.Write([]byte(d.FileInfo.File.Path))
hash.Write(d.FileInfo.Hash)
}
// InputFileID is a single string id for the data from this input, it's used in logs and in
// the statsTree
return hex.EncodeToString(hash.S... | go | func (a *APIServer) DatumID(data []*Input) string {
hash := sha256.New()
for _, d := range data {
hash.Write([]byte(d.FileInfo.File.Path))
hash.Write(d.FileInfo.Hash)
}
// InputFileID is a single string id for the data from this input, it's used in logs and in
// the statsTree
return hex.EncodeToString(hash.S... | [
"func",
"(",
"a",
"*",
"APIServer",
")",
"DatumID",
"(",
"data",
"[",
"]",
"*",
"Input",
")",
"string",
"{",
"hash",
":=",
"sha256",
".",
"New",
"(",
")",
"\n",
"for",
"_",
",",
"d",
":=",
"range",
"data",
"{",
"hash",
".",
"Write",
"(",
"[",
... | // DatumID computes the id for a datum, this value is used in ListDatum and
// InspectDatum. | [
"DatumID",
"computes",
"the",
"id",
"for",
"a",
"datum",
"this",
"value",
"is",
"used",
"in",
"ListDatum",
"and",
"InspectDatum",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/worker/api_server.go#L179-L188 | test |
pachyderm/pachyderm | src/server/worker/api_server.go | runUserErrorHandlingCode | func (a *APIServer) runUserErrorHandlingCode(ctx context.Context, logger *taggedLogger, environ []string, stats *pps.ProcessStats, rawDatumTimeout *types.Duration) (retErr error) {
logger.Logf("beginning to run user error handling code")
defer func(start time.Time) {
if retErr != nil {
logger.Logf("errored runni... | go | func (a *APIServer) runUserErrorHandlingCode(ctx context.Context, logger *taggedLogger, environ []string, stats *pps.ProcessStats, rawDatumTimeout *types.Duration) (retErr error) {
logger.Logf("beginning to run user error handling code")
defer func(start time.Time) {
if retErr != nil {
logger.Logf("errored runni... | [
"func",
"(",
"a",
"*",
"APIServer",
")",
"runUserErrorHandlingCode",
"(",
"ctx",
"context",
".",
"Context",
",",
"logger",
"*",
"taggedLogger",
",",
"environ",
"[",
"]",
"string",
",",
"stats",
"*",
"pps",
".",
"ProcessStats",
",",
"rawDatumTimeout",
"*",
... | // Run user error code and return the combined output of stdout and stderr. | [
"Run",
"user",
"error",
"code",
"and",
"return",
"the",
"combined",
"output",
"of",
"stdout",
"and",
"stderr",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/worker/api_server.go#L693-L758 | test |
pachyderm/pachyderm | src/server/worker/api_server.go | HashDatum | func HashDatum(pipelineName string, pipelineSalt string, data []*Input) string {
hash := sha256.New()
for _, datum := range data {
hash.Write([]byte(datum.Name))
hash.Write([]byte(datum.FileInfo.File.Path))
hash.Write(datum.FileInfo.Hash)
}
hash.Write([]byte(pipelineName))
hash.Write([]byte(pipelineSalt))
... | go | func HashDatum(pipelineName string, pipelineSalt string, data []*Input) string {
hash := sha256.New()
for _, datum := range data {
hash.Write([]byte(datum.Name))
hash.Write([]byte(datum.FileInfo.File.Path))
hash.Write(datum.FileInfo.Hash)
}
hash.Write([]byte(pipelineName))
hash.Write([]byte(pipelineSalt))
... | [
"func",
"HashDatum",
"(",
"pipelineName",
"string",
",",
"pipelineSalt",
"string",
",",
"data",
"[",
"]",
"*",
"Input",
")",
"string",
"{",
"hash",
":=",
"sha256",
".",
"New",
"(",
")",
"\n",
"for",
"_",
",",
"datum",
":=",
"range",
"data",
"{",
"has... | // HashDatum computes and returns the hash of datum + pipeline, with a
// pipeline-specific prefix. | [
"HashDatum",
"computes",
"and",
"returns",
"the",
"hash",
"of",
"datum",
"+",
"pipeline",
"with",
"a",
"pipeline",
"-",
"specific",
"prefix",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/worker/api_server.go#L1003-L1015 | test |
pachyderm/pachyderm | src/server/worker/api_server.go | HashDatum15 | func HashDatum15(pipelineInfo *pps.PipelineInfo, data []*Input) (string, error) {
hash := sha256.New()
for _, datum := range data {
hash.Write([]byte(datum.Name))
hash.Write([]byte(datum.FileInfo.File.Path))
hash.Write(datum.FileInfo.Hash)
}
// We set env to nil because if env contains more than one elements... | go | func HashDatum15(pipelineInfo *pps.PipelineInfo, data []*Input) (string, error) {
hash := sha256.New()
for _, datum := range data {
hash.Write([]byte(datum.Name))
hash.Write([]byte(datum.FileInfo.File.Path))
hash.Write(datum.FileInfo.Hash)
}
// We set env to nil because if env contains more than one elements... | [
"func",
"HashDatum15",
"(",
"pipelineInfo",
"*",
"pps",
".",
"PipelineInfo",
",",
"data",
"[",
"]",
"*",
"Input",
")",
"(",
"string",
",",
"error",
")",
"{",
"hash",
":=",
"sha256",
".",
"New",
"(",
")",
"\n",
"for",
"_",
",",
"datum",
":=",
"range... | // HashDatum15 computes and returns the hash of datum + pipeline for version <= 1.5.0, with a
// pipeline-specific prefix. | [
"HashDatum15",
"computes",
"and",
"returns",
"the",
"hash",
"of",
"datum",
"+",
"pipeline",
"for",
"version",
"<",
"=",
"1",
".",
"5",
".",
"0",
"with",
"a",
"pipeline",
"-",
"specific",
"prefix",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/worker/api_server.go#L1019-L1046 | test |
pachyderm/pachyderm | src/server/worker/api_server.go | Status | func (a *APIServer) Status(ctx context.Context, _ *types.Empty) (*pps.WorkerStatus, error) {
a.statusMu.Lock()
defer a.statusMu.Unlock()
started, err := types.TimestampProto(a.started)
if err != nil {
return nil, err
}
result := &pps.WorkerStatus{
JobID: a.jobID,
WorkerID: a.workerName,
Started: st... | go | func (a *APIServer) Status(ctx context.Context, _ *types.Empty) (*pps.WorkerStatus, error) {
a.statusMu.Lock()
defer a.statusMu.Unlock()
started, err := types.TimestampProto(a.started)
if err != nil {
return nil, err
}
result := &pps.WorkerStatus{
JobID: a.jobID,
WorkerID: a.workerName,
Started: st... | [
"func",
"(",
"a",
"*",
"APIServer",
")",
"Status",
"(",
"ctx",
"context",
".",
"Context",
",",
"_",
"*",
"types",
".",
"Empty",
")",
"(",
"*",
"pps",
".",
"WorkerStatus",
",",
"error",
")",
"{",
"a",
".",
"statusMu",
".",
"Lock",
"(",
")",
"\n",
... | // Status returns the status of the current worker. | [
"Status",
"returns",
"the",
"status",
"of",
"the",
"current",
"worker",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/worker/api_server.go#L1049-L1064 | test |
pachyderm/pachyderm | src/server/worker/api_server.go | Cancel | func (a *APIServer) Cancel(ctx context.Context, request *CancelRequest) (*CancelResponse, error) {
a.statusMu.Lock()
defer a.statusMu.Unlock()
if request.JobID != a.jobID {
return &CancelResponse{Success: false}, nil
}
if !MatchDatum(request.DataFilters, a.datum()) {
return &CancelResponse{Success: false}, nil... | go | func (a *APIServer) Cancel(ctx context.Context, request *CancelRequest) (*CancelResponse, error) {
a.statusMu.Lock()
defer a.statusMu.Unlock()
if request.JobID != a.jobID {
return &CancelResponse{Success: false}, nil
}
if !MatchDatum(request.DataFilters, a.datum()) {
return &CancelResponse{Success: false}, nil... | [
"func",
"(",
"a",
"*",
"APIServer",
")",
"Cancel",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"CancelRequest",
")",
"(",
"*",
"CancelResponse",
",",
"error",
")",
"{",
"a",
".",
"statusMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"a",
... | // Cancel cancels the currently running datum | [
"Cancel",
"cancels",
"the",
"currently",
"running",
"datum"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/worker/api_server.go#L1067-L1083 | test |
pachyderm/pachyderm | src/server/worker/api_server.go | mergeStats | func mergeStats(x, y *pps.ProcessStats) error {
var err error
if x.DownloadTime, err = plusDuration(x.DownloadTime, y.DownloadTime); err != nil {
return err
}
if x.ProcessTime, err = plusDuration(x.ProcessTime, y.ProcessTime); err != nil {
return err
}
if x.UploadTime, err = plusDuration(x.UploadTime, y.Uploa... | go | func mergeStats(x, y *pps.ProcessStats) error {
var err error
if x.DownloadTime, err = plusDuration(x.DownloadTime, y.DownloadTime); err != nil {
return err
}
if x.ProcessTime, err = plusDuration(x.ProcessTime, y.ProcessTime); err != nil {
return err
}
if x.UploadTime, err = plusDuration(x.UploadTime, y.Uploa... | [
"func",
"mergeStats",
"(",
"x",
",",
"y",
"*",
"pps",
".",
"ProcessStats",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"if",
"x",
".",
"DownloadTime",
",",
"err",
"=",
"plusDuration",
"(",
"x",
".",
"DownloadTime",
",",
"y",
".",
"DownloadTime",
... | // mergeStats merges y into x | [
"mergeStats",
"merges",
"y",
"into",
"x"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/worker/api_server.go#L2202-L2216 | test |
pachyderm/pachyderm | src/server/worker/api_server.go | mergeChunk | func (a *APIServer) mergeChunk(logger *taggedLogger, high int64, result *processResult) (retErr error) {
logger.Logf("starting to merge chunk")
defer func(start time.Time) {
if retErr != nil {
logger.Logf("errored merging chunk after %v: %v", time.Since(start), retErr)
} else {
logger.Logf("finished merging... | go | func (a *APIServer) mergeChunk(logger *taggedLogger, high int64, result *processResult) (retErr error) {
logger.Logf("starting to merge chunk")
defer func(start time.Time) {
if retErr != nil {
logger.Logf("errored merging chunk after %v: %v", time.Since(start), retErr)
} else {
logger.Logf("finished merging... | [
"func",
"(",
"a",
"*",
"APIServer",
")",
"mergeChunk",
"(",
"logger",
"*",
"taggedLogger",
",",
"high",
"int64",
",",
"result",
"*",
"processResult",
")",
"(",
"retErr",
"error",
")",
"{",
"logger",
".",
"Logf",
"(",
"\"starting to merge chunk\"",
")",
"\n... | // mergeChunk merges the datum hashtrees into a chunk hashtree and stores it. | [
"mergeChunk",
"merges",
"the",
"datum",
"hashtrees",
"into",
"a",
"chunk",
"hashtree",
"and",
"stores",
"it",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/worker/api_server.go#L2219-L2245 | test |
pachyderm/pachyderm | src/server/pfs/pfs.go | IsCommitNotFoundErr | func IsCommitNotFoundErr(err error) bool {
if err == nil {
return false
}
return commitNotFoundRe.MatchString(grpcutil.ScrubGRPC(err).Error())
} | go | func IsCommitNotFoundErr(err error) bool {
if err == nil {
return false
}
return commitNotFoundRe.MatchString(grpcutil.ScrubGRPC(err).Error())
} | [
"func",
"IsCommitNotFoundErr",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"commitNotFoundRe",
".",
"MatchString",
"(",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
".",
"Error",
"... | // IsCommitNotFoundErr returns true if 'err' has an error message that matches
// ErrCommitNotFound | [
"IsCommitNotFoundErr",
"returns",
"true",
"if",
"err",
"has",
"an",
"error",
"message",
"that",
"matches",
"ErrCommitNotFound"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/pfs.go#L112-L117 | test |
pachyderm/pachyderm | src/server/pfs/pfs.go | IsCommitDeletedErr | func IsCommitDeletedErr(err error) bool {
if err == nil {
return false
}
return commitDeletedRe.MatchString(grpcutil.ScrubGRPC(err).Error())
} | go | func IsCommitDeletedErr(err error) bool {
if err == nil {
return false
}
return commitDeletedRe.MatchString(grpcutil.ScrubGRPC(err).Error())
} | [
"func",
"IsCommitDeletedErr",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"commitDeletedRe",
".",
"MatchString",
"(",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
".",
"Error",
"("... | // IsCommitDeletedErr returns true if 'err' has an error message that matches
// ErrCommitDeleted | [
"IsCommitDeletedErr",
"returns",
"true",
"if",
"err",
"has",
"an",
"error",
"message",
"that",
"matches",
"ErrCommitDeleted"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/pfs.go#L121-L126 | test |
pachyderm/pachyderm | src/server/pfs/pfs.go | IsCommitFinishedErr | func IsCommitFinishedErr(err error) bool {
if err == nil {
return false
}
return commitFinishedRe.MatchString(grpcutil.ScrubGRPC(err).Error())
} | go | func IsCommitFinishedErr(err error) bool {
if err == nil {
return false
}
return commitFinishedRe.MatchString(grpcutil.ScrubGRPC(err).Error())
} | [
"func",
"IsCommitFinishedErr",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"commitFinishedRe",
".",
"MatchString",
"(",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
".",
"Error",
"... | // IsCommitFinishedErr returns true of 'err' has an error message that matches
// ErrCommitFinished | [
"IsCommitFinishedErr",
"returns",
"true",
"of",
"err",
"has",
"an",
"error",
"message",
"that",
"matches",
"ErrCommitFinished"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/pfs.go#L130-L135 | test |
pachyderm/pachyderm | src/server/pfs/pfs.go | IsRepoNotFoundErr | func IsRepoNotFoundErr(err error) bool {
if err == nil {
return false
}
return repoNotFoundRe.MatchString(err.Error())
} | go | func IsRepoNotFoundErr(err error) bool {
if err == nil {
return false
}
return repoNotFoundRe.MatchString(err.Error())
} | [
"func",
"IsRepoNotFoundErr",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"repoNotFoundRe",
".",
"MatchString",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}"
] | // IsRepoNotFoundErr returns true if 'err' is an error message about a repo
// not being found | [
"IsRepoNotFoundErr",
"returns",
"true",
"if",
"err",
"is",
"an",
"error",
"message",
"about",
"a",
"repo",
"not",
"being",
"found"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/pfs.go#L139-L144 | test |
pachyderm/pachyderm | src/server/pfs/pfs.go | IsBranchNotFoundErr | func IsBranchNotFoundErr(err error) bool {
if err == nil {
return false
}
return branchNotFoundRe.MatchString(err.Error())
} | go | func IsBranchNotFoundErr(err error) bool {
if err == nil {
return false
}
return branchNotFoundRe.MatchString(err.Error())
} | [
"func",
"IsBranchNotFoundErr",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"branchNotFoundRe",
".",
"MatchString",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}"
] | // IsBranchNotFoundErr returns true if 'err' is an error message about a
// branch not being found | [
"IsBranchNotFoundErr",
"returns",
"true",
"if",
"err",
"is",
"an",
"error",
"message",
"about",
"a",
"branch",
"not",
"being",
"found"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/pfs.go#L148-L153 | test |
pachyderm/pachyderm | src/server/pfs/pfs.go | IsFileNotFoundErr | func IsFileNotFoundErr(err error) bool {
if err == nil {
return false
}
return fileNotFoundRe.MatchString(err.Error())
} | go | func IsFileNotFoundErr(err error) bool {
if err == nil {
return false
}
return fileNotFoundRe.MatchString(err.Error())
} | [
"func",
"IsFileNotFoundErr",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"fileNotFoundRe",
".",
"MatchString",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}"
] | // IsFileNotFoundErr returns true if 'err' is an error message about a PFS
// file not being found | [
"IsFileNotFoundErr",
"returns",
"true",
"if",
"err",
"is",
"an",
"error",
"message",
"about",
"a",
"PFS",
"file",
"not",
"being",
"found"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/pfs.go#L157-L162 | test |
pachyderm/pachyderm | src/client/version.go | Version | func (c APIClient) Version() (string, error) {
v, err := c.VersionAPIClient.GetVersion(c.Ctx(), &types.Empty{})
if err != nil {
return "", grpcutil.ScrubGRPC(err)
}
return version.PrettyPrintVersion(v), nil
} | go | func (c APIClient) Version() (string, error) {
v, err := c.VersionAPIClient.GetVersion(c.Ctx(), &types.Empty{})
if err != nil {
return "", grpcutil.ScrubGRPC(err)
}
return version.PrettyPrintVersion(v), nil
} | [
"func",
"(",
"c",
"APIClient",
")",
"Version",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"v",
",",
"err",
":=",
"c",
".",
"VersionAPIClient",
".",
"GetVersion",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"types",
".",
"Empty",
"{",
"}",
"... | // Version returns the version of pachd as a string. | [
"Version",
"returns",
"the",
"version",
"of",
"pachd",
"as",
"a",
"string",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/version.go#L10-L16 | test |
pachyderm/pachyderm | src/server/pfs/server/driver.go | validateRepoName | func validateRepoName(name string) error {
match, _ := regexp.MatchString("^[a-zA-Z0-9_-]+$", name)
if !match {
return fmt.Errorf("repo name (%v) invalid: only alphanumeric characters, underscores, and dashes are allowed", name)
}
return nil
} | go | func validateRepoName(name string) error {
match, _ := regexp.MatchString("^[a-zA-Z0-9_-]+$", name)
if !match {
return fmt.Errorf("repo name (%v) invalid: only alphanumeric characters, underscores, and dashes are allowed", name)
}
return nil
} | [
"func",
"validateRepoName",
"(",
"name",
"string",
")",
"error",
"{",
"match",
",",
"_",
":=",
"regexp",
".",
"MatchString",
"(",
"\"^[a-zA-Z0-9_-]+$\"",
",",
"name",
")",
"\n",
"if",
"!",
"match",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"repo name (%v... | // validateRepoName determines if a repo name is valid | [
"validateRepoName",
"determines",
"if",
"a",
"repo",
"name",
"is",
"valid"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/server/driver.go#L71-L77 | test |
pachyderm/pachyderm | src/server/pfs/server/driver.go | newDriver | func newDriver(env *serviceenv.ServiceEnv, etcdPrefix string, treeCache *hashtree.Cache, storageRoot string, memoryRequest int64) (*driver, error) {
// Validate arguments
if treeCache == nil {
return nil, fmt.Errorf("cannot initialize driver with nil treeCache")
}
// Initialize driver
etcdClient := env.GetEtcdCl... | go | func newDriver(env *serviceenv.ServiceEnv, etcdPrefix string, treeCache *hashtree.Cache, storageRoot string, memoryRequest int64) (*driver, error) {
// Validate arguments
if treeCache == nil {
return nil, fmt.Errorf("cannot initialize driver with nil treeCache")
}
// Initialize driver
etcdClient := env.GetEtcdCl... | [
"func",
"newDriver",
"(",
"env",
"*",
"serviceenv",
".",
"ServiceEnv",
",",
"etcdPrefix",
"string",
",",
"treeCache",
"*",
"hashtree",
".",
"Cache",
",",
"storageRoot",
"string",
",",
"memoryRequest",
"int64",
")",
"(",
"*",
"driver",
",",
"error",
")",
"{... | // newDriver is used to create a new Driver instance | [
"newDriver",
"is",
"used",
"to",
"create",
"a",
"new",
"Driver",
"instance"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/server/driver.go#L121-L158 | test |
pachyderm/pachyderm | src/server/pfs/server/driver.go | inspectCommit | func (d *driver) inspectCommit(pachClient *client.APIClient, commit *pfs.Commit, blockState pfs.CommitState) (*pfs.CommitInfo, error) {
ctx := pachClient.Ctx()
if commit == nil {
return nil, fmt.Errorf("cannot inspect nil commit")
}
if err := d.checkIsAuthorized(pachClient, commit.Repo, auth.Scope_READER); err !=... | go | func (d *driver) inspectCommit(pachClient *client.APIClient, commit *pfs.Commit, blockState pfs.CommitState) (*pfs.CommitInfo, error) {
ctx := pachClient.Ctx()
if commit == nil {
return nil, fmt.Errorf("cannot inspect nil commit")
}
if err := d.checkIsAuthorized(pachClient, commit.Repo, auth.Scope_READER); err !=... | [
"func",
"(",
"d",
"*",
"driver",
")",
"inspectCommit",
"(",
"pachClient",
"*",
"client",
".",
"APIClient",
",",
"commit",
"*",
"pfs",
".",
"Commit",
",",
"blockState",
"pfs",
".",
"CommitState",
")",
"(",
"*",
"pfs",
".",
"CommitInfo",
",",
"error",
")... | // inspectCommit takes a Commit and returns the corresponding CommitInfo.
//
// As a side effect, this function also replaces the ID in the given commit
// with a real commit ID. | [
"inspectCommit",
"takes",
"a",
"Commit",
"and",
"returns",
"the",
"corresponding",
"CommitInfo",
".",
"As",
"a",
"side",
"effect",
"this",
"function",
"also",
"replaces",
"the",
"ID",
"in",
"the",
"given",
"commit",
"with",
"a",
"real",
"commit",
"ID",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/server/driver.go#L979-L1038 | test |
pachyderm/pachyderm | src/server/pfs/server/driver.go | scratchCommitPrefix | func (d *driver) scratchCommitPrefix(commit *pfs.Commit) string {
// TODO(msteffen) this doesn't currenty (2018-2-4) use d.scratchPrefix(),
// but probably should? If this is changed, filepathFromEtcdPath will also
// need to change.
return path.Join(commit.Repo.Name, commit.ID)
} | go | func (d *driver) scratchCommitPrefix(commit *pfs.Commit) string {
// TODO(msteffen) this doesn't currenty (2018-2-4) use d.scratchPrefix(),
// but probably should? If this is changed, filepathFromEtcdPath will also
// need to change.
return path.Join(commit.Repo.Name, commit.ID)
} | [
"func",
"(",
"d",
"*",
"driver",
")",
"scratchCommitPrefix",
"(",
"commit",
"*",
"pfs",
".",
"Commit",
")",
"string",
"{",
"return",
"path",
".",
"Join",
"(",
"commit",
".",
"Repo",
".",
"Name",
",",
"commit",
".",
"ID",
")",
"\n",
"}"
] | // scratchCommitPrefix returns an etcd prefix that's used to temporarily
// store the state of a file in an open commit. Once the commit is finished,
// the scratch space is removed. | [
"scratchCommitPrefix",
"returns",
"an",
"etcd",
"prefix",
"that",
"s",
"used",
"to",
"temporarily",
"store",
"the",
"state",
"of",
"a",
"file",
"in",
"an",
"open",
"commit",
".",
"Once",
"the",
"commit",
"is",
"finished",
"the",
"scratch",
"space",
"is",
"... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/server/driver.go#L1827-L1832 | test |
pachyderm/pachyderm | src/server/pfs/server/driver.go | scratchFilePrefix | func (d *driver) scratchFilePrefix(file *pfs.File) (string, error) {
return path.Join(d.scratchCommitPrefix(file.Commit), file.Path), nil
} | go | func (d *driver) scratchFilePrefix(file *pfs.File) (string, error) {
return path.Join(d.scratchCommitPrefix(file.Commit), file.Path), nil
} | [
"func",
"(",
"d",
"*",
"driver",
")",
"scratchFilePrefix",
"(",
"file",
"*",
"pfs",
".",
"File",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"path",
".",
"Join",
"(",
"d",
".",
"scratchCommitPrefix",
"(",
"file",
".",
"Commit",
")",
",",
... | // scratchFilePrefix returns an etcd prefix that's used to temporarily
// store the state of a file in an open commit. Once the commit is finished,
// the scratch space is removed. | [
"scratchFilePrefix",
"returns",
"an",
"etcd",
"prefix",
"that",
"s",
"used",
"to",
"temporarily",
"store",
"the",
"state",
"of",
"a",
"file",
"in",
"an",
"open",
"commit",
".",
"Once",
"the",
"commit",
"is",
"finished",
"the",
"scratch",
"space",
"is",
"re... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/server/driver.go#L1837-L1839 | test |
pachyderm/pachyderm | src/server/pfs/server/driver.go | getTreeForFile | func (d *driver) getTreeForFile(pachClient *client.APIClient, file *pfs.File) (hashtree.HashTree, error) {
if file.Commit == nil {
t, err := hashtree.NewDBHashTree(d.storageRoot)
if err != nil {
return nil, err
}
return t, nil
}
commitInfo, err := d.inspectCommit(pachClient, file.Commit, pfs.CommitState_S... | go | func (d *driver) getTreeForFile(pachClient *client.APIClient, file *pfs.File) (hashtree.HashTree, error) {
if file.Commit == nil {
t, err := hashtree.NewDBHashTree(d.storageRoot)
if err != nil {
return nil, err
}
return t, nil
}
commitInfo, err := d.inspectCommit(pachClient, file.Commit, pfs.CommitState_S... | [
"func",
"(",
"d",
"*",
"driver",
")",
"getTreeForFile",
"(",
"pachClient",
"*",
"client",
".",
"APIClient",
",",
"file",
"*",
"pfs",
".",
"File",
")",
"(",
"hashtree",
".",
"HashTree",
",",
"error",
")",
"{",
"if",
"file",
".",
"Commit",
"==",
"nil",... | // getTreeForFile is like getTreeForCommit except that it can handle open commits.
// It takes a file instead of a commit so that it can apply the changes for
// that path to the tree before it returns it. | [
"getTreeForFile",
"is",
"like",
"getTreeForCommit",
"except",
"that",
"it",
"can",
"handle",
"open",
"commits",
".",
"It",
"takes",
"a",
"file",
"instead",
"of",
"a",
"commit",
"so",
"that",
"it",
"can",
"apply",
"the",
"changes",
"for",
"that",
"path",
"t... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/server/driver.go#L2405-L2429 | test |
pachyderm/pachyderm | src/server/pfs/server/driver.go | provenantOnInput | func provenantOnInput(provenance []*pfs.CommitProvenance) bool {
provenanceCount := len(provenance)
for _, p := range provenance {
// in particular, we want to exclude provenance on the spec repo (used e.g. for spouts)
if p.Commit.Repo.Name == ppsconsts.SpecRepo {
provenanceCount--
break
}
}
return prov... | go | func provenantOnInput(provenance []*pfs.CommitProvenance) bool {
provenanceCount := len(provenance)
for _, p := range provenance {
// in particular, we want to exclude provenance on the spec repo (used e.g. for spouts)
if p.Commit.Repo.Name == ppsconsts.SpecRepo {
provenanceCount--
break
}
}
return prov... | [
"func",
"provenantOnInput",
"(",
"provenance",
"[",
"]",
"*",
"pfs",
".",
"CommitProvenance",
")",
"bool",
"{",
"provenanceCount",
":=",
"len",
"(",
"provenance",
")",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"provenance",
"{",
"if",
"p",
".",
"Commit"... | // this is a helper function to check if the given provenance has provenance on an input branch | [
"this",
"is",
"a",
"helper",
"function",
"to",
"check",
"if",
"the",
"given",
"provenance",
"has",
"provenance",
"on",
"an",
"input",
"branch"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/server/driver.go#L2459-L2469 | test |
pachyderm/pachyderm | src/server/pfs/server/driver.go | nodeToFileInfo | func nodeToFileInfo(ci *pfs.CommitInfo, path string, node *hashtree.NodeProto, full bool) *pfs.FileInfo {
fileInfo := &pfs.FileInfo{
File: &pfs.File{
Commit: ci.Commit,
Path: path,
},
SizeBytes: uint64(node.SubtreeSize),
Hash: node.Hash,
Committed: ci.Finished,
}
if node.FileNode != nil {
fi... | go | func nodeToFileInfo(ci *pfs.CommitInfo, path string, node *hashtree.NodeProto, full bool) *pfs.FileInfo {
fileInfo := &pfs.FileInfo{
File: &pfs.File{
Commit: ci.Commit,
Path: path,
},
SizeBytes: uint64(node.SubtreeSize),
Hash: node.Hash,
Committed: ci.Finished,
}
if node.FileNode != nil {
fi... | [
"func",
"nodeToFileInfo",
"(",
"ci",
"*",
"pfs",
".",
"CommitInfo",
",",
"path",
"string",
",",
"node",
"*",
"hashtree",
".",
"NodeProto",
",",
"full",
"bool",
")",
"*",
"pfs",
".",
"FileInfo",
"{",
"fileInfo",
":=",
"&",
"pfs",
".",
"FileInfo",
"{",
... | // If full is false, exclude potentially large fields such as `Objects`
// and `Children` | [
"If",
"full",
"is",
"false",
"exclude",
"potentially",
"large",
"fields",
"such",
"as",
"Objects",
"and",
"Children"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/server/driver.go#L2619-L2642 | test |
pachyderm/pachyderm | src/server/pfs/server/driver.go | fileHistory | func (d *driver) fileHistory(pachClient *client.APIClient, file *pfs.File, history int64, f func(*pfs.FileInfo) error) error {
var fi *pfs.FileInfo
for {
_fi, err := d.inspectFile(pachClient, file)
if err != nil {
if _, ok := err.(pfsserver.ErrFileNotFound); ok {
return f(fi)
}
return err
}
if fi... | go | func (d *driver) fileHistory(pachClient *client.APIClient, file *pfs.File, history int64, f func(*pfs.FileInfo) error) error {
var fi *pfs.FileInfo
for {
_fi, err := d.inspectFile(pachClient, file)
if err != nil {
if _, ok := err.(pfsserver.ErrFileNotFound); ok {
return f(fi)
}
return err
}
if fi... | [
"func",
"(",
"d",
"*",
"driver",
")",
"fileHistory",
"(",
"pachClient",
"*",
"client",
".",
"APIClient",
",",
"file",
"*",
"pfs",
".",
"File",
",",
"history",
"int64",
",",
"f",
"func",
"(",
"*",
"pfs",
".",
"FileInfo",
")",
"error",
")",
"error",
... | // fileHistory calls f with FileInfos for the file, starting with how it looked
// at the referenced commit and then all past versions that are different. | [
"fileHistory",
"calls",
"f",
"with",
"FileInfos",
"for",
"the",
"file",
"starting",
"with",
"how",
"it",
"looked",
"at",
"the",
"referenced",
"commit",
"and",
"then",
"all",
"past",
"versions",
"that",
"are",
"different",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/server/driver.go#L2819-L2850 | test |
pachyderm/pachyderm | src/server/pfs/server/driver.go | upsertPutFileRecords | func (d *driver) upsertPutFileRecords(pachClient *client.APIClient, file *pfs.File, newRecords *pfs.PutFileRecords) error {
prefix, err := d.scratchFilePrefix(file)
if err != nil {
return err
}
ctx := pachClient.Ctx()
_, err = col.NewSTM(ctx, d.etcdClient, func(stm col.STM) error {
commitsCol := d.openCommits... | go | func (d *driver) upsertPutFileRecords(pachClient *client.APIClient, file *pfs.File, newRecords *pfs.PutFileRecords) error {
prefix, err := d.scratchFilePrefix(file)
if err != nil {
return err
}
ctx := pachClient.Ctx()
_, err = col.NewSTM(ctx, d.etcdClient, func(stm col.STM) error {
commitsCol := d.openCommits... | [
"func",
"(",
"d",
"*",
"driver",
")",
"upsertPutFileRecords",
"(",
"pachClient",
"*",
"client",
".",
"APIClient",
",",
"file",
"*",
"pfs",
".",
"File",
",",
"newRecords",
"*",
"pfs",
".",
"PutFileRecords",
")",
"error",
"{",
"prefix",
",",
"err",
":=",
... | // Put the tree into the blob store
// Only write the records to etcd if the commit does exist and is open.
// To check that a key exists in etcd, we assert that its CreateRevision
// is greater than zero. | [
"Put",
"the",
"tree",
"into",
"the",
"blob",
"store",
"Only",
"write",
"the",
"records",
"to",
"etcd",
"if",
"the",
"commit",
"does",
"exist",
"and",
"is",
"open",
".",
"To",
"check",
"that",
"a",
"key",
"exists",
"in",
"etcd",
"we",
"assert",
"that",
... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/server/driver.go#L3064-L3102 | test |
pachyderm/pachyderm | src/server/pkg/sql/sql.go | ReadRow | func (r *PGDumpReader) ReadRow() ([]byte, error) {
if len(r.Header) == 0 {
err := r.readHeader()
if err != nil {
return nil, err
}
}
endLine := "\\.\n" // Trailing '\.' denotes the end of the row inserts
row, err := r.rd.ReadBytes('\n')
if err != nil && err != io.EOF {
return nil, fmt.Errorf("error read... | go | func (r *PGDumpReader) ReadRow() ([]byte, error) {
if len(r.Header) == 0 {
err := r.readHeader()
if err != nil {
return nil, err
}
}
endLine := "\\.\n" // Trailing '\.' denotes the end of the row inserts
row, err := r.rd.ReadBytes('\n')
if err != nil && err != io.EOF {
return nil, fmt.Errorf("error read... | [
"func",
"(",
"r",
"*",
"PGDumpReader",
")",
"ReadRow",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"len",
"(",
"r",
".",
"Header",
")",
"==",
"0",
"{",
"err",
":=",
"r",
".",
"readHeader",
"(",
")",
"\n",
"if",
"err",
"!=",... | // ReadRow parses the pgdump file and populates the header and the footer
// It returns EOF when done, and at that time both the Header and Footer will
// be populated. Both header and footer are required. If either are missing, an
// error is returned | [
"ReadRow",
"parses",
"the",
"pgdump",
"file",
"and",
"populates",
"the",
"header",
"and",
"the",
"footer",
"It",
"returns",
"EOF",
"when",
"done",
"and",
"at",
"that",
"time",
"both",
"the",
"Header",
"and",
"Footer",
"will",
"be",
"populated",
".",
"Both"... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/sql/sql.go#L28-L55 | test |
pachyderm/pachyderm | src/server/pkg/metrics/metrics.go | NewReporter | func NewReporter(clusterID string, kubeClient *kube.Clientset) *Reporter {
reporter := &Reporter{
segmentClient: newPersistentClient(),
clusterID: clusterID,
kubeClient: kubeClient,
}
go reporter.reportClusterMetrics()
return reporter
} | go | func NewReporter(clusterID string, kubeClient *kube.Clientset) *Reporter {
reporter := &Reporter{
segmentClient: newPersistentClient(),
clusterID: clusterID,
kubeClient: kubeClient,
}
go reporter.reportClusterMetrics()
return reporter
} | [
"func",
"NewReporter",
"(",
"clusterID",
"string",
",",
"kubeClient",
"*",
"kube",
".",
"Clientset",
")",
"*",
"Reporter",
"{",
"reporter",
":=",
"&",
"Reporter",
"{",
"segmentClient",
":",
"newPersistentClient",
"(",
")",
",",
"clusterID",
":",
"clusterID",
... | // NewReporter creates a new reporter and kicks off the loop to report cluster
// metrics | [
"NewReporter",
"creates",
"a",
"new",
"reporter",
"and",
"kicks",
"off",
"the",
"loop",
"to",
"report",
"cluster",
"metrics"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/metrics/metrics.go#L27-L35 | test |
pachyderm/pachyderm | src/server/pkg/metrics/metrics.go | ReportUserAction | func ReportUserAction(ctx context.Context, r *Reporter, action string) func(time.Time, error) {
if r == nil {
// This happens when stubbing out metrics for testing, e.g. src/server/pfs/server/server_test.go
return func(time.Time, error) {}
}
// If we report nil, segment sees it, but mixpanel omits the field
r.r... | go | func ReportUserAction(ctx context.Context, r *Reporter, action string) func(time.Time, error) {
if r == nil {
// This happens when stubbing out metrics for testing, e.g. src/server/pfs/server/server_test.go
return func(time.Time, error) {}
}
// If we report nil, segment sees it, but mixpanel omits the field
r.r... | [
"func",
"ReportUserAction",
"(",
"ctx",
"context",
".",
"Context",
",",
"r",
"*",
"Reporter",
",",
"action",
"string",
")",
"func",
"(",
"time",
".",
"Time",
",",
"error",
")",
"{",
"if",
"r",
"==",
"nil",
"{",
"return",
"func",
"(",
"time",
".",
"... | //ReportUserAction pushes the action into a queue for reporting,
// and reports the start, finish, and error conditions | [
"ReportUserAction",
"pushes",
"the",
"action",
"into",
"a",
"queue",
"for",
"reporting",
"and",
"reports",
"the",
"start",
"finish",
"and",
"error",
"conditions"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/metrics/metrics.go#L39-L53 | test |
pachyderm/pachyderm | src/server/pkg/metrics/metrics.go | FinishReportAndFlushUserAction | func FinishReportAndFlushUserAction(action string, err error, start time.Time) func() {
var wait func()
if err != nil {
wait = reportAndFlushUserAction(fmt.Sprintf("%vErrored", action), err)
} else {
wait = reportAndFlushUserAction(fmt.Sprintf("%vFinished", action), time.Since(start).Seconds())
}
return wait
} | go | func FinishReportAndFlushUserAction(action string, err error, start time.Time) func() {
var wait func()
if err != nil {
wait = reportAndFlushUserAction(fmt.Sprintf("%vErrored", action), err)
} else {
wait = reportAndFlushUserAction(fmt.Sprintf("%vFinished", action), time.Since(start).Seconds())
}
return wait
} | [
"func",
"FinishReportAndFlushUserAction",
"(",
"action",
"string",
",",
"err",
"error",
",",
"start",
"time",
".",
"Time",
")",
"func",
"(",
")",
"{",
"var",
"wait",
"func",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"wait",
"=",
"reportAndFlushUserA... | // FinishReportAndFlushUserAction immediately reports the metric but does
// not block execution. It returns a wait function which waits or times
// out after 5s.
// It is used by the pachctl binary and runs on users' machines | [
"FinishReportAndFlushUserAction",
"immediately",
"reports",
"the",
"metric",
"but",
"does",
"not",
"block",
"execution",
".",
"It",
"returns",
"a",
"wait",
"function",
"which",
"waits",
"or",
"times",
"out",
"after",
"5s",
".",
"It",
"is",
"used",
"by",
"the",... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/metrics/metrics.go#L126-L134 | test |
pachyderm/pachyderm | src/server/pkg/storage/chunk/reader.go | Read | func (r *Reader) Read(data []byte) (int, error) {
var totalRead int
for len(data) > 0 {
n, err := r.r.Read(data)
data = data[n:]
totalRead += n
if err != nil {
// If all DataRefs have been read, then io.EOF.
if len(r.dataRefs) == 0 {
return totalRead, io.EOF
}
// Get next chunk if necessary.
... | go | func (r *Reader) Read(data []byte) (int, error) {
var totalRead int
for len(data) > 0 {
n, err := r.r.Read(data)
data = data[n:]
totalRead += n
if err != nil {
// If all DataRefs have been read, then io.EOF.
if len(r.dataRefs) == 0 {
return totalRead, io.EOF
}
// Get next chunk if necessary.
... | [
"func",
"(",
"r",
"*",
"Reader",
")",
"Read",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"var",
"totalRead",
"int",
"\n",
"for",
"len",
"(",
"data",
")",
">",
"0",
"{",
"n",
",",
"err",
":=",
"r",
".",
"r",
".",... | // Read reads from the byte stream produced by the set of DataRefs. | [
"Read",
"reads",
"from",
"the",
"byte",
"stream",
"produced",
"by",
"the",
"set",
"of",
"DataRefs",
"."
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/storage/chunk/reader.go#L37-L61 | test |
pachyderm/pachyderm | src/server/enterprise/cmds/cmds.go | ActivateCmd | func ActivateCmd(noMetrics, noPortForwarding *bool) *cobra.Command {
var expires string
activate := &cobra.Command{
Use: "{{alias}} <activation-code>",
Short: "Activate the enterprise features of Pachyderm with an activation " +
"code",
Long: "Activate the enterprise features of Pachyderm with an activation ... | go | func ActivateCmd(noMetrics, noPortForwarding *bool) *cobra.Command {
var expires string
activate := &cobra.Command{
Use: "{{alias}} <activation-code>",
Short: "Activate the enterprise features of Pachyderm with an activation " +
"code",
Long: "Activate the enterprise features of Pachyderm with an activation ... | [
"func",
"ActivateCmd",
"(",
"noMetrics",
",",
"noPortForwarding",
"*",
"bool",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"expires",
"string",
"\n",
"activate",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"{{alias}} <activation-code>\"",
",",
... | // ActivateCmd returns a cobra.Command to activate the enterprise features of
// Pachyderm within a Pachyderm cluster. All repos will go from
// publicly-accessible to accessible only by the owner, who can subsequently add
// users | [
"ActivateCmd",
"returns",
"a",
"cobra",
".",
"Command",
"to",
"activate",
"the",
"enterprise",
"features",
"of",
"Pachyderm",
"within",
"a",
"Pachyderm",
"cluster",
".",
"All",
"repos",
"will",
"go",
"from",
"publicly",
"-",
"accessible",
"to",
"accessible",
"... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/enterprise/cmds/cmds.go#L35-L82 | test |
pachyderm/pachyderm | src/server/enterprise/cmds/cmds.go | GetStateCmd | func GetStateCmd(noMetrics, noPortForwarding *bool) *cobra.Command {
getState := &cobra.Command{
Short: "Check whether the Pachyderm cluster has enterprise features " +
"activated",
Long: "Check whether the Pachyderm cluster has enterprise features " +
"activated",
Run: cmdutil.Run(func(args []string) erro... | go | func GetStateCmd(noMetrics, noPortForwarding *bool) *cobra.Command {
getState := &cobra.Command{
Short: "Check whether the Pachyderm cluster has enterprise features " +
"activated",
Long: "Check whether the Pachyderm cluster has enterprise features " +
"activated",
Run: cmdutil.Run(func(args []string) erro... | [
"func",
"GetStateCmd",
"(",
"noMetrics",
",",
"noPortForwarding",
"*",
"bool",
")",
"*",
"cobra",
".",
"Command",
"{",
"getState",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Short",
":",
"\"Check whether the Pachyderm cluster has enterprise features \"",
"+",
"\"acti... | // GetStateCmd returns a cobra.Command to activate the enterprise features of
// Pachyderm within a Pachyderm cluster. All repos will go from
// publicly-accessible to accessible only by the owner, who can subsequently add
// users | [
"GetStateCmd",
"returns",
"a",
"cobra",
".",
"Command",
"to",
"activate",
"the",
"enterprise",
"features",
"of",
"Pachyderm",
"within",
"a",
"Pachyderm",
"cluster",
".",
"All",
"repos",
"will",
"go",
"from",
"publicly",
"-",
"accessible",
"to",
"accessible",
"... | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/enterprise/cmds/cmds.go#L88-L119 | test |
pachyderm/pachyderm | src/server/enterprise/cmds/cmds.go | Cmds | func Cmds(noMetrics, noPortForwarding *bool) []*cobra.Command {
var commands []*cobra.Command
enterprise := &cobra.Command{
Short: "Enterprise commands enable Pachyderm Enterprise features",
Long: "Enterprise commands enable Pachyderm Enterprise features",
}
commands = append(commands, cmdutil.CreateAlias(ent... | go | func Cmds(noMetrics, noPortForwarding *bool) []*cobra.Command {
var commands []*cobra.Command
enterprise := &cobra.Command{
Short: "Enterprise commands enable Pachyderm Enterprise features",
Long: "Enterprise commands enable Pachyderm Enterprise features",
}
commands = append(commands, cmdutil.CreateAlias(ent... | [
"func",
"Cmds",
"(",
"noMetrics",
",",
"noPortForwarding",
"*",
"bool",
")",
"[",
"]",
"*",
"cobra",
".",
"Command",
"{",
"var",
"commands",
"[",
"]",
"*",
"cobra",
".",
"Command",
"\n",
"enterprise",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Short",
... | // Cmds returns pachctl commands related to Pachyderm Enterprise | [
"Cmds",
"returns",
"pachctl",
"commands",
"related",
"to",
"Pachyderm",
"Enterprise"
] | 94fb2d536cb6852a77a49e8f777dc9c1bde2c723 | https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/enterprise/cmds/cmds.go#L122-L135 | test |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.