Packages

  • package root
    Definition Classes
    root
  • package com
    Definition Classes
    root
  • package twitter

    Start with com.twitter.finagle.

    Definition Classes
    com
  • package finagle

    Finagle is an extensible RPC system.

    Finagle is an extensible RPC system.

    Services are represented by class com.twitter.finagle.Service. Clients make use of com.twitter.finagle.Service objects while servers implement them.

    Finagle contains a number of protocol implementations; each of these implement Client and/or com.twitter.finagle.Server. For example, Finagle's HTTP implementation, com.twitter.finagle.Http (in package finagle-http), exposes both.

    Thus a simple HTTP server is built like this:

    import com.twitter.finagle.{Http, Service}
    import com.twitter.finagle.http.{Request, Response}
    import com.twitter.util.{Await, Future}
    
    val service = new Service[Request, Response] {
      def apply(req: Request): Future[Response] =
        Future.value(Response())
    }
    val server = Http.server.serve(":8080", service)
    Await.ready(server)

    We first define a service to which requests are dispatched. In this case, the service returns immediately with a HTTP 200 OK response, and with no content.

    This service is then served via the Http protocol on TCP port 8080. Finally we wait for the server to stop serving.

    We can now query our web server:

    % curl -D - localhost:8080
    HTTP/1.1 200 OK

    Building an HTTP client is also simple. (Note that type annotations are added for illustration.)

    import com.twitter.finagle.{Http, Service}
    import com.twitter.finagle.http.{Request, Response}
    import com.twitter.util.{Future, Return, Throw}
    
    val client: Service[Request, Response] = Http.client.newService("localhost:8080")
    val f: Future[Response] = client(Request()).respond {
      case Return(rep) =>
        printf("Got HTTP response %s\n", rep)
      case Throw(exc) =>
        printf("Got error %s\n", exc)
    }

    Http.client.newService("localhost:8080") constructs a new com.twitter.finagle.Service instance connected to localhost TCP port 8080. We then issue a HTTP/1.1 GET request to URI "/". The service returns a com.twitter.util.Future representing the result of the operation. We listen to this future, printing an appropriate message when the response arrives.

    The Finagle homepage contains useful documentation and resources for using Finagle.

    Definition Classes
    twitter
  • package addr
    Definition Classes
    finagle
  • package builder
    Definition Classes
    finagle
  • package client
    Definition Classes
    finagle
  • package context
    Definition Classes
    finagle
  • BackupRequest
  • Context
  • Contexts
  • Deadline
  • LocalContext
  • MarshalledContext
  • RemoteInfo
  • Retries
  • package core
    Definition Classes
    finagle
  • package dispatch
    Definition Classes
    finagle
  • package exp

    Package exp contains experimental code.

    Package exp contains experimental code. This can be removed or stabilized (moved elsewhere) at any time.

    Definition Classes
    finagle
  • package factory
    Definition Classes
    finagle
  • package filter
    Definition Classes
    finagle
  • package liveness
    Definition Classes
    finagle
  • package loadbalancer

    This package implements client side load balancing algorithms.

    This package implements client side load balancing algorithms.

    As an end-user, see the Balancers API to create instances which can be used to configure a Finagle client with various load balancing strategies.

    As an implementor, each algorithm gets its own subdirectory and is exposed via the Balancers object. Several convenient traits are provided which factor out common behavior and can be mixed in (i.e. Balancer, DistributorT, NodeT, and Updating).

    Definition Classes
    finagle
  • package namer
    Definition Classes
    finagle
  • package naming
    Definition Classes
    finagle
  • package offload
    Definition Classes
    finagle
  • package param

    Defines common com.twitter.finagle.Stack.Param's shared between finagle clients and servers.

    Defines common com.twitter.finagle.Stack.Param's shared between finagle clients and servers.

    Definition Classes
    finagle
  • package pool
    Definition Classes
    finagle
  • package pushsession
    Definition Classes
    finagle
  • package server
    Definition Classes
    finagle
  • package service
    Definition Classes
    finagle
  • package ssl
    Definition Classes
    finagle
  • package stats
    Definition Classes
    finagle
  • package thrift
    Definition Classes
    finagle
  • package tracing
    Definition Classes
    finagle
  • package transport
    Definition Classes
    finagle
  • package util
    Definition Classes
    finagle

package context

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. All

Type Members

  1. trait Context extends AnyRef

    A context contains a number of let-delimited bindings.

    A context contains a number of let-delimited bindings. Bindings are indexed by type Key[A] in a typesafe manner. Later bindings shadow earlier ones.

    Note that the implementation of context maintains all bindings in a linked list; context lookup requires a linear search.

  2. case class Deadline(timestamp: Time, deadline: Time) extends Ordered[Deadline] with Product with Serializable

    A deadline is the time by which some action (e.g., a request) must complete.

    A deadline is the time by which some action (e.g., a request) must complete. A deadline has a timestamp in addition to the deadline. This timestamp denotes the time at which the deadline was enacted.

    This is done so that they may be reconciled over process boundaries; e.g., to account for variable latencies in message deliveries.

    timestamp

    the time at which the deadline was enacted.

    deadline

    the time by which the action must complete.

  3. final class LocalContext extends Context

    A type of context that is local to the process.

    A type of context that is local to the process. The type of Key is also unique (generative) to each instance of this context, so that keys cannot be used across different instances of this context type.

  4. final class MarshalledContext extends Context

    A marshalled context contains bindings that may be marshalled and sent across process boundaries.

    A marshalled context contains bindings that may be marshalled and sent across process boundaries. A set of marshalled bindings may be restored in the local environment. Thus we can use marshalled contexts to propagate a set of bindings across a whole request tree.

  5. sealed trait RemoteInfo extends AnyRef

    Contains the remote information for a request, if available.

  6. case class Retries(attempt: Int) extends Product with Serializable

    Retries contains the number of times a request has been retried.

    Retries contains the number of times a request has been retried.

    attempt

    which retry attempt this is. Will be 0 if the request is not a retry.

Value Members

  1. object BackupRequest

    Used to signal that a request was initiated as a "backup request".

    Used to signal that a request was initiated as a "backup request".

    Note that these are broadcast across the rest of the request's call graph.

    See also

    com.twitter.finagle.client.BackupRequestFilter for details on what a backup request is.

    MethodBuilder's idempotent for configuring a client to use backups.

  2. object Contexts

    com.twitter.finagle.context.Contexts that are managed by Finagle.

  3. object Deadline extends Key[Deadline] with Serializable

    A broadcast context for deadlines.

  4. object RemoteInfo
  5. object Retries extends Key[Retries] with Serializable

Ungrouped