MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / KeyExists

Method KeyExists

base/bootstrap.go:434–448  ·  view source on GitHub ↗

KeyExists checks whether a key exists in the default collection for the specified bucket

(ctx context.Context, location, docID string)

Source from the content-addressed store, hash-verified

432
433// KeyExists checks whether a key exists in the default collection for the specified bucket
434func (cc *CouchbaseCluster) KeyExists(ctx context.Context, location, docID string) (exists bool, err error) {
435 if cc == nil {
436 return false, errors.New("nil CouchbaseCluster")
437 }
438
439 b, teardown, err := cc.getBucket(ctx, location)
440
441 if err != nil {
442 return false, err
443 }
444
445 defer teardown()
446
447 return cc.configPersistence.keyExists(b.DefaultCollection(), docID)
448}
449
450// GetDocument fetches a document from the default collection. Does not use configPersistence - callers
451// requiring configPersistence handling should use GetMetadataDocument.

Callers 1

TestBootstrapRefCountingFunction · 0.95

Calls 2

getBucketMethod · 0.95
keyExistsMethod · 0.65

Tested by 1

TestBootstrapRefCountingFunction · 0.76