title | description | link |
---|---|---|
Scaling Pinterest • Marty Weiner • GOTO 2014 | This presentation was recorded at GOTO Aarhus 2014http://gotocon.comMarty Weiner - Cloud Ninja @ PinterestABSTRACTIt's been an amazing ride building Pinteres... | https://www.youtube.com/watch?v= |
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
sealed trait UrinalStatus { def value: String } | |
final case object Available extends UrinalStatus { | |
val value = "Avialable" | |
} | |
final case object Occupied extends UrinalStatus { | |
val value = "Occupied" | |
} |
I hereby claim:
- I am nraychaudhuri on github.
- I am nilanjan (https://keybase.io/nilanjan) on keybase.
- I have a public key whose fingerprint is E5FB 9991 27E0 074C D2B7 7EF0 8CC4 C3BC B9D5 87B6
To claim this, I am signing this object:
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
private void busy(FiniteDuration duration) { | |
pi(duration.toMillis() * 800); | |
} | |
private BigDecimal pi(long m) { | |
int n = 0; | |
BigDecimal acc = new BigDecimal(0.0); | |
while(n < m) { | |
acc = acc.add(gregoryLeibnitz(n)); | |
n += 1; |
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
import akka.actor.ActorIdentity; | |
import akka.actor.ActorRef; | |
import akka.actor.ActorSystem; | |
import akka.event.Logging; | |
import akka.testkit.JavaTestKit; | |
import akka.testkit.TestProbe; | |
import com.typesafe.training.coffeehouse.CoffeeHouse; | |
import org.junit.AfterClass; | |
import org.junit.BeforeClass; | |
import org.junit.Test; |
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
//PLEASE NOTE: Typing actor refs are really hard problem(take a look at the discussions in Akka mailing list regarding this subject). This is no way a complete solution. This will only work if you know all the possible | |
//messages an actor can handle (that means no become/unbecome business). | |
package experiment | |
import akka.actor.{Props, ActorSystem, Actor, ActorRef} | |
case class TypedActorRef[A](actorRef: ActorRef) extends AnyVal { | |
def ![B](msg: B)(implicit ev: A <:< B, sender: ActorRef = Actor.noSender) = actorRef ! msg | |
} |
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
I try to put things into the larger perspective here, so prepare, long mail. | |
== Defining backpressure | |
First of all, we need a working definition of "backpressure". I put it in quotes since I will attack things from a very general perspective which might not exactly match what others think as backpressure. | |
Sometimes it is easier to characterize the correct behavior of a system/protocol by defining what we consider incorrect behavior rather than trying to limit ourselves when approaching from correctness properties. In the case of backpressure there are two undesireable kinds of behavior: | |
- If the buffers in the system might growth without bounds then the backpressure protocol is not safe | |
- If the protocol can become stuck, although the sender has messages to deliver and the receiver is also available to process them, then the backpressure protocol is not safe |
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
package solution | |
import scala.slick.driver.ExtendedProfile | |
object DI { | |
object models { | |
sealed trait Model { def id: Option[Long] } | |
case class ModelA(a: String, id: Option[Long] = None) extends Model | |
case class ModelB(b: String, id: Option[Long] = None) extends Model |
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 that bridges between slick and Play2-auth. Just mixin with controllers | |
trait Auth2SlickBridge { | |
self: StackableController => | |
def AuthAction[A](p: BodyParser[A], params: (RequestAttributeKey[_], Any)*)(f: RequestWithAttributes[A] => Action[A]): Action[A] = { | |
AsyncStack(p, params:_*) { implicit rs => | |
f(rs).apply(rs) | |
} | |
} |
NewerOlder