Skip to content

Commit

Permalink
fix: handle DeletedDurableState in extractCreationTime implementations (
Browse files Browse the repository at this point in the history
  • Loading branch information
aludwiko authored Oct 18, 2022
1 parent 455564f commit c113591
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import akka.NotUsed
import akka.actor.typed.ActorSystem
import akka.annotation.InternalApi
import akka.japi.Pair
import akka.persistence.query.DeletedDurableState
import akka.persistence.query.NoOffset
import akka.persistence.query.Offset
import akka.persistence.query.DurableStateChange
Expand Down Expand Up @@ -74,7 +75,7 @@ object DurableStateSourceProvider {
override def extractCreationTime(stateChange: DurableStateChange[A]): Long =
stateChange match {
case u: UpdatedDurableState[_] => u.timestamp
case _ => 0L // FIXME handle DeletedDurableState when that is added
case d: DeletedDurableState[_] => d.timestamp
}
}

Expand Down Expand Up @@ -141,10 +142,7 @@ object DurableStateSourceProvider {
override def extractCreationTime(stateChange: DurableStateChange[A]): Long =
stateChange match {
case u: UpdatedDurableState[_] => u.timestamp
case other =>
// FIXME case DeletedDurableState when that is added
throw new IllegalArgumentException(
s"DurableStateChange [${other.getClass.getName}] not implemented yet. Please report bug at https://github.com/akka/akka-persistence-r2dbc/issues")
case d: DeletedDurableState[_] => d.timestamp
}

override def getObject(persistenceId: String): CompletionStage[GetObjectResult[A]] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import scala.concurrent.Future

import akka.NotUsed
import akka.actor.typed.ActorSystem
import akka.persistence.query.DeletedDurableState
import akka.persistence.query.NoOffset
import akka.persistence.query.Offset
import akka.persistence.query.DurableStateChange
Expand Down Expand Up @@ -64,7 +65,7 @@ object DurableStateSourceProvider {
override def extractCreationTime(stateChange: DurableStateChange[A]): Long =
stateChange match {
case u: UpdatedDurableState[_] => u.timestamp
case _ => 0L // FIXME handle DeletedDurableState when that is added
case d: DeletedDurableState[_] => d.timestamp
}
}

Expand Down Expand Up @@ -129,10 +130,7 @@ object DurableStateSourceProvider {
override def extractCreationTime(stateChange: DurableStateChange[A]): Long =
stateChange match {
case u: UpdatedDurableState[_] => u.timestamp
case other =>
// FIXME case DeletedDurableState when that is added
throw new IllegalArgumentException(
s"DurableStateChange [${other.getClass.getName}] not implemented yet. Please report bug at https://github.com/akka/akka-persistence-r2dbc/issues")
case d: DeletedDurableState[_] => d.timestamp
}

override def getObject(persistenceId: String): Future[GetObjectResult[A]] =
Expand Down

0 comments on commit c113591

Please sign in to comment.