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

Method GetConfigBuckets

base/bootstrap.go:261–292  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

259}
260
261func (cc *CouchbaseCluster) GetConfigBuckets() ([]string, error) {
262 if cc == nil {
263 return nil, errors.New("nil CouchbaseCluster")
264 }
265
266 connection, err := cc.getClusterConnection()
267 if err != nil {
268 return nil, err
269 }
270
271 defer func() {
272 if cc.bucketConnectionMode == PerUseClusterConnections {
273 _ = connection.Close(nil)
274 }
275 }()
276
277 buckets, err := connection.Buckets().GetAllBuckets(nil)
278 if err != nil {
279 cc.cachedClusterConnection = nil
280 return nil, err
281 }
282
283 bucketList := make([]string, 0, len(buckets))
284 for bucketName := range buckets {
285 bucketList = append(bucketList, bucketName)
286 }
287
288 sort.Strings(bucketList)
289 cc.cachedBucketConnections.removeOutdatedBuckets(SetOf(bucketList...))
290
291 return bucketList, nil
292}
293
294func (cc *CouchbaseCluster) GetMetadataDocument(ctx context.Context, location, docID string, valuePtr interface{}) (cas uint64, err error) {
295 if cc == nil {

Callers 1

TestBootstrapRefCountingFunction · 0.95

Calls 4

getClusterConnectionMethod · 0.95
removeOutdatedBucketsMethod · 0.80
SetOfFunction · 0.70
CloseMethod · 0.65

Tested by 1

TestBootstrapRefCountingFunction · 0.76