replace unicode arrows
* ⇒, →, ← * because we don't want to show them in documentation snippets and then it's complicated to avoid that when snippets are located in src/test/scala in individual modules * dont replace object `→` in FSM.scala and PersistentFSM.scala
This commit is contained in:
parent
e4d38f92a4
commit
5c96a5f556
1521 changed files with 18846 additions and 18786 deletions
|
|
@ -64,9 +64,9 @@ final class PersistencePluginProxy(config: Config) extends Actor with Stash with
|
|||
|
||||
private val pluginId = self.path.name
|
||||
private val pluginType: PluginType = pluginId match {
|
||||
case "akka.persistence.journal.proxy" ⇒ Journal
|
||||
case "akka.persistence.snapshot-store.proxy" ⇒ SnapshotStore
|
||||
case other ⇒
|
||||
case "akka.persistence.journal.proxy" => Journal
|
||||
case "akka.persistence.snapshot-store.proxy" => SnapshotStore
|
||||
case other =>
|
||||
throw new IllegalArgumentException("Unknown plugin type: " + other)
|
||||
}
|
||||
|
||||
|
|
@ -80,10 +80,10 @@ final class PersistencePluginProxy(config: Config) extends Actor with Stash with
|
|||
override def preStart(): Unit = {
|
||||
if (startTarget) {
|
||||
val target = pluginType match {
|
||||
case Journal ⇒
|
||||
case Journal =>
|
||||
log.info("Starting target journal [{}]", targetPluginId)
|
||||
Persistence(context.system).journalFor(targetPluginId)
|
||||
case SnapshotStore ⇒
|
||||
case SnapshotStore =>
|
||||
log.info("Starting target snapshot-store [{}]", targetPluginId)
|
||||
Persistence(context.system).snapshotStoreFor(targetPluginId)
|
||||
}
|
||||
|
|
@ -96,7 +96,7 @@ final class PersistencePluginProxy(config: Config) extends Actor with Stash with
|
|||
log.info("Setting target {} address to {}", pluginType.qualifier, targetAddress)
|
||||
PersistencePluginProxy.setTargetLocation(context.system, AddressFromURIString(targetAddress))
|
||||
} catch {
|
||||
case _: URISyntaxException ⇒ log.warning("Invalid URL provided for target {} address: {}", pluginType.qualifier, targetAddress)
|
||||
case _: URISyntaxException => log.warning("Invalid URL provided for target {} address: {}", pluginType.qualifier, targetAddress)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -113,15 +113,15 @@ final class PersistencePluginProxy(config: Config) extends Actor with Stash with
|
|||
def receive = init
|
||||
|
||||
def init: Receive = {
|
||||
case TargetLocation(address) ⇒
|
||||
case TargetLocation(address) =>
|
||||
context.setReceiveTimeout(1.second) // for retries
|
||||
context.become(identifying(address))
|
||||
case InitTimeout ⇒
|
||||
case InitTimeout =>
|
||||
log.info("Initialization timed-out (after {}), Use `PersistencePluginProxy.setTargetLocation` or set `target-{}-address`", initTimeout, pluginType.qualifier)
|
||||
context.become(initTimedOut)
|
||||
unstashAll() // will trigger appropriate failures
|
||||
case Terminated(_) ⇒
|
||||
case msg ⇒
|
||||
case Terminated(_) =>
|
||||
case msg =>
|
||||
stash()
|
||||
}
|
||||
|
||||
|
|
@ -138,67 +138,67 @@ final class PersistencePluginProxy(config: Config) extends Actor with Stash with
|
|||
}
|
||||
|
||||
def identifying(address: Address): Receive = ({
|
||||
case ActorIdentity(`targetPluginId`, Some(target)) ⇒
|
||||
case ActorIdentity(`targetPluginId`, Some(target)) =>
|
||||
log.info("Found target {} at [{}]", pluginType.qualifier, address)
|
||||
context.setReceiveTimeout(Duration.Undefined)
|
||||
context.watch(target)
|
||||
unstashAll()
|
||||
context.become(active(target, address == selfAddress))
|
||||
case _: ActorIdentity ⇒ // will retry after ReceiveTimeout
|
||||
case Terminated(_) ⇒
|
||||
case ReceiveTimeout ⇒
|
||||
case _: ActorIdentity => // will retry after ReceiveTimeout
|
||||
case Terminated(_) =>
|
||||
case ReceiveTimeout =>
|
||||
sendIdentify(address)
|
||||
}: Receive).orElse(init)
|
||||
|
||||
def active(targetJournal: ActorRef, targetAtThisNode: Boolean): Receive = {
|
||||
case TargetLocation(address) ⇒
|
||||
case TargetLocation(address) =>
|
||||
if (targetAtThisNode && address != selfAddress)
|
||||
becomeIdentifying(address)
|
||||
case Terminated(`targetJournal`) ⇒
|
||||
case Terminated(`targetJournal`) =>
|
||||
context.unwatch(targetJournal)
|
||||
context.become(initTimedOut)
|
||||
case Terminated(_) ⇒
|
||||
case InitTimeout ⇒
|
||||
case msg ⇒
|
||||
case Terminated(_) =>
|
||||
case InitTimeout =>
|
||||
case msg =>
|
||||
targetJournal forward msg
|
||||
}
|
||||
|
||||
def initTimedOut: Receive = {
|
||||
|
||||
case req: JournalProtocol.Request ⇒ req match { // exhaustive match
|
||||
case WriteMessages(messages, persistentActor, actorInstanceId) ⇒
|
||||
case req: JournalProtocol.Request => req match { // exhaustive match
|
||||
case WriteMessages(messages, persistentActor, actorInstanceId) =>
|
||||
persistentActor ! WriteMessagesFailed(timeoutException)
|
||||
messages.foreach {
|
||||
case a: AtomicWrite ⇒
|
||||
a.payload.foreach { p ⇒
|
||||
case a: AtomicWrite =>
|
||||
a.payload.foreach { p =>
|
||||
persistentActor ! WriteMessageFailure(p, timeoutException, actorInstanceId)
|
||||
}
|
||||
case r: NonPersistentRepr ⇒
|
||||
case r: NonPersistentRepr =>
|
||||
persistentActor ! LoopMessageSuccess(r.payload, actorInstanceId)
|
||||
}
|
||||
case ReplayMessages(fromSequenceNr, toSequenceNr, max, persistenceId, persistentActor) ⇒
|
||||
case ReplayMessages(fromSequenceNr, toSequenceNr, max, persistenceId, persistentActor) =>
|
||||
persistentActor ! ReplayMessagesFailure(timeoutException)
|
||||
case DeleteMessagesTo(persistenceId, toSequenceNr, persistentActor) ⇒
|
||||
case DeleteMessagesTo(persistenceId, toSequenceNr, persistentActor) =>
|
||||
persistentActor ! DeleteMessagesFailure(timeoutException, toSequenceNr)
|
||||
}
|
||||
|
||||
case req: SnapshotProtocol.Request ⇒ req match { // exhaustive match
|
||||
case LoadSnapshot(persistenceId, criteria, toSequenceNr) ⇒
|
||||
case req: SnapshotProtocol.Request => req match { // exhaustive match
|
||||
case LoadSnapshot(persistenceId, criteria, toSequenceNr) =>
|
||||
sender() ! LoadSnapshotFailed(timeoutException)
|
||||
case SaveSnapshot(metadata, snapshot) ⇒
|
||||
case SaveSnapshot(metadata, snapshot) =>
|
||||
sender() ! SaveSnapshotFailure(metadata, timeoutException)
|
||||
case DeleteSnapshot(metadata) ⇒
|
||||
case DeleteSnapshot(metadata) =>
|
||||
sender() ! DeleteSnapshotFailure(metadata, timeoutException)
|
||||
case DeleteSnapshots(persistenceId, criteria) ⇒
|
||||
case DeleteSnapshots(persistenceId, criteria) =>
|
||||
sender() ! DeleteSnapshotsFailure(criteria, timeoutException)
|
||||
}
|
||||
|
||||
case TargetLocation(address) ⇒
|
||||
case TargetLocation(address) =>
|
||||
becomeIdentifying(address)
|
||||
|
||||
case Terminated(_) ⇒
|
||||
case Terminated(_) =>
|
||||
|
||||
case other ⇒
|
||||
case other =>
|
||||
val e = timeoutException()
|
||||
log.error(e, "Failed PersistencePluginProxy request: {}", e.getMessage)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue