id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c17000
if err := r.apiGet(buildPodStatusURI(name), nil, &podStatus); err != nil { return nil, err } return &podStatus, nil }
c17001
if err := r.apiGet(buildPodStatusURI(""), nil, &podStatuses); err != nil { return nil, err } return podStatuses, nil }
c17002
return r.wait(name, timeout, r.PodIsRunning) }
c17003
ok && apiErr.ErrCode == ErrCodeNotFound { return false } if err == nil && podStatus.Status == PodStateStable { return true } return false }
c17004
rc.Name = &name return rc }
c17005
rc.Protocol = proto return rc }
c17006
{ rc.Path = p return rc }
c17007
rc.PortName = name return rc }
c17008
:= int(interval.Seconds()) rc.IntervalSeconds = secs return rc }
c17009
:= int(timeout.Seconds()) rc.TimeoutSeconds = secs return rc }
c17010
rc.HTTPStatusCodesForReady = &codes return rc }
c17011
rc.PreserveLastResponse = &preserve return rc }
c17012
deployment.Steps = make([][]*DeploymentStep, 0) var steps []*StepActions // Unmarshal v1.X Marathon step if err := json.Unmarshal(deployment.XXStepsRaw, &steps); err != nil { return nil, err } for stepIndex, step := range steps { deployment.Steps = append(deployment.Steps, make([]*DeploymentS...
c17013
Name: name, Host: path, } }
c17014
Name: name, MountPath: mount, } }
c17015
*PersistentVolume) *PodVolume { pv.Persistent = p return pv }
c17016
nil, info); err != nil { return nil, err } return info, nil }
c17017
} if err := r.apiGet(marathonAPILeader, nil, &leader); err != nil { return "", err } return leader.Leader, nil }
c17018
nil, &message); err != nil { return "", err } return message.Message, nil }
c17019
ImageType) *PodContainerImage { i.Kind = typ return i }
c17020
string) *PodContainerImage { i.ID = id return i }
c17021
if err := r.apiGet(marathonAPIGroups, "", groups); err != nil { return nil, err } return groups, nil }
c17022
the HTTP request to Marathon request, err = r.client.buildMarathonJSONRequest(method, member, path, reader) if err != nil { return nil, member, newRequestError{err} } return request, member, nil }
c17023
nil), []byte("\n"), []byte("\\n "), -1) }
c17024
{ r.Ports = make([]int, 0) r.EmptyPortDefinitions() r.IPAddressPerTask = &ipAddressPerTask return r }
c17025
r.Cmd = &cmd return r }
c17026
} if r.TasksRunning == *r.Instances { return true } return false }
c17027
portDefinitions = append(portDefinitions, portDefinition) r.PortDefinitions = &portDefinitions return r }
c17028
r.Executor = &executor return r }
c17029
*r.HealthChecks healthChecks = append(healthChecks, healthCheck) r.HealthChecks = &healthChecks return r }
c17030
!= nil && len(*r.HealthChecks) > 0 }
c17031
readinessChecks = append(readinessChecks, readinessCheck) r.ReadinessChecks = &readinessChecks return r }
c17032
found { deployment := &DeploymentID{ Version: r.Version, DeploymentID: id, } deployments = append(deployments, deployment) } } return deployments }
c17033
*Application { r.UpgradeStrategy = &us return r }
c17034
*Application { r.UnreachableStrategy = &us return r }
c17035
= &Residency{ TaskLostBehavior: whenLost, } return r }
c17036
return fmt.Sprintf(`{"error": "error decoding type into json: %s"}`, err) } return string(s) }
c17037
:= new(Applications) err := r.apiGet(marathonAPIApps+query, nil, applications) if err != nil { return nil, err } return applications, nil }
c17038
for _, application := range applications.Apps { list = append(list, application.ID) } return list, nil }
c17039
mode} networks := *r.Networks networks = append(networks, network) r.Networks = &networks return r }
c17040
&& len(r.HealthCheckResults) > 0 }
c17041
p.EmptyPort() } p.Port = &port return p }
c17042
case string: env[envName] = envValOrSecret case map[string]interface{}: for secret, secretStore := range envValOrSecret { if secStore, ok := secretStore.(string); ok && secret == "secret" { secrets[secStore] = Secret{EnvVar: envName} break } return fmt.Errorf("unexpected secret field %v ...
c17043
} secrets[k] = TmpSecret{v.Source} } } aux := &struct { *PodAlias Env map[string]interface{} `json:"environment,omitempty"` Secrets map[string]TmpSecret `json:"secrets,omitempty"` }{PodAlias: (*PodAlias)(p), Env: env, Secrets: secrets} return json.Marshal(aux) }
c17044
EventsPort: 10001, EventsInterface: "eth0", LogOutput: ioutil.Discard, PollingWaitTime: defaultPollingWaitTime, } }
c17045
&InvalidEndpointError{message: fmt.Sprintf(message, args...)} }
c17046
code == http.StatusNotFound: errDef = &simpleErrDef{code: ErrCodeNotFound} case code == http.StatusMethodNotAllowed: errDef = &simpleErrDef{code: ErrCodeMethodNotAllowed} case code == http.StatusConflict: errDef = &conflictDef{} case code == 422: errDef = &unprocessableEntityDef{} case code >= http.StatusI...
c17047
[]*PodArtifact{}, Labels: map[string]string{}, Resources: NewResources(), } }
c17048
p.Name = name return p }
c17049
{ p.Exec = &PodExec{ Command: PodCommand{ Shell: name, }, } return p }
c17050
*PodContainer { p.Resources.Cpus = cpu return p }
c17051
*PodContainer { p.Resources.Mem = memory return p }
c17052
*PodContainer { p.Resources.Disk = disk return p }
c17053
*PodContainer { p.Resources.Gpus = gpu return p }
c17054
= append(p.Endpoints, endpoint) return p }
c17055
*PodContainer { p.Image = image return p }
c17056
make(map[string]string) return p }
c17057
p = p.EmptyEnvs() } p.Env[name] = value return p }
c17058
if p.Env == nil { p = p.EmptyEnvs() } for k, v := range env { p.AddEnv(k, v) } return p }
c17059
p = p.EmptyEnvs() } p.Env[name] = secretName return p }
c17060
p.HealthCheck = healthcheck return p }
c17061
= append(p.VolumeMounts, mount) return p }
c17062
= append(p.Artifacts, artifact) return p }
c17063
p.Labels[key] = value return p }
c17064
p.Lifecycle = lifecycle return p }
c17065
*Alias Env map[string]interface{} `json:"env,omitempty"` Secrets map[string]TmpSecret `json:"secrets,omitempty"` }{Alias: (*Alias)(app), Env: env, Secrets: secrets} return json.Marshal(aux) }
c17066
at even positions, pos are at odd positions in stateRecord array }
c17067
if !s.cached { s.cached = true s.cacheRecord = s.stateRecord[s.readPos] } return s.cacheRecord.pos }
c17068
s.peekState() } s.readPos += 1 return s.cacheRecord.state }
c17069
scanEndArray || state < scanBeginLiteral { return false } return true }
c17070
} return s.error(c, "in literal true (expecting 'e')") }
c17071
!= 0 { //we need here cycle because of nested objects and slices op, end = d.takeRecord() if op == startop { count++ } if op == endop { count-- } } return d.data[start : end+1] }
c17072
d.scan.peekState(), d.scan.takePos() }
c17073
:= os.Getenv(envName) if value == "" { return defaultValue } return value }
c17074
make(map[interface{}]*expireRecord), ttl: ttl, } }
c17075
in // the cache by resetting the expire time record.ExpireAt = time.Now().UTC().Add(c.ttl) c.stats.Hit++ return record.Value, ok }
c17076
record := expireRecord{ Value: value, ExpireAt: time.Now().UTC().Add(c.ttl), } // Add the record to the cache c.cache[key] = &record }
c17077
{ return errors.Errorf("ExpoireCache() - No record found for '%+v'", key) } record.Value = value return nil }
c17078
c.mutex.Lock() if record, hit := c.cache[key]; hit { return record.Value, true } return nil, false }
c17079
return errors.Errorf("Each() - key '%+v' disapeared "+ "from cache during iteration", key) } err := callBack(key, record.Value) if err != nil { return err } c.mutex.Lock() if record.ExpireAt.Before(time.Now().UTC()) { delete(c.cache, key) } c.mutex.Unlock() return nil },...
c17080
= ExpireCacheStats{} c.mutex.Unlock() }() return c.stats }
c17081
c.mutex.Lock() return int64(len(c.cache)) }
c17082
p.size <- true go func() { err := callBack(data) if err != nil { p.errChan <- err } <-p.size }() }
c17083
the error collector routine is complete p.wg.Wait() // If there are no errors if len(p.errs) == 0 { return nil } return p.errs }
c17084
for i, b := range bytes { bytes[i] = chars[b%byte(len(chars))] } return prefix + string(bytes) }
c17085
RandomRunes(prefix, length, AlphaRunes) }
c17086
length, AlphaRunes, NumericRunes) }
c17087
rand.Read(bytes) return items[bytes[0]%byte(len(items))] }
c17088
} ft.advance(d) return Now().UTC().Sub(frozenAt) }
c17089
provider.Wait4Scheduled(count, timeout) }
c17090
return provider.AfterFunc(d, f) }
c17091
key.") } return s.SignRequestWithKey(r, s.secretKey) }
c17092
with key.") } return s.AuthenticateRequestWithKey(r, s.secretKey) }
c17093
isValid, err := checkMAC(secretKey, s.config.SignVerbAndURI, r.Method, r.URL.RequestURI(), timestamp, nonce, bodyBytes, headerValues, signature) if !isValid { return err } // check timestamp isValid, err = s.CheckTimestamp(timestamp) if !isValid { return err } // check to see if we have seen nonce befor...
c17094
// if the timestamp is older than ttl - skew, it's invalid if timestamp <= now-int64(s.nonceCache.cacheTTL-MaxSkewSec) { return false, fmt.Errorf("timestamp header too old; now: %v; %v: %v; difference: %v", now, s.config.TimestampHeaderName, timestamp, now-timestamp) } return true, nil }
c17095
:= fn.FileLine(pc) return FrameInfo{ CallStack: GetCallStack(frames), Func: FuncName(fn), File: filePath, LineNo: lineNo, } }
c17096
// build metrics client hostport := fmt.Sprintf("%v:%v", config.StatsdHost, config.StatsdPort) metricsClient, err = metrics.NewWithOptions(hostport, prefix, metrics.Options{UseBuffering: true}) if err != nil { return nil, err } } else { // if you don't want to emit stats, use the nop client metricsClie...
c17097
err := New(&Config{KeyBytes: secretKey}) if err != nil { return nil, err } return secretService.Seal(value) }
c17098
err := New(&Config{KeyBytes: secretKey}) if err != nil { return nil, err } return secretService.Open(e) }
c17099
encrypted = secretbox.Seal(encrypted, value, nonce, s.secretKey) // return sealed ciphertext return &SealedBytes{ Ciphertext: encrypted, Nonce: nonce[:], }, nil }