This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AkkaJobScheduler | |
{ | |
def run : Cancellable = | |
{ | |
val system = akka.actor.ActorSystem("system") | |
val simpleJob = system.actorOf(SimpleJob.props(), "simple-job") | |
system.scheduler.schedule(0 milliseconds,50 milliseconds, simpleJob, "foo") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object SimpleJob | |
{ | |
def props(): Props = Props(new SimpleJob) | |
case object JobToDo | |
} | |
class SimpleJob extends Actor with LoggerHelper | |
{ | |
override def receive = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RestSpec extends WordSpec with Matchers with ScalatestRouteTest with MockitoSugar { | |
val mockUserImpl = mock[UserImpl] | |
object TestObject extends RestService { | |
val userImpl = mockUserImpl | |
} | |
"The service" should { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait RestService { | |
implicit val userFormat = jsonFormat2(User) | |
val userImpl: UserImpl | |
val route = | |
post { | |
path("adduser") { | |
entity(as[User]) { user => | |
val saved: Future[Done] = userImpl.addUser(user) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Block[P <: Proposition, TX <: Transaction[P]] | |
extends TransactionsCarryingPersistentNodeViewModifier[P, TX] { | |
def version: Version | |
def timestamp: Timestamp | |
} | |
object Block { | |
type BlockId = ModifierId | |
type Timestamp = Long | |
type Version = Byte |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait SyncInfo extends BytesSerializable { | |
def startingPoints: History.ModifierIds | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait History[PM <: PersistentNodeViewModifier, SI <: SyncInfo, HT <: History[PM, SI, HT]] extends HistoryReader[PM, SI] { | |
def append(modifier: PM): Try[(HT, ProgressInfo[PM])] | |
def reportModifierIsValid(modifier: PM): HT | |
def reportModifierIsInvalid(modifier: PM, progressInfo: ProgressInfo[PM]): (HT, ProgressInfo[PM]) | |
def getReader: HistoryReader[PM, SI] = this | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Box[P <: Proposition] extends BytesSerializable { | |
val value: Box.Amount | |
val proposition: P | |
val id: ADKey | |
} | |
object Box { | |
type Amount = Long | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait NodeViewHolder[P <: Proposition, TX <: Transaction[P], PMOD <: PersistentNodeViewModifier] | |
extends Actor with ScorexLogging { | |
type SI <: SyncInfo | |
type HIS <: History[PMOD, SI, HIS] | |
type MS <: MinimalState[PMOD, MS] | |
type VL <: Vault[P, TX, PMOD, VL] | |
type MP <: MemoryPool[TX, MP] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Question 1: | |
scala> val list = List("Hello,World") | |
list: List[String] = List(Hello,World) | |
scala> val rdd = sc.parallelize(list) | |
rdd: org.apache.spark.rdd.RDD[String] = ParallelCollectionRDD[2] at parallelize at <console>:26 | |
scala> rdd.collect | |
res3: Array[String] = Array(Hello,World) |