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 main | |
import ( | |
"flag" | |
"fmt" | |
"math/rand" | |
"net/http" | |
"os" | |
) |
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 com.twitter.conversions.time._ | |
import com.twitter.finagle.util.DefaultTimer | |
import com.twitter.util._ | |
import java.util.concurrent.atomic.AtomicInteger | |
import scala.util.control.NoStackTrace | |
object Cancellator { | |
class Cancelled(n: Int) extends NoStackTrace |
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
version: '2' | |
services: | |
l5d: | |
image: buoyantio/linkerd:nightly | |
container_name: l5d | |
ports: | |
- 4142:4142 | |
- 9990:9990 |
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 main | |
import ( | |
"flag" | |
"fmt" | |
"net/http" | |
"os" | |
) | |
func dieIf(err error) { |
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
extern crate rand; | |
use rand::Rng; | |
use std::cell::RefCell; | |
use std::collections::HashMap; | |
use std::rc::Rc; | |
use std::thread; | |
use std::time::Duration; | |
fn main() { |
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
/* | |
* check a condition asynchronously until it's true and then do another thing | |
*/ | |
def checkCond: Future[Boolean] = ??? | |
def doThing[T]: Future[T] = ??? | |
implicit val timer = DefaultTimer.twitter | |
def untilCondition(backoff: Stream[Duration]): Future[Unit] = | |
checkCond.flatMap { |
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 com.twitter.concurrent.AsyncStream | |
import com.twitter.conversions.time._ | |
import com.twitter.finagle._ | |
import com.twitter.finagle.util.DefaultTimer | |
import com.twitter.io.{Buf, Reader} | |
import com.twitter.util._ | |
object StreamProxy { | |
implicit val timer = DefaultTimer.twitter |
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
case class AuthRequest( | |
loginEndpoint: String, | |
uid: String, | |
privateKey: String, | |
algorithm: JwtAlgorithm = JwtAlgorithm.RS256 | |
) { | |
val path: String = new URL(loginEndpoint).getPath | |
val jwt: String = { | |
val token = Jwt.encode(s"""{"uid":"$uid"}""", privateKey, algorithm) |
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
admin: | |
port: 9989 | |
metricsIntervalSecs: 10 | |
routers: | |
- label: default | |
interpreter: | |
kind: io.l5d.namerd.http |
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
use futures::{Future, Stream, Poll, Async, AsyncSink, Sink, StartSend}; | |
use futures::unsync::{oneshot, mpsc}; | |
use std::cell::RefCell; | |
use std::collections::VecDeque; | |
use std::rc::Rc; | |
/// Creates a dispatching channel. | |
/// | |
/// This channel supports a single producer task and many consumers. | |
/// It is intended to be used by a producer task that pushes T-typed |