id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c162800 | if _, ok := cc.cache[newCorrelationID]; ok {
log.Warning("BUG: Overwriting Kafka request message in correlation cache")
}
cc.cache[newCorrelationID] = &correlationEntry{
request: req,
created: time.Now(),
origCorrelationID: origCorrelationID,
finishFunc: finishFunc,
}
} | |
c162801 | defer cc.mutex.RUnlock()
entry, _ := cc.cache[id]
return entry
} | |
c162802 | if entry := cc.cache[correlationID]; entry != nil {
res.SetCorrelationID(entry.origCorrelationID)
if entry.finishFunc != nil {
entry.finishFunc(entry.request)
}
delete(cc.cache, correlationID)
return entry.request
}
return nil
} | |
c162803 | name,
MapOptions: *NewMapOpts(*values, validator),
}
} | |
c162804 | }
return &MapOptions{
vals: values,
validator: validator,
}
} | |
c162805 | := strings.SplitN(value, "=", 2)
if len(vals) == 1 {
(opts.vals)[vals[0]] = ""
} else {
(opts.vals)[vals[0]] = vals[1]
}
return nil
} | |
c162806 | *GetEndpointOK {
o.Payload = payload
return o
} | |
c162807 | err != nil {
err = fmt.Errorf("Invalid monitor aggregation level %q", value)
return MonitorAggregationLevelNone, err
}
parsed := OptionSetting(valueParsed)
if parsed < MonitorAggregationLevelNone || parsed > MonitorAggregationLevelMax {
err = fmt.Errorf("Monitor aggregation level must be between %d and %d",
... | |
c162808 | models.Error) *PatchConfigBadRequest {
o.Payload = payload
return o
} | |
c162809 | models.Error) *PatchConfigFailure {
o.Payload = payload
return o
} | |
c162810 |
return nil, Hint(err)
}
return resp.Payload, nil
} | |
c162811 |
params := daemon.NewPatchConfigParams().WithConfiguration(fullCfg.Spec).WithTimeout(api.ClientTimeout)
_, err = c.Daemon.PatchConfig(params)
return Hint(err)
} | |
c162812 | != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | |
c162813 | return nil, nil
}
parser := jsonpath.New("").AllowMissingKeys(true)
if err := parser.Parse(jsonPath); err != nil {
fmt.Fprintf(os.Stderr, "Couldn't parse jsonpath expression: '%s'\n", err)
return nil, err
}
buf := new(bytes.Buffer)
if err := parser.Execute(buf, data); err != nil {
fmt.Fprintf(os.Stderr, ... | |
c162814 | return err
}
fmt.Println(string(jsonBytes[:]))
return nil
} | |
c162815 |
ch := c.disconnected
c.disconnectedMu.RUnlock()
return ch
} | |
c162816 | _, err := c.KV().Put(k, opts.WithContext(ctx))
increaseMetric(key, metricSet, "Update", duration.EndError(err).Total(), err)
return err
} | |
c162817 | if _, err := c.CreateOnly(context.TODO(), key, value, lease); err != nil {
return err
}
// Consul does not support transactions which would allow to check for
// the presence of another key
masterKey, err := c.Get(condKey)
if err != nil || masterKey == nil {
c.Delete(key)
return fmt.Errorf("conditional key... | |
c162818 |
p := KeyValuePairs(make(map[string][]byte, len(pairs)))
for i := 0; i < len(pairs); i++ {
p[pairs[i].Key] = pairs[i].Value
}
return p, nil
} | |
c162819 | c.controllers.RemoveAll()
}
if c.lease != "" {
c.Session().Destroy(c.lease, nil)
}
} | |
c162820 |
log.WithField(fieldWatcher, w).Debug("Starting watcher...")
go c.Watch(w)
return w
} | |
c162821 |
return uint16(0)
}
return uint16(id)
} | |
c162822 | // the range. This is fine (tm) and we can just skip to reserve the ID
// from the pool as the pool will not cover it.
if idpool.ID(id) > maxID {
return nil
}
if !pool.Remove(idpool.ID(id)) {
return fmt.Errorf("endpoint ID %d is already in use", id)
}
return nil
} | |
c162823 | fmt.Errorf("Unable to release endpoint ID %d", id)
}
return nil
} | |
c162824 |
// Parameter is provided by construction from the route
o.Name = raw
return nil
} | |
c162825 | := getPrefix(currIP, ones)
lpmEntries = append(lpmEntries, lpmEntry{prefix, identity})
}
r := iradix.New()
for _, e := range lpmEntries {
r, _, _ = r.Insert(e.prefix, e.identity)
}
// Look-up using all bits in the argument ip
var mask int
if isV4 {
mask = 8 * net.IPv4len
} else {
mask = 8 * net.IPv6... | |
c162826 | >> uint8(j)
if mask&ip[i] == 0 {
bytes[i*8+j] = 0x0
} else {
bytes[i*8+j] = 0x1
}
n++
}
i++
}
return bytes
} | |
c162827 | }
if k == nil {
// Something is really wrong
errMsg := "Unable to retrieve last free ID because the key is always empty\n"
log.Error(errMsg)
return 0, fmt.Errorf(errMsg)
}
}
var freeID uint32
if err := json.Unmarshal(k, &freeID); err != nil {
return 0, err
}
return freeID, nil
} | |
c162828 | }
var kvstoreL3n4AddrID loadbalancer.L3n4AddrID
if err := json.Unmarshal(value, &kvstoreL3n4AddrID); err != nil {
return false, err
}
if kvstoreL3n4AddrID.ID == 0 {
log.WithField(logfields.Identity, *incID).Info("Recycling Service ID")
return false, setIDtoL3n4Addr(*incID)
}
*incID++
if *incID... | |
c162829 | svc's path
rmsg, err := kvstore.Client().Get(svcPath)
if err != nil {
return nil, err
}
sl4KV := loadbalancer.L3n4AddrID{}
if rmsg != nil {
if err := json.Unmarshal(rmsg, &sl4KV); err != nil {
return nil, err
}
}
if sl4KV.ID == 0 {
sl4KV.L3n4Addr = l3n4Addr
if err := gasNewL3n4AddrID(&sl4KV, baseI... | |
c162830 | L3n4AddrID for ID")
return getL3n4AddrID(path.Join(ServiceIDKeyPath, strID))
} | |
c162831 | nil
}
return deleteL3n4AddrIDBySHA256(l3n4AddrID.SHA256Sum())
} | |
c162832 | var l3n4AddrID loadbalancer.L3n4AddrID
if err := json.Unmarshal(rmsg, &l3n4AddrID); err != nil {
return err
}
oldL3n4ID := l3n4AddrID.ID
l3n4AddrID.ID = 0
// update the value in the kvstore
if err := updateL3n4AddrIDRef(oldL3n4ID, l3n4AddrID); err != nil {
return err
}
marshaledL3n4AddrID, err := json.Mar... | |
c162833 | MapPath(name)
}
return mapRegister[name]
} | |
c162834 | &GetFqdnCacheID{Context: ctx, Handler: handler}
} | |
c162835 | {
o.SetTimeout(timeout)
return o
} | |
c162836 | *GetFqdnCacheParams {
o.SetContext(ctx)
return o
} | |
c162837 | *http.Client) *GetFqdnCacheParams {
o.SetHTTPClient(client)
return o
} | |
c162838 | {
o.SetCidr(cidr)
return o
} | |
c162839 | o.SetMatchpattern(matchpattern)
return o
} | |
c162840 | switch component {
case components.CiliumAgentName:
metric = ErrorsWarnings
default:
panic(fmt.Sprintf("component %s is unsupported by LoggingHook", component))
}
return &LoggingHook{metric: metric}
} | |
c162841 | logrus.ErrorLevel,
logrus.WarnLevel,
}
} | |
c162842 | and doesn't contain 'subsys' field")
}
return fmt.Errorf("log entry doesn't contain 'subsys' field: %s", serializedEntry)
}
subsystem, ok := iSubsystem.(string)
if !ok {
return fmt.Errorf("type of the 'subsystem' log entry field is not string but %s", reflect.TypeOf(iSubsystem))
}
// Increment the metric.
... | |
c162843 | &GetPolicy{Context: ctx, Handler: handler}
} | |
c162844 | models.Error) *PutEndpointIDInvalid {
o.Payload = payload
return o
} | |
c162845 | models.Error) *PutEndpointIDFailed {
o.Payload = payload
return o
} | |
c162846 | Name: resp.Payload.Cluster.Self,
}
s.RWMutex.Unlock()
}
nodes := make(nodeMap)
for _, n := range resp.Payload.Cluster.Nodes {
if n.PrimaryAddress != nil {
if n.PrimaryAddress.IPV4 != nil {
nodes[ipString(n.PrimaryAddress.IPV4.IP)] = NewHealthNode(n)
}
if n.PrimaryAddress.IPV6 != nil {
nodes... | |
c162847 | s.connectivity.startTime.Before(report.startTime) {
s.connectivity = report
}
} | |
c162848 | return &healthModels.HealthStatusResponse{
Local: &healthModels.SelfStatus{
Name: name,
},
Nodes: s.connectivity.nodes,
Timestamp: s.connectivity.startTime.Format(time.RFC3339),
}
} | |
c162849 |
return nil, err
}
log.Debug("Run complete")
s.updateCluster(prober.getResults())
return s.GetStatusResponse(), nil
} | |
c162850 | err
}
server.Client = cl
server.Server = *server.newServer(swaggerSpec, 0)
}
for port := range PortToPaths {
srv := server.newServer(swaggerSpec, port)
server.tcpServers = append(server.tcpServers, srv)
}
return server, nil
} | |
c162851 | for _, cnp := range cnpToUpdate {
sem <- true
go func(cnp *cilium_v2.CiliumNetworkPolicy) {
defer func() { <-sem }()
addDerivativeCNP(cnp)
}(cnp)
}
} | |
c162852 | return pointInTime.After(entry.ExpirationTime)
} | |
c162853 | ips = append(ips, net.ParseIP(ip))
}
}
return ip.KeepUniqueIPs(ips) // sorts IPs
} | |
c162854 | lastCleanup: time.Now(),
cleanup: map[int64][]string{},
overLimit: map[string]bool{},
perHostLimit: 0,
minTTL: minTTL,
}
return c
} | |
c162855 | := NewDNSCache(minTTL)
c.perHostLimit = limit
return c
} | |
c162856 |
if c.removeExpired(entries, time.Now(), time.Time{}) {
changed = true
}
if c.perHostLimit > 0 && len(entries) > c.perHostLimit {
c.overLimit[entry.Name] = true
}
return changed
} | |
c162857 | entry.ExpirationTime.Unix()
expiredEntries, exists := c.cleanup[expiration]
if !exists {
expiredEntries = []string{}
}
c.cleanup[expiration] = append(expiredEntries, entry.Name)
} | |
c162858 |
result := []string{}
for _, name := range KeepUniqueNames(expiredEntries) {
if entries, exists := c.forward[name]; exists {
if !c.removeExpired(entries, c.lastCleanup, time.Time{}) {
continue
}
result = append(result, name)
}
}
return result, startTime
} | |
c162859 | entry})
}
sort.Slice(sortedEntries, func(i, j int) bool {
return sortedEntries[i].entry.ExpirationTime.Before(sortedEntries[j].entry.ExpirationTime)
})
for i := 0; i < overlimit; i++ {
key := sortedEntries[i]
delete(entries, key.ip)
c.removeReverse(key.ip, key.entry)
}
affectedNames = append(... | |
c162860 |
c.Unlock()
return KeepUniqueNames(append(expiredEntries, overLimitEntries...))
} | |
c162861 | {
for name := range update.forward {
namesToUpdate = append(namesToUpdate, name)
}
}
for _, name := range namesToUpdate {
newEntries, exists := update.forward[name]
if !exists {
continue
}
for _, newEntry := range newEntries {
c.updateWithEntry(newEntry)
}
}
} | |
c162862 | {
c.RLock()
defer c.RUnlock()
return c.lookupByTime(time.Now(), name)
} | |
c162863 | {
entries, found := c.forward[name]
if !found {
return nil
}
return entries.getIPs(now)
} | |
c162864 | c.lookupByRegexpByTime(time.Now(), re)
} | |
c162865 | re.MatchString(name) {
matches[name] = append(matches[name], entry.getIPs(now)...)
}
}
return matches
} | |
c162866 | {
c.RLock()
defer c.RUnlock()
return c.lookupIPByTime(time.Now(), ip)
} | |
c162867 | {
if entry != nil && !entry.isExpiredBy(now) {
names = append(names, name)
}
}
sort.Strings(names)
return names
} | |
c162868 | entries = make(map[string]*cacheEntry)
c.reverse[ip] = entries
}
entries[entry.Name] = entry
} | |
c162869 | return
}
delete(entries, entry.Name)
if len(entries) == 0 {
delete(c.reverse, ip)
}
} | |
c162870 | `now` parameter but it is redundant
// because LookupTime must be before ExpirationTime.
// The second expireLookupsBefore actually matches lookup times, and will
// delete the entries completely.
nameNeedsRegen := c.removeExpired(entries, expireLookupsBefore, expireLookupsBefore)
if nameNeedsRegen {
name... | |
c162871 | same,
// it is safe to overwrite the second duplicate.
sort.Slice(lookups, func(i, j int) bool {
return uintptr(unsafe.Pointer(lookups[i])) < uintptr(unsafe.Pointer(lookups[j]))
})
deduped := lookups[:0] // len==0 but cap==cap(lookups)
for readIdx, lookup := range lookups {
if readIdx == 0 || deduped[len(ded... | |
c162872 | isNetErr && netErr.Timeout() {
return true
}
return false
} | |
c162873 | for _, s := range []*dns.Server{p.UDPServer, p.TCPServer} {
go func(server *dns.Server) {
// try 5 times during a single ProxyBindTimeout period. We fatal here
// because we have no other way to indicate failure this late.
start := time.Now()
for time.Since(start) < ProxyBindTimeout {
if err := serve... | |
c162874 | pattern")
p.UpdateAllowed([]string{reStr}, nil, endpointID)
} | |
c162875 | for _, reStr := range reStrToRemove {
p.allowed.Remove(reStr, endpointID)
}
for _, reStr := range reStrToAdd {
p.allowed.Add(reStr, endpointID)
}
} | |
c162876 | nil {
scopedLog.WithError(err).Error("Cannot send REFUSED response")
err = fmt.Errorf("cannot send REFUSED response: %s", err)
}
return err
} | |
c162877 | default:
log.Infof("DNS reject response '%s' is not valid, available options are '%v'",
opt, option.FQDNRejectOptions)
return
}
} | |
c162878 | TTL = ans.Hdr.Ttl
}
case *dns.AAAA:
responseIPs = append(responseIPs, ans.AAAA)
if TTL > ans.Hdr.Ttl {
TTL = ans.Hdr.Ttl
}
case *dns.CNAME:
// We still track the TTL because the lowest TTL in the chain
// determines the valid caching time for the whole response.
if TTL > ans.Hdr.Ttl {
... | |
c162879 | []byte, queueSize),
}
go nm.eventDrainer()
return nm
} | |
c162880 | l, err := r.ReadBytes('\n') // this is a blocking read
if err != nil {
return fmt.Errorf("Unable to read stdout from monitor: %s", err)
}
var tmp *models.MonitorStatus
if err := json.Unmarshal(l, &tmp); err != nil {
return fmt.Errorf("Unable to unmarshal stdout from monitor: %s", err)
}
nm.setStat... | |
c162881 | log.WithError(err).Warning("Error while running monitor")
}
backoffConfig.Wait(context.TODO())
}
} | |
c162882 | state := nm.state
nm.Mutex.RUnlock()
return state
} | |
c162883 | nm.state = state
nm.Mutex.Unlock()
} | |
c162884 | <- append([]byte{byte(typ)}, buf.Bytes()...):
default:
nm.bumpLost()
return fmt.Errorf("Monitor queue is full, discarding notification")
}
return nil
} | |
c162885 | nm.lost++
nm.pipeLock.Unlock()
} | |
c162886 | time.Duration) *PutStatusProbeParams {
o.SetTimeout(timeout)
return o
} | |
c162887 | *PutStatusProbeParams {
o.SetContext(ctx)
return o
} | |
c162888 | {
o.SetHTTPClient(client)
return o
} | |
c162889 | %q cannot be executed", ciliumEnvoy)
}
return strings.TrimSpace(string(out))
} | |
c162890 | log it at the same level and with the
// same fields as the previous line.
msg = line
}
if len(msg) == 0 {
continue
}
// Map the Envoy log level to a logrus level.
switch level {
case "off", "critical", "error":
scopedLog.Error(msg)
case "warning":
scopedLog.Warn(msg)
case... | |
c162891 | := len(strerr)
return errlen >= 3 && strerr[errlen-3:] == io.EOF.Error()
} | |
c162892 |
err, ok := <-e.errCh
if ok {
return err
}
return nil
} | |
c162893 | logrus.Level) {
e.admin.changeLogLevel(level)
} | |
c162894 | }
if len(args) > 0 {
return &APIError{code: code, msg: fmt.Sprintf(msg, args...)}
}
return &APIError{code: code, msg: msg}
} | |
c162895 | {
err = fmt.Errorf("Error pointer was nil")
}
return New(code, err.Error())
} | |
c162896 | models.Error(a.msg)
return &m
} | |
c162897 | err := producer.Produce(rw, m); err != nil {
panic(err)
}
} | |
c162898 | *PutStatusProbeOK {
o.Payload = payload
return o
} | |
c162899 | models.Error) *PutStatusProbeFailed {
o.Payload = payload
return o
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.