Skip to content

Commit

Permalink
renamed to ViewProjector
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodolfo committed Jan 10, 2025
1 parent 4ac2431 commit 9c07a0e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/crablet/query/CrabletQueryApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data class SubscriptionSource(
val maxNumberOfRowsToPull: Int = 250,
)

interface EventViewProjector {
interface ViewProjector {
fun project(
sqlConnection: SqlConnection,
eventAsJson: JsonObject,
Expand All @@ -20,7 +20,7 @@ interface EventViewProjector {

class SubscriptionConfig(
val source: SubscriptionSource,
val eventViewProjector: EventViewProjector,
val viewProjector: ViewProjector,
val callback: (() -> Unit)? = null,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SubscriptionComponent(
}.flatMap { jsonList: List<JsonObject> ->
jsonList
.fold(Future.succeededFuture<Void>()) { future, eventJson ->
future.compose { subscriptionConfig.eventViewProjector.project(tx, eventJson) }
future.compose { subscriptionConfig.viewProjector.project(tx, eventJson) }
}.map { jsonList }
}.compose { jsonList: List<JsonObject> ->
if (jsonList.isNotEmpty()) {
Expand Down
4 changes: 2 additions & 2 deletions src/test/kotlin/crablet/query/AccountsViewProjectionTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class AccountsViewProjectionTest : AbstractCrabletTest() {

val source = SubscriptionSource(name = "accounts-view", eventTypes = eventTypes)

class AccountsViewProjector : EventViewProjector {
class AccountsViewProjector : ViewProjector {
override fun project(sqlConnection: SqlConnection, eventAsJson: JsonObject): Future<Void> {
val eventPayload = eventAsJson.getJsonObject("event_payload")

Expand Down Expand Up @@ -231,7 +231,7 @@ class AccountsViewProjectionTest : AbstractCrabletTest() {

val subscriptionConfig = SubscriptionConfig(
source = source,
eventViewProjector = AccountsViewProjector(),
viewProjector = AccountsViewProjector(),
callback = { latch.countDown() })
container.addSubscription(
subscriptionConfig = subscriptionConfig,
Expand Down

0 comments on commit 9c07a0e

Please sign in to comment.