Skip to content

Commit

Permalink
Rename PostgresChannelHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianfett committed Mar 11, 2022
1 parent c7edb9b commit f94cc9f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Sources/PostgresNIO/Connection/PostgresConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public final class PostgresConnection {
}
}

let channelHandler = PSQLChannelHandler(
let channelHandler = PostgresChannelHandler(
configuration: configuration,
logger: logger,
configureSSLCallback: configureSSLCallback
Expand Down Expand Up @@ -576,7 +576,7 @@ extension PostgresConnection {

let listenContext = PostgresListenContext()

self.channel.pipeline.handler(type: PSQLChannelHandler.self).whenSuccess { handler in
self.channel.pipeline.handler(type: PostgresChannelHandler.self).whenSuccess { handler in
if self.notificationListeners[channel] != nil {
self.notificationListeners[channel]!.append((listenContext, notificationHandler))
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/PostgresNIO/New/PSQLEventsHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import NIOTLS
import Logging

enum PSQLOutgoingEvent {
/// the event we send down the channel to inform the `PSQLChannelHandler` to authenticate
/// the event we send down the channel to inform the ``PostgresChannelHandler`` to authenticate
///
/// this shall be removed with the next breaking change and always supplied with `PSQLConnection.Configuration`
case authenticate(AuthContext)
}

enum PSQLEvent {

/// the event that is used to inform upstream handlers that `PSQLChannelHandler` has established a connection
/// the event that is used to inform upstream handlers that ``PostgresChannelHandler`` has established a connection
case readyForStartup

/// the event that is used to inform upstream handlers that `PSQLChannelHandler` is currently idle
/// the event that is used to inform upstream handlers that ``PostgresChannelHandler`` is currently idle
case readyForQuery
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ protocol PSQLChannelHandlerNotificationDelegate: AnyObject {
func notificationReceived(_: PostgresBackendMessage.NotificationResponse)
}

final class PSQLChannelHandler: ChannelDuplexHandler {
final class PostgresChannelHandler: ChannelDuplexHandler {
typealias OutboundIn = PSQLTask
typealias InboundIn = ByteBuffer
typealias OutboundOut = ByteBuffer
Expand Down Expand Up @@ -501,7 +501,7 @@ final class PSQLChannelHandler: ChannelDuplexHandler {
}
}

extension PSQLChannelHandler: PSQLRowsDataSource {
extension PostgresChannelHandler: PSQLRowsDataSource {
func request(for stream: PSQLRowStream) {
guard self.rowStream === stream else {
return
Expand Down Expand Up @@ -587,7 +587,7 @@ extension ConnectionStateMachine.TLSConfiguration {
}
}

extension PSQLChannelHandler {
extension PostgresChannelHandler {
convenience init(
configuration: PostgresConnection.InternalConfiguration,
configureSSLCallback: ((Channel) throws -> Void)?)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import NIOSSL
import NIOEmbedded
@testable import PostgresNIO

class PSQLChannelHandlerTests: XCTestCase {
class PostgresChannelHandlerTests: XCTestCase {

// MARK: Startup

func testHandlerAddedWithoutSSL() {
let config = self.testConnectionConfiguration()
let handler = PSQLChannelHandler(configuration: config, configureSSLCallback: nil)
let handler = PostgresChannelHandler(configuration: config, configureSSLCallback: nil)
let embedded = EmbeddedChannel(handlers: [
ReverseByteToMessageHandler(PSQLFrontendMessageDecoder()),
ReverseMessageToByteHandler(PSQLBackendMessageEncoder()),
Expand Down Expand Up @@ -40,7 +40,7 @@ class PSQLChannelHandlerTests: XCTestCase {
var config = self.testConnectionConfiguration()
XCTAssertNoThrow(config.tls = .require(try NIOSSLContext(configuration: .makeClientConfiguration())))
var addSSLCallbackIsHit = false
let handler = PSQLChannelHandler(configuration: config) { channel in
let handler = PostgresChannelHandler(configuration: config) { channel in
addSSLCallbackIsHit = true
}
let embedded = EmbeddedChannel(handlers: [
Expand Down Expand Up @@ -82,7 +82,7 @@ class PSQLChannelHandlerTests: XCTestCase {
var config = self.testConnectionConfiguration()
XCTAssertNoThrow(config.tls = .require(try NIOSSLContext(configuration: .makeClientConfiguration())))

let handler = PSQLChannelHandler(configuration: config) { channel in
let handler = PostgresChannelHandler(configuration: config) { channel in
XCTFail("This callback should never be exectuded")
throw PSQLError.sslUnsupported
}
Expand Down Expand Up @@ -118,7 +118,7 @@ class PSQLChannelHandlerTests: XCTestCase {
database: config.authentication?.database
)
let state = ConnectionStateMachine(.waitingToStartAuthentication)
let handler = PSQLChannelHandler(configuration: config, state: state, configureSSLCallback: nil)
let handler = PostgresChannelHandler(configuration: config, state: state, configureSSLCallback: nil)
let embedded = EmbeddedChannel(handlers: [
ReverseByteToMessageHandler(PSQLFrontendMessageDecoder()),
ReverseMessageToByteHandler(PSQLBackendMessageEncoder()),
Expand Down Expand Up @@ -147,7 +147,7 @@ class PSQLChannelHandlerTests: XCTestCase {
database: config.authentication?.database
)
let state = ConnectionStateMachine(.waitingToStartAuthentication)
let handler = PSQLChannelHandler(configuration: config, state: state, configureSSLCallback: nil)
let handler = PostgresChannelHandler(configuration: config, state: state, configureSSLCallback: nil)
let embedded = EmbeddedChannel(handlers: [
ReverseByteToMessageHandler(PSQLFrontendMessageDecoder()),
ReverseMessageToByteHandler(PSQLBackendMessageEncoder()),
Expand Down

0 comments on commit f94cc9f

Please sign in to comment.