GetBucketNames returns a slice of the bucket names associated with the server context
()
| 1950 | |
| 1951 | // GetBucketNames returns a slice of the bucket names associated with the server context |
| 1952 | func (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. |
| 1978 | func (sc *ServerContext) FetchConfigs(ctx context.Context, isInitialStartup bool) (dbNameConfigs map[string]DatabaseConfig, err error) { |
no test coverage detected