File tree Expand file tree Collapse file tree
config-service-impl/src/main/java/org/hypertrace/config/service/store Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ public class DocumentConfigStore implements ConfigStore {
5555 @ Override
5656 public void init (Config config ) {
5757 datastore = initDataStore (config );
58- this .collection = getOrCreateCollection ( datastore ) ;
58+ this .collection = this . datastore . getCollection ( CONFIGURATIONS_COLLECTION ); ;
5959 }
6060
6161 private Datastore initDataStore (Config config ) {
@@ -65,16 +65,6 @@ private Datastore initDataStore(Config config) {
6565 return DatastoreProvider .getDatastore (dataStoreType , dataStoreConfig );
6666 }
6767
68- private Collection getOrCreateCollection (Datastore datastore ) {
69- if (!datastore .listCollections ().contains (CONFIGURATIONS_COLLECTION )) {
70- if (!datastore .createCollection (CONFIGURATIONS_COLLECTION , Collections .emptyMap ())) {
71- throw new RuntimeException (
72- "Failed to create collection:" + CONFIGURATIONS_COLLECTION + " in document store" );
73- }
74- }
75- return datastore .getCollection (CONFIGURATIONS_COLLECTION );
76- }
77-
7868 @ Override
7969 public long writeConfig (ConfigResource configResource , String userId , Value config )
8070 throws IOException {
You can’t perform that action at this time.
0 commit comments