Commit Graph

284 Commits

Author SHA1 Message Date
Nathan Harris c010e13b9e 50 -- Rename EventLoopFuture.mapFromRESP to convertFromRESPValue 2019-06-24 22:06:21 -07:00
Nathan Harris e0e5a68957 Merge branch '53-circular-buffer' into 'master'
53 -- Use `CircularBuffer` for `RedisCommandHandler` queue

Closes #53

See merge request Mordil/swift-redis-nio-client!59
2019-06-22 02:45:33 +00:00
Nathan Harris 88c6cfa2c8 53 -- Use CircularBuffer for RedisCommandHandler queue 2019-06-21 19:40:49 -07:00
Nathan Harris 5672c55560 Merge branch '51-ascii-init' into 'master'
51 -- Use `UInt8(ascii:)` for RESP Tokens

Closes #51

See merge request Mordil/swift-redis-nio-client!58
2019-06-22 02:11:52 +00:00
Nathan Harris b9d8af0f10 51 -- Use UInt8(ascii:) for RESP Tokens 2019-06-22 02:07:28 +00:00
Nathan Harris 6dc4864734 Merge branch '52-exported' into 'master'
52 -- Remove `@_exported` Usage

Closes #52

See merge request Mordil/swift-redis-nio-client!57
2019-06-22 02:05:00 +00:00
Nathan Harris 2f8520c43b 52 -- Remove @_exported Usage 2019-06-21 19:00:33 -07:00
Nathan Harris 531a7d4021 Merge branch 'add-port-static' into 'master'
Add static property for default RedisConnection port

See merge request Mordil/swift-redis-nio-client!51
1.0.0-alpha.2.1
2019-06-12 17:18:56 +00:00
Nathan Harris 73b3f5df32 Add static property for default RedisConnection port
Motivation:

The default port for Redis is well published to be 6379, and it is common to want to pass this value around or use it as a static default value in methods and initializers.

Modifications:

Add `RedisConnection.defaultPort` static property for all users to use, and update references of the `6379` literals to use new  the new property.

Result:

Users should have a reliable default defined to use everywhere to avoid bugs.
2019-06-12 10:11:53 -07:00
Nathan Harris 30733dea02 Merge branch 'fix-data-conversion' into 'master'
Fix `Data` Conversion to `RESPValue`

See merge request Mordil/swift-redis-nio-client!50
1.0.0-alpha.2
2019-06-11 20:26:06 +00:00
Nathan Harris 34647e1423 Fix Data Conversion to RESPValue
Motivation:

`Foundation.Data` was unexpectedly receiving `RESPValueConvertible` conformance through the `Collection` extension which lead to incorrect encoding.

Modifications:

Add explicit conformance to `RESPValueConvertible` for `Data`.

Result:

Users should see their `Data` encoding to RESP format as expected.
2019-06-11 13:20:24 -07:00
Nathan Harris 788f69dede Fix warning with default for RESPValue.description implementation. 1.0.0-alpha.1.1.1 2019-06-11 12:23:29 -07:00
Nathan Harris d4584924cf Improve debugging of RESPValue
Motivation:

Reading output from `RESPValue` existentials is entirely verbose and does not provide a human-readable description of what is being represented.

Modifications:

- Add conformance to `CustomStringConvertible` for `RESPValue`
- Remove redundant logging of arguments in `RedisConnection.send`

Result:

String representations of `RESPValue` should now be more readable for human to understand.
1.0.0-alpha.1.1
2019-06-11 12:16:22 -07:00
Nathan Harris d48485869d Merge branch 'docs-tweak' into 'master'
Fix README and API Docs

See merge request Mordil/swift-redis-nio-client!49
2019-06-07 01:52:35 +00:00
Nathan Harris 06c0aeed0a Fix README and API Docs
Motivation:

The emojis in the README were not rendered consistently in the docs and on different screen form factors making a poor UX.

Modifications:

The CI config now properly sends the custom theme to Jazzy, and the README no longer has the `🔔` emoji in the disclaimer header.

Result:

A consistent UX with the README and proper API docs referring to GitLab
2019-06-06 18:40:32 -07:00
Nathan Harris 23a8d4455f Update README
Motivation:

After moving to GitLab, and while still having a GitHub mirror, it is important to drive people to the proper location for getting help and reporting bugs or feature requests.

Also, some information should be updated to include new tags, formatting, and a link to the new API docs.

Modifications:

README is updated to point users to the GitLab repository and to have up-to-date information about the project.

Result:

Users should know where to reach project maintainers and where to find documentation.
1.0.0-alpha.1
2019-06-06 18:00:42 -07:00
Nathan Harris 3b5faf0498 Merge branch '45-api-docs' into 'master'
45 -- Add API Documentation

See merge request Mordil/swift-redis-nio-client!48
2019-06-07 00:22:03 +00:00
Nathan Harris dd839fdf02 45 -- Add API Documentation
Motivation:

Users need a quick reference available online that is up to date.

Modifications:

Add CI job to generate and publish API docs with Jazzy

Result:

Users can view API docs that are updated when new releases are tagged at https://mordil.gitlab.io/swift-redis-nio-client
2019-06-06 17:17:29 -07:00
Nathan Harris 6f6fe74c92 Merge branch 'se-0226' into 'master'
Rename package to match repo

See merge request Mordil/swift-redis-nio-client!47
0.10.0
2019-06-06 22:19:12 +00:00
Nathan Harris dfbccf4c07 Rename package to match repo
Motivation:

SE-0226 changes how SPM resolves a dependency graph and as part of the accepted proposal was to require package names to match their repo URL segments.

Modifications:

Change package from `redis-nio` to `swift-redis-nio-client`

Result:

The project should compliant with SE-0226: https://github.com/apple/swift-evolution/blob/master/proposals/0226-package-manager-target-based-dep-resolution.md
2019-06-06 15:10:59 -07:00
Nathan Harris dcc9ceaeed Merge branch 'gitlab' into 'master'
Migrate from CircleCI to GitLab CI

See merge request Mordil/swift-redis-nio-client!46
2019-06-06 22:02:18 +00:00
Nathan Harris 67fa6f2f25 Migrate from CircleCI to GitLab CI
Motivation:

Now that the project has migrated from GitHub, it can now fully use GitLab CI.

Modifications:

Removed `circle.yml` and added `.gitlab-ci.yml` files

Result:

GitLab CI should be fully supported
2019-06-06 14:33:27 -07:00
Nathan Harris a765914e93 Merge pull request #45 from Mordil/renaming
Rename `NIORedis` to `RedisNIO`
0.9.0
2019-06-06 10:06:02 -07:00
Nathan Harris e81f9546d1 Rename NIORedis to RedisNIO
Motivation:

The SSWG has identified a fast approaching reality of namespace clashes in SPM within the ecosystem and has proposed a rule on names that `NIORedis` no longer complies with.

Modifications:

All references to `NIORedis` have been switched to `RedisNIO` as this module name is unique (at least within GitHub's public repositories).

The goals for this name are as follows:

1. To indicate that this is a Redis client library that is built with SwiftNIO
2. That it is a lower level library, as it directly exposes SwiftNIO as an implementation detail
    2a. The idea being that a higher level library (`Redis`) will be used, and to "go one level deeper" in the stack, you append the "deeper" `NIO` postfix
3. It follows a naming pattern adopted by Vapor who has expressed their desire to adopt this library as their Redis implementation

Result:

A repository, package name, and module name that are unique across GitHub's public repositories that achives the goals outlined above.
2019-06-06 09:55:08 -07:00
Nathan Harris 7ae20244d5 Merge pull request #41 from Mordil/40-metrics
Implement Basic Metrics (#40)
0.8.0
2019-06-06 09:45:24 -07:00
Nathan Harris 9df653962d Implement Basic Metrics (#40)
Motivation:

End users will want to capture some baseline performance metrics that can only be accurately gathered at this level of the stack.

Modifications:

Added new `RedisMetrics` struct that retains all SwiftMetrics objects used throughout the system lifecycle, and appropriate code to track desired metrics.

Result:

Users now have a way to peek into the system's performance to understand what NIORedis is being asked to do from their usage.
2019-06-05 11:40:45 -07:00
Nathan Harris 0b28491251 Add Xcode 11 .swiftpm to .gitignore 2019-06-05 11:39:06 -07:00
Nathan Harris b0d0882ee2 Update License Notice for SwiftLog & SwiftMetrics
Motivation:

The project has adopted the `swift-log` and `swift-metrics` API packages, and the project's license needs to include attributions to their authors.

Modifications:

`NOTICE.txt` now lists `swift-log` and `swift-metrics` from Apple.

Result:

Apple has been properly attributed for the code from `swift-log` and `swift-metrics`
2019-05-27 17:02:31 -07:00
Nathan Harris f6facaa252 Merge pull request #43 from Mordil/blocking-pop
Add Blocking List Pop Commands
2019-05-27 16:44:58 -07:00
Nathan Harris eaa9d2bfd0 Add Blocking List Pop Commands
Motivation:

To be a comprehensive library, all commands should be implemented, even if they are highly discouraged. List's collection of commands were missing `brpop`, `blpop`, and `brpoplpush`.

Modifications:

`brpop`, `blpop` and `brpoplpush` are supported with defaults and overloads for an easier API.

Result:

Users now have access to `brpop`, `blpop` and `brpoplpush` commands.
2019-05-27 16:43:55 -07:00
Nathan Harris 0c4db2129a Merge pull request #42 from Mordil/blocking-zpop
Add Blocking Sorted Set Pop Commands
2019-05-27 15:02:41 -07:00
Nathan Harris 739223258c Add Blocking Sorted Set Pop Commands
Motivation:

To be a comprehensive library, all commands should be implemented, even if they are highly discouraged. Sorted Set's collection of commands were missing `bzpopmin` and `bzpopmax`.

Modifications:

`bzpopmin` and `bzpopmax` are supported with defaults and overloads for an easier API.
`RedisClient.channel` is now `internal` to have access during testing for bypassing normal guards for closing connections.

Result:

Users now have access to `bzpopmin` and `bzpopmax` commands.
2019-05-27 12:56:55 -07:00
Nathan Harris d0da3e760b Improve Redis Channel Pipeline Debugging
Motivation:

Debugging and properly handling errors was difficult as the `ChannelHandler` names were the default generic names, in addition the `RedisCommandHandler` did not pipe errors further up the pipeline.

Modifications:

`RedisCommandHandler` now calls `context.fireErrorCaught(error)` when receiving errors, and the default Redis `ChannelPipeline` handlers are added with debugging names.

Result:

It should be easier for debugging purposes to work with any Redis `ChannelPipeline`.
2019-05-27 12:09:18 -07:00
Nathan Harris 1a9f086c68 Add SwiftMetrics Dependency
This will eventually support issue #40
2019-05-17 18:34:45 -07:00
Nathan Harris d9d61bafe4 Minor comment fixes 2019-05-01 21:52:27 -07:00
Nathan Harris 3eb7608762 Tweak README formatting 2019-05-01 19:36:19 -07:00
Nathan Harris 0131fe43ba Update Readme and Tweak Redis.makeConnection(...)
Motivation:

The goal of the `Redis.makeConnection` factory method is to provide end users with a quick way to jump in and get started with Redis in Swift.

Right now, users have to provide an `EventLoopGroup` instance, when a reasonable default is available for us to define.

Modifications:

- Add: `MultiThreadedEventLoopGroup` for 1 thread as a default argument to the `using:` label in `Redis.makeConnection`
- Remove: The `with:` label for the password in `Redis.makeConnection`
- Change: The project README to reflect the current state of the project

Results:

Users should be able to create `RedisConnections` by just defining an IP Address & Port to connect to - and possibly a password.

In addition, the README should now properly direct users on how to use the latest version of the library.
0.7.0
2019-05-01 18:59:59 -07:00
Nathan Harris c7a606d8a6 Add Copyright Notices, Acknowledgements, and Contributors List 2019-05-01 16:24:05 -07:00
Nathan Harris d071bbaed6 Merge pull request #36 from Mordil/resolve-batching
Resolve `RedisPipeline` Proposal Discussion Topic
2019-05-01 15:28:16 -07:00
Nathan Harris 066a5c3dea Resolve RedisPipeline Proposal Discussion Topic
Motivation:

During the discussion thread of the NIORedis SSWG proposal, there were concerns expressed over the implementation
of `RedisPipeline` that covered the following areas:

1. Clashes with SwiftNIO concepts such as "Pipeline"
2. Misleading users on library behavior with using a Pipeline vs. a single `RedisConnection`
3. The implementation was "too clever" in that it allowed users to easily find themselves in "Undefined Behavior"
   due to lack of enough type safety in the API

However, the value in being able to control how frequently "flush" happens on a socket was discussed and considered
high - so something still needs to be in place to force flushes by users.

It was decided to leave the implementation of batching commands and their responses to library users, perhaps in
higher level frameworks while the library will provide said mechanism for controlling writing and flushing of commands.

Modifications:

- Add: `sendCommandsImmediately` bool property to `RedisConnection` to handle choice of flushing after each command
- Remove: `RedisPipeline`

Results:

Users should now have a more clear understanding on what type of control they have over the timing of when commands
are actually sent over the wire, with the greater emphasis placed on `RedisConnection`.
2019-05-01 15:26:00 -07:00
Nathan Harris 8bde6fd421 Merge pull request #39 from Mordil/cleanup-handlers
Simplify RESP Parsing and Redis Channel Handlers
2019-04-30 22:55:44 -07:00
Nathan Harris 477668e667 Simplify RESP Parsing and Redis Channel Handlers
Motivation:

As it stands, the parsing / encoding implementations for RESP was directly tied to the NIO Channel Handlers.

Unit tests were sloppily spread across multiple files and it made it difficult to explicitly separate out
the Channel Handler behavior from the RESP specification implementation.

Modifications:

- Add: `RESPTranslator` enum helper object with static methods that only handles RESP parsing / encoding
- Rename: `RESPEncoder` to `RedisMessageEncoder`
- Rename: `RESPDecoder` to `RedisByteDecoder`

Results:

It should be easier to understand what type is intended to be used as part of a NIO channel pipeline while
still having a direct way of parsing / encoding between Swift types and the RESP specification.

Unit tests should be more maintainable as well.
2019-04-30 22:54:31 -07:00
Nathan Harris a8a1fa5921 Merge pull request #38 from Mordil/namespacing
Namespace global static factory methods under `Redis`
2019-04-30 21:04:59 -07:00
Nathan Harris e446a834cd Namespace global static factory methods under Redis
Motivation:

The two provided factory methods for creating `RedisConnection` and `ClientBootstrap` were not readily discoverable or appropriately expressible.

Modifications:

- Add: `Redis` top-level namespace enum
- Move & Rename: `RedisConnection.connect` factory method to `Redis.makeConnection`
- Move & Rename: `ClientBootstrap.makeRedisDefault` factory method to `Redis.makeDefaultClientBootstrap`
- Rename: `EventLoopFuture` extension file to just `SwiftNIO` to have all framework extensions in a single file

Results:

Using NIORedis should be more discoverable and straight forward on how to create a connection with `Redis.makeConnection(...)` over `RedisConnection.connect(...)`
2019-04-30 21:01:35 -07:00
Nathan Harris d03823f27a Merge pull request #37 from Mordil/error-handling
Standardize Error Handling
2019-04-30 16:19:29 -07:00
Nathan Harris 46e96bd9cb Standardize Error Handling
Motivation:

`RedisError` was being used in many places in an ad-hoc fashion that made it unclear as to what source of errors it exactly represents.

In addition, it doesn't follow community conventions of handling known "classes" of errors with enums rather than static struct instances.

Results:

All errors that are generated and thrown within the library are specified as either `RESPDecoder.Error` or `NIORedisError`.

`RedisError` is simplified to represent an error message sent by a Redis instance that conforms to `LocalizedError`.
2019-04-30 16:18:21 -07:00
Nathan Harris f89e64decc Update unit test SetUp failures to include error messages to debug failures easier 2019-04-24 10:35:06 -07:00
Nathan Harris 76ceb6370c Fix incorrect default logger label in RedisConnection static factory method 2019-04-24 10:34:29 -07:00
Nathan Harris 864c4bcff6 Refactor RedisClient state to use enum instead of booleans
Motivation:

When later adding support for pub/sub, and potentially batching commands, a state is going to need to be defined and multiple booleans will create a large matrix that will be error prone.

Results:

Rather than using `Atomic<Bool>`, a `Lock` and `ConnectionState` enum are used to determine if a connection is open.
2019-04-24 10:33:55 -07:00
Nathan Harris ed106a943f Update to use official release of SwiftLog 2019-04-10 11:33:52 -07:00