-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bulk Load CDK: Add a dedicated flush checkpoints task (#46318)
- Loading branch information
1 parent
b38057b
commit d8f6799
Showing
6 changed files
with
80 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
airbyte-cdk/bulk/core/load/src/main/kotlin/io/airbyte/cdk/task/FlushCheckpointsTask.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.cdk.task | ||
|
||
import io.airbyte.cdk.state.CheckpointManager | ||
import io.micronaut.context.annotation.Secondary | ||
import jakarta.inject.Singleton | ||
|
||
interface FlushCheckpointsTask : SyncTask | ||
|
||
class DefaultFlushCheckpointsTask( | ||
private val checkpointManager: CheckpointManager<*, *>, | ||
) : FlushCheckpointsTask { | ||
override suspend fun execute() { | ||
checkpointManager.flushReadyCheckpointMessages() | ||
} | ||
} | ||
|
||
interface FlushCheckpointsTaskFactory { | ||
fun make(): FlushCheckpointsTask | ||
} | ||
|
||
@Singleton | ||
@Secondary | ||
class DefaultFlushCheckpointsTaskFactory( | ||
private val checkpointManager: CheckpointManager<*, *>, | ||
) : FlushCheckpointsTaskFactory { | ||
override fun make(): FlushCheckpointsTask { | ||
return DefaultFlushCheckpointsTask(checkpointManager) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters