ticket 989 #Allow specifying preferred-nodes of other type than node:<name>/

currently the task has been downscoped to only allow node:name since we need to rethink this part. Metadata is going to make it /
it possible to deal with way more nodes
This commit is contained in:
Peter Veentjer 2011-08-09 13:22:05 +03:00
commit eae045ff45
3 changed files with 14 additions and 16 deletions

View file

@ -31,7 +31,7 @@ trait ActorDeployer {
*/
object Deployer extends ActorDeployer {
val defaultAddress = Host(Config.hostname)
// val defaultAddress = Node(Config.nodename)
lazy val instance: ActorDeployer = {
val deployer = if (ClusterModule.isEnabled) ClusterModule.clusterDeployer else LocalDeployer
@ -183,9 +183,9 @@ object Deployer extends ActorDeployer {
val address = tokenizer.nextElement.asInstanceOf[String]
protocol match {
case "host" Host(address)
//case "host" Host(address)
case "node" Node(address)
case "ip" IP(address)
//case "ip" IP(address)
case _ raiseHomeConfigError()
}
}

View file

@ -59,7 +59,7 @@ object DeploymentConfig {
// --------------------------------
sealed trait Scope
case class Clustered(
preferredNodes: Iterable[Home] = Vector(Host("localhost")),
preferredNodes: Iterable[Home] = Vector(Node(Config.nodename)),
replicas: ReplicationFactor = ZeroReplicationFactor,
replication: ReplicationScheme = Transient) extends Scope
@ -73,9 +73,9 @@ object DeploymentConfig {
// --- Home
// --------------------------------
sealed trait Home
case class Host(hostName: String) extends Home
// case class Host(hostName: String) extends Home
case class Node(nodeName: String) extends Home
case class IP(ipAddress: String) extends Home
// case class IP(ipAddress: String) extends Home
// --------------------------------
// --- Replicas
@ -138,13 +138,11 @@ object DeploymentConfig {
def nodeNameFor(home: Home): String = home match {
case Node(nodename) nodename
case Host("localhost") Config.nodename
case IP("0.0.0.0") Config.nodename
case IP("127.0.0.1") Config.nodename
case Host(hostname) throw new UnsupportedOperationException(
"Specifying preferred node name by 'hostname' is not yet supported. Use the node name like: preferred-nodes = [\"node:node1\"]")
case IP(address) throw new UnsupportedOperationException(
"Specifying preferred node name by 'IP address' is not yet supported. Use the node name like: preferred-nodes = [\"node:node1\"]")
// case Host("localhost") Config.nodename
// case IP("0.0.0.0") Config.nodename
// case IP("127.0.0.1") Config.nodename
// case Host(hostname) throw new UnsupportedOperationException("Specifying preferred node name by 'hostname' is not yet supported. Use the node name like: preferred-nodes = [\"node:node1\"]")
// case IP(address) throw new UnsupportedOperationException("Specifying preferred node name by 'IP address' is not yet supported. Use the node name like: preferred-nodes = [\"node:node1\"]")
}
def isHomeNode(homes: Iterable[Home]): Boolean = homes exists (home nodeNameFor(home) == Config.nodename)

View file

@ -51,9 +51,9 @@ akka {
# default (if omitted) is local non-clustered actor
preferred-nodes = ["node:node1"] # a list of preferred nodes for instantiating the actor instances on
# defined as: hostname, IP-address or node name
# available: "host:<hostname>", "ip:<ip address>" and "node:<node name>"
# default is "host:localhost"
# defined as node name
# available:
# "node:<node name>"
replication-factor = 3 # number of actor instances in the cluster
# available: positive integer (0-N) or the string "auto" for auto-scaling