Skip to content

Commit d89c87c

Browse files
pedroslopezjhammarstedt
authored andcommitted
remove usages of YamlSeedConfigPersistence (airbytehq#17895)
1 parent f48973d commit d89c87c

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

airbyte-bootloader/src/main/java/io/airbyte/bootloader/BootloaderApp.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import io.airbyte.config.init.ApplyDefinitionsHelper;
1818
import io.airbyte.config.init.DefinitionsProvider;
1919
import io.airbyte.config.init.LocalDefinitionsProvider;
20-
import io.airbyte.config.init.YamlSeedConfigPersistence;
2120
import io.airbyte.config.persistence.ConfigPersistence;
2221
import io.airbyte.config.persistence.ConfigRepository;
2322
import io.airbyte.config.persistence.DatabaseConfigPersistence;
@@ -206,7 +205,7 @@ private static ConfigPersistence getConfigPersistence(final Database configDatab
206205
}
207206

208207
private static DefinitionsProvider getLocalDefinitionsProvider() throws IOException {
209-
return new LocalDefinitionsProvider(YamlSeedConfigPersistence.DEFAULT_SEED_DEFINITION_RESOURCE_CLASS);
208+
return new LocalDefinitionsProvider(LocalDefinitionsProvider.DEFAULT_SEED_DEFINITION_RESOURCE_CLASS);
210209
}
211210

212211
private static Database getJobDatabase(final DSLContext dslContext) throws IOException {

airbyte-bootloader/src/test/java/io/airbyte/bootloader/BootloaderAppTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
import io.airbyte.config.Geography;
2525
import io.airbyte.config.SourceConnection;
2626
import io.airbyte.config.StandardWorkspace;
27-
import io.airbyte.config.init.YamlSeedConfigPersistence;
27+
import io.airbyte.config.init.DefinitionProviderToConfigPersistenceAdapter;
28+
import io.airbyte.config.init.DefinitionsProvider;
29+
import io.airbyte.config.init.LocalDefinitionsProvider;
2830
import io.airbyte.config.persistence.ConfigPersistence;
2931
import io.airbyte.config.persistence.ConfigRepository;
3032
import io.airbyte.config.persistence.DatabaseConfigPersistence;
@@ -199,9 +201,10 @@ void testBootloaderAppRunSecretMigration() throws Exception {
199201
val initBootloader = new BootloaderApp(mockedConfigs, mockedFeatureFlags, null, configsDslContext, jobsDslContext, configsFlyway, jobsFlyway);
200202
initBootloader.load();
201203

202-
final ConfigPersistence localSchema = new YamlSeedConfigPersistence(YamlSeedConfigPersistence.DEFAULT_SEED_DEFINITION_RESOURCE_CLASS);
204+
final DefinitionsProvider localDefinitions = new LocalDefinitionsProvider(LocalDefinitionsProvider.DEFAULT_SEED_DEFINITION_RESOURCE_CLASS);
203205
final ConfigRepository configRepository = new ConfigRepository(configPersistence, configDatabase);
204-
configRepository.loadDataNoSecrets(localSchema);
206+
final ConfigPersistence localConfigPersistence = new DefinitionProviderToConfigPersistenceAdapter(localDefinitions);
207+
configRepository.loadDataNoSecrets(localConfigPersistence);
205208

206209
final String sourceSpecs = """
207210
{

airbyte-config/config-persistence/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
This module contains the logic for accessing the config database. This database is primarily used by the `airbyte-server` but is also accessed from `airbyte-workers`. It contains all configuration information for Airbyte.
44

55
## Key files
6-
* `ConfigPersistence.java` is the interface over "low-level" access to the db. The most commonly used implementation of it is `DatabaseConfigPersistence.java` The only other one that is used is the `YamlSeedConfigPersistence.java` which is used for loading configs that ship with the app.
6+
* `ConfigPersistence.java` is the interface over "low-level" access to the db. The most commonly used implementation of it is `DatabaseConfigPersistence.java`.
77
* `ConfigRepository.java` is what is most used for accessing the databases. The `ConfigPersistence` iface was hard to work with. `ConfigRepository` builds on top of it and houses any databases queries to keep them from proliferating throughout the codebase.

airbyte-config/init/src/main/java/io/airbyte/config/init/LocalDefinitionsProvider.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
*/
3434
final public class LocalDefinitionsProvider implements DefinitionsProvider {
3535

36+
public static final Class<?> DEFAULT_SEED_DEFINITION_RESOURCE_CLASS = SeedType.class;
37+
3638
private final static String PROTOCOL_VERSION = "protocol_version";
3739
private final static String SPEC = "spec";
3840

airbyte-config/init/src/test/java/io/airbyte/config/init/SpecFormatTest.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66

77
import com.fasterxml.jackson.databind.JsonNode;
88
import io.airbyte.commons.json.JsonSchemas;
9-
import io.airbyte.config.ConfigSchema;
10-
import io.airbyte.config.StandardDestinationDefinition;
11-
import io.airbyte.config.StandardSourceDefinition;
12-
import io.airbyte.config.persistence.ConfigPersistence;
139
import io.airbyte.config.persistence.split_secrets.JsonSecretsProcessor;
1410
import io.airbyte.validation.json.JsonValidationException;
1511
import java.io.IOException;
@@ -25,16 +21,14 @@ class SpecFormatTest {
2521

2622
@Test
2723
void testOnAllExistingConfig() throws IOException, JsonValidationException {
28-
final ConfigPersistence configPersistence = new YamlSeedConfigPersistence(YamlSeedConfigPersistence.DEFAULT_SEED_DEFINITION_RESOURCE_CLASS);
24+
final DefinitionsProvider definitionsProvider = new LocalDefinitionsProvider(LocalDefinitionsProvider.DEFAULT_SEED_DEFINITION_RESOURCE_CLASS);
2925

30-
final List<JsonNode> sourceSpecs = configPersistence.listConfigs(
31-
ConfigSchema.STANDARD_SOURCE_DEFINITION, StandardSourceDefinition.class)
26+
final List<JsonNode> sourceSpecs = definitionsProvider.getSourceDefinitions()
3227
.stream()
3328
.map(standardSourceDefinition -> standardSourceDefinition.getSpec().getConnectionSpecification())
3429
.toList();
3530

36-
final List<JsonNode> destinationSpecs = configPersistence.listConfigs(
37-
ConfigSchema.STANDARD_DESTINATION_DEFINITION, StandardDestinationDefinition.class)
31+
final List<JsonNode> destinationSpecs = definitionsProvider.getDestinationDefinitions()
3832
.stream()
3933
.map(standardDestinationDefinition -> standardDestinationDefinition.getSpec().getConnectionSpecification())
4034
.toList();

0 commit comments

Comments
 (0)