Skip to content

Releases: vapor/postgres-nio

DataRow without allocation; DataRow as Collection; RowDescription top level

22 Nov 10:24
1042870
Compare
Choose a tag to compare
This patch was authored and released by @fabianfett.

This is a cherry pick of #188.

Modifications

  • DataRow and RowDescription have been moved out of the PSQLBackendMessage namespace. This allows us to mark them as @inlinable or @usableFromInline at a later point, without marking everything in PSQLBackendMessage as @inlinable
  • DataRow does not use an internal array for its columns anymore. Instead all read operations are directly done on its ByteBuffer slice.
  • DataRow implements the Collection protocol now.

Result

One allocation fewer per queried row.

Make password hashing fast

21 Oct 07:12
c5eda6c
Compare
Choose a tag to compare
This patch was authored by @fabianfett and released by @gwynne.

This is just a really quick patch to reduce the 320 allocations we have for hashing the password to something sensible (less than 10).

Result

In allocation analysis, password hashing doesn't appear as a biggy anymore.

PostgresNIO 1.6.2

23 Sep 18:09
046d3ba
Compare
Choose a tag to compare

Semver Patch

  • PSQLBackendMessageDecoder is a SingleStepDecoder (#174)
  • Add conveniences to PSQLFrontendMessage (#173)
  • Add RowStreamStateMachine (#176)
  • Extract PSQLRow (#177)
  • Add BufferedMessageEncoder, fix PSQLFrontendMessageEncoder (#179)
  • Batch rows for consumption (#180)
  • Depend on Swift Crypto "1.0.0" ..< "3.0.0" (#183)
  • Move Decoding into PSQLChannelHandler (#182)
  • Move message encoding into PSQLChannelHandler (#181)
  • Bump SwiftNIO dependency to 2.33.0 (#184)

Other changes

  • Add PSQLBackendMessageEncoder (#175)
  • Add PSQLFrontendMessageDecoder (#178)

PostgresNIO 1.6.1

19 Aug 14:50
6a9eb6f
Compare
Choose a tag to compare

SemVer Patch

  • Fix NIOSSL deprecation warnings (#168) (patch credit to @jareyesda)
  • Fix NIO imports (#171)

Other Changes

  • Splits CI Jobs Into Unit And Integration Tests On Linux (#169) (patch credit to @dnadoba)

1.6.0

28 Jul 16:43
1d37934
Compare
Choose a tag to compare
  • Add platform requirements for iOS, watchOS and tvOS (#154)
  • Update api-docs.yml (#156) Thanks @JaapWijnen
  • Split out IntegrationTests into separate testTarget (#157)
  • Use sync pipeline operations, update NIO dependencies (#152)
  • Add one Auth and one SSL test case (#159)
  • Fix API docs link. Resolves (#163)
  • Add link to our SECURITY.md (#164)
  • Use PSQLFormat when encoding and decoding (#158)
  • Support AWS Redshift queries - SELECT Metadata without row number (#167) Thanks @grennis

Ignore errors when closing the connection

21 Apr 13:44
33eea14
Compare
Choose a tag to compare
This patch was authored by @fabianfett and released by @0xTim.

Resolves an issue where errors thrown by some database servers during closing a connection would cause an error in PostgresNIO. Resolves #150

Modifications

  • We ignore errors when the connection is already closing
  • Updated logging to only issue debug and trace logs.
  • Don't print password in trace logging mode.

Fixes an issue where empty values were treated as null values and vica versa

26 Feb 10:49
fa93d76
Compare
Choose a tag to compare
This patch was authored by @fabianfett and released by @0xTim.

Fix encoding and decoding optional values to and from the database due to a regression in #135. Resolves #143 (#144)

Fixes an issue where empty values were treated as null values and vica versa

26 Feb 10:49
fa93d76
Compare
Choose a tag to compare
This patch was authored by @fabianfett and released by @0xTim.

Fix encoding and decoding optional values to and from the database due to a regression in #135. Resolves #143 (#144)

State machine

24 Feb 18:17
cdb18d1
Compare
Choose a tag to compare
This patch was authored by @fabianfett and released by @0xTim.

Motivation

Connection state changes can be modeled with state machines. This PR introduces a ConnectionStateMachine that models the PostgresConnection's state. This will improve the Unit-testability of this package.

Changes

  • This PR does not change any public API
  • It replaces the underlying implementation of PostgresConnection with a new PSQLConnection
  • All new classes and structs that support the new PSQLConnection live in the /New folder
  • The PSQLConnection is mainly implemented using these structs and classes:
    • PSQLFrontendMessage a new enum modeling outgoing client messages to the server
    • PSQLBackendMessage a new enum modeling incoming server messages to the client
    • PSQLFrontendMessage.Encoder a new MessageToByteEncoder
    • PSQLBackendMessage.Decoder a new ByteToMessageEncoder
    • ConnectionStateMachine with the sub state machines:
      • AuthenticationStateMachine
      • CloseStateMachine
      • ExtendedQueryStateMachine
      • PrepareStatementStateMachine
    • PSQLChannelHandler is the main ChannelDuplexHandler for the PSQLConnection
    • PSQLEventsHandler is a new ChannelHandler that observes the channel events and closes the connection when appropriate.
    • PSQLEncodable is a new protocol to convert Swift types to Postgres types.
    • PSQLDecodable is a new protocol to convert Postgres types to Swift types.
    • PSQLEncodable and PSQLDecodable defer the encoding and decoding as much as possible, saving unnecessary allocations and conversions.
  • Thanks to these changes extended queries and prepared statements will now take the same code paths. Thus we ensure that code improvements for one query type will also lead to improvements for the other.

Result

We get a better testable PostgresConnection.

State machine

24 Feb 18:17
cdb18d1
Compare
Choose a tag to compare
This patch was authored by @fabianfett and released by @0xTim.

Motivation

Connection state changes can be modeled with state machines. This PR introduces a ConnectionStateMachine that models the PostgresConnection's state. This will improve the Unit-testability of this package.

Changes

  • This PR does not change any public API
  • It replaces the underlying implementation of PostgresConnection with a new PSQLConnection
  • All new classes and structs that support the new PSQLConnection live in the /New folder
  • The PSQLConnection is mainly implemented using these structs and classes:
    • PSQLFrontendMessage a new enum modeling outgoing client messages to the server
    • PSQLBackendMessage a new enum modeling incoming server messages to the client
    • PSQLFrontendMessage.Encoder a new MessageToByteEncoder
    • PSQLBackendMessage.Decoder a new ByteToMessageEncoder
    • ConnectionStateMachine with the sub state machines:
      • AuthenticationStateMachine
      • CloseStateMachine
      • ExtendedQueryStateMachine
      • PrepareStatementStateMachine
    • PSQLChannelHandler is the main ChannelDuplexHandler for the PSQLConnection
    • PSQLEventsHandler is a new ChannelHandler that observes the channel events and closes the connection when appropriate.
    • PSQLEncodable is a new protocol to convert Swift types to Postgres types.
    • PSQLDecodable is a new protocol to convert Postgres types to Swift types.
    • PSQLEncodable and PSQLDecodable defer the encoding and decoding as much as possible, saving unnecessary allocations and conversions.
  • Thanks to these changes extended queries and prepared statements will now take the same code paths. Thus we ensure that code improvements for one query type will also lead to improvements for the other.

Result

We get a better testable PostgresConnection.