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

Method getClusterConnection

base/bootstrap.go:240–259  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

238}
239
240func (cc *CouchbaseCluster) getClusterConnection() (*gocb.Cluster, error) {
241
242 if cc.bucketConnectionMode == PerUseClusterConnections {
243 return cc.connect(nil)
244 }
245
246 cc.cachedConnectionLock.Lock()
247 defer cc.cachedConnectionLock.Unlock()
248 if cc.cachedClusterConnection != nil {
249 return cc.cachedClusterConnection, nil
250 }
251
252 clusterConnection, err := cc.connect(nil)
253 if err != nil {
254 return nil, err
255 }
256 cc.cachedClusterConnection = clusterConnection
257 return cc.cachedClusterConnection, nil
258
259}
260
261func (cc *CouchbaseCluster) GetConfigBuckets() ([]string, error) {
262 if cc == nil {

Callers 2

TestBootstrapRefCountingFunction · 0.95
GetConfigBucketsMethod · 0.95

Calls 3

connectMethod · 0.95
LockMethod · 0.45
UnlockMethod · 0.45

Tested by 1

TestBootstrapRefCountingFunction · 0.76