+per #16541 initial version of the Persistence Query module

This commit is contained in:
Patrik Nordwall & Konrad Malawski 2015-06-08 12:26:19 +02:00 committed by Konrad Malawski
parent 09aff42d40
commit f849793f36
23 changed files with 1051 additions and 14 deletions

View file

@ -219,7 +219,7 @@ class Persistence(val system: ExtendedActorSystem) extends Extension {
* When configured, uses `journalPluginId` as absolute path to the journal configuration entry.
* Configuration entry must contain few required fields, such as `class`. See `src/main/resources/reference.conf`.
*/
@tailrec final def journalFor(journalPluginId: String): ActorRef = {
@tailrec private[akka] final def journalFor(journalPluginId: String): ActorRef = {
val configPath = if (isEmpty(journalPluginId)) defaultJournalPluginId else journalPluginId
val extensionIdMap = journalPluginExtensionId.get
extensionIdMap.get(configPath) match {
@ -239,12 +239,14 @@ class Persistence(val system: ExtendedActorSystem) extends Extension {
}
/**
* INTERNAL API
*
* Returns a snapshot store plugin actor identified by `snapshotPluginId`.
* When empty, looks in `akka.persistence.snapshot-store.plugin` to find configuration entry path.
* When configured, uses `snapshotPluginId` as absolute path to the snapshot store configuration entry.
* Configuration entry must contain few required fields, such as `class`. See `src/main/resources/reference.conf`.
*/
@tailrec final def snapshotStoreFor(snapshotPluginId: String): ActorRef = {
@tailrec private[akka] final def snapshotStoreFor(snapshotPluginId: String): ActorRef = {
val configPath = if (isEmpty(snapshotPluginId)) defaultSnapshotPluginId else snapshotPluginId
val extensionIdMap = snapshotPluginExtensionId.get
extensionIdMap.get(configPath) match {

View file

@ -41,12 +41,12 @@ final case class AtomicWrite(payload: immutable.Seq[PersistentRepr]) extends Per
// only check that all persistenceIds are equal when there's more than one in the Seq
if (payload match {
case l: List[PersistentRepr] => l.tail.nonEmpty
case v: Vector[PersistentRepr] => v.size > 1
case _ => true // some other collection type, let's just check
case l: List[PersistentRepr] l.tail.nonEmpty
case v: Vector[PersistentRepr] v.size > 1
case _ true // some other collection type, let's just check
}) require(payload.forall(_.persistenceId == payload.head.persistenceId),
"AtomicWrite must contain messages for the same persistenceId, " +
s"yet different persistenceIds found: ${payload.map(_.persistenceId).toSet}")
"AtomicWrite must contain messages for the same persistenceId, " +
s"yet different persistenceIds found: ${payload.map(_.persistenceId).toSet}")
def persistenceId = payload.head.persistenceId
def lowestSequenceNr = payload.head.sequenceNr // this assumes they're gapless; they should be (it is only our code creating AWs)

View file

@ -42,6 +42,7 @@ import static org.junit.matchers.JUnitMatchers.hasItems;
public class AbstractPersistentFSMTest {
private static Option<String> none = Option.none();
@ClassRule
public static AkkaJUnitActorSystemResource actorSystemResource =
new AkkaJUnitActorSystemResource("PersistentFSMJavaTest", PersistenceSpec.config(

View file

@ -204,7 +204,7 @@ class PersistentActorFailureSpec extends PersistenceSpec(PersistenceSpec.config(
expectMsg("Failure: wrong-1")
expectTerminated(persistentActor)
}
"call onPersistFailure and stop if persistAsync fails xoxo" in {
"call onPersistFailure and stop if persistAsync fails" in {
system.actorOf(Props(classOf[Supervisor], testActor)) ! Props(classOf[AsyncPersistPersistentActor], name)
val persistentActor = expectMsgType[ActorRef]
persistentActor ! Cmd("a")