All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.s2.sourcing.dsl.view.SourcingViewExecutorImpl.kt Maven / Gradle / Ivy

There is a newer version: 0.21.0
Show newest version
package s2.sourcing.dsl.view

import s2.dsl.automate.Evt
import s2.dsl.automate.model.WithS2Id
import s2.sourcing.dsl.snap.SnapRepository

class SourcingViewExecutorImpl< EVENT, ENTITY, ID>(
	private val evolver: View,
	private val viewBuilder: ViewLoader,
	private val viewRepository: SnapRepository
): SourcingViewExecutor where
EVENT: Evt,
EVENT: WithS2Id {

	suspend fun evolve(id: ID & Any, msg: EVENT){
		val entity = viewRepository.get(id) ?: viewBuilder.load(id)
		evolver.evolve(msg, entity)
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy