class ClientDispatcher extends GenSerialClientDispatcher[Request, Response, FrontendMessage, BackendMessage]
Handles transforming the Postgres protocol to an RPC style.
The Postgres protocol is not of the style request => Future[Response]
.
Instead, it uses a stateful protocol where each connection is in a particular state and streams of requests / responses
take place to move the connection from one state to another.
The dispatcher is responsible for managing this connection state and transforming the stream of request / response to a single request / response style that conforms to Finagle's request / response style.
The dispatcher uses state machines to handle the connection state management.
When a connection is established, the HandshakeMachine is immediately executed and takes care of authentication. Subsequent machines to execute are based on the client's query. For example, if the client submits a Request.Query, then the SimpleQueryMachine will be dispatched to manage the connection's state.
Any unexpected error from the state machine will lead to tearing down the connection to make sure we don't reuse a connection in an unknown / bad state.
- See also
StateMachine
- Alphabetic
- By Inheritance
- ClientDispatcher
- GenSerialClientDispatcher
- Service
- Closable
- Function1
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new ClientDispatcher(transport: ClientTransport, params: Params)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def andThen[A](g: (Future[Response]) => A): (Request) => A
- Definition Classes
- Function1
- Annotations
- @unspecialized()
- def apply(req: Request): Future[Response]
This is the method to override/implement to create your own Service.
This is the method to override/implement to create your own Service.
- Definition Classes
- GenSerialClientDispatcher → Service → Function1
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def close(deadline: Time): Future[Unit]
- Definition Classes
- GenSerialClientDispatcher → Service → Closable
- def close(after: Duration): Future[Unit]
- Definition Classes
- Closable
- final def close(): Future[Unit]
- Definition Classes
- Closable
- def compose[A](g: (A) => Request): (A) => Future[Response]
- Definition Classes
- Function1
- Annotations
- @unspecialized()
- def dispatch(req: Request, p: Promise[Response]): Future[Unit]
Dispatch a request, satisfying Promise
p
with the response; the returned Future is satisfied when the dispatch is complete: only one request is admitted at any given time.Dispatch a request, satisfying Promise
p
with the response; the returned Future is satisfied when the dispatch is complete: only one request is admitted at any given time.Note that GenSerialClientDispatcher manages interrupts, satisfying
p
should it be interrupted -- implementors beware: use onlyupdateIfEmpty
variants for satisfying the Promise.GenSerialClientDispatcher will also attempt to satisfy the promise if the returned
Future[Unit]
fails.- Attributes
- protected
- Definition Classes
- ClientDispatcher → GenSerialClientDispatcher
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isAvailable: Boolean
Determines whether this
Service
is available (can accept requests with a reasonable likelihood of success).Determines whether this
Service
is available (can accept requests with a reasonable likelihood of success).- Definition Classes
- Service
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def machineDispatch[R <: Response](machine: StateMachine[R], promise: Promise[R]): Future[Unit]
- def map[Req1](f: (Req1) => Request): Service[Req1, Response]
- Definition Classes
- Service
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def status: Status
The current availability Status of this
Service
.The current availability Status of this
Service
.- Definition Classes
- GenSerialClientDispatcher → Service
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- Service → Function1 → AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()