diff --git a/core/src/main/scala/akka/persistence/r2dbc/R2dbcSettings.scala b/core/src/main/scala/akka/persistence/r2dbc/R2dbcSettings.scala index 892d6c05..a079f4a5 100644 --- a/core/src/main/scala/akka/persistence/r2dbc/R2dbcSettings.scala +++ b/core/src/main/scala/akka/persistence/r2dbc/R2dbcSettings.scala @@ -238,6 +238,22 @@ final class R2dbcSettings private ( val numberOfDataPartitions: Int) { import R2dbcSettings.NumberOfSlices + val numberOfDatabases: Int = _connectionFactorySettings.size + + val dataPartitionSliceRanges: immutable.IndexedSeq[Range] = { + val rangeSize = NumberOfSlices / numberOfDataPartitions + (0 until numberOfDataPartitions).map { i => + (i * rangeSize until i * rangeSize + rangeSize) + }.toVector + } + + val connectionFactorSliceRanges: immutable.IndexedSeq[Range] = { + val rangeSize = NumberOfSlices / numberOfDatabases + (0 until numberOfDatabases).map { i => + (i * rangeSize until i * rangeSize + rangeSize) + }.toVector + } + private val _journalTableWithSchema: String = schema.map(_ + ".").getOrElse("") + journalTable /** @@ -321,22 +337,6 @@ final class R2dbcSettings private ( else acc.updated(table, sliceRange.min) } - val numberOfDatabases: Int = _connectionFactorySettings.size - - val dataPartitionSliceRanges: immutable.IndexedSeq[Range] = { - val rangeSize = NumberOfSlices / numberOfDataPartitions - (0 until numberOfDataPartitions).map { i => - (i * rangeSize until i * rangeSize + rangeSize) - }.toVector - } - - val connectionFactorSliceRanges: immutable.IndexedSeq[Range] = { - val rangeSize = NumberOfSlices / numberOfDatabases - (0 until numberOfDatabases).map { i => - (i * rangeSize until i * rangeSize + rangeSize) - }.toVector - } - /** * INTERNAL API */