id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c16900
(nameOut string) { return strings.Replace(nameIn, "-", "_", -1) } var strong config.CloudConfig if err := yaml.Unmarshal([]byte(cfg), &strong); err != nil { return node{}, err } s := NewNode(strong, NewContext(cfg)) // coerceNodes weak nodes and strong nodes. strong nodes replace weak nodes // if they are ...
c16901
//report.Info(node.line, fmt.Sprintf("%q uses '-' instead of '_'", node.name)) node.name = strings.Replace(node.name, "-", "_", -1) } for i := range node.children { node.children[i] = normalizeNodeNames(node.children[i], report) } return node }
c16902
err = walk(v, walker) } if ok && err == nil { err = ew.Exit(WalkLoc) } return }
c16903
header.DestinationAddress.String() == q.DestinationAddress.String() && header.SourcePort == q.SourcePort && header.DestinationPort == q.DestinationPort }
c16904
return header.writeVersion2(w) default: return 0, ErrUnknownProxyProtocolVersion } }
c16905
return parseVersion1(reader) } else if signature, err := reader.Peek(12); err == nil && bytes.Equal(signature[:12], SIGV2) { return parseVersion2(reader) } } return nil, ErrNoProxyProtocol }
c16906
func() { h := &header{} h.h, h.e = Read(reader) read <- h }() timer := time.NewTimer(timeout) select { case result := <-read: timer.Stop() return result.h, result.e case <-timer.C: return nil, ErrNoProxyProtocol } }
c16907
make([]uint8, 3*w*h), Stride: 3 * w, Rect: r} }
c16908
color.Color { return p.RGBAAt(x, y) }
c16909
<< 8 g = uint32(c.G) g |= g << 8 b = uint32(c.B) b |= b << 8 a = uint32(0xFFFF) return }
c16910
nil, errors.New("Image has unsupported colorspace") } dest, err = decodeGray(dinfo) case 3: switch dinfo.jpeg_color_space { case C.JCS_YCbCr: dest, err = decodeYCbCr(dinfo) case C.JCS_RGB: dest, err = decodeRGB(dinfo) default: return nil, errors.New("Image has unsupported colorspace") } } ret...
c16911
C.TRUE) setupDecoderOptions(dinfo, options) C.jpeg_calc_output_dimensions(dinfo) dest = rgb.NewImage(image.Rect(0, 0, int(dinfo.output_width), int(dinfo.output_height))) dinfo.out_color_space = C.JCS_RGB readScanLines(dinfo, dest.Pix, dest.Stride) return }
c16912
r) } } }() C.jpeg_read_header(dinfo, C.TRUE) setupDecoderOptions(dinfo, options) C.jpeg_calc_output_dimensions(dinfo) dest = image.NewRGBA(image.Rect(0, 0, int(dinfo.output_width), int(dinfo.output_height))) colorSpace := getJCS_EXT_RGBA() if colorSpace == C.JCS_UNKNOWN { return nil, errors.New("JCS_E...
c16913
} } }() C.jpeg_read_header(dinfo, C.TRUE) config = image.Config{ ColorModel: color.YCbCrModel, Width: int(dinfo.image_width), Height: int(dinfo.image_height), } return }
c16914
stride := pad(w, alignSize) + alignSize ph := pad(h, alignSize) + alignSize pix := make([]uint8, stride*ph) return &image.Gray{ Pix: pix, Stride: stride, Rect: r, } }
c16915
{ case *image.YCbCr: err = encodeYCbCr(cinfo, s, opt) case *image.Gray: err = encodeGray(cinfo, s, opt) case *image.RGBA: err = encodeRGBA(cinfo, s, opt) default: return errors.New("unsupported image type") } return }
c16916
= 1, 2 compInfo[Cb].h_samp_factor, compInfo[Cb].v_samp_factor = 1, 1 compInfo[Cr].h_samp_factor, compInfo[Cr].v_samp_factor = 1, 1 colorVDiv = 2 case image.YCbCrSubsampleRatio422: // 2x1,1x1,1x1 compInfo[Y].h_samp_factor, compInfo[Y].v_samp_factor = 2, 1 compInfo[Cb].h_samp_factor, compInfo[Cb].v_samp_fac...
c16917
libjpeg-turbo)") } C.jpeg_set_defaults(cinfo) setupEncoderOptions(cinfo, p) // Start compression C.jpeg_start_compress(cinfo, C.TRUE) C.encode_rgba(cinfo, C.JSAMPROW(unsafe.Pointer(&src.Pix[0])), C.int(src.Stride)) C.jpeg_finish_compress(cinfo) return }
c16918
raw data in is in planar format, which avoids unnecessary // planar->packed->planar conversions. cinfo.raw_data_in = C.TRUE // Start compression C.jpeg_start_compress(cinfo, C.TRUE) C.encode_gray(cinfo, C.JSAMPROW(unsafe.Pointer(&src.Pix[0])), C.int(src.Stride)) C.jpeg_finish_compress(cinfo) return }
c16919
*Residency { r.TaskLostBehavior = behavior return r }
c16920
*Residency { r.RelaunchEscalationTimeoutSeconds = int(timeout.Seconds()) return r }
c16921
p.Backoff = &backoffSeconds return p }
c16922
p.BackoffFactor = &backoffFactor return p }
c16923
p.MaxLaunchDelay = &maxLaunchDelaySeconds return p }
c16924
p.MinimumHealthCapacity = &capacity return p }
c16925
p.MaximumOverCapacity = &capacity return p }
c16926
*PodBackoff) *PodSchedulingPolicy { p.Backoff = backoff return p }
c16927
*PodUpgrade) *PodSchedulingPolicy { p.Upgrade = upgrade return p }
c16928
{ p.Placement = placement return p }
c16929
p.KillSelection = killSelection return p }
c16930
= &UnreachableStrategy{ EnabledUnreachableStrategy: strategy, } return p }
c16931
{ p.UnreachableStrategy = &UnreachableStrategy{ AbsenceReason: UnreachableStrategyAbsenceReasonDisabled, } return p }
c16932
return nil } return fmt.Errorf("failed to unmarshal unreachable strategy: unmarshaling into enabled returned error '%s'; unmarshaling into non-enabled returned error '%s'", errEnabledUS, errNonEnabledUS) }
c16933
return json.Marshal(us.EnabledUnreachableStrategy) } return json.Marshal(us.AbsenceReason) }
c16934
us.InactiveAfterSeconds = &cap return us }
c16935
us.ExpungeAfterSeconds = &cap return us }
c16936
h.Command = &c return h }
c16937
h.PortIndex = &i return h }
c16938
h.Port = &i return h }
c16939
h.Path = &p return h }
c16940
h.MaxConsecutiveFailures = &i return h }
c16941
h.IgnoreHTTP1xx = &ignore return h }
c16942
&portIndex, MaxConsecutiveFailures: &maxConsecutiveFailures, GracePeriodSeconds: 30, IntervalSeconds: 10, TimeoutSeconds: 5, } }
c16943
p.GracePeriodSeconds = &gracePeriodSeconds return p }
c16944
p.IntervalSeconds = &intervalSeconds return p }
c16945
p.MaxConsecutiveFailures = &maxFailures return p }
c16946
p.TimeoutSeconds = &timeoutSeconds return p }
c16947
p.DelaySeconds = &delaySeconds return p }
c16948
{ h.Path = path return h }
c16949
h.Scheme = scheme return h }
c16950
PodCommand) *CommandHealthCheck { c.Command = p return c }
c16951
map[string]Secret{}, Volumes: []*PodVolume{}, Networks: []*PodNetwork{}, } }
c16952
make(map[string]string) return p }
c16953
p.Labels[key] = value return p }
c16954
*Pod { p.Labels = labels return p }
c16955
make(map[string]string) return p }
c16956
= append(p.Containers, container) return p }
c16957
make(map[string]Secret) return p }
c16958
} return "", fmt.Errorf("secret does not exist") }
c16959
} p.Secrets[secretName] = Secret{EnvVar: envVar, Source: sourceName} return p }
c16960
= append(p.Volumes, vol) return p }
c16961
= append(p.Networks, net) return p }
c16962
"fixed", Instances: count, } return p }
c16963
p.Scheduling = policy return p }
c16964
*Pod { p.ExecutorResources = resources return p }
c16965
ok := err.(*APIError); ok && apiErr.ErrCode == ErrCodeNotFound { return false, nil } return false, err } return true, nil }
c16966
nil, result); err != nil { return nil, err } return result, nil }
c16967
&result); err != nil { return nil, err } return result, nil }
c16968
if err := r.apiPost(marathonAPIPods, &pod, result); err != nil { return nil, err } return result, nil }
c16969
err := r.apiDelete(uri, nil, deployID); err != nil { return nil, err } return deployID, nil }
c16970
err := r.apiPut(uri, pod, result); err != nil { return nil, err } return result, nil }
c16971
nil, &result); err != nil { return nil, err } return result, nil }
c16972
:= r.apiGet(uri, nil, result); err != nil { return nil, err } return result, nil }
c16973
&PersistentVolume{} v.Persistent = ev return ev }
c16974
container.Docker = &Docker{} return container }
c16975
us.MinimumHealthCapacity = &cap return us }
c16976
us.MaximumOverCapacity = &cap return us }
c16977
r.apiGet(marathonAPISubscription, nil, subscriptions); err != nil { return nil, err } return subscriptions, nil }
c16978
r.config.CallbackURL, defaultEventsURL) } return fmt.Sprintf("http://%s:%d%s", r.ipAddress, r.config.EventsPort, defaultEventsURL) }
c16979
case EventsTransportSSE: return r.registerSSESubscription() default: return fmt.Errorf("the events transport: %d is not supported", r.config.EventsTransport) } }
c16980
!= nil { r.debugLog("Error connecting SSE subscription: %s", err) <-time.After(5 * time.Second) continue } err = r.listenToSSE(stream) stream.Close() r.debugLog("Error on SSE subscription: %s", err) } }() r.subscribedToSSE = true return nil }
c16981
if err != nil { return nil, err } return queue, nil }
c16982
empty hosts if u.Host == "" { return nil, newInvalidEndpointError("endpoint: %s must have a host", endpoint) } // step: if DCOS is set and no path is given, set the default DCOS path. // done in order to maintain compatibility with automatic addition of the // default DCOS path. if isDCOS && strings.Tr...
c16983
n := range c.members { if n.status == memberStatusUp { return n.endpoint, nil } } return "", ErrMarathonDown }
c16984
multiple checks if n.status == memberStatusUp && n.endpoint == endpoint { n.status = memberStatusDown go c.healthCheckNode(n) break } } }
c16985
{ req, err := c.client.buildMarathonRequest("GET", node.endpoint, "ping", nil) if err == nil { res, err := c.client.Do(req) if err == nil && res.StatusCode == 200 { // step: mark the node as active again c.Lock() node.status = memberStatusUp c.Unlock() break } } } }
c16986
var list []string for _, m := range c.members { if m.status == status { list = append(list, m.endpoint) } } return list }
c16987
return fmt.Sprintf("member: %s:%s", m.endpoint, status) }
c16988
&PodNetwork{ Name: name, Labels: map[string]string{}, } }
c16989
NewPodNetwork(name) return pn.SetMode(ContainerNetworkMode) }
c16990
n.Name = name return n }
c16991
*PodNetwork { n.Mode = mode return n }
c16992
n.Labels[key] = value return n }
c16993
e.Name = name return e }
c16994
e.ContainerPort = port return e }
c16995
e.HostPort = port return e }
c16996
= append(e.Protocol, protocol) return e }
c16997
e.Labels[key] = value return e }
c16998
r.apiDelete(uri, instances, &result); err != nil { return nil, err } return result, nil }
c16999
:= r.apiDelete(uri, nil, result); err != nil { return nil, err } return result, nil }