diff --git a/Package.swift b/Package.swift index ad421ae..3ce19ce 100644 --- a/Package.swift +++ b/Package.swift @@ -32,8 +32,11 @@ let package = Package( .target( name: "RediStack", dependencies: [ - .product(name: "Atomics", package: "swift-atomics"), + .product(name: "NIOCore", package: "swift-nio"), + .product(name: "NIOPosix", package: "swift-nio"), .product(name: "NIO", package: "swift-nio"), + .product(name: "NIOConcurrencyHelpers", package: "swift-nio"), + .product(name: "Atomics", package: "swift-atomics"), .product(name: "Logging", package: "swift-log"), .product(name: "Metrics", package: "swift-metrics") ] @@ -42,7 +45,8 @@ let package = Package( .target( name: "RediStackTestUtils", dependencies: [ - .product(name: "NIO", package: "swift-nio"), + .product(name: "NIOCore", package: "swift-nio"), + .product(name: "NIOEmbedded", package: "swift-nio"), "RediStack" ] ), diff --git a/README.md b/README.md index 1956093..4422c39 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ dependencies: [ **RediStack** is quick to use - all you need is an [`EventLoop`](https://apple.github.io/swift-nio/docs/current/NIO/Protocols/EventLoop.html) from **SwiftNIO**. ```swift -import NIO +import NIOCore import RediStack let eventLoop: EventLoop = ... diff --git a/Sources/RediStack/ChannelHandlers/RedisByteDecoder.swift b/Sources/RediStack/ChannelHandlers/RedisByteDecoder.swift index 1c9a297..308c78b 100644 --- a/Sources/RediStack/ChannelHandlers/RedisByteDecoder.swift +++ b/Sources/RediStack/ChannelHandlers/RedisByteDecoder.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore /// Handles incoming byte messages from Redis /// and decodes them according to the Redis Serialization Protocol (RESP). diff --git a/Sources/RediStack/ChannelHandlers/RedisCommandHandler.swift b/Sources/RediStack/ChannelHandlers/RedisCommandHandler.swift index 7c04005..3390ca9 100644 --- a/Sources/RediStack/ChannelHandlers/RedisCommandHandler.swift +++ b/Sources/RediStack/ChannelHandlers/RedisCommandHandler.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore /// The `NIO.ChannelOutboundHandler.OutboundIn` type for `RedisCommandHandler`. /// diff --git a/Sources/RediStack/ChannelHandlers/RedisMessageEncoder.swift b/Sources/RediStack/ChannelHandlers/RedisMessageEncoder.swift index 17f2700..57d535b 100644 --- a/Sources/RediStack/ChannelHandlers/RedisMessageEncoder.swift +++ b/Sources/RediStack/ChannelHandlers/RedisMessageEncoder.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore #if DEBUG // used only for debugging purposes where we build a formatted string for the encoded bytes diff --git a/Sources/RediStack/ChannelHandlers/RedisPubSubHandler.swift b/Sources/RediStack/ChannelHandlers/RedisPubSubHandler.swift index 1eb3770..24ec7a0 100644 --- a/Sources/RediStack/ChannelHandlers/RedisPubSubHandler.swift +++ b/Sources/RediStack/ChannelHandlers/RedisPubSubHandler.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore /// A closure receiver of individual Pub/Sub messages from Redis subscriptions to channels and patterns. /// - Warning: The receiver is called on the same `NIO.EventLoop` that processed the message. diff --git a/Sources/RediStack/Commands/BasicCommands.swift b/Sources/RediStack/Commands/BasicCommands.swift index fd4814a..b87229b 100644 --- a/Sources/RediStack/Commands/BasicCommands.swift +++ b/Sources/RediStack/Commands/BasicCommands.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore extension RedisClient { /// Echos the provided message through the Redis instance. diff --git a/Sources/RediStack/Commands/HashCommands.swift b/Sources/RediStack/Commands/HashCommands.swift index 66ea877..cd4706a 100644 --- a/Sources/RediStack/Commands/HashCommands.swift +++ b/Sources/RediStack/Commands/HashCommands.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore // MARK: Static Helpers diff --git a/Sources/RediStack/Commands/ListCommands.swift b/Sources/RediStack/Commands/ListCommands.swift index 6f05668..ea2a666 100644 --- a/Sources/RediStack/Commands/ListCommands.swift +++ b/Sources/RediStack/Commands/ListCommands.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore // MARK: General diff --git a/Sources/RediStack/Commands/PubSubCommands.swift b/Sources/RediStack/Commands/PubSubCommands.swift index a6c60a4..7e6dab9 100644 --- a/Sources/RediStack/Commands/PubSubCommands.swift +++ b/Sources/RediStack/Commands/PubSubCommands.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore // MARK: Publish diff --git a/Sources/RediStack/Commands/SetCommands.swift b/Sources/RediStack/Commands/SetCommands.swift index a7fd09e..9e35e0c 100644 --- a/Sources/RediStack/Commands/SetCommands.swift +++ b/Sources/RediStack/Commands/SetCommands.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore // MARK: General diff --git a/Sources/RediStack/Commands/SortedSetCommands.swift b/Sources/RediStack/Commands/SortedSetCommands.swift index 2b10ecb..a36dd74 100644 --- a/Sources/RediStack/Commands/SortedSetCommands.swift +++ b/Sources/RediStack/Commands/SortedSetCommands.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore // MARK: Static Helpers diff --git a/Sources/RediStack/Commands/StringCommands.swift b/Sources/RediStack/Commands/StringCommands.swift index 48500c0..942e5cf 100644 --- a/Sources/RediStack/Commands/StringCommands.swift +++ b/Sources/RediStack/Commands/StringCommands.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore // MARK: Get diff --git a/Sources/RediStack/Configuration.swift b/Sources/RediStack/Configuration.swift index d34540b..b57d76f 100644 --- a/Sources/RediStack/Configuration.swift +++ b/Sources/RediStack/Configuration.swift @@ -14,7 +14,8 @@ import Foundation import Logging -import NIO +import NIOCore +import NIOPosix extension RedisConnection.Configuration { public struct ValidationError: LocalizedError, Equatable { diff --git a/Sources/RediStack/ConnectionPool/ConnectionPool.swift b/Sources/RediStack/ConnectionPool/ConnectionPool.swift index ce7fd13..fb70917 100644 --- a/Sources/RediStack/ConnectionPool/ConnectionPool.swift +++ b/Sources/RediStack/ConnectionPool/ConnectionPool.swift @@ -13,7 +13,7 @@ //===----------------------------------------------------------------------===// import Logging -import NIO +import NIOCore /// `ConnectionPool` is RediStack's internal representation of a pool of Redis connections. /// diff --git a/Sources/RediStack/Extensions/SwiftNIO.swift b/Sources/RediStack/Extensions/SwiftNIO.swift index de934d7..08d0e2c 100644 --- a/Sources/RediStack/Extensions/SwiftNIO.swift +++ b/Sources/RediStack/Extensions/SwiftNIO.swift @@ -12,7 +12,8 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore +import NIOPosix // MARK: Convenience extensions diff --git a/Sources/RediStack/RESP/RESPTranslator.swift b/Sources/RediStack/RESP/RESPTranslator.swift index f62191e..72587a6 100644 --- a/Sources/RediStack/RESP/RESPTranslator.swift +++ b/Sources/RediStack/RESP/RESPTranslator.swift @@ -13,7 +13,7 @@ //===----------------------------------------------------------------------===// import protocol Foundation.LocalizedError -import NIO +import NIOCore /// A helper object for translating between raw bytes and Swift types according to the Redis Serialization Protocol (RESP). /// diff --git a/Sources/RediStack/RESP/RESPValue.swift b/Sources/RediStack/RESP/RESPValue.swift index 4e04b7a..8e95a73 100644 --- a/Sources/RediStack/RESP/RESPValue.swift +++ b/Sources/RediStack/RESP/RESPValue.swift @@ -13,7 +13,7 @@ //===----------------------------------------------------------------------===// import struct Foundation.Data -import NIO +import NIOCore /// A representation of a Redis Serialization Protocol (RESP) primitive value. /// @@ -168,7 +168,7 @@ extension RESPValue: RESPValueConvertible { // MARK: EventLoopFuture Extensions -import NIO +import NIOCore extension EventLoopFuture where Value == RESPValue { /// Attempts to convert the resolved RESPValue to the desired type. diff --git a/Sources/RediStack/RedisClient.swift b/Sources/RediStack/RedisClient.swift index b3e3254..6afd029 100644 --- a/Sources/RediStack/RedisClient.swift +++ b/Sources/RediStack/RedisClient.swift @@ -14,7 +14,7 @@ import protocol Foundation.LocalizedError import struct Logging.Logger -import NIO +import NIOCore // - Important: Any RedisClient defined by RediStack should conform to the RedisClientWithUserContext protocol as well diff --git a/Sources/RediStack/RedisConnection.swift b/Sources/RediStack/RedisConnection.swift index 1339698..3025d9c 100644 --- a/Sources/RediStack/RedisConnection.swift +++ b/Sources/RediStack/RedisConnection.swift @@ -17,8 +17,9 @@ import struct Dispatch.DispatchTime import Atomics import Logging import Metrics -import NIO +import NIOCore import NIOConcurrencyHelpers +import NIOPosix extension RedisConnection { diff --git a/Sources/RediStack/RedisConnectionPool.swift b/Sources/RediStack/RedisConnectionPool.swift index 2e41881..4c5aefa 100644 --- a/Sources/RediStack/RedisConnectionPool.swift +++ b/Sources/RediStack/RedisConnectionPool.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// import struct Foundation.UUID -import NIO +import NIOCore import NIOConcurrencyHelpers import Logging diff --git a/Sources/RediStack/RedisKey+TTL.swift b/Sources/RediStack/RedisKey+TTL.swift index 0753572..0c4a853 100644 --- a/Sources/RediStack/RedisKey+TTL.swift +++ b/Sources/RediStack/RedisKey+TTL.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore extension RedisKey.Lifetime { /// The lifetime duration for a `RedisKey` which has an expiry set. diff --git a/Sources/RediStack/RedisLogging.swift b/Sources/RediStack/RedisLogging.swift index fe7c478..84b4752 100644 --- a/Sources/RediStack/RedisLogging.swift +++ b/Sources/RediStack/RedisLogging.swift @@ -13,7 +13,7 @@ //===----------------------------------------------------------------------===// import Logging -import NIO +import NIOCore /// The system funnel for all `Logging` static details such as labels, `Logging.Logger` prototypes, and metadata keys used by RediStack. public enum RedisLogging { diff --git a/Sources/RediStack/_Deprecations.swift b/Sources/RediStack/_Deprecations.swift index 249ae89..028ce47 100644 --- a/Sources/RediStack/_Deprecations.swift +++ b/Sources/RediStack/_Deprecations.swift @@ -13,7 +13,8 @@ //===----------------------------------------------------------------------===// import Logging -import NIO +import NIOCore +import NIOPosix extension RedisConnection { /// The documented default port that Redis connects through. diff --git a/Sources/RediStackTestUtils/EmbeddedMockRedisServer.swift b/Sources/RediStackTestUtils/EmbeddedMockRedisServer.swift index f535ac1..de2368c 100644 --- a/Sources/RediStackTestUtils/EmbeddedMockRedisServer.swift +++ b/Sources/RediStackTestUtils/EmbeddedMockRedisServer.swift @@ -14,7 +14,8 @@ import RediStack import XCTest -import NIO +import NIOCore +import NIOEmbedded internal enum MockConnectionPoolError: Error { case unexpectedMessage diff --git a/Sources/RediStackTestUtils/Extensions/General.swift b/Sources/RediStackTestUtils/Extensions/General.swift index 97fe9a3..1663e01 100644 --- a/Sources/RediStackTestUtils/Extensions/General.swift +++ b/Sources/RediStackTestUtils/Extensions/General.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore private let allocator = ByteBufferAllocator() diff --git a/Sources/RediStackTestUtils/Extensions/RediStack.swift b/Sources/RediStackTestUtils/Extensions/RediStack.swift index a9ed062..dad09cb 100644 --- a/Sources/RediStackTestUtils/Extensions/RediStack.swift +++ b/Sources/RediStackTestUtils/Extensions/RediStack.swift @@ -13,7 +13,7 @@ //===----------------------------------------------------------------------===// import Foundation -import NIO +import NIOCore import RediStack extension RedisConnection.Configuration { diff --git a/Sources/RediStackTestUtils/RedisConnectionPoolIntegrationTestCase.swift b/Sources/RediStackTestUtils/RedisConnectionPoolIntegrationTestCase.swift index bf97105..87eb2cf 100644 --- a/Sources/RediStackTestUtils/RedisConnectionPoolIntegrationTestCase.swift +++ b/Sources/RediStackTestUtils/RedisConnectionPoolIntegrationTestCase.swift @@ -12,9 +12,10 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore import RediStack import XCTest +import NIOPosix /// A helper `XCTestCase` subclass that does the standard work of creating a connection pool to use in test cases. /// diff --git a/Sources/RediStackTestUtils/RedisIntegrationTestCase.swift b/Sources/RediStackTestUtils/RedisIntegrationTestCase.swift index d329753..ddab140 100644 --- a/Sources/RediStackTestUtils/RedisIntegrationTestCase.swift +++ b/Sources/RediStackTestUtils/RedisIntegrationTestCase.swift @@ -12,8 +12,9 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore import RediStack +import NIOPosix import XCTest /// A helper `XCTestCase` subclass that does the standard work of creating a connection to use in test cases. diff --git a/Sources/RediStackTestUtils/_Deprecations.swift b/Sources/RediStackTestUtils/_Deprecations.swift index c77f24a..0c27fef 100644 --- a/Sources/RediStackTestUtils/_Deprecations.swift +++ b/Sources/RediStackTestUtils/_Deprecations.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore import RediStack extension RedisConnection { diff --git a/Sources/RedisTypes/RedisSet.swift b/Sources/RedisTypes/RedisSet.swift index c8b4516..bb237ff 100644 --- a/Sources/RedisTypes/RedisSet.swift +++ b/Sources/RedisTypes/RedisSet.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore import RediStack extension RedisClient { diff --git a/Tests/RediStackIntegrationTests/Commands/PubSubCommandsTests.swift b/Tests/RediStackIntegrationTests/Commands/PubSubCommandsTests.swift index d615d24..94a6c85 100644 --- a/Tests/RediStackIntegrationTests/Commands/PubSubCommandsTests.swift +++ b/Tests/RediStackIntegrationTests/Commands/PubSubCommandsTests.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore import RediStack import RediStackTestUtils import XCTest diff --git a/Tests/RediStackIntegrationTests/Commands/SortedSetCommandsTests.swift b/Tests/RediStackIntegrationTests/Commands/SortedSetCommandsTests.swift index 30446ca..c790349 100644 --- a/Tests/RediStackIntegrationTests/Commands/SortedSetCommandsTests.swift +++ b/Tests/RediStackIntegrationTests/Commands/SortedSetCommandsTests.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore @testable import RediStack import RediStackTestUtils import XCTest diff --git a/Tests/RediStackIntegrationTests/RedisConnectionPoolTests.swift b/Tests/RediStackIntegrationTests/RedisConnectionPoolTests.swift index 1baf050..e38def0 100644 --- a/Tests/RediStackIntegrationTests/RedisConnectionPoolTests.swift +++ b/Tests/RediStackIntegrationTests/RedisConnectionPoolTests.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore import Logging @testable import RediStack import RediStackTestUtils diff --git a/Tests/RediStackTests/ChannelHandlers/RedisByteDecoderTests.swift b/Tests/RediStackTests/ChannelHandlers/RedisByteDecoderTests.swift index 575f3b0..55119ca 100644 --- a/Tests/RediStackTests/ChannelHandlers/RedisByteDecoderTests.swift +++ b/Tests/RediStackTests/ChannelHandlers/RedisByteDecoderTests.swift @@ -12,7 +12,8 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore +import NIOEmbedded import NIOTestUtils @testable import RediStack import XCTest diff --git a/Tests/RediStackTests/ChannelHandlers/RedisMessageEncoderTests.swift b/Tests/RediStackTests/ChannelHandlers/RedisMessageEncoderTests.swift index 1dfb182..1c579ee 100644 --- a/Tests/RediStackTests/ChannelHandlers/RedisMessageEncoderTests.swift +++ b/Tests/RediStackTests/ChannelHandlers/RedisMessageEncoderTests.swift @@ -12,7 +12,8 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore +import NIOEmbedded @testable import RediStack import RediStackTestUtils import XCTest diff --git a/Tests/RediStackTests/ConfigurationTests.swift b/Tests/RediStackTests/ConfigurationTests.swift index 3deab95..b37e6b9 100644 --- a/Tests/RediStackTests/ConfigurationTests.swift +++ b/Tests/RediStackTests/ConfigurationTests.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import NIO +import NIOCore import RediStack import XCTest diff --git a/Tests/RediStackTests/ConnectionPoolTests.swift b/Tests/RediStackTests/ConnectionPoolTests.swift index 991c5ac..3bb6b46 100644 --- a/Tests/RediStackTests/ConnectionPoolTests.swift +++ b/Tests/RediStackTests/ConnectionPoolTests.swift @@ -15,7 +15,8 @@ @testable import RediStack @testable import RediStackTestUtils import XCTest -import NIO +import NIOCore +import NIOEmbedded enum ConnectionPoolTestError: Error { case connectionFailedForSomeReason diff --git a/Tests/RediStackTests/RESPTranslatorTests.swift b/Tests/RediStackTests/RESPTranslatorTests.swift index f613d09..33bbdcf 100644 --- a/Tests/RediStackTests/RESPTranslatorTests.swift +++ b/Tests/RediStackTests/RESPTranslatorTests.swift @@ -13,7 +13,7 @@ //===----------------------------------------------------------------------===// import struct Foundation.Data -import NIO +import NIOCore @testable import RediStack import XCTest diff --git a/Tests/RediStackTests/RedisConnectionTests.swift b/Tests/RediStackTests/RedisConnectionTests.swift index 6572774..224a295 100644 --- a/Tests/RediStackTests/RedisConnectionTests.swift +++ b/Tests/RediStackTests/RedisConnectionTests.swift @@ -13,7 +13,8 @@ //===----------------------------------------------------------------------===// import Logging -import NIO +import NIOCore +import NIOEmbedded @testable import RediStack import XCTest diff --git a/scripts/soundness.sh b/scripts/soundness.sh index 4a41418..41335ca 100755 --- a/scripts/soundness.sh +++ b/scripts/soundness.sh @@ -143,10 +143,10 @@ done rm "$tmp" # This checks for the umbrella NIO module. -#printf "=> Checking for imports of umbrella NIO module... " -#if git grep --color=never -i "^[ \t]*import \+NIO[ \t]*$" > /dev/null; then -# printf "\033[0;31mUmbrella imports found.\033[0m\n" -# git grep -i "^[ \t]*import \+NIO[ \t]*$" -# exit 1 -#fi -#printf "\033[0;32mokay.\033[0m\n" +printf "=> Checking for imports of umbrella NIO module... " +if git grep --color=never -i "^[ \t]*import \+NIO[ \t]*$" > /dev/null; then + printf "\033[0;31mUmbrella imports found.\033[0m\n" + git grep -i "^[ \t]*import \+NIO[ \t]*$" + exit 1 +fi +printf "\033[0;32mokay.\033[0m\n"