debt(pre-router): resolved most of the technical debt that was noted while finishing epic-12 and epic-13.
This commit is contained in:
@@ -6,4 +6,5 @@ plugins {
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-datetime"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinx_coroutines_version"
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.correx.core.events.stores
|
||||
import com.correx.core.events.events.NewEvent
|
||||
import com.correx.core.events.events.StoredEvent
|
||||
import com.correx.core.events.types.SessionId
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
|
||||
interface EventStore {
|
||||
@@ -34,4 +35,10 @@ interface EventStore {
|
||||
* Get last sequence number for session.
|
||||
*/
|
||||
fun lastSequence(sessionId: SessionId): Long?
|
||||
|
||||
/**
|
||||
* Subscribe to live events for a session. Emits each event as it is appended.
|
||||
* Does not replay historical events — use [readFrom] for catch-up before subscribing.
|
||||
*/
|
||||
fun subscribe(sessionId: SessionId): Flow<StoredEvent>
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.correx.core.kernel.orchestration
|
||||
|
||||
import com.correx.core.approvals.model.ApprovalDecision
|
||||
import com.correx.core.events.types.ApprovalRequestId
|
||||
|
||||
interface ApprovalGateway {
|
||||
fun submitApprovalDecision(requestId: ApprovalRequestId, decision: ApprovalDecision)
|
||||
}
|
||||
+2
-2
@@ -22,7 +22,7 @@ class DefaultSessionOrchestrator(
|
||||
private val repositories: OrchestratorRepositories,
|
||||
engines: OrchestratorEngines,
|
||||
private val retryCoordinator: RetryCoordinator,
|
||||
) : SessionOrchestrator(repositories, engines) {
|
||||
) : SessionOrchestrator(repositories, engines), ApprovalGateway {
|
||||
override val cancellations: ConcurrentHashMap<SessionId, AtomicBoolean> =
|
||||
ConcurrentHashMap<SessionId, AtomicBoolean>()
|
||||
|
||||
@@ -82,7 +82,7 @@ class DefaultSessionOrchestrator(
|
||||
cancellations.getOrPut(sessionId) { AtomicBoolean(false) }.set(true)
|
||||
}
|
||||
|
||||
fun submitApprovalDecision(requestId: ApprovalRequestId, decision: ApprovalDecision) {
|
||||
override fun submitApprovalDecision(requestId: ApprovalRequestId, decision: ApprovalDecision) {
|
||||
val deferred = pendingApprovals[requestId]
|
||||
?: error("No pending approval for requestId ${requestId.value}")
|
||||
deferred.complete(decision)
|
||||
|
||||
Reference in New Issue
Block a user