package postgresql
- Alphabetic
- Public
- Protected
Type Members
- sealed abstract class BackendMessage extends AnyRef
- abstract class Client extends QueryClient[String] with Closable
- class ClientDispatcher extends GenSerialClientDispatcher[Request, Response, FrontendMessage, BackendMessage]
Handles transforming the Postgres protocol to an RPC style.
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
- sealed abstract class FrontendMessage extends AnyRef
- case class Parameter[T](value: T)(implicit valueWrites: ValueWrites[T]) extends Product with Serializable
- class PgSqlClientError extends PgSqlException
- abstract class PgSqlException extends RuntimeException
- case class PgSqlInvalidMachineStateError(msg: String) extends PgSqlStateMachineError with Product with Serializable
- case class PgSqlNoSuchTransition(machine: String, state: String, msg: String) extends PgSqlStateMachineError with Product with Serializable
- case class PgSqlServerError(error: ErrorResponse) extends PgSqlException with Product with Serializable
- sealed abstract class PgSqlStateMachineError extends PgSqlClientError
- class PgSqlTransporter extends Transporter[FrontendMessage, BackendMessage, PgTransportContext]
Transport for the Postgres protocol.
Transport for the Postgres protocol.
This is responsible for properly framing the bytes on the wire to form Postgres protocol packets.
- case class PgSqlUnsupportedAuthenticationMechanism(method: AuthenticationMessage) extends PgSqlClientError with Product with Serializable
- case class PgSqlUnsupportedError(msg: String) extends PgSqlClientError with Product with Serializable
- final case class PrepareCache(svc: Service[Request, Response], maxSize: Int, statsReceiver: StatsReceiver) extends ServiceProxy[Request, Response] with Product with Serializable
Caches statements that have been successfully prepared over the connection managed by the underlying service (a ClientDispatcher).
Caches statements that have been successfully prepared over the connection managed by the underlying service (a ClientDispatcher). This decreases the chances of leaking prepared statements and can simplify the implementation of prepared statements in the presence of a connection pool.
- abstract class PreparedStatement extends QueryClient[Seq[Parameter[_]]]
- abstract class QueryClient[Q] extends AnyRef
- sealed trait Request extends AnyRef
- sealed abstract class Response extends AnyRef
- final case class ResultSet(fields: IndexedSeq[FieldDescription], wireRows: Seq[IndexedSeq[WireValue]], parameters: ConnectionParameters) extends Product with Serializable
- final case class Row(fields: IndexedSeq[FieldDescription], values: IndexedSeq[WireValue], charset: Charset, columnIndex: Map[String, Int]) extends Product with Serializable
- class TlsHandshakeTransporter extends Transporter[Buf, Buf, TransportContext]
The Postgres protocol doesn't use its standard packet format during TLS negotiation.
The Postgres protocol doesn't use its standard packet format during TLS negotiation.
https://www.postgresql.org/docs/9.3/protocol-flow.html#AEN100021
The flow is that the client should request TLS using the FrontendMessage.SslRequest message. The backend responds with a single, unframed byte: either 'S' or 'N'.
* 'S' means that the backend is willing to continue with TLS negotiation * 'N' means that the backend doesn't support TLS
Once TLS negotiation is successful, this transport will insert the provided Framer into the netty pipeline, where it would have been inserted by Netty4ClientChannelInitializer.
This unfortunately requires reaching behind Finagle's abstractions a little bit.
Value Members
- object BackendMessage
- object Client
- object ClientDispatcher
- object FrontendMessage
- object Params
- object PgSqlNoSuchTransition extends Serializable
- case object PgSqlPasswordRequired extends PgSqlClientError with Product with Serializable
- case object PgSqlTlsUnsupportedError extends PgSqlException with Product with Serializable
- object Request
- object Response
- object ResultSet extends Serializable
- object Types