From 6d0416f0aa904c2409e4ca039e52a529e966695b Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Thu, 13 Aug 2015 15:13:27 +0200 Subject: [PATCH] !per #17918 Make deleteMessages reply msgs public --- akka-docs/rst/java/lambda-persistence.rst | 3 +++ akka-docs/rst/java/persistence.rst | 3 +++ akka-docs/rst/scala/persistence.rst | 3 +++ .../main/scala/akka/persistence/Eventsourced.scala | 3 ++- .../scala/akka/persistence/JournalProtocol.scala | 12 ------------ .../scala/akka/persistence/PersistentActor.scala | 10 ++++++++++ .../PersistentActorDeleteFailureSpec.scala | 1 - .../scala/akka/persistence/PersistentActorSpec.scala | 1 - 8 files changed, 21 insertions(+), 15 deletions(-) diff --git a/akka-docs/rst/java/lambda-persistence.rst b/akka-docs/rst/java/lambda-persistence.rst index 60c09fc16f..a12399ce68 100644 --- a/akka-docs/rst/java/lambda-persistence.rst +++ b/akka-docs/rst/java/lambda-persistence.rst @@ -335,6 +335,9 @@ Deleting messages in event sourcing based applications is typically either not u up until the sequence number of the data held by that snapshot can be issued, to safely delete the previous events, while still having access to the accumulated state during replays - by loading the snapshot. +The result of the ``deleteMessages`` request is signaled to the persistent actor with a ``DeleteMessagesSuccess`` +message if the delete was successful or a ``DeleteMessagesFailure`` message if it failed. + Persistence status handling --------------------------- Persisting, deleting and replaying messages can either succeed or fail. diff --git a/akka-docs/rst/java/persistence.rst b/akka-docs/rst/java/persistence.rst index bdbe0f58b7..a6be201b99 100644 --- a/akka-docs/rst/java/persistence.rst +++ b/akka-docs/rst/java/persistence.rst @@ -338,6 +338,9 @@ Deleting messages in event sourcing based applications is typically either not u up until the sequence number of the data held by that snapshot can be issued, to safely delete the previous events, while still having access to the accumulated state during replays - by loading the snapshot. +The result of the ``deleteMessages`` request is signaled to the persistent actor with a ``DeleteMessagesSuccess`` +message if the delete was successful or a ``DeleteMessagesFailure`` message if it failed. + Persistence status handling --------------------------- Persisting, deleting and replaying messages can either succeed or fail. diff --git a/akka-docs/rst/scala/persistence.rst b/akka-docs/rst/scala/persistence.rst index 946c81c8a0..9df379f5cd 100644 --- a/akka-docs/rst/scala/persistence.rst +++ b/akka-docs/rst/scala/persistence.rst @@ -325,6 +325,9 @@ Deleting messages in event sourcing based applications is typically either not u up until the sequence number of the data held by that snapshot can be issued, to safely delete the previous events, while still having access to the accumulated state during replays - by loading the snapshot. +The result of the ``deleteMessages`` request is signaled to the persistent actor with a ``DeleteMessagesSuccess`` +message if the delete was successful or a ``DeleteMessagesFailure`` message if it failed. + Persistence status handling --------------------------- Persisting, deleting and replaying messages can either succeed or fail. diff --git a/akka-persistence/src/main/scala/akka/persistence/Eventsourced.scala b/akka-persistence/src/main/scala/akka/persistence/Eventsourced.scala index c0e65b1dca..2117ad40fc 100644 --- a/akka-persistence/src/main/scala/akka/persistence/Eventsourced.scala +++ b/akka-persistence/src/main/scala/akka/persistence/Eventsourced.scala @@ -390,7 +390,8 @@ private[persistence] trait Eventsourced extends Snapshotter with Stash with Stas /** * Permanently deletes all persistent messages with sequence numbers less than or equal `toSequenceNr`. * - * If the delete fails an [[akka.persistence.JournalProtocol.DeleteMessagesFailure]] will be sent to the actor. + * If the delete is successful a [[DeleteMessagesSuccess]] will be sent to the actor. + * If the delete fails a [[DeleteMessagesFailure]] will be sent to the actor. * * @param toSequenceNr upper sequence number bound of persistent messages to be deleted. */ diff --git a/akka-persistence/src/main/scala/akka/persistence/JournalProtocol.scala b/akka-persistence/src/main/scala/akka/persistence/JournalProtocol.scala index cd7ca2eaee..6f2b12b7af 100644 --- a/akka-persistence/src/main/scala/akka/persistence/JournalProtocol.scala +++ b/akka-persistence/src/main/scala/akka/persistence/JournalProtocol.scala @@ -22,18 +22,6 @@ private[persistence] object JournalProtocol { /** Internal journal acknowledgement. */ sealed trait Response extends Message - /** - * Reply message to a successful [[DeleteMessagesTo]] request. - */ - final case class DeleteMessagesSuccess(toSequenceNr: Long) - extends Response - - /** - * Reply message to a failed [[DeleteMessagesTo]] request. - */ - final case class DeleteMessagesFailure(cause: Throwable, toSequenceNr: Long) - extends Response - /** * Request to delete all persistent messages with sequence numbers up to `toSequenceNr` * (inclusive). diff --git a/akka-persistence/src/main/scala/akka/persistence/PersistentActor.scala b/akka-persistence/src/main/scala/akka/persistence/PersistentActor.scala index 0c202e9fef..337fe0c40a 100644 --- a/akka-persistence/src/main/scala/akka/persistence/PersistentActor.scala +++ b/akka-persistence/src/main/scala/akka/persistence/PersistentActor.scala @@ -21,6 +21,16 @@ case object RecoveryCompleted extends RecoveryCompleted { def getInstance = this } +/** + * Reply message to a successful [[Eventsourced#deleteMessages]] request. + */ +final case class DeleteMessagesSuccess(toSequenceNr: Long) + +/** + * Reply message to a failed [[Eventsourced#deleteMessages]] request. + */ +final case class DeleteMessagesFailure(cause: Throwable, toSequenceNr: Long) + /** * Recovery mode configuration object to be returned in [[PersistentActor#recovery]]. * diff --git a/akka-persistence/src/test/scala/akka/persistence/PersistentActorDeleteFailureSpec.scala b/akka-persistence/src/test/scala/akka/persistence/PersistentActorDeleteFailureSpec.scala index bc511df98d..c4088ea80e 100644 --- a/akka-persistence/src/test/scala/akka/persistence/PersistentActorDeleteFailureSpec.scala +++ b/akka-persistence/src/test/scala/akka/persistence/PersistentActorDeleteFailureSpec.scala @@ -7,7 +7,6 @@ package akka.persistence import akka.actor._ import akka.event.Logging import akka.event.Logging.Warning -import akka.persistence.JournalProtocol.DeleteMessagesFailure import akka.persistence.journal.inmem.InmemJournal import akka.testkit.{ EventFilter, ImplicitSender, TestEvent } diff --git a/akka-persistence/src/test/scala/akka/persistence/PersistentActorSpec.scala b/akka-persistence/src/test/scala/akka/persistence/PersistentActorSpec.scala index 89b25f7e40..a2f466eda1 100644 --- a/akka-persistence/src/test/scala/akka/persistence/PersistentActorSpec.scala +++ b/akka-persistence/src/test/scala/akka/persistence/PersistentActorSpec.scala @@ -7,7 +7,6 @@ package akka.persistence import java.util.concurrent.atomic.AtomicInteger import akka.actor._ -import akka.persistence.JournalProtocol.DeleteMessagesSuccess import akka.testkit.{ ImplicitSender, TestLatch, TestProbe } import com.typesafe.config.Config