Move SnapshotConfig class
This commit is contained in:
@@ -10,27 +10,6 @@ import kotlinx.datetime.Clock
|
||||
import kotlinx.datetime.Instant
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.ConcurrentLinkedQueue
|
||||
import kotlin.time.Duration
|
||||
import kotlin.time.Duration.Companion.minutes
|
||||
|
||||
data class SnapshotConfig(
|
||||
/**
|
||||
* Keep snapshot when is on the head of the queue cache
|
||||
*/
|
||||
val maxSnapshotCacheSize: Int = 20,
|
||||
/**
|
||||
* Keep snapshot when is newer of
|
||||
*
|
||||
* snapshot.date > now + maxSnapshotCacheTtl
|
||||
*/
|
||||
val maxSnapshotCacheTtl: Duration = 10.minutes,
|
||||
/**
|
||||
* Keep snapshot when version is this modulo
|
||||
*
|
||||
* snapshot.lastVersion % modulo == 1
|
||||
*/
|
||||
val modulo: Int = 10,
|
||||
)
|
||||
|
||||
class ProjectionSnapshotRepositoryInMemory<E : Event<ID>, P : Projection<ID>, ID : AggregateId>(
|
||||
private val eventStore: EventStore<E, ID>,
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package eventDemo.libs.event.projection
|
||||
|
||||
import kotlin.time.Duration
|
||||
import kotlin.time.Duration.Companion.minutes
|
||||
|
||||
data class SnapshotConfig(
|
||||
/**
|
||||
* Keep snapshot when is on the head of the queue cache
|
||||
*/
|
||||
val maxSnapshotCacheSize: Int = 20,
|
||||
/**
|
||||
* Keep snapshot when is newer of
|
||||
*
|
||||
* snapshot.date > now + maxSnapshotCacheTtl
|
||||
*/
|
||||
val maxSnapshotCacheTtl: Duration = 10.minutes,
|
||||
/**
|
||||
* Keep snapshot when version is this modulo
|
||||
*
|
||||
* snapshot.lastVersion % modulo == 1
|
||||
*/
|
||||
val modulo: Int = 10,
|
||||
)
|
||||
Reference in New Issue
Block a user