Skip to content
This repository has been archived by the owner on May 7, 2019. It is now read-only.

Commit

Permalink
Make sure all case classes are final
Browse files Browse the repository at this point in the history
  • Loading branch information
Max-Meldrum committed Aug 21, 2018
1 parent 7e348f1 commit bd6f26a
Show file tree
Hide file tree
Showing 19 changed files with 58 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import runtime.common.Identifiers

object ClusterListener {
def apply(): Props = Props(new ClusterListener)
case class TaskManagerRegistration(addr: Address)
case class TaskManagerRemoved(addr: Address)
case class UnreachableTaskManager(addr: Address)
final case class TaskManagerRegistration(addr: Address)
final case class TaskManagerRemoved(addr: Address)
final case class UnreachableTaskManager(addr: Address)
}

class ClusterListener extends Actor with ActorLogging {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import scala.concurrent.duration._

private[resourcemanager] object ResourceManager {
def apply(): Props = Props(new ResourceManager)
case class SlotRequest(job: ArcJob)
case class ResourceRequest(job: ArcJob)
final case class SlotRequest(job: ArcJob)
final case class ResourceRequest(job: ArcJob)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import runtime.common.Identifiers
object ClusterListener {
def apply(): Props = Props(new ClusterListener)
// ResourceManager
case class UnreachableResourceManager(addr: Address)
case class RemovedResourceManager(addr: Address)
case class ResourceManagerUp(addr: Address)
final case class UnreachableResourceManager(addr: Address)
final case class RemovedResourceManager(addr: Address)
final case class ResourceManagerUp(addr: Address)
}

class ClusterListener extends Actor with ActorLogging {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ private[standalone] object TaskExecutor {
// Refactor
def apply(binPath: String, task: ArcTask, aMaster: ActorRef, sMaster: ActorRef): Props =
Props(new TaskExecutor(binPath, task, aMaster, sMaster))
case object HealthCheck
case class StdOutResult(r: String)
case class CreateTaskReader(task: ArcTask)
final case object HealthCheck
final case class StdOutResult(r: String)
final case class CreateTaskReader(task: ArcTask)
}

/** Initial PoC for executing binaries and "monitoring" them
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import runtime.protobuf.messages.{ArcTask, ArcTaskUpdate}
object TaskExecutorReader {
def apply(p: Process, appMaster: ActorRef, task: ArcTask): Props =
Props(new TaskExecutorReader(p, appMaster, task))
case class Result(s: String)
final case class Result(s: String)
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import scala.util.{Failure, Success}
private[standalone] object TaskMaster {
def apply(container: Container):Props =
Props(new TaskMaster(container))
case object VerifyHeartbeat
case class TaskUploaded(name: String)
case class TaskReady(id: String)
case object TaskWriteFailure
case object StartExecution
final case object VerifyHeartbeat
final case class TaskUploaded(name: String)
final case class TaskReady(id: String)
final case object TaskWriteFailure
final case object StartExecution
}

/** Actor that manages received Binaries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ private[yarn] object TaskExecutor {
taskMaster: ActorRef,
stateMaster: ActorRef): Props =
Props(new TaskExecutor(binPath, taskId, appMaster, taskMaster, stateMaster))
case object HealthCheck
case class StdOutResult(r: String)
case class CreateTaskReader(task: ArcTask)
final case object HealthCheck
final case class StdOutResult(r: String)
final case class CreateTaskReader(task: ArcTask)
}

/** Actor that is responsible for executing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import runtime.protobuf.messages.{ArcTask, ArcTaskUpdate}
object TaskExecutorReader {
def apply(p: Process, appMaster: ActorRef, task: ArcTask): Props =
Props(new TaskExecutorReader(p, appMaster, task))
case class Result(s: String)
final case class Result(s: String)
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import scala.concurrent.duration._
private[yarn] object TaskMaster {
def apply(appmaster: ActorRef, statemaster: ActorRef, jobId: String): Props =
Props(new TaskMaster(appmaster, statemaster, jobId))
case class LaunchedTask(containerId: ContainerId, task: ArcTask, container: Container)
final case class LaunchedTask(containerId: ContainerId, task: ArcTask, container: Container)
type AllocationID = Long
type BinaryPath = String
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package runtime.kompact


case class ExecutorTerminated(ref: KompactRef)
case class ExecutorUp(ref: KompactRef)
case object ProxyServerTerminated
final case class ExecutorTerminated(ref: KompactRef)
final case class ExecutorUp(ref: KompactRef)
final case object ProxyServerTerminated
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import runtime.kompact.messages.KompactAkkaMsg

private[kompact] object KompactAsk {
sealed trait AskResponse
case object AskFailure extends AskResponse
case class AskSuccess(msg: Msg) extends AskResponse
case object AskExpired
case object AskTickerInit
final case object AskFailure extends AskResponse
final case class AskSuccess(msg: Msg) extends AskResponse
final case object AskExpired
final case object AskTickerInit
def apply(t: Timeout): Props = Props(new KompactAsk(t))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package runtime.kompact
import akka.actor.{ActorRef, ActorSystem, ExtendedActorSystem, Extension, ExtensionId, ExtensionIdProvider}

private[kompact] object KompactExtensionImpl {
case class Register(actorRef: ActorRef)
case class Unregister(actorRef: ActorRef)
final case class Register(actorRef: ActorRef)
final case class Unregister(actorRef: ActorRef)
}

class KompactExtensionImpl(system: ExtendedActorSystem) extends Extension {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import scala.collection.mutable
private[kompact] object ProxyActor {
def apply(): Props = Props(new ProxyActor())
type ActorName = String
case class ProxyMsg(name: ActorName, msg: AnyRef)
case class AskRelay(reply: AskReply)
final case class AskRelay(reply: AskReply)
}

private[kompact] class ProxyActor extends Actor with ActorLogging {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import runtime.kompact.messages.KompactAkkaMsg

private[kompact] object ExtensionActor {
def apply(parent: ActorRef): Props = Props(new ExtensionActor(parent))
case class TestAsk(msg: KompactAkkaMsg)
case object TestDeathWatch
final case class TestAsk(msg: KompactAkkaMsg)
final case object TestDeathWatch
}

private[kompact] class ExtensionActor(parent: ActorRef) extends Actor with ActorLogging {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import scala.concurrent.duration._
import scala.util.{Failure, Success}

object AppManager {
case class ArcJobRequest(job: ArcJob)
case class ArcDeployRequest(priority: Int, locality: Boolean, tasks: Seq[ArcTask])
case class ArcJobStatus(id: String)
case class KillArcJobRequest(id: String)
case object ResourceManagerUnavailable
case object ListJobs
case object ListJobsWithDetails
case object StateMasterError
final case class ArcJobRequest(job: ArcJob)
final case class ArcDeployRequest(priority: Int, locality: Boolean, tasks: Seq[ArcTask])
final case class ArcJobStatus(id: String)
final case class KillArcJobRequest(id: String)
final case object ResourceManagerUnavailable
final case object ListJobs
final case object ListJobsWithDetails
final case object StateMasterError
type ArcJobID = String
}

Expand Down Expand Up @@ -202,6 +202,6 @@ class StandaloneAppManager extends AppManager {
}

object StandaloneAppManager {
case class AppMasterInit(job: ArcJob, rmAddr: Address, stateMaster: ActorRef)
final case class AppMasterInit(job: ArcJob, rmAddr: Address, stateMaster: ActorRef)
def apply(): Props = Props(new StandaloneAppManager())
}
Original file line number Diff line number Diff line change
Expand Up @@ -276,5 +276,5 @@ private[runtime] object StandaloneAppMaster {
def apply(job: ArcJob, resourceManagerAddr: Address): Props =
Props(new StandaloneAppMaster(job, resourceManagerAddr))

case class BinaryTask(bin: Array[Byte], name: String)
final case class BinaryTask(bin: Array[Byte], name: String)
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import runtime.common.Identifiers

object ClusterListener {
def apply(): Props = Props(new ClusterListener)
case class RmRegistration(addr: Address)
case class UnreachableRm(addr: Address)
case class RmRemoved(addr: Address)
final case class RmRegistration(addr: Address)
final case class UnreachableRm(addr: Address)
final case class RmRemoved(addr: Address)

case class StateManagerRegistration(addr: Address)
case class StateManagerRemoved(addr: Address)
case class StateManagerUnreachable(addr: Address)
final case class StateManagerRegistration(addr: Address)
final case class StateManagerRemoved(addr: Address)
final case class StateManagerUnreachable(addr: Address)
}

class ClusterListener extends Actor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import scala.collection.mutable
object MetricAccumulator {
def apply(): Props = Props(new MetricAccumulator())

case object ClusterMetrics
case object TaskManagerMetrics
case object StateManagerMetrics
final case object ClusterMetrics
final case object TaskManagerMetrics
final case object StateManagerMetrics

sealed trait ArcMetric
case class CpuMetric(loadAverage: Double, processors: Int) extends ArcMetric
case class MemoryMetric(heapUsed: Double, heapCommited: Double, heapMax: Long) extends ArcMetric
case object UnknownMetric extends ArcMetric
case class ExhaustiveMetric(address: String, cpu: CpuMetric, mem: MemoryMetric) extends ArcMetric
final case class CpuMetric(loadAverage: Double, processors: Int) extends ArcMetric
final case class MemoryMetric(heapUsed: Double, heapCommited: Double, heapMax: Long) extends ArcMetric
final case object UnknownMetric extends ArcMetric
final case class ExhaustiveMetric(address: String, cpu: CpuMetric, mem: MemoryMetric) extends ArcMetric
}

/** Actor that collects host level metrics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ object ClusterRoute {
import scala.concurrent.duration._


case class NamedMetric(name: String, metrics: ExhaustiveMetric)
final case class NamedMetric(name: String, metrics: ExhaustiveMetric)


/** api/$version/cluster/metrics
Expand Down

0 comments on commit bd6f26a

Please sign in to comment.