id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c12900 | c.transport.TLSHandshakeTimeout = d
c.dialer.Timeout = d
}
} | |
c12901 | *Config) {
c.client.Transport = rt
}
} | |
c12902 |
c.transport.TLSClientConfig = tc
}
} | |
c12903 | != nil {
modifyTransport(c.transport)
}
}
} | |
c12904 | *Config) {
if f != nil {
if rt := f(c.client.Transport); rt != nil {
c.client.Transport = rt
}
}
}
} | |
c12905 | := resources.Clone()
return x.Subtract(that...)
} | |
c12906 | := resources.Clone()
return x.Add(that...)
} | |
c12907 | := resources.Clone()
return x.Subtract1(that)
} | |
c12908 | return false
}
if ls := left.GetDisk().GetSource(); ls != nil {
switch ls.GetType() {
case Resource_DiskInfo_Source_PATH:
// Two PATH resources can be added if their disks are identical
case Resource_DiskInfo_Source_BLOCK,
Resource_DiskInfo_Source_MOUNT:
// Two resources that represent exclusive 'MOU... | |
c12909 | right.GetRanges().Compare(left.GetRanges()) <= 0
case SET:
return right.GetSet().Compare(left.GetSet()) <= 0
default:
return false
}
} | |
c12910 |
case RANGES:
left.Ranges = left.GetRanges().Subtract(right.GetRanges())
case SET:
left.Set = left.GetSet().Subtract(right.GetSet())
}
} | |
c12911 | left.GetType() != t {
panic(fmt.Sprintf("expected type %v instead of %v", t, left.GetType()))
}
return t
} | |
c12912 | len(left.GetRanges().GetRange()) == 0
case SET:
return len(left.GetSet().GetItem()) == 0
}
return false
} | |
c12913 | (left.Role == nil || left.GetRole() == "*") && left.GetReservation() == nil && len(left.GetReservations()) == 0
} | |
c12914 | using the old reservation API, role is a first class field of Resource
// (and it's never stored in Resource.Reservation).
return r.GetRole()
} | |
c12915 | := left.ReservationRole()
return role == r || roles.IsStrictSubroleOf(role, r)
} | |
c12916 | return rs[len(rs)-1].GetType() == Resource_ReservationInfo_DYNAMIC
}
return false
} | |
c12917 | {
if s := left.GetDisk().GetSource(); s != nil {
return s.GetType() == t
}
return false
} | |
c12918 | Add1 to avoid additional calls to Clone
rr := *r
for j := range result {
r2 := &result[j]
if r2.Addable(rr) {
r2.Add(rr)
continue pop_next
}
}
// cannot be combined with an existing resource
result = append(result, rr)
}
return
} | |
c12919 | }
r.AllocationInfo = &Resource_AllocationInfo{Role: &role}
} | |
c12920 | rs[i].AllocationInfo = &Resource_AllocationInfo{Role: &role}
}
return rs
} | |
c12921 | rs[i].AllocationInfo = nil
}
return rs
} | |
c12922 | offset
for i, opt := range opts {
if opt != nil {
undo[size-i] = opt(c)
}
}
return undo.Merged()
}
} | |
c12923 | nil {
return o
}
return Opts{o, other}.Merged()
} | |
c12924 | &transport,
address: address,
shouldQuit: make(chan struct{}),
server: &http.Server{
ReadTimeout: ReadTimeout,
WriteTimeout: WriteTimeout,
Handler: mux,
},
}
for _, f := range opts {
f(result)
}
result.state = ¬StartedState{result}
return result
} | |
c12925 | {
return t.getState().Send(ctx, msg)
} | |
c12926 | if (resp.StatusCode != http.StatusOK) && (resp.StatusCode != http.StatusAccepted) {
return &mesosError{
errorCode: resp.StatusCode,
upid: msg.UPID.String(),
uri: msg.RequestURI(),
status: resp.Status,
}
}
return nil
})
} | |
c12927 | defer t.stateLock.Unlock()
return t.state.Start()
} | |
c12928 |
log.Errorln("HTTP server stopped with error", err.Error())
} else {
log.V(1).Infof("HTTP server stopped")
}
ch <- err
t.Stop(false)
}
}()
return t.upid, ch
} | |
c12929 | t.stateLock.Unlock()
return t.state.Stop(graceful)
} | |
c12930 | pending requests to terminate
err := t.listener.Close()
return err
} | |
c12931 | t.stateLock.Unlock()
return t.upid
} | |
c12932 | uf)
)
return encoding.DecoderFunc(func(u encoding.Unmarshaler) error { return dec.Decode(u) })
} | |
c12933 | (mesos.Response, error) {
return f(ctx, c)
} | |
c12934 | error {
resp, err := caller.Call(ctx, call)
if resp != nil {
resp.Close()
}
return err
} | |
c12935 | labels := labeler(ctx, e)
harness(func() error {
ctx, e, err = ch(ctx, e, err)
return err
}, labels...)
return ctx, e, err
}
} | |
c12936 | newErr := h.HandleEvent(ctx, e)
return chain(ctx, e, Error2(err, newErr))
}
} | |
c12937 |
cache.lock.Lock()
cache.savedOffers[offer.Id.GetValue()] = &cachedOffer{offer: offer, slavePid: pid}
cache.lock.Unlock()
} | |
c12938 |
}
cache.lock.RLock()
defer cache.lock.RUnlock()
return cache.savedOffers[offerId.GetValue()]
} | |
c12939 | return f
default:
return framing.ReaderFunc(framing.EOFReaderFunc)
}
}
} | |
c12940 | if len(b) == 0 && err == nil {
err = io.EOF
}
return
}
} | |
c12941 | n, err := w.Write(b)
if err == nil && n != len(b) {
return io.ErrShortWrite
}
return err
}
} | |
c12942 | a(float64(x), s...)
} | |
c12943 | (
t = clock()
err = f()
)
timed.Since(t, labels...)
if err != nil {
errors(labels...)
}
return err
}
} else {
harness = func(f func() error, labels ...string) error {
counts(labels...)
err := f()
if err != nil {
errors(labels...)
}
return err
}
}
return harness
... | |
c12944 | http.RoundTripper {
return roundTripperFunc(func(req *http.Request) (*http.Response, error) {
var h http.Header
if req.Header != nil {
h = make(http.Header, len(req.Header))
for k, v := range req.Header {
h[k] = append(make([]string, 0, len(v)), v...)
}
}
clonedReq := *req
clonedReq.H... | |
c12945 | _ mesos.Response, _ error, ch Chain) (context.Context, *scheduler.Call, mesos.Response, error) {
resp, err := caller.Call(ctx, c)
return ch(ctx, c, resp, err)
}
} | |
c12946 | Rules{r, Call(caller)}.Eval
} | |
c12947 | r.Caller(calls.Caller(cf))
} | |
c12948 |
}
<-l.line // concurrent calls to Close block until the latch is actually closed
} | |
c12949 | l.value = make(chan struct{}), 0
return l
} | |
c12950 | rf
}
return func(acc, x *mesos.Resource) *mesos.Resource {
if f(x) {
return rf(acc, x)
}
return acc
}
} | |
c12951 | rf
}
return rf.If(func(r *mesos.Resource) bool {
return !f(r)
})
} | |
c12952 | not be nil")
}
for i := range rs {
r = rf(r, &rs[i])
}
return
} | |
c12953 |
if opt != nil {
opt(r)
}
}
return r
} | |
c12954 |
x := make(CallOptions, len(co))
copy(x, co)
return x
} | |
c12955 | return IllegalState, nil, IllegalStateErr
} | |
c12956 | invoke Split after scanning has started,
// use this proxy func as a work-around.
return r.splitf(data, atEOF)
})
buf := make([]byte, 16*1024)
r.Buffer(buf, 1<<22) // 1<<22 == max protobuf size
r.splitf = r.splitSize
// apply options
for _, f := range opt {
if f != nil {
f(r)
}
}
return r
} | |
c12957 | succeeded and we have a token...
err = r.Err()
if err == nil && len(tok) == 0 {
err = io.EOF
}
return
} | |
c12958 | make(chan struct{}),
recoveryTimeout: defaultRecoveryTimeout,
}
driver.cond = sync.NewCond(&driver.lock)
// decouple serialized executor callback execution from goroutines of this driver
var execLock sync.Mutex
driver.withExecutor = func(f func(e Executor)) {
go func() {
execLock.Lock()
defer execLoc... | |
c12959 |
defer driver.lock.Unlock()
return driver.stop()
} | |
c12960 |
}
driver.cond.Broadcast()
}()
driver.status = stopStatus
if err != nil {
return err
}
return nil
} | |
c12961 |
defer driver.lock.Unlock()
return driver.abort()
} | |
c12962 |
defer driver.lock.Unlock()
return driver.join()
} | |
c12963 | (mesosproto.Status, error) {
driver.lock.Lock()
defer driver.lock.Unlock()
return driver.sendStatusUpdate(taskStatus)
} | |
c12964 |
defer driver.lock.Unlock()
return driver.sendFrameworkMessage(data)
} | |
c12965 | > 0 {
result = make([]mesos.TaskInfo, 0, n)
for k := range state.unackedTasks {
result = append(result, state.unackedTasks[k])
}
}
return
} | |
c12966 | > 0 {
result = make([]executor.Call_Update, 0, n)
for k := range state.unackedUpdates {
result = append(result, state.unackedUpdates[k])
}
}
return
} | |
c12967 | leaderSyncInterval: defaultMesosLeaderSyncInterval,
httpClientTimeout: defaultMesosHttpClientTimeout,
assumedMasterPort: defaultMesosMasterPort,
}
stand.poller = stand._poller
stand.fetchPid = stand._fetchPid
return stand
} | |
c12968 | o != nil {
log.V(1).Info("spawning asyc master detector listener")
go func() {
log.V(2).Infof("waiting for polled to send updates")
pollWaiter:
for {
select {
case mi, ok := <-s.ch:
if !ok {
break pollWaiter
}
log.V(1).Infof("detected master change: %+v", mi)
o.OnMasterCha... | |
c12969 | != nil {
return h.HandleEvent(ctx, e)
}
return nil
} | |
c12970 | splits[1]); err != nil {
return nil, err
}
upid.Host, upid.Port, _ = net.SplitHostPort(splits[1])
return upid, nil
} | |
c12971 | != nil && u.ID == upid.ID && u.Host == upid.Host && u.Port == upid.Port
}
} | |
c12972 | != nil {
call.GetMetrics.Timeout = &mesos.DurationInfo{
Nanoseconds: d.Nanoseconds(),
}
}
return
} | |
c12973 |
Type: master.Call_LIST_FILES,
ListFiles: &master.Call_ListFiles{
Path: path,
},
}
} | |
c12974 |
Type: master.Call_READ_FILE,
ReadFile: &master.Call_ReadFile{
Path: path,
Offset: offset,
},
}
} | |
c12975 |
Type: master.Call_UPDATE_WEIGHTS,
UpdateWeights: &master.Call_UpdateWeights{
WeightInfos: weights,
},
}
} | |
c12976 |
Type: master.Call_RESERVE_RESOURCES,
ReserveResources: &master.Call_ReserveResources{
AgentID: a,
Resources: r,
},
}
} | |
c12977 |
Type: master.Call_UNRESERVE_RESOURCES,
UnreserveResources: &master.Call_UnreserveResources{
AgentID: a,
Resources: r,
},
}
} | |
c12978 |
Type: master.Call_CREATE_VOLUMES,
CreateVolumes: &master.Call_CreateVolumes{
AgentID: a,
Volumes: v,
},
}
} | |
c12979 |
Type: master.Call_DESTROY_VOLUMES,
DestroyVolumes: &master.Call_DestroyVolumes{
AgentID: a,
Volumes: v,
},
}
} | |
c12980 |
Type: master.Call_GROW_VOLUME,
GrowVolume: &master.Call_GrowVolume{
AgentID: a,
Volume: volume,
Addition: addition,
},
}
} | |
c12981 | &master.Call{
Type: master.Call_SHRINK_VOLUME,
ShrinkVolume: &master.Call_ShrinkVolume{
AgentID: a,
Volume: volume,
Subtract: subtract,
},
}
} | |
c12982 | master.Call_UPDATE_MAINTENANCE_SCHEDULE,
UpdateMaintenanceSchedule: &master.Call_UpdateMaintenanceSchedule{
Schedule: s,
},
}
} | |
c12983 |
StartMaintenance: &master.Call_StartMaintenance{
Machines: m,
},
}
} | |
c12984 |
StopMaintenance: &master.Call_StopMaintenance{
Machines: m,
},
}
} | |
c12985 |
Type: master.Call_SET_QUOTA,
SetQuota: &master.Call_SetQuota{
QuotaRequest: qr,
},
}
} | |
c12986 |
Type: master.Call_REMOVE_QUOTA,
RemoveQuota: &master.Call_RemoveQuota{
Role: role,
},
}
} | |
c12987 |
MarkAgentGone: &master.Call_MarkAgentGone{
AgentID: id,
},
}
} | |
c12988 |
Type: master.Call_TEARDOWN,
Teardown: &master.Call_Teardown{
FrameworkID: id,
},
}
} | |
c12989 | append(rb.Ranges, mesos.Value_Range{Begin: bp, End: ep})
return rb
} | |
c12990 | h := hs[e.GetType()]; h != nil {
return h.HandleEvent(ctx, e)
}
return f(ctx, e)
}
} | |
c12991 | a graceful cancel to a forced one
if !graceful {
select {
case <-d.forceQuit:
// already forcefully quitting
default:
close(d.forceQuit) // push it!
}
}
} | |
c12992 | stream.
d.chunked = true
} else {
// via https://tools.ietf.org/html/rfc7230#section-3.3.2
d.req.ContentLength = 0
}
}
// check "Connection" for "Keep-Alive"
d.kalive = d.req.Header.Get("Connection") == "Keep-Alive"
log.V(2).Infof(d.idtag+"update-for-request: chunked %v keep-alive %v", d.chunked, d.... | |
c12993 | no further responses should be written
d.Cancel(false)
if d.con != nil {
d.con.Close()
}
// there is no spoon
return nil
} | |
c12994 |
case <-d.shouldQuit:
return gracefulTerminateState, true
default:
return stateContinue, true
}
}
d.sendError(err)
return terminateState, true
}
return nil, false
} | |
c12995 | ch Chain) (context.Context, *executor.Event, error) {
return ch(rs.Chain()(ctx, e, err))
} | |
c12996 | {
old := c.redirect.MaxAttempts
c.redirect.MaxAttempts = mr
return MaxRedirects(old)
}
} | |
c12997 | c.allowReconnect = v
return AllowReconnection(old)
}
} | |
c12998 | cl.With(result.redirectHandler())
for _, o := range opts {
if o != nil {
o(result)
}
}
return &state{
client: result,
fn: disconnectedFn,
}
} | |
c12999 | error) {
return cli.httpDo(ctx, call)
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.