Skip to content

Commit

Permalink
Revert "Remove production use of DatabaseConfigPersistence (#19275)"
Browse files Browse the repository at this point in the history
This reverts commit 2c5dabc.
  • Loading branch information
terencecho committed Dec 1, 2022
1 parent 5af2f25 commit 0b8328a
Show file tree
Hide file tree
Showing 16 changed files with 3,296 additions and 1,330 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
* This class can be used to store DB queries for persisting configs that we may want to reuse
* across this package.
* <p>
* Currently this class is used to move write queries out of {@link ConfigPersistence} so that they
* can be reused/composed in {@link ConfigRepository}.
* Currently this class is used to move write queries out of {@link DatabaseConfigPersistence} so
* that they can be reused/composed in {@link ConfigRepository}.
*/
@SuppressWarnings("PMD.CognitiveComplexity")
public class ConfigWriter {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import io.airbyte.db.ExceptionWrappingDatabase;
import io.airbyte.db.instance.configs.jooq.generated.tables.Actor;
import io.airbyte.db.instance.configs.jooq.generated.tables.ActorDefinition;
import io.airbyte.protocol.models.CatalogHelpers;
import io.airbyte.protocol.models.StreamDescriptor;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.ArrayList;
Expand Down Expand Up @@ -74,7 +72,11 @@ public ConfigWithMetadata<StandardSync> getStandardSyncWithMetadata(final UUID c
}

public List<StandardSync> listStandardSync() throws IOException {
return listStandardSyncWithMetadata(Optional.empty()).stream().map(ConfigWithMetadata::getConfig).toList();
return listStandardSyncWithMetadata().stream().map(ConfigWithMetadata::getConfig).toList();
}

public List<ConfigWithMetadata<StandardSync>> listStandardSyncWithMetadata() throws IOException {
return listStandardSyncWithMetadata(Optional.empty());
}

public void writeStandardSync(final StandardSync standardSync) throws IOException {
Expand All @@ -84,12 +86,6 @@ public void writeStandardSync(final StandardSync standardSync) throws IOExceptio
});
}

/**
* Deletes a connection (sync) and all of dependent resources (state and connection_operations).
*
* @param standardSyncId - id of the sync (a.k.a. connection_id)
* @throws IOException - error while accessing db.
*/
public void deleteStandardSync(final UUID standardSyncId) throws IOException {
database.transaction(ctx -> {
PersistenceHelpers.deleteConfig(CONNECTION_OPERATION, CONNECTION_OPERATION.CONNECTION_ID, standardSyncId, ctx);
Expand Down Expand Up @@ -122,11 +118,6 @@ public void clearUnsupportedProtocolVersionFlag(final UUID actorDefinitionId,
});
}

public List<StreamDescriptor> getAllStreamsForConnection(final UUID connectionId) throws ConfigNotFoundException, IOException {
final StandardSync standardSync = getStandardSync(connectionId);
return CatalogHelpers.extractStreamDescriptors(standardSync.getCatalog());
}

private List<ConfigWithMetadata<StandardSync>> listStandardSyncWithMetadata(final Optional<UUID> configId) throws IOException {
final Result<Record> result = database.query(ctx -> {
final SelectJoinStep<Record> query = ctx.select(asterisk()).from(CONNECTION);
Expand Down

This file was deleted.

Loading

0 comments on commit 0b8328a

Please sign in to comment.