Skip to content

Commit

Permalink
removed useflag
Browse files Browse the repository at this point in the history
  • Loading branch information
basilkohler committed Jun 5, 2014
1 parent 96a333a commit 3f73b51
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
17 changes: 9 additions & 8 deletions nfn/src/main/scala/ccn/packet/CCNPacket.scala
Expand Up @@ -10,7 +10,8 @@ sealed trait Packet
trait Ack

object CCNName {
val thunkInterestKeyword = "USETHUNK"
// val thunkInterestKeyword = "USETHUNK"
val thunkInterestKeyword = "THUNK"
val thunkKeyword = "THUNK"
val nfnKeyword = "NFN"
val computeKeyword = "COMPUTE"
Expand All @@ -30,7 +31,7 @@ object CCNName {
case class CCNName(cmps: String *) extends Logging {


import CCNName.{thunkKeyword, thunkInterestKeyword, nfnKeyword, computeKeyword}
import CCNName.{thunkKeyword, nfnKeyword, computeKeyword}

def to = toString.replaceAll("/", "_").replaceAll("[^a-zA-Z0-9]", "-")
override def toString = {
Expand All @@ -42,7 +43,7 @@ case class CCNName(cmps: String *) extends Logging {

def isThunk: Boolean = isThunkWithKeyword(thunkKeyword)

def isInterestThunk: Boolean = isThunkWithKeyword(thunkInterestKeyword)
// def isInterestThunk: Boolean = isThunkWithKeyword(thunkInterestKeyword)

def isNFN: Boolean = cmps.size >= 1 && cmps.last == nfnKeyword

Expand Down Expand Up @@ -81,10 +82,10 @@ case class CCNName(cmps: String *) extends Logging {
}

def withoutThunk: CCNName = withoutThunkAndIsThunk._1
def withoutInterestThunk: CCNName = withoutInterestThunkAndIsInterestThunk._1
// def withoutInterestThunk: CCNName = withoutInterestThunkAndIsInterestThunk._1

def withoutThunkAndIsThunk: (CCNName, Boolean) = withoutThunkAndIsThunkWithKeyword(thunkKeyword)
def withoutInterestThunkAndIsInterestThunk: (CCNName, Boolean) = withoutThunkAndIsThunkWithKeyword(thunkInterestKeyword)
// def withoutInterestThunkAndIsInterestThunk: (CCNName, Boolean) = withoutThunkAndIsThunkWithKeyword(thunkInterestKeyword)

private def thunkifyWithKeyword(keyword: String): CCNName = {
cmps match {
Expand All @@ -99,8 +100,8 @@ case class CCNName(cmps: String *) extends Logging {
}

def thunkify: CCNName = thunkifyWithKeyword(thunkKeyword)

def thunkifyInterest: CCNName = thunkifyWithKeyword(thunkInterestKeyword)
//
// def thunkifyInterest: CCNName = thunkifyWithKeyword(thunkInterestKeyword)

def append(cmpsToAppend:String*):CCNName = CCNName(cmps ++ cmpsToAppend:_*)
def prepend(cmpsToPrepend:String*):CCNName = CCNName(cmpsToPrepend ++ cmps:_*)
Expand All @@ -123,7 +124,7 @@ case class Interest(name: CCNName) extends CCNPacket {

def this(cmps: String *) = this(CCNName(cmps:_*))

def thunkifyInterest: Interest = Interest(name.thunkifyInterest)
// def thunkifyInterest: Interest = Interest(name.thunkifyInterest)

def thunkify: Interest = Interest(name.thunkify)

Expand Down
2 changes: 1 addition & 1 deletion nfn/src/main/scala/config/AkkaConfig.scala
Expand Up @@ -10,7 +10,7 @@ import akka.util.Timeout
object AkkaConfig {


val timeoutDuration: FiniteDuration = 20 seconds
val timeoutDuration: FiniteDuration = 10 seconds
implicit val timeout = Timeout( timeoutDuration)

val configInfo =
Expand Down
9 changes: 2 additions & 7 deletions nfn/src/main/scala/evaluation/PaperExperiment.scala
Expand Up @@ -137,16 +137,12 @@ object PaperExperiment extends App {

import LambdaDSL._
import LambdaNFNImplicits._
implicit val useThunks: Boolean = false
implicit val useThunks: Boolean = true

val ts = Translate().toString
val wc = WordCountService().toString

// nodes foreach { node =>
// node ? (ts appl node.prefix.append("dummy"))
// }

node1 ? (ts appl node1.prefix.append("dummy"))
// node1 ? (ts appl node1.prefix.append("dummy"))

Thread.sleep(2000)

Expand Down Expand Up @@ -189,7 +185,6 @@ object PaperExperiment extends App {
}

def doExp(exprToDo: Expr) = {

import AkkaConfig.timeout
var startTime = System.currentTimeMillis()
node1 ? exprToDo onComplete {
Expand Down
6 changes: 3 additions & 3 deletions nfn/src/main/scala/nfn/NFNServer.scala
Expand Up @@ -170,7 +170,7 @@ case class NFNServer(nodeConfig: CombinedNodeConfig) extends Actor {
implicit val timeout = Timeout(timeoutFromContent)
(pit ? PIT.Get(content.name)).mapTo[Option[Set[Face]]] onSuccess {
case Some(pendingFaces) => {
val (contentNameWithoutThunk, isThunk) = content.name.withoutInterestThunkAndIsInterestThunk
val (contentNameWithoutThunk, isThunk) = content.name.withoutThunkAndIsThunk

assert(isThunk, s"handleInterstThunkContent received the content object $content which is not a thunk")

Expand Down Expand Up @@ -205,7 +205,7 @@ case class NFNServer(nodeConfig: CombinedNodeConfig) extends Actor {
}
}

if(content.name.isInterestThunk) {
if(content.name.isThunk && !content.name.isCompute) {
handleInterstThunkContent
} else {
handleNonThunkContent
Expand Down Expand Up @@ -316,7 +316,7 @@ case class NFNServer(nodeConfig: CombinedNodeConfig) extends Actor {
*/
case NFNApi.CCNSendReceive(interest, useThunks) => {
val maybeThunkInterest =
if(interest.name.isNFN && useThunks) interest.thunkifyInterest
if(interest.name.isNFN && useThunks) interest.thunkify
else interest
handlePacket(maybeThunkInterest, sender)
}
Expand Down
2 changes: 1 addition & 1 deletion nfn/src/main/scala/node/Node.scala
Expand Up @@ -130,7 +130,7 @@ case class Node(nodeConfig: CombinedNodeConfig) {

val maybeNFNServer: Option[ActorRef] = {
nodeConfig.maybeComputeNodeConfig map { computeNodeConfig =>
val system = ActorSystem(s"Sys${computeNodeConfig.prefix.toString.replace("/", "-")}", AkkaConfig.configInfo)
val system = ActorSystem(s"Sys${computeNodeConfig.prefix.toString.replace("/", "-")}", AkkaConfig.configDebug)
CCNServerFactory.ccnServer(system, nodeConfig)
}
}
Expand Down

0 comments on commit 3f73b51

Please sign in to comment.