GetSingleDataStoreNamesFromScopes config returns a lexically sorted list of configured datastores.
(config ScopesConfig)
| 466 | |
| 467 | // GetSingleDataStoreNamesFromScopes config returns a lexically sorted list of configured datastores. |
| 468 | func GetDataStoreNamesFromScopesConfig(config ScopesConfig) []sgbucket.DataStoreName { |
| 469 | var names []string |
| 470 | for scopeName, scopeConfig := range config { |
| 471 | for collectionName, _ := range scopeConfig.Collections { |
| 472 | names = append(names, fmt.Sprintf("%s%s%s", scopeName, base.ScopeCollectionSeparator, collectionName)) |
| 473 | } |
| 474 | |
| 475 | } |
| 476 | sort.Strings(names) |
| 477 | var dataStoreNames []sgbucket.DataStoreName |
| 478 | for _, scopeAndCollection := range names { |
| 479 | keyspace := strings.Split(scopeAndCollection, base.ScopeCollectionSeparator) |
| 480 | dataStoreNames = append(dataStoreNames, base.ScopeAndCollectionName{Scope: keyspace[0], Collection: keyspace[1]}) |
| 481 | } |
| 482 | return dataStoreNames |
| 483 | |
| 484 | } |
| 485 | |
| 486 | // LeakyBucket gets the bucket from the RestTester as a leaky bucket allowing for callbacks to be set on the fly. |
| 487 | // The RestTester must have been set up to create and use a leaky bucket by setting LeakyBucketConfig in the RT |
no outgoing calls