Commit Graph
247 Commits
Author SHA1 Message Date
Nathan Harris 3c4b5c407a Update Test Matrix to include Swift 5.1 Official Release
Motivation:

With the release of Swift 5.1, the official docker containers are available for both 16.04 and 18.04 of Linux - so the test matrix should include them.

Modifications:

- Add new 5.1 jobs for 18.04 linux and change 16.04 5.1 jobs to use the official docker images.
- Update the README to capture the changes

Result:

The number of configurations the library is tested against should be as wide as possible for regular interval testing passes.
2019-09-23 19:19:31 -07:00
Nathan Harris 9741a2ef4f Merge branch 'respvalue-nil-init' into 'master'
Change `RESPValue.init(bulk:)` initializers to accept a wider range of values

See merge request Mordil/swift-redi-stack!81
2019-07-29 05:19:09 +00:00
Nathan Harris 479c024d4b Change RESPValue.init(bulk:) initializers to accept a wider range of values
Motivation:

While working to add more test coverage with `RESPTranslator`, it was made apparent that a `.bulkString(.none)` is impossible to create directly with the `RESPValue` initializers, even though it is a reasonable possibility.

Additionally, forcing all integer types to have to be stored in an `Int` is unnecessarily restrictive.

Modifications:

- Change `RESPValue.init(bulk:)` initializers to accept `Optional` instances
- Change `RESPValue.init(bulk:)` for `Int` initializer to be generic on `FixedWidthInteger`

Result:

Converting types to and from `RESPValue` should be more bi-directional and seamless.
2019-07-29 05:05:39 +00:00
Nathan Harris b70923623b Merge branch 'more-resptranslator-tests' into 'master'
Add more test coverage of `RESPTranslator`

See merge request Mordil/swift-redi-stack!82
2019-07-29 05:04:19 +00:00
Nathan Harris b9b703078e Add more test coverage of RESPTranslator
Motivation:

Diagnostics for why `.bulkString` parses might fail were weak, and edge cases fell through gaps in coverage were found.

Modifications:

Added new cases to `RESPTranslator.ParsingError` for `.bulkString` parsing with additional test coverage.

Result:

Users should have better diagnostics for bogus data or failed parsing state.
2019-07-28 21:42:43 -07:00
Nathan Harris 8c3bdbac86 Merge branch 'update-linuxmain' into 'master'
Add missing `ByteToMessageDecoderVerifier` tests to Linux Main

See merge request Mordil/swift-redi-stack!80
2019-07-29 03:25:48 +00:00
Nathan Harris 0d4b520bb7 Add missing ByteToMessageDecoderVerifier tests to Linux Main
Motivation:

While working on issue #56, it was forgotten to add the new test cases to the linux manifest file.

Modifications:

Update the linux manifests to include all current unit tests

Result:

All written unit tests should be ran on Linux
2019-07-28 20:23:09 -07:00
Nathan Harris 879afb4c27 Merge branch 'faster-mr-ci' into 'master'
Speed up CI pipelines for Merge Requests

See merge request Mordil/swift-redi-stack!79
2019-07-29 03:18:16 +00:00
Nathan Harris 02d8d02176 Speed up CI pipelines for Merge Requests
Motivation:

MRs take unnecessarily too long to have completed pipelines with "redundant" builds happening in sequence.

The entire stage of building in release is an additional QA layer that can happen on merges into master, but for MRs are just added CPU cycles.

While it's useful to ensure that building in release is possible, we will get almost all build failures from the test stage, and the most important checks are the unit and integration tests.

Modifications:

Change the ordering of build vs. test, as well as only running "build in release" jobs on the master branch.

Result:

MRs should be able to be merged sooner as CI pipelines take less time to run.
2019-07-28 20:12:21 -07:00
Nathan Harris 50dba5c93a Merge branch '56-b2m-verifier-tests' into 'master'
56 -- Add `ByteToMessageDecoderVerifier` unit tests

Closes #56

See merge request Mordil/swift-redi-stack!78
2019-07-29 03:11:51 +00:00
Nathan Harris 556da6475f 56 -- Add ByteToMessageDecoderVerifier unit tests 2019-07-28 20:05:14 -07:00
Nathan Harris cd40320873 Merge branch 'test-util-connections' into 'master'
Change test utils RedisConnection process to be less opinionated.

See merge request Mordil/swift-redi-stack!74
2019-07-28 07:31:25 +00:00
Nathan Harris a09c434612 Change test utils RedisConnection process to be less opinionated.
Motivation:

After working with RedisKit with RediStackTestUtils as a dependency, it was realized how opinionated the module is in how RedisConnections can be created in test environments.

Modifications:

Require more information, with reasonable defaults for `RedisConnection.init()`. Provide subclass hooks for `RedisIntegrationTestCase` for implementors to make decisions for themselves at how to connect to Redis.

Result:

Users should have more freedom in how they connect to Redis in their units tests.
2019-07-28 00:21:07 -07:00
Nathan Harris 30a0774a2f Merge branch 'split-tests' into 'master'
Split tests into two targets: Unit tests and Integration tests

See merge request Mordil/swift-redi-stack!75
2019-07-28 07:17:14 +00:00
Nathan Harris ce43dad72e Split tests into two targets: Unit tests and Integration tests
Motivation:

For users looking to contribute, and for those looking to validate the library, it was unclear what tests require an actual connection to a Redis instance in order to run.

Modifications:

Add a `RediStackIntegrationTests` that takes all tests that require a Redis instance in order to run.

Result:

Those looking to run just unit tests, or contribute new tests, can now directly point to a specific testTarget as defined in the Package manifest.
2019-07-28 00:09:19 -07:00
Nathan Harris 1b4b5fa67d Merge branch 'rediserror-equatable' into 'master'
Add `Equatable` conformance for `RedisError`

See merge request Mordil/swift-redi-stack!77
2019-07-28 06:55:13 +00:00
Nathan Harris d702121f59 Add Equatable conformance for RedisError
Motivation:

There is a reasonable way to compare if two `RedisErrors` are equal, which was seen as needed in the `Equatable` conformance for `RESPValue`.

Modifications:

Added `Equatable` conformance for `RedisError` by comparing the messages.

Result:

Two `RedisError` instances are now equatable.
2019-07-27 23:48:40 -07:00
Nathan Harris 1d21f663de Merge branch 'respvalue-equatable' into 'master'
Add `Equatable` conformance to `RESPValue`

See merge request Mordil/swift-redi-stack!76
2019-07-28 06:42:19 +00:00
Nathan Harris 081c7ca855 Add Equatable conformance to RESPValue
Motivation:

While working on unit tests the need for conformance to `Equatable` for `RESPValue` has been needed a few times and it was decided to make it public.

Modifications:

Added conformance to `Equatable` for `RESPValue` with unit test.

Result:

Users should now be able to compare two `RESPValue` instances for equality.
2019-07-27 23:25:03 -07:00
Nathan Harris ca16cee332 Fix relative links in README to legal docs 1.0.0-alpha.5.0.2 2019-07-12 20:31:50 -07:00
Nathan Harris fae8eadad9 Make RedisConnection.sendCommandsImmediately public
Motivation:

During the refactor work (commit ea7c755) that was merged with MRs !71 and !53 - `sendCommandsImmediately` was accidentally lowered to `internal`

Modifications:

Properly mark `RedisConnection.sendCommandsImmediately` as `public`

Result:

Developers should now have proper access to the `sendCommandsImmediately` property
2019-07-12 20:30:53 -07:00
Nathan Harris 611cc4ebf8 Use swift test --generate-linuxmain to handle index of unit tests
Motivation:

A handful of times, unit tests were forgotten to be added to the `allTests` extension, or were incorrectly copy/pasted.

Modifications:

Remove manual entries of `allTest` and use generated result from `swift test --generate-linuxmain`

Result:

There should be proper test parity between macOS and Linux.
2019-07-12 19:41:20 -07:00
Nathan Harris 6791ba80e9 Fix relative links in README that were broken for docs site users 2019-07-11 14:52:02 -07:00
Nathan Harris aeae1f6c78 Properly export module 1.0.0-alpha.5.0.1 2019-07-10 22:46:20 -07:00
Nathan Harris f788056ecb Update documentation URL to new docs.redistack.info URL 2019-07-09 13:45:43 -07:00
Nathan Harris 0fbc2eb39f Add links to new support email.
Motivation:

As this project might take off and support be needed, users will want a direct line of communication to file support tickets.

Modifications:

Update docs to include references and links for contacting the RediStack maintainers for assistance.

Result:

Users should have more information on how to contact project maintainers.
2019-07-09 13:20:10 -07:00
Nathan Harris 0ecb3c1ef3 Iterate on type safety for zadd
Motivation:

Issue #60 called for improving the type safety of the options available for the `zadd` command, and MR !70 made some great headway, but attempted to cram too much into a single enum.

Modifications:

- Break the `RedisSortedSetAddOption.returnChangedCount` value into an additional boolean param

Result:

Using `zadd` should now be more straight forward, while being type safe.
1.0.0-alpha.5
2019-07-09 00:26:52 -07:00
Nathan Harris 2605763810 Rename RedisCommand properties to avoid overloading terms and being more specific.
Motivation:

There are several cases where "command" could refer to a command keyword, or an entire message (keyword + args). This made working with `RedisCommand` and it's documentation ambiguous.

Modifications:

- Rename `RedisCommand.command` to `message`
- Rename initializer labels to `message` and `responsePromise`

Result:

When encountering a `RedisCommand` everyone should know that they are dealing with a message that should be sent to Redis as soon as possible.
2019-07-08 23:48:19 -07:00
Nathan Harris 04aa1f93a3 Polish project documents
Motivation:

To give a better first impression, and providing more comprehensive information for first time viewers, the README file needed reworking.

Modifications:

- Add a CHANGELOG file that at least redirects readers to the releases page of GitLab
- Update the CONTRIBUTORS list
- Change project README to have more information, flow better, and to have a better "first impression"

Result:

The README should give a stronger indication into the project's health.
2019-07-08 23:06:57 -07:00
Nathan Harris f2df346097 Update Jazzy Doc Generation Script
Motivation:

Up until now, Jazzy docs were generated on a private CI runner hosting macOS - which doesn't make CI portable as it requires that runner to always be available.

Modifications:

- Change: CI config to use a Linux Jazzy Docker image for portability
- Change: Doc theme templates to not reference GitHub

Result:

Jazzy docs should be able to be generated at any time, as the CI infrastructure is using GitLab's cloud solution with a Docker image
2019-07-08 20:36:04 -07:00
Nathan Harris fd73e0abed Merge branch '61-rebrand' into 'master'
61 -- Rebrand from `RedisNIO` to `RediStack`

Closes #61

See merge request Mordil/swift-redis-nio-client!73
2019-07-09 02:53:58 +00:00
Nathan Harris 7e7e354697 61 -- Rebrand from RedisNIO to RediStack 2019-07-08 19:45:33 -07:00
Nathan Harris 57168eda35 Merge branch 'rename-errors' into 'master'
Rename `RedisNIOError` to `RedisClientError`

See merge request Mordil/swift-redis-nio-client!72
2019-07-09 02:42:13 +00:00
Nathan Harris 13432f0c09 Rename RedisNIOError to RedisClientError
Motivation:

To make it a little more generic, and to avoid turnover during renames (such as the planned rebranding in issue #61), `RedisClientError` more accurately reflects the source of the errors, as well as the responsibility of causing the bug.

Modifications:

- Rename `RedisNIOError` to `RedisClientError`
- Rename `RedisError` file to `RedisErrors`
- Add documentation of `RedisClientError`
- Remove no longer used `.unsupportedOperation(method:message:)` value
- Rename `.responseConversion(to:)` to `.failedRESPConversion(to:)`

Result:

Names of `RedisClientError` should be more descriptive, less prone to turnover, and more documented for users to understand the issues related to these thrown errors.
2019-07-08 19:34:57 -07:00
Nathan Harris 6c39eb3913 Merge branch '47-proposal-feedback' into 'master'
47 -- SSWG Review Feedback

Closes #55, #57, #54, #49, and #47

See merge request Mordil/swift-redis-nio-client!53
2019-07-09 02:33:42 +00:00
Nathan Harris 238ebb7496 Merge branch 'connection-refactor' into '47-proposal-feedback'
Refactor `RedisConnection`

See merge request Mordil/swift-redis-nio-client!71
2019-07-09 02:27:57 +00:00
Nathan Harris ea7c755d07 Refactor RedisConnection
Motivation:

During proposal review, and while working within the codebase, several issues were identified with how `RedisConnection` was architectured.

Modifications:

- Change implementation of `RedisConnection` in some areas for new logic of internal `ConnectionState`
- Change behavior of logging in a few places
- The initializer for `RedisConnection` is now **internal**
- How users can override the default `ClientBootstrap` for a connection is by passing an instance to the `.connect` static method
- Change unit tests to inherit from a common XCTestCase class that handles creation and cleanup of `RedisConnection` in tests
- Remove Redis namespace enum

Result:

The API for `RedisConnection` should be much simpler, with the implementation being less buggy.

This resolves issues #49, #54, and #57.
2019-07-05 11:29:35 -07:00
Nathan Harris b807af58b5 Use String Interpolation for Logging Metadata 2019-07-04 12:39:32 -07:00
Nathan Harris 2f21e2071b Merge branch '60-typesafe-sortedset' into '47-proposal-feedback'
60 -- Provide Strong Option Types in SortedSet Commands

See merge request Mordil/swift-redis-nio-client!70
2019-07-04 19:27:18 +00:00
Nathan Harris 6423299231 60 -- Provide Strong Option Types in SortedSet Commands
Motivation:

While working through issue #59, it was noticed just how "stringly" the SortedSet command options for `zadd`, `zinterstore`, and `zunionstore` were, and Swift provides ways of having strong type safety for these options.

Modifications:

- Add `RedisSortedSetAddOption` and `RedisSortedSetAggregateMethod` to replace the String API in `zadd`, `zinterstore`, and `zunionstore`
- Fix an implication of how `overestimatedCountBeingAdded` documentation for `Array where Element == RESPValue` for `add(contentsOf:overestimatedCountBeingAdded:_:)`

Result:

Users should have a more discoverable and straightforward way that isn't error prone for calling `zadd`, `zinterstore`, and `zunionstore` with Redis supported options.
2019-07-04 12:20:45 -07:00
Nathan Harris 392be14796 Merge branch '59-respconvertible-generics' into '47-proposal-feedback'
59 -- Use `RESPValueConvertible` as Generic Constraint

See merge request Mordil/swift-redis-nio-client!69
2019-07-04 18:01:21 +00:00
Nathan Harris fa227b0e08 59 -- Use RESPValueConvertible as Generic Constraint
Motivation:

Johannes continues to provide great insight, and correctly pointed out that `RESPValueConvertible` was being used as an "existential" in all cases.

This can cause unexpected type-erasure and introduce unnecessary cost overhead with dynamic dispatch when in most cases we know the exact value we want for `RESPValue` to execute commands.

Modifications:

- Add new extensions to `Array where Element == RESPValue` for appending and adding elements into them
- Change `RedisClient.send(command:with:)` to require `[RESPValue]` instead of `[RESPValueConvertible]` as the `with` argument type
- Change all instances of `RESPValueConvertible` being an "existential" type for method arguments to instead be a generic constraint

Result:

The library should be safeguarded from a class of bugs, with the use of `send` being a bit more straight forward, with some new convenience methods for `[RESPValue]` types.
2019-07-04 01:03:36 -07:00
Nathan Harris e964ba0429 Merge branch 'cleanup-unsafe' into '47-proposal-feedback'
Revisit `RESPValue` and `RESPValueConvertible` implementations.

See merge request Mordil/swift-redis-nio-client!67
2019-07-02 23:19:15 -07:00
Nathan Harris cd9bd04f73 Revisit RESPValue and RESPValueConvertible implementations.
Motivation:

Johannes provided a fair code review of the project and summarized his findings in issue #48, and one of the prime offenders was all of the `unsafe*` APIs (pointers, buffers, bytes)
that were used with `RESPValue` and `RESPValueConvertible`.

He also provided great feedback and pointed out good points of confusion with the API design of `RESPValue` and `RESPValueConvertible`.

Modifications:

- Return to using `Array` instead of `ContiguousArray` for `RESPValue.array` storage
- Update all documentation to be more thorough in explaining how the types should be used and conformed to.
- Remove all uses of `unsafe*` APIs where possible
- Change implementations to be a lot more type and memory safe, double checking assumptions
- Remove conformance to `ExpressibleBy*Literal` as it is too easy for users to shoot themselves in the foot and saves only a few characters over `.init(bulk:)`
- Create new `RedisNIOTestUtils` target for common test extensions, making them public
- Move most almost all implementations of `RESPValue` computed properties into the `RESPValueConvertible` conformances

Result:

Users should be more safeguarded by the API against unknowingly getting incorrect `RESPValue` representations, the API design of `RESPValue` and `RESPValueConvertible` should be much clearer,
and memory safety should be at a higher bar from these changes.

This resolves issues #55 & #48, and contributes to issue #47.
2019-07-02 23:19:15 -07:00
Nathan Harris f445822c23 Merge branch 'redis-command' into '47-proposal-feedback'
Rename `RedisCommandContext` to `RedisCommand`, improve `RedisCommandHandler`...

See merge request Mordil/swift-redis-nio-client!66
2019-07-02 23:19:14 -07:00
Nathan Harris 15a3c0383e Merge branch 'expire-timeout' into '47-proposal-feedback'
Update `RedisClient.expire` to no longer use `deadline` terminology.

See merge request Mordil/swift-redis-nio-client!65
2019-07-02 23:19:13 -07:00
Nathan Harris 5fb0bfca5c Rename RedisCommandContext to RedisCommand, improve RedisCommandHandler usage semantics, and cleanup documentation.
Motivation:

During proposal review, it was noted that `RedisCommandContext` was a bit misleading, and the hidden reference semantics worrisome.

In addition, several of parts of the documentation around `RedisCommandHandler` were weak or also misleading.

Modifications:

- Rename `RedisCommandContext` to just `RedisCommand`
- Update documentation to be more explicit about the module who owns the types being referenced
- Update documentation to call out explicit usage semantics and behavior
- Change `RedisCommandHandler` to close the socket connection on error thrown
- Rename the "base" Redis Channel Handlers to be more explicitly named

Result:

Users should have clearer documentation on what happens when using `RedisCommandHandler` and `RedisCommand` without hidden semantics.

This contributes to issue #47.
2019-07-02 23:19:13 -07:00
Nathan Harris b96f64c7d0 Update RedisClient.expire to no longer use deadline terminology.
Motivation:

During proposal review, it was appropriately pointed out that `RedisClient.expire` incorrectly mixes 'deadline' and 'timeout' terminology.

Modifications:

- Change references of 'deadline' to 'timeout' to follow Redis' established semantics for 'EXPIRE'
- Add additional unit test for `RedisClient.expire`

Result:

`RedisClient.expire` should now be more clear as to its semantics and not mix terminology incorrectly.

This contributes to issue #47
2019-07-02 23:19:13 -07:00
Nathan Harris c5241a461c Merge branch 'client-bootstrap' into '47-proposal-feedback'
Change `Redis.makeDefaultClientBootstrap` to `ClientBootstrap.makeRedisTCPClient`

See merge request Mordil/swift-redis-nio-client!64
2019-07-02 23:19:12 -07:00
Nathan Harris 5d232ad022 Change Redis.makeDefaultClientBootstrap to ClientBootstrap.makeRedisTCPClient
Motivation:

During proposal review, feedback was provided that the discoverability of the factory method for building a standard RESP `ChannelPipeline` was poor outside of documentation.

Modifications:

- Move `Redis.makeDefaultClientBootstrap` to `ClientBootstrap.makeRedisTCPClient`.
- Move the `channelInitializer` implementation into a new `Channel.addBaseRedisHandlers()` instance method.

Result:

Users should have an easier time discovering how to easily create baseline RESP `ChannelPipelines`.

This contributes to #47.
2019-07-02 23:19:12 -07:00