Skip to content

Commit

Permalink
Merge branch 'main' into update/logback-classic-1.5.8
Browse files Browse the repository at this point in the history
  • Loading branch information
johanandren authored Sep 30, 2024
2 parents f70b7ba + e1163f5 commit afc8fd7
Show file tree
Hide file tree
Showing 42 changed files with 282 additions and 222 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/link-validator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Link Validator

on:
workflow_dispatch:
pull_request:
schedule:
- cron: '0 6 * * 1'

permissions:
contents: read

jobs:
validate-links:
runs-on: ubuntu-22.04
if: github.repository == 'akka/akka-persistence-r2dbc'
steps:
- name: Checkout
# https://github.com/actions/checkout/releases
# v4.1.1
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
# See https://github.com/actions/checkout/issues/299#issuecomment-677674415
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 100

- name: Fetch tags
run: git fetch --depth=100 origin +refs/tags/*:refs/tags/*

- name: Cache Coursier cache
# https://github.com/coursier/cache-action/releases
# v6.4.5
uses: coursier/cache-action@1ff273bff02a8787bc9f1877d347948af647956d

- name: Set up JDK 17
# https://github.com/coursier/setup-action/releases
# v1.3.5
uses: coursier/setup-action@7bde40eee928896f074dbb76d22dd772eed5c65f
with:
jvm: temurin:1.17.0.5
apps: cs

- name: sbt site
run: sbt docs/makeSite

- name: Run Link Validator
run: cs launch net.runne::site-link-validator:0.2.5 -- scripts/link-validator.conf
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
# v1.3.5
uses: coursier/setup-action@7bde40eee928896f074dbb76d22dd772eed5c65f
with:
jvm: temurin:1.11
jvm: temurin:1.17

- name: Publish
run: |-
Expand Down
2 changes: 1 addition & 1 deletion .jvmopts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

-Xms2G
-Xmx2G
-Xss2M
-Xss2M
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

The Akka family of projects is managed by teams at [Lightbend](https://lightbend.com/) with help from the community.

[Akka Persistence](https://doc.akka.io/docs/akka/current/scala/persistence.html) journal and snapshot
[Akka Persistence](https://doc.akka.io/libraries/akka-core/current/scala/persistence.html) journal and snapshot
store for SQL datbases with RD2BC connectivity.

For questions please use the [discuss.akka.io](https://discuss.akka.io). Tag any new questions with `akka-persistence` and `r2dbc`.

The documentation can be found [here](https://doc.akka.io/docs/akka-persistence-r2dbc/current/index.html)
The documentation can be found [here](https://doc.akka.io/libraries/akka-persistence-r2dbc/current/index.html)

## Project status

Expand Down
28 changes: 20 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ inThisBuild(
Seq(
organization := "com.lightbend.akka",
organizationName := "Lightbend Inc.",
homepage := Some(url("https://doc.akka.io/docs/akka-persistence-r2dbc/current")),
homepage := Some(url("https://doc.akka.io/libraries/akka-persistence-r2dbc/current")),
scmInfo := Some(
ScmInfo(
url("https://github.com/akka/akka-persistence-r2dbc"),
Expand Down Expand Up @@ -66,6 +66,18 @@ def common: Seq[Setting[_]] =
"-Xms1G" :: "-Xmx1G" :: "-XX:MaxDirectMemorySize=256M" :: akkaProperties
},
projectInfoVersion := (if (isSnapshot.value) "snapshot" else version.value),
Compile / doc / scalacOptions := scalacOptions.value ++ Seq(
"-doc-title",
"Akka Persistence R2DBC",
"-doc-version",
version.value) ++ {
// make use of https://github.com/scala/scala/pull/8663
if (scalaBinaryVersion.value.startsWith("3")) {
Seq(s"-external-mappings:https://docs.oracle.com/en/java/javase/${Dependencies.JavaDocLinkVersion}/docs/api")
} else {
Seq("-jdk-api-doc-base", s"https://docs.oracle.com/en/java/javase/${Dependencies.JavaDocLinkVersion}/docs/api")
}
},
Global / excludeLintKeys += projectInfoVersion,
Global / excludeLintKeys += mimaReportSignatureProblems,
Global / excludeLintKeys += mimaPreviousArtifacts,
Expand Down Expand Up @@ -137,22 +149,22 @@ lazy val docs = project
previewPath := (Paradox / siteSubdirName).value,
Preprocess / siteSubdirName := s"api/akka-persistence-r2dbc/${projectInfoVersion.value}",
Preprocess / sourceDirectory := (LocalRootProject / ScalaUnidoc / unidoc / target).value,
Paradox / siteSubdirName := s"docs/akka-persistence-r2dbc/${projectInfoVersion.value}",
Paradox / siteSubdirName := s"libraries/akka-persistence-r2dbc/${projectInfoVersion.value}",
paradoxGroups := Map(
"Language" -> Seq("Java", "Scala"),
"Dialect" -> Seq("Postgres", "Yugabyte", "H2", "SQLServer")),
Compile / paradoxProperties ++= Map(
"project.url" -> "https://doc.akka.io/docs/akka-persistence-r2dbc/current/",
"canonical.base_url" -> "https://doc.akka.io/docs/akka-persistence-r2dbc/current",
"project.url" -> "https://doc.akka.io/libraries/akka-persistence-r2dbc/current/",
"canonical.base_url" -> "https://doc.akka.io/libraries/akka-persistence-r2dbc/current",
"akka.version" -> Dependencies.AkkaVersion,
"h2.version" -> Dependencies.H2Version,
"r2dbc-h2.version" -> Dependencies.R2dbcH2Version,
"scala.version" -> scalaVersion.value,
"scala.binary.version" -> scalaBinaryVersion.value,
"extref.akka.base_url" -> s"https://doc.akka.io/docs/akka/${Dependencies.AkkaVersionInDocs}/%s",
"extref.akka-docs.base_url" -> s"https://doc.akka.io/docs/akka/${Dependencies.AkkaVersionInDocs}/%s",
"extref.akka-projection.base_url" -> s"https://doc.akka.io/docs/akka-projection/${Dependencies.AkkaProjectionVersionInDocs}/%s",
"extref.java-docs.base_url" -> "https://docs.oracle.com/en/java/javase/11/%s",
"extref.akka.base_url" -> s"https://doc.akka.io/libraries/akka-core/${Dependencies.AkkaVersionInDocs}/%s",
"extref.akka-docs.base_url" -> s"https://doc.akka.io/libraries/akka-core/${Dependencies.AkkaVersionInDocs}/%s",
"extref.akka-projection.base_url" -> s"https://doc.akka.io/libraries/akka-projection/${Dependencies.AkkaProjectionVersionInDocs}/%s",
"extref.java-docs.base_url" -> s"https://docs.oracle.com/en/java/javase/${Dependencies.JavaDocLinkVersion}/%s",
"scaladoc.scala.base_url" -> s"https://www.scala-lang.org/api/current/",
"scaladoc.akka.persistence.r2dbc.base_url" -> s"/${(Preprocess / siteSubdirName).value}/",
"javadoc.akka.persistence.r2dbc.base_url" -> "", // no Javadoc is published
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ akka.persistence.r2dbc {
# currentEventsBySlicesStartingFromSnapshots are used. That has a small overhead when storing
# snapshots because the timestamp and tags of the corresponding event is retrieved when storing
# a snapshot.
# See also https://doc.akka.io/docs/akka-persistence-r2dbc/current/migration-guide.html#eventsBySlicesStartingFromSnapshots
# See also https://doc.akka.io/libraries/akka-persistence-r2dbc/current/migration-guide.html#eventsBySlicesStartingFromSnapshots
enabled = false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import io.r2dbc.spi.ConnectionFactory
import java.time.{ Duration => JDuration }
import java.util.concurrent.ConcurrentHashMap

import scala.collection.JavaConverters._
import scala.concurrent.Future
import scala.concurrent.duration.Duration
import scala.jdk.CollectionConverters._
import scala.util.Failure
import scala.util.Success

Expand Down
34 changes: 17 additions & 17 deletions core/src/main/scala/akka/persistence/r2dbc/R2dbcSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

package akka.persistence.r2dbc

import scala.concurrent.duration._
import scala.collection.immutable
import scala.jdk.DurationConverters._

import akka.annotation.InternalApi
import akka.annotation.InternalStableApi
import akka.persistence.r2dbc.internal.codec.IdentityAdapter
Expand All @@ -14,12 +17,9 @@ import akka.persistence.r2dbc.internal.codec.QueryAdapter
import akka.persistence.r2dbc.internal.codec.TagsCodec
import akka.persistence.r2dbc.internal.codec.TimestampCodec
import akka.persistence.r2dbc.internal.ConnectionFactorySettings
import akka.util.JavaDurationConverters._
import com.typesafe.config.Config

import java.util.Locale
import scala.collection.immutable
import scala.concurrent.duration._

/**
* INTERNAL API
Expand All @@ -36,7 +36,7 @@ object R2dbcSettings {
"Database dialect config has moved from 'akka.persistence.r2dbc.dialect' into the connection-factory block, " +
"the old 'dialect' config entry must be removed, " +
"see akka-persistence-r2dbc documentation for details on the new configuration scheme: " +
"https://doc.akka.io/docs/akka-persistence-r2dbc/current/migration-guide.html")
"https://doc.akka.io/libraries/akka-persistence-r2dbc/current/migration-guide.html")
}

val schema: Option[String] = Option(config.getString("schema")).filterNot(_.trim.isEmpty)
Expand All @@ -61,7 +61,7 @@ object R2dbcSettings {
configToMap(config.getConfig("state.custom-table"))

val durableStateAdditionalColumnClasses: Map[String, immutable.IndexedSeq[String]] = {
import akka.util.ccompat.JavaConverters._
import scala.jdk.CollectionConverters._
val cfg = config.getConfig("state.additional-columns")
cfg.root.unwrapped.asScala.toMap.map {
case (k, v: java.util.List[_]) => k -> v.iterator.asScala.map(_.toString).toVector
Expand Down Expand Up @@ -102,7 +102,7 @@ object R2dbcSettings {
"The Akka Persistence R2DBC database config scheme has changed, the config needs to be updated " +
"to choose database dialect using the connection-factory block, " +
"see akka-persistence-r2dbc documentation for details on the new configuration scheme: " +
"https://doc.akka.io/docs/akka-persistence-r2dbc/current/migration-guide.html")
"https://doc.akka.io/libraries/akka-persistence-r2dbc/current/migration-guide.html")
}
Vector(ConnectionFactorySettings(config.getConfig("connection-factory")))
} else {
Expand All @@ -126,7 +126,7 @@ object R2dbcSettings {
val logDbCallsExceeding: FiniteDuration =
config.getString("log-db-calls-exceeding").toLowerCase(Locale.ROOT) match {
case "off" => -1.millis
case _ => config.getDuration("log-db-calls-exceeding").asScala
case _ => config.getDuration("log-db-calls-exceeding").toScala
}

val codecSettings = {
Expand Down Expand Up @@ -190,7 +190,7 @@ object R2dbcSettings {
}

private def configToMap(cfg: Config): Map[String, String] = {
import akka.util.ccompat.JavaConverters._
import scala.jdk.CollectionConverters._
cfg.root.unwrapped.asScala.toMap.map { case (k, v) => k -> v.toString }
}

Expand Down Expand Up @@ -484,11 +484,11 @@ final class R2dbcSettings private (
*/
@InternalStableApi
final class QuerySettings(config: Config) {
val refreshInterval: FiniteDuration = config.getDuration("refresh-interval").asScala
val behindCurrentTime: FiniteDuration = config.getDuration("behind-current-time").asScala
val refreshInterval: FiniteDuration = config.getDuration("refresh-interval").toScala
val behindCurrentTime: FiniteDuration = config.getDuration("behind-current-time").toScala
val backtrackingEnabled: Boolean = config.getBoolean("backtracking.enabled")
val backtrackingWindow: FiniteDuration = config.getDuration("backtracking.window").asScala
val backtrackingBehindCurrentTime: FiniteDuration = config.getDuration("backtracking.behind-current-time").asScala
val backtrackingWindow: FiniteDuration = config.getDuration("backtracking.window").toScala
val backtrackingBehindCurrentTime: FiniteDuration = config.getDuration("backtracking.behind-current-time").toScala
val bufferSize: Int = config.getInt("buffer-size")
val persistenceIdsBufferSize: Int = config.getInt("persistence-ids.buffer-size")
val deduplicateCapacity: Int = config.getInt("deduplicate-capacity")
Expand All @@ -502,18 +502,18 @@ final class QuerySettings(config: Config) {
final class ConnectionPoolSettings(config: Config) {
val initialSize: Int = config.getInt("initial-size")
val maxSize: Int = config.getInt("max-size")
val maxIdleTime: FiniteDuration = config.getDuration("max-idle-time").asScala
val maxLifeTime: FiniteDuration = config.getDuration("max-life-time").asScala
val maxIdleTime: FiniteDuration = config.getDuration("max-idle-time").toScala
val maxLifeTime: FiniteDuration = config.getDuration("max-life-time").toScala

val acquireTimeout: FiniteDuration = config.getDuration("acquire-timeout").asScala
val acquireTimeout: FiniteDuration = config.getDuration("acquire-timeout").toScala
val acquireRetry: Int = config.getInt("acquire-retry")

val validationQuery: String = config.getString("validation-query")

val closeCallsExceeding: Option[FiniteDuration] =
config.getString("close-calls-exceeding").toLowerCase(Locale.ROOT) match {
case "off" => None
case _ => Some(config.getDuration("close-calls-exceeding").asScala)
case _ => Some(config.getDuration("close-calls-exceeding").toScala)
}
}

Expand All @@ -523,7 +523,7 @@ final class ConnectionPoolSettings(config: Config) {
@InternalStableApi
final class PublishEventsDynamicSettings(config: Config) {
val throughputThreshold: Int = config.getInt("throughput-threshold")
val throughputCollectInterval: FiniteDuration = config.getDuration("throughput-collect-interval").asScala
val throughputCollectInterval: FiniteDuration = config.getDuration("throughput-collect-interval").toScala
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ package akka.persistence.r2dbc.cleanup.javadsl
import java.util.concurrent.CompletionStage
import java.util.{ List => JList }

import scala.collection.JavaConverters._
import scala.compat.java8.FutureConverters._
import scala.jdk.CollectionConverters._
import scala.jdk.FutureConverters._

import akka.Done
import akka.actor.ClassicActorSystemProvider
Expand Down Expand Up @@ -43,14 +43,14 @@ final class DurableStateCleanup private (delegate: scaladsl.DurableStateCleanup)
* Delete the state related to one single `persistenceId`.
*/
def deleteState(persistenceId: String, resetRevisionNumber: Boolean): CompletionStage[Done] = {
delegate.deleteState(persistenceId, resetRevisionNumber).toJava
delegate.deleteState(persistenceId, resetRevisionNumber).asJava
}

/**
* Delete all states related to the given list of `persistenceIds`.
*/
def deleteStates(persistenceIds: JList[String], resetRevisionNumber: Boolean): CompletionStage[Done] = {
delegate.deleteStates(persistenceIds.asScala.toVector, resetRevisionNumber).toJava
delegate.deleteStates(persistenceIds.asScala.toVector, resetRevisionNumber).asJava
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import java.time.Instant
import java.util.concurrent.CompletionStage
import java.util.{ List => JList }

import scala.collection.JavaConverters._
import scala.compat.java8.FutureConverters._
import scala.jdk.CollectionConverters._
import scala.jdk.FutureConverters._

import akka.Done
import akka.actor.ClassicActorSystemProvider
Expand Down Expand Up @@ -53,19 +53,19 @@ final class EventSourcedCleanup private (delegate: scaladsl.EventSourcedCleanup)
* sequence nr (inclusive) to delete up to
*/
def deleteEventsTo(persistenceId: String, toSequenceNr: Long): CompletionStage[Done] =
delegate.deleteEventsTo(persistenceId, toSequenceNr).toJava
delegate.deleteEventsTo(persistenceId, toSequenceNr).asJava

/**
* Delete all events related to one single `persistenceId`. Snapshots are not deleted.
*/
def deleteAllEvents(persistenceId: String, resetSequenceNumber: Boolean): CompletionStage[Done] =
delegate.deleteAllEvents(persistenceId, resetSequenceNumber).toJava
delegate.deleteAllEvents(persistenceId, resetSequenceNumber).asJava

/**
* Delete all events related to the given list of `persistenceIds`. Snapshots are not deleted.
*/
def deleteAllEvents(persistenceIds: JList[String], resetSequenceNumber: Boolean): CompletionStage[Done] =
delegate.deleteAllEvents(persistenceIds.asScala.toVector, resetSequenceNumber).toJava
delegate.deleteAllEvents(persistenceIds.asScala.toVector, resetSequenceNumber).asJava

/**
* Delete events before a timestamp for the given persistence id. Snapshots are not deleted.
Expand All @@ -83,7 +83,7 @@ final class EventSourcedCleanup private (delegate: scaladsl.EventSourcedCleanup)
* timestamp (exclusive) to delete up to
*/
def deleteEventsBefore(persistenceId: String, timestamp: Instant): CompletionStage[Done] =
delegate.deleteEventsBefore(persistenceId, timestamp).toJava
delegate.deleteEventsBefore(persistenceId, timestamp).asJava

/**
* Delete events before a timestamp for the given entityType and slice. Snapshots are not deleted.
Expand All @@ -103,43 +103,43 @@ final class EventSourcedCleanup private (delegate: scaladsl.EventSourcedCleanup)
* timestamp (exclusive) to delete up to
*/
def deleteEventsBefore(entityType: String, slice: Int, timestamp: Instant): CompletionStage[Done] =
delegate.deleteEventsBefore(entityType, slice, timestamp).toJava
delegate.deleteEventsBefore(entityType, slice, timestamp).asJava

/**
* Delete snapshots related to one single `persistenceId`. Events are not deleted.
*/
def deleteSnapshot(persistenceId: String): CompletionStage[Done] =
delegate.deleteSnapshot(persistenceId).toJava
delegate.deleteSnapshot(persistenceId).asJava

/**
* Delete all snapshots related to the given list of `persistenceIds`. Events are not deleted.
*/
def deleteSnapshots(persistenceIds: JList[String]): CompletionStage[Done] =
delegate.deleteSnapshots(persistenceIds.asScala.toVector).toJava
delegate.deleteSnapshots(persistenceIds.asScala.toVector).asJava

/**
* Deletes all events for the given persistence id from before the snapshot. The snapshot is not deleted. The event
* with the same sequence number as the remaining snapshot is deleted.
*/
def cleanupBeforeSnapshot(persistenceId: String): CompletionStage[Done] =
delegate.cleanupBeforeSnapshot(persistenceId).toJava
delegate.cleanupBeforeSnapshot(persistenceId).asJava

/**
* See single persistenceId overload for what is done for each persistence id
*/
def cleanupBeforeSnapshot(persistenceIds: JList[String]): CompletionStage[Done] =
delegate.cleanupBeforeSnapshot(persistenceIds.asScala.toVector).toJava
delegate.cleanupBeforeSnapshot(persistenceIds.asScala.toVector).asJava

/**
* Delete everything related to one single `persistenceId`. All events and snapshots are deleted.
*/
def deleteAll(persistenceId: String, resetSequenceNumber: Boolean): CompletionStage[Done] =
delegate.deleteAll(persistenceId, resetSequenceNumber).toJava
delegate.deleteAll(persistenceId, resetSequenceNumber).asJava

/**
* Delete everything related to the given list of `persistenceIds`. All events and snapshots are deleted.
*/
def deleteAll(persistenceIds: JList[String], resetSequenceNumber: Boolean): CompletionStage[Done] =
delegate.deleteAll(persistenceIds.asScala.toVector, resetSequenceNumber).toJava
delegate.deleteAll(persistenceIds.asScala.toVector, resetSequenceNumber).asJava

}
Loading

0 comments on commit afc8fd7

Please sign in to comment.