rename ActorPath.{pathElemens => elements}
This commit is contained in:
parent
eeca88d674
commit
0b5f8b083d
5 changed files with 29 additions and 29 deletions
|
|
@ -61,21 +61,21 @@ class ActorLookupSpec extends AkkaSpec {
|
||||||
}
|
}
|
||||||
|
|
||||||
"find actors by looking up their root-anchored relative path" in {
|
"find actors by looking up their root-anchored relative path" in {
|
||||||
system.actorFor(c1.path.pathElements.mkString("/", "/", "")) must be === c1
|
system.actorFor(c1.path.elements.mkString("/", "/", "")) must be === c1
|
||||||
system.actorFor(c2.path.pathElements.mkString("/", "/", "")) must be === c2
|
system.actorFor(c2.path.elements.mkString("/", "/", "")) must be === c2
|
||||||
system.actorFor(c21.path.pathElements.mkString("/", "/", "")) must be === c21
|
system.actorFor(c21.path.elements.mkString("/", "/", "")) must be === c21
|
||||||
}
|
}
|
||||||
|
|
||||||
"find actors by looking up their relative path" in {
|
"find actors by looking up their relative path" in {
|
||||||
system.actorFor(c1.path.pathElements.mkString("/")) must be === c1
|
system.actorFor(c1.path.elements.mkString("/")) must be === c1
|
||||||
system.actorFor(c2.path.pathElements.mkString("/")) must be === c2
|
system.actorFor(c2.path.elements.mkString("/")) must be === c2
|
||||||
system.actorFor(c21.path.pathElements.mkString("/")) must be === c21
|
system.actorFor(c21.path.elements.mkString("/")) must be === c21
|
||||||
}
|
}
|
||||||
|
|
||||||
"find actors by looking up their path elements" in {
|
"find actors by looking up their path elements" in {
|
||||||
system.actorFor(c1.path.pathElements) must be === c1
|
system.actorFor(c1.path.elements) must be === c1
|
||||||
system.actorFor(c2.path.pathElements) must be === c2
|
system.actorFor(c2.path.elements) must be === c2
|
||||||
system.actorFor(c21.path.pathElements) must be === c21
|
system.actorFor(c21.path.elements) must be === c21
|
||||||
}
|
}
|
||||||
|
|
||||||
"find system-generated actors" in {
|
"find system-generated actors" in {
|
||||||
|
|
@ -109,10 +109,10 @@ class ActorLookupSpec extends AkkaSpec {
|
||||||
"find temporary actors" in {
|
"find temporary actors" in {
|
||||||
val f = c1 ? GetSender(testActor)
|
val f = c1 ? GetSender(testActor)
|
||||||
val a = expectMsgType[ActorRef]
|
val a = expectMsgType[ActorRef]
|
||||||
a.path.pathElements.head must be === "temp"
|
a.path.elements.head must be === "temp"
|
||||||
system.actorFor(a.path) must be === a
|
system.actorFor(a.path) must be === a
|
||||||
system.actorFor(a.path.toString) must be === a
|
system.actorFor(a.path.toString) must be === a
|
||||||
system.actorFor(a.path.pathElements) must be === a
|
system.actorFor(a.path.elements) must be === a
|
||||||
system.actorFor(a.path.toString + "/") must be === a
|
system.actorFor(a.path.toString + "/") must be === a
|
||||||
system.actorFor(a.path.toString + "/hallo") must be === system.deadLetters
|
system.actorFor(a.path.toString + "/hallo") must be === system.deadLetters
|
||||||
f.isCompleted must be === false
|
f.isCompleted must be === false
|
||||||
|
|
@ -151,8 +151,8 @@ class ActorLookupSpec extends AkkaSpec {
|
||||||
|
|
||||||
"find actors by looking up their root-anchored relative path" in {
|
"find actors by looking up their root-anchored relative path" in {
|
||||||
def check(looker: ActorRef, pathOf: ActorRef, result: ActorRef) {
|
def check(looker: ActorRef, pathOf: ActorRef, result: ActorRef) {
|
||||||
(looker ? LookupString(pathOf.path.pathElements.mkString("/", "/", ""))).get must be === result
|
(looker ? LookupString(pathOf.path.elements.mkString("/", "/", ""))).get must be === result
|
||||||
(looker ? LookupString(pathOf.path.pathElements.mkString("/", "/", "/"))).get must be === result
|
(looker ? LookupString(pathOf.path.elements.mkString("/", "/", "/"))).get must be === result
|
||||||
}
|
}
|
||||||
for {
|
for {
|
||||||
looker ← all
|
looker ← all
|
||||||
|
|
@ -170,7 +170,7 @@ class ActorLookupSpec extends AkkaSpec {
|
||||||
for {
|
for {
|
||||||
looker ← Seq(c1, c2)
|
looker ← Seq(c1, c2)
|
||||||
target ← all
|
target ← all
|
||||||
} check(looker, target, Seq("..") ++ target.path.pathElements.drop(1): _*)
|
} check(looker, target, Seq("..") ++ target.path.elements.drop(1): _*)
|
||||||
check(c21, user, "..", "..")
|
check(c21, user, "..", "..")
|
||||||
check(c21, root, "..", "..", "..")
|
check(c21, root, "..", "..", "..")
|
||||||
check(c21, root, "..", "..", "..", "..")
|
check(c21, root, "..", "..", "..", "..")
|
||||||
|
|
@ -182,8 +182,8 @@ class ActorLookupSpec extends AkkaSpec {
|
||||||
(looker ? LookupPath(target.path)).get must be === target
|
(looker ? LookupPath(target.path)).get must be === target
|
||||||
(looker ? LookupString(target.path.toString)).get must be === target
|
(looker ? LookupString(target.path.toString)).get must be === target
|
||||||
(looker ? LookupString(target.path.toString + "/")).get must be === target
|
(looker ? LookupString(target.path.toString + "/")).get must be === target
|
||||||
(looker ? LookupString(target.path.pathElements.mkString("/", "/", ""))).get must be === target
|
(looker ? LookupString(target.path.elements.mkString("/", "/", ""))).get must be === target
|
||||||
if (target != root) (looker ? LookupString(target.path.pathElements.mkString("/", "/", "/"))).get must be === target
|
if (target != root) (looker ? LookupString(target.path.elements.mkString("/", "/", "/"))).get must be === target
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (target ← Seq(root, syst, user, system.deadLetters)) check(target)
|
for (target ← Seq(root, syst, user, system.deadLetters)) check(target)
|
||||||
|
|
@ -207,16 +207,16 @@ class ActorLookupSpec extends AkkaSpec {
|
||||||
"find temporary actors" in {
|
"find temporary actors" in {
|
||||||
val f = c1 ? GetSender(testActor)
|
val f = c1 ? GetSender(testActor)
|
||||||
val a = expectMsgType[ActorRef]
|
val a = expectMsgType[ActorRef]
|
||||||
a.path.pathElements.head must be === "temp"
|
a.path.elements.head must be === "temp"
|
||||||
(c2 ? LookupPath(a.path)).get must be === a
|
(c2 ? LookupPath(a.path)).get must be === a
|
||||||
(c2 ? LookupString(a.path.toString)).get must be === a
|
(c2 ? LookupString(a.path.toString)).get must be === a
|
||||||
(c2 ? LookupString(a.path.pathElements.mkString("/", "/", ""))).get must be === a
|
(c2 ? LookupString(a.path.elements.mkString("/", "/", ""))).get must be === a
|
||||||
(c2 ? LookupString("../../" + a.path.pathElements.mkString("/"))).get must be === a
|
(c2 ? LookupString("../../" + a.path.elements.mkString("/"))).get must be === a
|
||||||
(c2 ? LookupString(a.path.toString + "/")).get must be === a
|
(c2 ? LookupString(a.path.toString + "/")).get must be === a
|
||||||
(c2 ? LookupString(a.path.pathElements.mkString("/", "/", "") + "/")).get must be === a
|
(c2 ? LookupString(a.path.elements.mkString("/", "/", "") + "/")).get must be === a
|
||||||
(c2 ? LookupString("../../" + a.path.pathElements.mkString("/") + "/")).get must be === a
|
(c2 ? LookupString("../../" + a.path.elements.mkString("/") + "/")).get must be === a
|
||||||
(c2 ? LookupElems(Seq("..", "..") ++ a.path.pathElements)).get must be === a
|
(c2 ? LookupElems(Seq("..", "..") ++ a.path.elements)).get must be === a
|
||||||
(c2 ? LookupElems(Seq("..", "..") ++ a.path.pathElements :+ "")).get must be === a
|
(c2 ? LookupElems(Seq("..", "..") ++ a.path.elements :+ "")).get must be === a
|
||||||
f.isCompleted must be === false
|
f.isCompleted must be === false
|
||||||
a ! 42
|
a ! 42
|
||||||
f.isCompleted must be === true
|
f.isCompleted must be === true
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ sealed trait ActorPath extends Comparable[ActorPath] {
|
||||||
/**
|
/**
|
||||||
* Sequence of names for this path. Performance implication: has to allocate a list.
|
* Sequence of names for this path. Performance implication: has to allocate a list.
|
||||||
*/
|
*/
|
||||||
def pathElements: Iterable[String]
|
def elements: Iterable[String]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Walk up the tree to obtain and return the RootActorPath.
|
* Walk up the tree to obtain and return the RootActorPath.
|
||||||
|
|
@ -82,7 +82,7 @@ final case class RootActorPath(address: Address, name: String = ActorPath.separa
|
||||||
|
|
||||||
def /(child: String): ActorPath = new ChildActorPath(this, child)
|
def /(child: String): ActorPath = new ChildActorPath(this, child)
|
||||||
|
|
||||||
val pathElements: Iterable[String] = List("")
|
val elements: Iterable[String] = List("")
|
||||||
|
|
||||||
override val toString = address + name
|
override val toString = address + name
|
||||||
|
|
||||||
|
|
@ -98,7 +98,7 @@ final class ChildActorPath(val parent: ActorPath, val name: String) extends Acto
|
||||||
|
|
||||||
def /(child: String): ActorPath = new ChildActorPath(this, child)
|
def /(child: String): ActorPath = new ChildActorPath(this, child)
|
||||||
|
|
||||||
def pathElements: Iterable[String] = {
|
def elements: Iterable[String] = {
|
||||||
@tailrec
|
@tailrec
|
||||||
def rec(p: ActorPath, acc: List[String]): Iterable[String] = p match {
|
def rec(p: ActorPath, acc: List[String]): Iterable[String] = p match {
|
||||||
case r: RootActorPath ⇒ acc
|
case r: RootActorPath ⇒ acc
|
||||||
|
|
|
||||||
|
|
@ -451,7 +451,7 @@ class LocalActorRefProvider(
|
||||||
}
|
}
|
||||||
|
|
||||||
def actorFor(path: ActorPath): InternalActorRef =
|
def actorFor(path: ActorPath): InternalActorRef =
|
||||||
if (path.root == rootPath) actorFor(rootGuardian, path.pathElements)
|
if (path.root == rootPath) actorFor(rootGuardian, path.elements)
|
||||||
else deadLetters
|
else deadLetters
|
||||||
|
|
||||||
def actorFor(ref: InternalActorRef, path: Iterable[String]): InternalActorRef =
|
def actorFor(ref: InternalActorRef, path: Iterable[String]): InternalActorRef =
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ abstract class DurableMailbox(owner: ActorCell) extends Mailbox(owner) with Defa
|
||||||
|
|
||||||
def system = owner.system
|
def system = owner.system
|
||||||
def ownerPath = owner.self.path
|
def ownerPath = owner.self.path
|
||||||
val ownerPathString = ownerPath.pathElements.mkString("/")
|
val ownerPathString = ownerPath.elements.mkString("/")
|
||||||
val name = "mailbox_" + Name.replaceAllIn(ownerPathString, "_")
|
val name = "mailbox_" + Name.replaceAllIn(ownerPathString, "_")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ class RemoteActorRefProvider(
|
||||||
.setPayload(ByteString.copyFrom(actorFactoryBytes))
|
.setPayload(ByteString.copyFrom(actorFactoryBytes))
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
val connectionFactory = () ⇒ actorFor(RootActorPath(remoteAddress) / remote.remoteDaemon.path.pathElements)
|
val connectionFactory = () ⇒ actorFor(RootActorPath(remoteAddress) / remote.remoteDaemon.path.elements)
|
||||||
|
|
||||||
// try to get the connection for the remote address, if not already there then create it
|
// try to get the connection for the remote address, if not already there then create it
|
||||||
val connection = remoteDaemonConnectionManager.putIfAbsent(remoteAddress, connectionFactory)
|
val connection = remoteDaemonConnectionManager.putIfAbsent(remoteAddress, connectionFactory)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue