id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c9500 |
return func(cb *Breaker) bool {
return cb.Failures() == threshold
}
} | |
c9501 |
return func(cb *Breaker) bool {
return cb.ConsecFailures() == threshold
}
} | |
c9502 | &noopStatter{},
StatsPrefixf: defaultStatsPrefixf,
lastTripTimes: make(map[string]time.Time)}
} | |
c9503 | p.eventReceivers {
receiver <- PanelEvent{name, event}
}
switch event {
case BreakerTripped:
p.breakerTripped(name)
case BreakerReset:
p.breakerReset(name)
case BreakerFail:
p.breakerFail(name)
case BreakerReady:
p.breakerReady(name)
}
}
}()
} | |
c9504 | if ok {
return cb, ok
}
return NewBreaker(), ok
} | |
c9505 | for v := range eventReader {
select {
case output <- v:
default:
<-output
output <- v
}
}
}()
p.eventReceivers = append(p.eventReceivers, eventReader)
return output
} | |
c9506 | *HTTPClient {
breaker := NewThresholdBreaker(threshold)
return NewHTTPClientWithBreaker(breaker, timeout, client)
} | |
c9507 | host := parsedURL.Host
cb, ok := c.Panel.Get(host)
if !ok {
cb = NewThresholdBreaker(threshold)
c.Panel.Add(host, cb)
}
return cb
}
return brclient
} | |
c9508 | c.Panel.Get(defaultBreakerName)
return cb
}
events := breaker.Subscribe()
go func() {
event := <-events
switch event {
case BreakerTripped:
brclient.runBreakerTripped()
case BreakerReset:
brclient.runBreakerReset()
}
}()
return brclient
} | |
c9509 |
b.Fail()
w.bucketLock.Unlock()
} | |
c9510 |
b.Success()
w.bucketLock.Unlock()
} | |
c9511 | failures += b.failure
})
w.bucketLock.RUnlock()
return failures
} | |
c9512 | successes += b.success
})
w.bucketLock.RUnlock()
return successes
} | |
c9513 | x.(*bucket).Reset()
})
w.bucketLock.Unlock()
} | |
c9514 | &MutationState{}
mt.Add(tokens...)
return mt
} | |
c9515 | {
for _, v := range tokens {
mt.addSingle(v)
}
} | |
c9516 | return json.Unmarshal(data, &mt.data)
} | |
c9517 | we already have our result
err := r.Close()
if err != nil {
// Return no error as we got the one result already.
return nil
}
return nil
} | |
c9518 | = "field"
q.options["field"] = field
return q
} | |
c9519 | *SearchSortField {
q.options["type"] = value
return q
} | |
c9520 | *SearchSortField {
q.options["mode"] = mode
return q
} | |
c9521 | *SearchSortField {
q.options["missing"] = missing
return q
} | |
c9522 |
q.options["field"] = field
q.options["location"] = []float64{lon, lat}
return q
} | |
c9523 | *SearchSortGeoDistance {
q.options["unit"] = unit
return q
} | |
c9524 | client in cluster close: %s", err)
overallErr = err
}
delete(c.connections, key)
}
c.clusterLock.Unlock()
return overallErr
} | |
c9525 | q.options["match_phrase"] = phrase
return q
} | |
c9526 | := &RegexpQuery{newFtsQueryBase()}
q.options["regexp"] = regexp
return q
} | |
c9527 | &QueryStringQuery{newFtsQueryBase()}
q.options["query"] = query
return q
} | |
c9528 | start
q.options["inclusive_start"] = inclusive
return q
} | |
c9529 | end
q.options["inclusive_end"] = inclusive
return q
} | |
c9530 | *DateRangeQuery {
q.options["datetime_parser"] = parser
return q
} | |
c9531 | q.options["conjuncts"] = []FtsQuery{}
return q.And(queries...)
} | |
c9532 | append(q.options["conjuncts"].([]FtsQuery), queries...)
return q
} | |
c9533 | q.options["disjuncts"] = []FtsQuery{}
return q.Or(queries...)
} | |
c9534 | append(q.options["disjuncts"].([]FtsQuery), queries...)
return q
} | |
c9535 | q.data.Must = val
default:
q.data.Must = NewConjunctionQuery(val)
}
return q
} | |
c9536 | q.data.MustNot = val
default:
q.data.MustNot = NewDisjunctionQuery(val)
}
return q
} | |
c9537 | q.shouldMin = min
return q
} | |
c9538 |
if q.data.Should != nil {
delete(q.data.Should.options, "min")
}
return bytes, err
} | |
c9539 | q.options["wildcard"] = wildcard
return q
} | |
c9540 |
q.options["ids"] = []string{}
return q.AddDocIds(ids...)
} | |
c9541 | append(q.options["ids"].([]string), ids...)
return q
} | |
c9542 | &BooleanFieldQuery{newFtsQueryBase()}
q.options["bool"] = val
return q
} | |
c9543 | := &TermQuery{newFtsQueryBase()}
q.options["term"] = term
return q
} | |
c9544 |
q.options["terms"] = terms
return q
} | |
c9545 | := &PrefixQuery{newFtsQueryBase()}
q.options["prefix"] = prefix
return q
} | |
c9546 |
q := &TermRangeQuery{newFtsQueryBase()}
q.options["term"] = term
return q
} | |
c9547 | []float64{lon, lat}
q.options["distance"] = distance
return q
} | |
c9548 |
q.options["top_left"] = []float64{tlLon, tlLat}
q.options["bottom_right"] = []float64{brLon, brLat}
return q
} | |
c9549 | DefaultDecode(d.contents, d.flags, valuePtr)
} | |
c9550 | decode = DefaultDecode
}
return decode(d.contents, d.flags, valuePtr)
} | |
c9551 | ok {
m := make(map[string]interface{})
m[path.path] = make(map[string]interface{})
content = append(arr, m)
d.set(paths[1:], m[path.path], value)
return content
}
cMap, ok := content.(map[string]interface{})
if !ok {
// this isn't possible but the linter won't play nice without it
}
cMap[pa... | |
c9552 |
}
if decode == nil {
decode = JSONDecode
}
return lir.contents[idx].as(valuePtr, decode)
} | |
c9553 | return lir.contents[idx].exists()
} | |
c9554 | != gocbcore.KeyStateNotFound && d.keyState != gocbcore.KeyStateDeleted
} | |
c9555 | {
return nil, errors.New("result must be closed before accessing meta-data")
}
return r.facets, nil
} | |
c9556 | {
return time.Duration(r.took) / time.Nanosecond
} | |
c9557 | opentracing.Tag{Key: "couchbase.service", Value: "fts"}, opentracing.ChildOf(opts.ParentSpanContext))
}
defer span.Finish()
provider, err := c.getHTTPProvider()
if err != nil {
return nil, err
}
return c.searchQuery(ctx, span.Context(), q, opts, provider)
} | |
c9558 | val, *opts)
if err != nil {
return nil, err
}
if opts.PersistTo == 0 && opts.ReplicateTo == 0 {
return res, nil
}
return res, c.durability(durabilitySettings{
ctx: opts.Context,
tracectx: span.Context(),
key: key,
cas: res.Cas(),
mt: res.MutationTo... | |
c9559 | func(res *gocbcore.GetResult, err error) {
if err != nil {
errOut = maybeEnhanceErr(err, key)
ctrl.resolve()
return
}
if res != nil {
doc := &GetResult{
Result: Result{
cas: Cas(res.Cas),
},
contents: res.Value,
flags: res.Flags,
}
docOut = doc
}
ctrl.resolve()
})... | |
c9560 | defer cancel()
}
res, err := c.exists(ctx, span.Context(), key, *opts)
if err != nil {
return nil, err
}
return res, nil
} | |
c9561 | defer cancel()
}
res, err := c.getFromReplica(ctx, span.Context(), key, replicaIdx, *opts)
if err != nil {
return nil, err
}
return res, nil
} | |
c9562 | defer cancel()
}
res, err := c.getAndTouch(ctx, span.Context(), key, expiration, *opts)
if err != nil {
return nil, err
}
return res, nil
} | |
c9563 | defer cancel()
}
res, err := c.getAndLock(ctx, span.Context(), key, expiration, *opts)
if err != nil {
return nil, err
}
return res, nil
} | |
c9564 | defer cancel()
}
res, err := c.unlock(ctx, span.Context(), key, *opts)
if err != nil {
return nil, err
}
return res, nil
} | |
c9565 | defer cancel()
}
res, err := c.touch(ctx, span.Context(), key, expiration, *opts)
if err != nil {
return nil, err
}
return res, nil
} | |
c9566 | Flags: gocbcore.SubdocFlag(SubdocFlagNone),
}
return LookupInOp{op: op}
} | |
c9567 | Op: gocbcore.SubDocOpGetCount,
Path: path,
Flags: gocbcore.SubdocFlag(flags),
}
return LookupInOp{op: op}
} | |
c9568 | {
defer cancel()
}
span := c.startKvOpTrace(opts.ParentSpanContext, "LookupIn")
defer span.Finish()
res, err := c.lookupIn(ctx, span.Context(), key, ops, *opts)
if err != nil {
return nil, err
}
return res, nil
} | |
c9569 | nil {
encoder = JSONEncode
}
marshaled, _, err := encoder(val)
if err != nil {
return MutateInOp{err: err}
}
op := gocbcore.SubDocOp{
Op: gocbcore.SubDocOpSetDoc,
Flags: gocbcore.SubdocFlag(SubdocFlagNone),
Value: marshaled,
}
return MutateInOp{op: op}
} | |
c9570 | MutateInOp{err: err}
}
op := gocbcore.SubDocOp{
Op: gocbcore.SubDocOpReplace,
Path: path,
Flags: gocbcore.SubdocFlag(flags),
Value: marshaled,
}
return MutateInOp{op: op}
} | |
c9571 |
op := gocbcore.SubDocOp{
Op: gocbcore.SubDocOpDelete,
Path: path,
Flags: gocbcore.SubdocFlag(flags),
}
return MutateInOp{op: op}
} | |
c9572 | Flags: gocbcore.SubdocFlag(SubdocFlagNone),
}
return &MutateInOp{op: op}, nil
} | |
c9573 |
encoder = JSONEncode
}
marshaled, _, err := encoder(val)
if err != nil {
return MutateInOp{err: err}
}
op := gocbcore.SubDocOp{
Op: gocbcore.SubDocOpArrayAddUnique,
Path: path,
Flags: gocbcore.SubdocFlag(flags),
Value: marshaled,
}
return MutateInOp{op: op}
} | |
c9574 | != nil {
return MutateInOp{err: err}
}
op := gocbcore.SubDocOp{
Op: gocbcore.SubDocOpCounter,
Path: path,
Flags: gocbcore.SubdocFlag(flags),
Value: marshaled,
}
return MutateInOp{op: op}
} | |
c9575 | != nil {
defer cancel()
}
res, err := c.mutate(ctx, span.Context(), key, ops, *opts)
if err != nil {
return nil, err
}
if opts.PersistTo == 0 && opts.ReplicateTo == 0 {
return res, nil
}
return res, c.durability(durabilitySettings{
ctx: opts.Context,
tracectx: span.Context(),
key:... | |
c9576 | will be triggered as expected
ctx, cancel := c.context(opts.Context, opts.Timeout)
if cancel != nil {
defer cancel()
}
res, err := c.append(ctx, span.Context(), key, val, *opts)
if err != nil {
return nil, err
}
return res, nil
} | |
c9577 | will be triggered as expected
ctx, cancel := c.context(opts.Context, opts.Timeout)
if cancel != nil {
defer cancel()
}
res, err := c.prepend(ctx, span.Context(), key, val, *opts)
if err != nil {
return nil, err
}
return res, nil
} | |
c9578 | triggered as expected
ctx, cancel := c.context(opts.Context, opts.Timeout)
if cancel != nil {
defer cancel()
}
res, err := c.decrement(ctx, span.Context(), key, *opts)
if err != nil {
return nil, err
}
return res, nil
} | |
c9579 | nil {
return nil, err
}
designDoc = b.maybePrefixDevDocument(opts.Development, designDoc)
urlValues, err := opts.toURLValues()
if err != nil {
return nil, errors.Wrap(err, "could not parse query options")
}
return b.executeViewQuery(ctx, span.Context(), "_view", designDoc, viewName, *urlValues, provider)
... | |
c9580 | b.defaultScope().DefaultCollection(opts)
} | |
c9581 | {
mq := &TermFacet{}
mq.data.Field = field
mq.data.Size = size
return mq
} | |
c9582 | numericFacetRange{
Name: name,
Start: start,
End: end,
})
return f
} | |
c9583 | {
mq := &NumericFacet{}
mq.data.Field = field
mq.data.Size = size
return mq
} | |
c9584 | Name: name,
Start: start,
End: end,
})
return f
} | |
c9585 | {
mq := &DateFacet{}
mq.data.Field = field
mq.data.Size = size
return mq
} | |
c9586 | opentracing.GlobalTracer().StartSpan(operationName,
opentracing.Tag{Key: "couchbase.collection", Value: c.sb.CollectionName},
opentracing.Tag{Key: "couchbase.service", Value: "kv"}, opentracing.ChildOf(parentSpanCtx))
}
return span
} | |
c9587 | *interface{}:
*typedOut = bytes
return nil
default:
return clientError{"You must encode binary in a byte array or interface"}
}
} else if valueType == gocbcore.StringType {
switch typedOut := out.(type) {
case *string:
*typedOut = string(bytes)
return nil
case *interface{}:
*typedOut = str... | |
c9588 | bytes = []byte(*typeValue)
flags = gocbcore.EncodeCommonFlags(gocbcore.StringType, gocbcore.NoCompression)
case *interface{}:
return DefaultEncode(*typeValue)
default:
bytes, err = json.Marshal(value)
if err != nil {
return nil, 0, err
}
flags = gocbcore.EncodeCommonFlags(gocbcore.JsonType, gocbcore.... | |
c9589 | case *interface{}:
return JSONEncode(*typeValue)
default:
bytes, err = json.Marshal(value)
if err != nil {
return nil, 0, err
}
}
// No compression supported currently
return bytes, flags, nil
} | |
c9590 |
default:
err := json.Unmarshal(bytes, &out)
if err != nil {
return err
}
return nil
}
} | |
c9591 | cause.(KeyValueError); ok && kvErr.KVError() {
return kvErr.StatusCode() == int(gocbcore.StatusScopeUnknown)
}
return false
} | |
c9592 | cause.(KeyValueError); ok && kvErr.KVError() {
return kvErr.StatusCode() == int(gocbcore.StatusCollectionUnknown)
}
return false
} | |
c9593 | cause.(KeyValueError); ok && kvErr.KVError() {
return kvErr.StatusCode() == int(gocbcore.StatusKeyExists)
}
return false
} | |
c9594 | cause.(KeyValueError); ok && kvErr.KVError() {
return kvErr.StatusCode() == int(gocbcore.StatusKeyNotFound)
}
return false
} | |
c9595 | cause.(KeyValueError); ok && kvErr.KVError() {
return kvErr.StatusCode() == int(gocbcore.StatusTmpFail)
}
return false
} | |
c9596 | cause.(KeyValueError); ok && kvErr.KVError() {
return kvErr.StatusCode() == int(gocbcore.StatusTooBig)
}
return false
} | |
c9597 | cause.(KeyValueError); ok && kvErr.KVError() {
return kvErr.StatusCode() == int(gocbcore.StatusLocked)
}
return false
} | |
c9598 | ok && kvErr.KVError() {
return kvErr.StatusCode() == int(gocbcore.StatusSubDocPathExists)
}
return false
} | |
c9599 | cause.(KeyValueError); ok && kvErr.KVError() {
return kvErr.StatusCode() == int(gocbcore.StatusRangeError)
}
return false
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.