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. Product
  4. Equals
  5. MysqlRichClient
  6. WithDefaultLoadBalancer
  7. WithSessionPool
  8. StdStackClient
  9. EndpointerStackClient
  10. WithSessionQualifier
  11. WithClientSession
  12. WithClientTransport
  13. WithClientAdmissionControl
  14. ClientParams
  15. CommonParams
  16. StackClient
  17. StackBasedClient
  18. Transformable
  19. Parameterized
  20. Client
  21. AnyRef
  22. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

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(classOf[java.lang.CloneNotSupportedException]) @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[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. def injectors: Seq[ClientParamsInjector]
    Attributes
    protected
    Definition Classes
    EndpointerStackClient
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. def newClient(dest: Name, label0: String): ServiceFactory[Request, Result]
    Definition Classes
    EndpointerStackClient → Client
  19. final def newClient(dest: String, label: String): ServiceFactory[Request, Result]
    Definition Classes
    Client
  20. final def newClient(dest: String): ServiceFactory[Request, Result]
    Definition Classes
    Client
  21. def newDispatcher(transport: Transport[In, Out] { type Context <: Client.this.Context }): Service[Request, Result]
    Attributes
    protected
    Definition Classes
    Client → StdStackClient
  22. 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
  23. 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
  24. def newService(dest: Name, label: String): Service[Request, Result]
    Definition Classes
    EndpointerStackClient → Client
  25. final def newService(dest: String, label: String): Service[Request, Result]
    Definition Classes
    Client
  26. final def newService(dest: String): Service[Request, Result]
    Definition Classes
    Client
  27. def newTransporter(addr: SocketAddress): Transporter[In, Out, Context]
    Attributes
    protected
    Definition Classes
    Client → StdStackClient
  28. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  29. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  30. val params: Params
    Definition Classes
    Client → StackClient → Parameterized
  31. def productElementNames: Iterator[String]
    Definition Classes
    Product
  32. final def registerTransporter(transporterName: String): Unit
    Attributes
    protected
    Definition Classes
    StackClient
  33. def richClientStatsReceiver: StatsReceiver
    Definition Classes
    ClientMysqlRichClient
  34. val stack: Stack[ServiceFactory[Request, Result]]
    Definition Classes
    Client → StackClient
  35. val supportUnsigned: Boolean

    Whether the client supports unsigned integer fields

    Whether the client supports unsigned integer fields

    Attributes
    protected
    Definition Classes
    ClientMysqlRichClient
  36. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  37. def transformed(t: Transformer): StackClient[Request, Result]
    Definition Classes
    StackClient → Transformable
  38. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  39. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  40. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  41. val withAdmissionControl: ClientAdmissionControlParams[Client]
    Definition Classes
    Client → WithClientAdmissionControl
  42. 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

  43. def withCharset(charset: Short): Client

    The default character set used when establishing a new session.

  44. def withConnectionInitRequest(request: Request): Client

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

  45. 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.

  46. def withDatabase(db: String): Client

    Database to use when this client establishes a new session.

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

    The maximum number of concurrent prepare statements.

  54. def withMonitor(monitor: Monitor): Client
    Definition Classes
    Client → CommonParams
  55. 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

  56. def withParams(params: Params): Client
    Definition Classes
    EndpointerStackClient → StackClient → Parameterized
  57. def withRequestTimeout(timeout: Duration): Client
    Definition Classes
    Client → CommonParams
  58. def withRequestTimeout(timeout: Tunable[Duration]): Client
    Definition Classes
    CommonParams
  59. def withResponseClassifier(responseClassifier: ResponseClassifier): Client
    Definition Classes
    Client → CommonParams
  60. def withRetryBackoff(backoff: Backoff): Client
    Definition Classes
    Client → ClientParams
  61. def withRetryBudget(budget: RetryBudget): Client
    Definition Classes
    Client → ClientParams
  62. 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

  63. val withSession: ClientSessionParams[Client]
    Definition Classes
    Client → WithClientSession
  64. val withSessionPool: SessionPoolingParams[Client]
    Definition Classes
    Client → WithSessionPool
  65. val withSessionQualifier: SessionQualificationParams[Client]
    Definition Classes
    Client → WithSessionQualifier
  66. def withStack(fn: (Stack[ServiceFactory[Request, Result]]) => Stack[ServiceFactory[Request, Result]]): Client
    Definition Classes
    Client → EndpointerStackClient → StackClient
  67. def withStack(stack: Stack[ServiceFactory[Request, Result]]): Client
    Definition Classes
    Client → EndpointerStackClient → StackClient
  68. def withStatsReceiver(statsReceiver: StatsReceiver): Client
    Definition Classes
    Client → CommonParams
  69. def withTracer(tracer: Tracer): Client
    Definition Classes
    Client → CommonParams
  70. 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 Product

Inherited from Equals

Inherited from MysqlRichClient

Inherited from WithSessionPool[Client]

Inherited from WithClientSession[Client]

Inherited from WithClientTransport[Client]

Inherited from ClientParams[Client]

Inherited from CommonParams[Client]

Inherited from StackClient[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