id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c16600
return &Error{"xattr.FSet", f.Name(), name, err} } return nil }
c16601
return &Error{"xattr.SetWithFlags", path, name, err} } return nil }
c16602
return &Error{"xattr.LSetWithFlags", path, name, err} } return nil }
c16603
return &Error{"xattr.FSetWithFlags", f.Name(), name, err} } return nil }
c16604
name); err != nil { return &Error{"xattr.Remove", path, name, err} } return nil }
c16605
name); err != nil { return &Error{"xattr.LRemove", path, name, err} } return nil }
c16606
name); err != nil { return &Error{"xattr.FRemove", f.Name(), name, err} } return nil }
c16607
func(data []byte) (int, error) { return listxattr(path, data) }) }
c16608
{ return llistxattr(path, data) }) }
c16609
func(data []byte) (int, error) { return flistxattr(f, data) }) }
c16610
of ERANGE error when reading // from a SMB1 mount point (https://github.com/pkg/xattr/issues/16). buf := make([]byte, size+1) // Read into buffer of that size. read, err := listxattrFunc(buf) if err != nil { return nil, &Error{myname, path, "", err} } return stringsFromByteSlice(buf[:read]), nil } r...
c16611
int) { size = len(data) if size > 0 { ptr = &data[0] } return }
c16612
&& bytes.HasPrefix(ip, v4Prefix) { return IPv4 } return IPv6 }
c16613
nil { return nil, err } for _, network := range networks { if ipNet, castable := network.(*net.IPNet); castable { ips = append(ips, ipNet.IP) } } // Note that on non-IP interfaces it will be an empty slice // and no error indicator. Maybe that's not super-perfect. return ips, nil }
c16614
syscall.IPPROTO_UDP default: return ErrUnknownProtocol } if o.Flags != "" { for _, flag := range strings.Split(o.Flags, "|") { if _, ok := schedulerFlags[flag]; !ok { return ErrUnknownFlag } } } if len(o.Method) == 0 { // WRR since Pulse will dynamically reweight backends. o.Method = "wrr" ...
c16615
case "tunnel", "ipip": o.methodID = gnl2go.IPVS_TUNNELING default: return ErrUnknownMethod } if o.Pulse == nil { // It doesn't make much sense to have a backend with no Pulse. o.Pulse = &pulse.Options{} } return nil }
c16616
o.Type = strings.ToLower(o.Type) if fn := get[o.Type]; fn == nil { return ErrUnknownPulseType } var err error if o.interval, err = util.ParseInterval(o.Interval); err != nil { return err } else if o.interval <= 0 { return ErrInvalidPulseInterval } return nil }
c16617
StatusUp, Health: 1, Uptime: 0, lastTs: time.Now()} }
c16618
m.Health/float64(len(m.record)) if ts := time.Now(); m.Status != StatusUp { m.Uptime, m.lastTs = 0, ts } else { m.Uptime, m.lastTs = m.Uptime+ts.Sub(m.lastTs)/time.Second, ts } return *m }
c16619
32) duration := intervals[strings.ToLower(m[2])] return duration * time.Duration(value), nil } return 0, errInvalidIntervalFormat }
c16620
JSONOptions. json.Indent(&buffer, output, "", "\t") return buffer.Bytes() default: return output } }
c16621
return newConsulDriver(opts.Args) default: return &noopDriver{}, nil } }
c16622
return nil, err } stopCh := make(chan struct{}) return &Pulse{d, opts.interval, stopCh, NewMetrics()}, nil }
c16623
} case <-p.stopCh: log.Infof("stopping pulse for %s", id) pulseCh <- Update{id, p.metrics.Update(StatusRemoved)} return } // TODO(@kobolog): Add exponential back-offs, thresholds. interval = p.interval log.Debugf("current pulse for %s: %s", id, p.metrics.Status.String()) } }
c16624
} else if isInt(v.(string)) { convertedValue, _ := strconv.Atoi(v.(string)) return convertedValue } else { return d } }
c16625
future, since it's not really maintained anymore. return nil, ErrIpvsSyscallFailed } if options.Flush && ctx.ipvs.Flush() != nil { log.Errorf("unable to clean up IPVS pools - ensure ip_vs is loaded") ctx.Close() return nil, ErrIpvsSyscallFailed } if options.VipInterface != "" { var err error if ctx.v...
c16626
range ctx.services { ctx.RemoveService(vsID) } // This is not strictly required, as far as I know. ctx.ipvs.Exit() }
c16627
for vsID := range ctx.services { r = append(r, vsID) } return r, nil }
c16628
+= backend.metrics.Health } if len(result.Backends) == 0 { // Service without backends is healthy, albeit useless. result.Health = 1.0 } else { result.Health /= float64(len(result.Backends)) } return &result, nil }
c16629
!exists { return nil, ErrObjectNotFound } return &BackendInfo{rs.options, rs.metrics}, nil }
c16630
if f, ok := fc["facet_fields"].(map[string]interface{}); ok { sr.Facets = f } } }
c16631
*SolrResult) { if jf, ok := response.Response["facets"].(map[string]interface{}); ok { sr.JsonFacets = jf } }
c16632
ok := response.Response["facet_counts"].(map[string]interface{}); ok { sr.FacetCounts = facetCounts } }
c16633
ok := response.Response["highlighting"].(map[string]interface{}); ok { sr.Highlighting = highlighting } }
c16634
ok := response.Response["stats"].(map[string]interface{}); ok { sr.Stats = stats } }
c16635
= username ca.password = password }
c16636
&& password != "" { req.SetBasicAuth(username, password) } if len(headers) > 0 { for i := range headers { req.Header.Add(headers[i][0], headers[i][1]) } } return makeRequest(client, req) }
c16637
if err != nil { return nil, err } if username != "" && password != "" { req.SetBasicAuth(username, password) } if len(headers) > 0 { for i := range headers { req.Header.Add(headers[i][0], headers[i][1]) } } return makeRequest(client, req) }
c16638
return nil, err } return &Connection{url: u, core: core}, nil }
c16639
params.Encode()), b, [][]string{{"Content-Type", "application/json"}}, c.username, c.password) if err != nil { return nil, err } resp, err := bytes2json(&r) if err != nil { return nil, err } // check error in resp if !successStatus(resp) || hasError(resp) { return &SolrUpdateResponse{Success: false, Resu...
c16640
} if c != nil { s.conn = c } return s }
c16641
} if s.Debug != "" { s.query.params.Set("debug", s.Debug) s.query.params.Set("indent", "true") } return s.query.params }
c16642
nil { parser = new(StandardResultParser) } return parser.Parse(resp) }
c16643
return nil, err } return &Schema{url: u, core: core}, nil }
c16644
fmt.Sprintf("%d", start)) }
c16645
fmt.Sprintf("%d", rows)) }
c16646
ok := d[k] return ok }
c16647
_ := d[k] return v }
c16648
return nil, err } return &SolrInterface{conn: c}, nil }
c16649
return NewSearch(si.conn, q) }
c16650
chunks := make([]map[string]interface{}, num_chunk) for i := 0; i < num_chunk; i++ { add := make([]Document, 0, chunk_size) for j := 0; j < chunk_size; j++ { if doc_counter >= docs_len { break } add = append(add, docs[doc_counter]) doc_counter++ } chunks[i] = M{"add": add} } return chunks }
c16651
{ res, err := si.Update(chunks[i], params) if err != nil { return nil, err } result.Success = result.Success && res.Success responses[fmt.Sprintf("chunk_%d", i+1)] = M{ "result": res.Result, "success": res.Success, "total": len(chunks[i]["add"].([]Document))} } result.Result = responses ret...
c16652
params.Add("commit", "true") return si.Delete(M{"query": "*:*"}, params) }
c16653
&url.Values{} params.Add("commit", "true") return si.Update(M{}, params) }
c16654
nil, err } ca.SetBasicAuth(si.conn.username, si.conn.password) return ca, nil }
c16655
if err != nil { return nil, err } s.SetBasicAuth(si.conn.username, si.conn.password) return s, nil }
c16656
return "", -1, fmt.Errorf("Unexpected response returned") } if QTime, ok := resp["responseHeader"].(map[string]interface{})["QTime"].(float64); ok { qtime = int(QTime) } else { qtime = -1 } return status, qtime, nil }
c16657
((sum >> i) & 1) if bit == 1 { v[i] += weight } else { v[i] -= weight } } } return v }
c16658
return feature{h.Sum64(), 1} }
c16659
:= NewFeature(f) fw.weight = weight return fw }
c16660
true, func(s *sinkSession) error { h, err := s.ReadHeaderOrReply() if err != nil { return fmt.Errorf("failed to read scp message header: err=%s", err) } timeHeader, ok := h.(timeMsgHeader) if !ok { return fmt.Errorf("expected time message header, got %+v", h) } h, err = s.ReadHeaderOrReply() if ...
c16661
err != nil { return fmt.Errorf("failed to open source file: err=%s", err) } // NOTE: file will be closed by WriteFile. err = s.WriteFile(fi, file) if err != nil { return fmt.Errorf("failed to copy file: err=%s", err) } return nil }) }
c16662
:= acceptFn(filepath.Dir(path), scpFileInfo) if err != nil { return err } if isDir { if !accepted { prevDirSkipped = true return filepath.SkipDir } err := s.StartDirectory(scpFileInfo) if err != nil { return err } } else { if accepted { fi := newFileInfoFro...
c16663
Regular{find, replace}) compile() }
c16664
= append(singularInflections, Regular{find, replace}) compile() }
c16665
Irregular{singular, plural}) compile() }
c16666
copy(plurals, pluralInflections) return plurals }
c16667
copy(singulars, singularInflections) return singulars }
c16668
copy(irregular, irregularInflections) return irregular }
c16669
copy(uncountables, uncountableInflections) return uncountables }
c16670
return inflection.regexp.ReplaceAllString(str, inflection.replace) } } return str }
c16671
if inflection.regexp.MatchString(str) { return inflection.regexp.ReplaceAllString(str, inflection.replace) } } return str }
c16672
secret: secret, plugin: plugin, logger: logs, } if handler.logger == nil { handler.logger = logger.Discard() } return handler }
c16673
}, Transport: &http.Transport{ Proxy: http.ProxyFromEnvironment, TLSClientConfig: &tls.Config{ InsecureSkipVerify: true, }, }, } } return client }
c16674
} defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { return err } if res.StatusCode > 299 { // if the response body includes an error message // we should return the error string. if len(body) != 0 { return errors.New( string(body), ) } // if the response body is...
c16675
strings.TrimSuffix(uri, "/")} }
c16676
c.addr) err := c.get(uri, out) return out, err }
c16677
c.addr, login) err := c.get(uri, out) return out, err }
c16678
c.addr) err := c.get(uri, &out) return out, err }
c16679
c.addr) err := c.post(uri, in, out) return out, err }
c16680
out := new(User) uri := fmt.Sprintf(pathUser, c.addr, login) err := c.patch(uri, in, out) return out, err }
c16681
:= fmt.Sprintf(pathUser, c.addr, login) err := c.delete(uri) return err }
c16682
:= new(Repo) uri := fmt.Sprintf(pathRepo, c.addr, owner, name) err := c.get(uri, out) return out, err }
c16683
c.addr) err := c.get(uri, &out) return out, err }
c16684
c.addr) err := c.post(uri, nil, &out) return out, err }
c16685
new(Repo) uri := fmt.Sprintf(pathRepo, c.addr, owner, name) err := c.post(uri, nil, out) return out, err }
c16686
owner, name) err := c.delete(uri) return err }
c16687
owner, name) err := c.patch(uri, in, out) return out, err }
c16688
owner, name) return c.post(uri, nil, nil) }
c16689
fmt.Sprintf(pathBuild, c.addr, owner, name, num) err := c.get(uri, out) return out, err }
c16690
{ uri += "?branch=" + branch } err := c.get(uri, out) return out, err }
c16691
encodeListOptions(opts)) err := c.get(uri, &out) return out, err }
c16692
build) if len(params) > 0 { uri = uri + "?" + val.Encode() } err := c.post(uri, nil, out) return out, err }
c16693
{ uri := fmt.Sprintf(pathBuild, c.addr, owner, name, build) err := c.delete(uri) return err }
c16694
fmt.Sprintf(pathBuilds, c.addr, owner, name, param) err := c.delete(uri) return err }
c16695
:= fmt.Sprintf(pathRollback, c.addr, namespace, name, build, val.Encode()) err := c.post(uri, nil, out) return out, err }
c16696
name, build, stage) err := c.post(uri, nil, nil) return err }
c16697
out []*Line uri := fmt.Sprintf(pathLog, c.addr, owner, name, build, stage, step) err := c.get(uri, &out) return out, err }
c16698
{ uri := fmt.Sprintf(pathLog, c.addr, owner, name, build, stage, step) err := c.delete(uri) return err }
c16699
out := struct { Data string `json:"data"` }{} uri := fmt.Sprintf(pathSign, c.addr, owner, name) err := c.post(uri, &in, &out) return out.Data, err }