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

Method GetBucketNames

rest/config.go:1952–1975  ·  view source on GitHub ↗

GetBucketNames returns a slice of the bucket names associated with the server context

()

Source from the content-addressed store, hash-verified

1950
1951// GetBucketNames returns a slice of the bucket names associated with the server context
1952func (sc *ServerContext) GetBucketNames() (buckets []string, err error) {
1953 if sc.Config.IsServerless() {
1954 buckets = make([]string, len(sc.Config.BucketCredentials))
1955 for bucket, _ := range sc.Config.BucketCredentials {
1956 buckets = append(buckets, bucket)
1957 }
1958 // TODO: Enable code as part of CBG-2280
1959 // Return buckets that have credentials set that do not have a db associated with them
1960 // buckets = make([]string, len(sc.Config.BucketCredentials)-len(sc.bucketDbName))
1961 // for bucket := range sc.Config.BucketCredentials {
1962 // i := 0
1963 // if sc.bucketDbName[bucket] == "" {
1964 // buckets[i] = bucket
1965 // i++
1966 // }
1967 // }
1968 } else {
1969 buckets, err = sc.BootstrapContext.Connection.GetConfigBuckets()
1970 if err != nil {
1971 return nil, fmt.Errorf("couldn't get buckets from cluster: %w", err)
1972 }
1973 }
1974 return buckets, nil
1975}
1976
1977// FetchConfigs retrieves all database configs from the ServerContext's bootstrapConnection.
1978func (sc *ServerContext) FetchConfigs(ctx context.Context, isInitialStartup bool) (dbNameConfigs map[string]DatabaseConfig, err error) {

Callers 3

FetchConfigsMethod · 0.95
GetConfigBucketsMethod · 0.80
handleGetClusterInfoMethod · 0.80

Calls 3

IsServerlessMethod · 0.80
ErrorfMethod · 0.80
GetConfigBucketsMethod · 0.65

Tested by

no test coverage detected