Packages

case class Client(stack: Stack[ServiceFactory[Request, Result]] = Client.stack, params: Params = Client.params) extends StdStackClient[Request, Result, Client] with WithSessionPool[Client] with WithDefaultLoadBalancer[Client] with MysqlRichClient with Product with Serializable

Implements a mysql client in terms of a com.twitter.finagle.client.StackClient. The client inherits a wealth of features from finagle including connection pooling and load balancing.

Additionally, this class provides methods via MysqlRichClient for constructing a client which exposes an API that has use case specific methods, for example mysql.Client.read, mysql.Client.modify, and mysql.Client.prepare. This is an easier experience for most users.

Example:
  1. import com.twitter.finagle.Mysql
    import com.twitter.finagle.mysql.Client
    import com.twitter.util.Future
    
    val client: Client = Mysql.client
      .withCredentials("username", "password")
      .withDatabase("database")
      .newRichClient("host:port")
    val names: Future[Seq[String]] =
      client.select("SELECT name FROM employee") { row =>
        row.stringOrNull("name")
      }
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Client
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. MysqlRichClient
  7. WithDefaultLoadBalancer
  8. WithSessionPool
  9. StdStackClient
  10. EndpointerStackClient
  11. WithSessionQualifier
  12. WithClientSession
  13. WithClientTransport
  14. WithClientAdmissionControl
  15. ClientParams
  16. CommonParams
  17. StackClient
  18. StackBasedClient
  19. Transformable
  20. Parameterized
  21. Client
  22. AnyRef
  23. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Client(stack: Stack[ServiceFactory[Request, Result]] = Client.stack, params: Params = Client.params)

Type Members

  1. type Context = TransportContext
    Attributes
    protected
    Definition Classes
    Client → StdStackClient
  2. type In = Packet
    Attributes
    protected
    Definition Classes
    Client → StdStackClient
  3. type Out = Packet
    Attributes
    protected
    Definition Classes
    Client → StdStackClient

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  6. def configured[P](psp: (P, Param[P])): Client
    Definition Classes
    Client → EndpointerStackClient → StackClient → Parameterized
  7. def configured[P](p: P)(implicit arg0: Param[P]): Client
    Definition Classes
    EndpointerStackClient → StackClient → Parameterized
  8. def configuredParams(newParams: Params): Client
    Definition Classes
    EndpointerStackClient → StackClient → Parameterized
  9. def copy1(stack: Stack[ServiceFactory[Request, Result]] = this.stack, params: Params = this.params): Client
    Attributes
    protected
    Definition Classes
    Client → StdStackClient → EndpointerStackClient
  10. final def endpointer: Stackable[ServiceFactory[Request, Result]]
    Attributes
    protected
    Definition Classes
    StdStackClient → EndpointerStackClient
  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. def filtered(filter: Filter[Request, Result, Request, Result]): Client
    Definition Classes
    Client → EndpointerStackClient
  13. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. def newClient(dest: Name, label0: String): ServiceFactory[Request, Result]
    Definition Classes
    EndpointerStackClient → Client
  18. final def newClient(dest: String, label: String): ServiceFactory[Request, Result]
    Definition Classes
    Client
  19. final def newClient(dest: String): ServiceFactory[Request, Result]
    Definition Classes
    Client
  20. def newDispatcher(transport: Transport[In, Out] { type Context <: Client.this.Context }): Service[Request, Result]
    Attributes
    protected
    Definition Classes
    Client → StdStackClient
  21. def newRichClient(dest: String): mysql.Client with Transactions

    Creates a new RichClient connected to the logical destination described by dest.

    Creates a new RichClient connected to the logical destination described by dest.

    dest

    the location to connect to, e.g. "host:port". See the user guide for details on destination names.

    Definition Classes
    MysqlRichClient
  22. def newRichClient(dest: Name, label: String): mysql.Client with Transactions

    Creates a new RichClient connected to the logical destination described by dest with the assigned label.

    Creates a new RichClient connected to the logical destination described by dest with the assigned label. The label is used to scope client stats.

    Definition Classes
    MysqlRichClient
  23. def newService(dest: Name, label: String): Service[Request, Result]
    Definition Classes
    EndpointerStackClient → Client
  24. final def newService(dest: String, label: String): Service[Request, Result]
    Definition Classes
    Client
  25. final def newService(dest: String): Service[Request, Result]
    Definition Classes
    Client
  26. def newTransporter(addr: SocketAddress): Transporter[In, Out, Context]
    Attributes
    protected
    Definition Classes
    Client → StdStackClient
  27. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  28. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  29. val params: Params
    Definition Classes
    Client → StackClient → Parameterized
  30. final def registerTransporter(transporterName: String): Unit
    Attributes
    protected
    Definition Classes
    StackClient
  31. def richClientStatsReceiver: StatsReceiver
    Definition Classes
    ClientMysqlRichClient
  32. val stack: Stack[ServiceFactory[Request, Result]]
    Definition Classes
    Client → StackClient
  33. val supportUnsigned: Boolean

    Whether the client supports unsigned integer fields

    Whether the client supports unsigned integer fields

    Attributes
    protected
    Definition Classes
    ClientMysqlRichClient
  34. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  35. def transformed(t: Transformer): StackClient[Request, Result]
    Definition Classes
    StackClient → Transformable
  36. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  38. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  39. val withAdmissionControl: ClientAdmissionControlParams[Client]
    Definition Classes
    Client → WithClientAdmissionControl
  40. def withAffectedRows(): Client

    Don't set the CLIENT_FOUND_ROWS flag when establishing a new session.

    Don't set the CLIENT_FOUND_ROWS flag when establishing a new session. This will make "INSERT ... ON DUPLICATE KEY UPDATE" statements return the "correct" update count.

    See https://dev.mysql.com/doc/refman/5.7/en/information-functions.html#function_row-count

  41. def withCharset(charset: Short): Client

    The default character set used when establishing a new session.

  42. def withConnectionInitRequest(request: Request): Client

    The connection init request to use when establishing a new session.

  43. def withCredentials(u: String, p: String): Client

    The credentials to use when authenticating a new session.

    The credentials to use when authenticating a new session.

    p

    if null, no password is used.

  44. def withDatabase(db: String): Client

    Database to use when this client establishes a new session.

  45. def withExceptionStatsHandler(exceptionStatsHandler: ExceptionStatsHandler): Client
    Definition Classes
    Client → CommonParams
  46. def withExecutionOffloaded(executor: ExecutorService): Client
    Definition Classes
    CommonParams
  47. def withExecutionOffloaded(pool: FuturePool): Client
    Definition Classes
    CommonParams
  48. def withLabel(label: String): Client
    Definition Classes
    Client → CommonParams
  49. def withLabels(keywords: String*): Client
    Definition Classes
    CommonParams
  50. val withLoadBalancer: DefaultLoadBalancingParams[Client]
    Definition Classes
    Client → WithDefaultLoadBalancer
  51. def withMaxConcurrentPrepareStatements(num: Int): Client

    The maximum number of concurrent prepare statements.

  52. def withMonitor(monitor: Monitor): Client
    Definition Classes
    Client → CommonParams
  53. def withNoRollback: Client

    Removes the module on the client which issues a ROLLBACK statement each time a service is put back into the pool.

    Removes the module on the client which issues a ROLLBACK statement each time a service is put back into the pool. This may result in better performance at the risk of receiving a connection from the pool with uncommitted state.

    Instead of disabling this feature, consider configuring the connection pool for the client (via withSessionPool) to offer more available connections.

    Note

    the rollback module is installed by default.

    See also

    com.twitter.finagle.mysql.RollbackFactory

    https://dev.mysql.com/doc/en/implicit-commit.html

  54. def withParams(params: Params): Client
    Definition Classes
    EndpointerStackClient → StackClient → Parameterized
  55. def withRequestTimeout(timeout: Duration): Client
    Definition Classes
    Client → CommonParams
  56. def withRequestTimeout(timeout: Tunable[Duration]): Client
    Definition Classes
    CommonParams
  57. def withResponseClassifier(responseClassifier: ResponseClassifier): Client
    Definition Classes
    Client → CommonParams
  58. def withRetryBackoff(backoff: Stream[Duration]): Client
    Definition Classes
    Client → ClientParams
  59. def withRetryBudget(budget: RetryBudget): Client
    Definition Classes
    Client → ClientParams
  60. def withRollback: Client

    Installs a module on the client which issues a ROLLBACK statement when a service is put back into the pool.

    Installs a module on the client which issues a ROLLBACK statement when a service is put back into the pool. This exists to ensure that a "clean" connection is always returned from the connection pool. For example, it prevents situations where an unfinished transaction has been written to the wire, the service has been released back into the pool, the same service is again checked out of the pool, and a statement that causes an implicit commit is issued.

    The additional work incurred for the rollback may result in less throughput from the connection pool and, as such, may require configuring the pool (via withSessionPool) to offer more available connections connections.

    Note

    this module is installed by default.

    See also

    com.twitter.finagle.mysql.RollbackFactory

    https://dev.mysql.com/doc/en/implicit-commit.html

  61. val withSession: ClientSessionParams[Client]
    Definition Classes
    Client → WithClientSession
  62. val withSessionPool: SessionPoolingParams[Client]
    Definition Classes
    Client → WithSessionPool
  63. val withSessionQualifier: SessionQualificationParams[Client]
    Definition Classes
    Client → WithSessionQualifier
  64. def withStack(fn: (Stack[ServiceFactory[Request, Result]]) ⇒ Stack[ServiceFactory[Request, Result]]): Client
    Definition Classes
    Client → EndpointerStackClient → StackClient
  65. def withStack(stack: Stack[ServiceFactory[Request, Result]]): Client
    Definition Classes
    Client → EndpointerStackClient → StackClient
  66. def withStatsReceiver(statsReceiver: StatsReceiver): Client
    Definition Classes
    Client → CommonParams
  67. def withTracer(tracer: Tracer): Client
    Definition Classes
    Client → CommonParams
  68. val withTransport: ClientTransportParams[Client]
    Definition Classes
    Client → WithClientTransport

Deprecated Value Members

  1. def transformed(f: (Stack[ServiceFactory[Request, Result]]) ⇒ Stack[ServiceFactory[Request, Result]]): Client
    Definition Classes
    EndpointerStackClient
    Annotations
    @deprecated
    Deprecated

    (Since version 2018-10-30) Use withStack(Stack[ServiceFactory[Req, Rep]] => Stack[ServiceFactory[Req, Rep]]) instead

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from MysqlRichClient

Inherited from WithSessionPool[Client]

Inherited from StdStackClient[Request, Result, Client]

Inherited from WithSessionQualifier[Client]

Inherited from WithClientSession[Client]

Inherited from WithClientTransport[Client]

Inherited from ClientParams[Client]

Inherited from CommonParams[Client]

Inherited from StackClient[Request, Result]

Inherited from StackBasedClient[Request, Result]

Inherited from Transformable[StackClient[Request, Result]]

Inherited from Parameterized[Client]

Inherited from finagle.Client[Request, Result]

Inherited from AnyRef

Inherited from Any

Ungrouped