ptrdom commented on code in PR #177:
URL: 
https://github.com/apache/pekko-persistence-r2dbc/pull/177#discussion_r1855160442


##########
projection/src/main/scala/org/apache/pekko/projection/r2dbc/R2dbcProjectionSettings.scala:
##########
@@ -44,25 +46,149 @@ object R2dbcProjectionSettings {
       keepNumberOfEntries = 
config.getInt("offset-store.keep-number-of-entries"),
       evictInterval = config.getDuration("offset-store.evict-interval"),
       deleteInterval = config.getDuration("offset-store.delete-interval"),
-      logDbCallsExceeding)
+      logDbCallsExceeding
+    )
   }
 
   def apply(system: ActorSystem[_]): R2dbcProjectionSettings =
     apply(system.settings.config.getConfig(DefaultConfigPath))
+
+  def apply(
+      schema: Option[String],
+      offsetTable: String,
+      timestampOffsetTable: String,
+      managementTable: String,
+      useConnectionFactory: String,
+      timeWindow: JDuration,
+      keepNumberOfEntries: Int,
+      evictInterval: JDuration,
+      deleteInterval: JDuration,
+      logDbCallsExceeding: FiniteDuration
+  ): R2dbcProjectionSettings = new R2dbcProjectionSettings(
+    Dialect.Postgres,
+    schema,
+    offsetTable,
+    timestampOffsetTable,
+    managementTable,
+    useConnectionFactory,
+    timeWindow,
+    keepNumberOfEntries,
+    evictInterval,
+    deleteInterval,
+    logDbCallsExceeding
+  )
 }
 
-// FIXME remove case class, and add `with` methods
-final case class R2dbcProjectionSettings(
-    schema: Option[String],
-    offsetTable: String,
-    timestampOffsetTable: String,
-    managementTable: String,
-    useConnectionFactory: String,
-    timeWindow: JDuration,
-    keepNumberOfEntries: Int,
-    evictInterval: JDuration,
-    deleteInterval: JDuration,
-    logDbCallsExceeding: FiniteDuration) {
+final class R2dbcProjectionSettings private (
+    val dialect: Dialect,
+    val schema: Option[String],
+    val offsetTable: String,
+    val timestampOffsetTable: String,
+    val managementTable: String,
+    val useConnectionFactory: String,
+    val timeWindow: JDuration,
+    val keepNumberOfEntries: Int,
+    val evictInterval: JDuration,
+    val deleteInterval: JDuration,
+    val logDbCallsExceeding: FiniteDuration
+) extends Serializable {
+
+  override def toString: String =
+    s"R2dbcProjectionSettings($dialect, $schema, $offsetTable, 
$timestampOffsetTable, $managementTable, " +
+    s"$useConnectionFactory, $timeWindow, $keepNumberOfEntries, 
$evictInterval, $deleteInterval, $logDbCallsExceeding)"
+
+  override def equals(other: Any): Boolean =
+    other match {
+      case that: R2dbcProjectionSettings =>
+        dialect == that.dialect && schema == that.schema &&
+        offsetTable == that.offsetTable && timestampOffsetTable == 
that.timestampOffsetTable &&
+        managementTable == that.managementTable && useConnectionFactory == 
that.useConnectionFactory &&
+        timeWindow == that.timeWindow && keepNumberOfEntries == 
that.keepNumberOfEntries &&
+        evictInterval == that.evictInterval && deleteInterval == 
that.deleteInterval &&
+        logDbCallsExceeding == that.logDbCallsExceeding
+      case _ => false
+    }
+
+  override def hashCode(): Int = {
+    val values = Seq(
+      dialect,
+      schema,
+      offsetTable,
+      timestampOffsetTable,
+      managementTable,
+      useConnectionFactory,
+      timeWindow,
+      keepNumberOfEntries,
+      evictInterval,
+      deleteInterval,
+      logDbCallsExceeding
+    )
+    val h = values.foldLeft(MurmurHash3.productSeed) { case (h, value) =>
+      MurmurHash3.mix(h, value.##)
+    }
+    MurmurHash3.finalizeHash(h, values.size)
+  }
+
+  private[this] def copy(

Review Comment:
   Technically making `copy` private is not a source compatible change, but 
IIUC it is necessary for an implementation that enables keeping backwards 
compatibility. @pjfanning please let me know if you want this handled 
differently.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org
For additional commands, e-mail: notifications-h...@pekko.apache.org

Reply via email to