Commit Graph

169 Commits

Author SHA1 Message Date
Nathan Harris 610915a909 Add new 'RedisTypes' module
Motivation:

Redis is written in C, so even though it has concepts of "types" such as SortedSet or List
its commands are all "free-floating" functions.

This can make it unfamiliar for those new to Redis to work within its systems and understand the relation of all of the commands.

RediStack can improve this by giving a way of having a consistent reference to a Redis type and all of its associated methods.

Modifications:

- Add: New library product called "RedisTypes"
- Add: First type to "RedisTypes", `RedisSet`

Result:

Newcomers to Redis will have an easier time getting familiar with the APIs and working with its types by having wrappers that
provide a familiar Swift Standard Library API tailored to Redis APIs.
2020-08-30 14:33:21 -07:00
tanner 40d1a587f1 Add optional promise parameter to RedisConnectionPool.close
Motivation:

The actual process for closing a connection pool involves closing each individual connection, which is all asynchronous.

There is currently no way to work off of the event when all of the connections have completed their close process.

Modifications:

- Add: `poolHasActiveConnections` error value to `RedisConnectionPoolError`
- Add: `promise` parameter to the `RedisConnectionPool.close` method
- Add: Documentation comments for the close method

Result:

Developers should now have a way of chaining callbacks when all connections in a pool have been closed.
2020-08-04 22:16:38 -07:00
Nathan Harris cc3add5dc2 68 -- Catch situations where the remote connection is closed 2020-08-01 23:05:33 -07:00
Nathan Harris c4ff3fc300 Rename ELF extension map to tryConverting and make internal
Motivation:

As originally pointed out in #48, the `map` prefix alone is not enough context into what the method actually does.

Since it fails the future, and isn't a mapping function, the name should reflect this.

But, this method as-is currently provides little value outside of the client context, so it should not be `public`.

If users provide an adequate use case for having it outside of the package, then it can be made public again.

Modifications:

- Rename: ELF where Value == RESPValue extension `map` to `tryConverting`
- Change: `tryConverting` from public to internal

Result:

A "problematic" method should no longer be available for API users to hurt themselves with.
2020-06-20 23:58:45 -07:00
Nathan Harris b48b472930 Convert RESPTranslator.ParsingError from enum to struct
Motivation:

Much like the change for `RedisClientError` (6471a2) any error enum that we may want to change will necessitate a major SemVer.

To avoid this, we need to use the established struct-as-enum pattern.

Modifications:

- Change: `RESPTranslator.ParsingError` to be a struct backed by an enum

Result:

The library should be able to evolve to add more `RESPTranslator.ParsingError` cases without becoming a breaking change.
2020-06-04 16:40:01 +00:00
George Barnett e7b451c42f Add SETEX and PSETEX commands
Motivation:

The SETEX and PSETEX commands are missing.

Modifications:

- Add SETEX command
- Add PSETEX command
- Add integration tests

Result:

Users can atomically set a key with an expire
2020-06-04 17:24:10 +01:00
George Barnett ddfc7b0ae0 Add SET options
Motivation:

SET has a range of options for setting expirations and conditionally
setting a value.

Modification:

- Add another `set` function with a range of options. Options are
  modelled as `struct`s backed by private `enum`s to allow additional
  options to be added without breaking API.
- Added tests

Result:

Options may be specified with `set`, and resolves #67
2020-06-04 16:01:02 +00:00
George Barnett 5749215e5d Replace usage of @_specialize with @inlinable
Motivation:

- Newer compilers warn that "'exported: true' has no effect in
  '_specialize' attribute"
- Specialize is underscored so (probably) shouldn't be relied upon
  outside of the stdlib

Modifications:

- Replace @_specialize with @inlinable

Result:

Fewer warnings on more recent compilers
2020-06-04 11:54:50 +01:00
Lukasa 5dbd716acf Implement a simple Redis Connection Pool.
Motivation:

Users of Redis will frequently want to be able to run queries in
parallel, while bounding the number of connections they use. They will
also often want to be able to reuse connections, without having to
arrange to manage those connections themselves. These are jobs usually
done by a Connection Pool.

This new connection pool will conform to `RedisClient` so a pool of clients and a single connection are interchangeable.

Connection Pools come in a wide range of shapes and sizes. In NIO
applications and frameworks, there are a number of questions that have
to be answered by any pool implementation:

1. Is the pool safe to share across EventLoops: that is, is its
   interface thread-safe?
2. Is the pool _tied_ to an EventLoop: that is, can the pool return
   connections that belong on lots of event loops, or just one?
3. If the pool is not tied to an EventLoop, is it possible to influence
   its choice about what event loop it uses for a given connection?

Question 1 is straightforward: it is almost always a trivial win to
ensure that the public interface to a connection pool is thread-safe.
NIO makes it possible to do this fairly cheaply in the case when the
pool is only used on a single loop.

Question 2 is a lot harder. Pools that are not tied to a specific
EventLoop have two advantages. The first is that it is easier to bound
maximum concurrency by simply configuring the pool, instead of needing
to do math on the number of pools and the number of event loops. The
second is that non-tied pools can arrange to keep busy applications
close to this maximum concurrency regardless of how the application
spreads its load across loops.

However, pools that are tied to a specific EventLoop have advantages
too. The first is one of implementation simplicity. As they always serve
connections on a single EventLoop, they can arrange to have all of their
state on that event loop too. This avoids the need to acquire locks on
that loop, making internal state management easier and more obviously
correct without having to worry about how long locks are held for.

The second advantage is that they can be used for latency sensitive
use-cases without needing to go to the work of (3). In cases where
latency is very important, it can be valuable to ensure that any Channel
that needs a connection can get one on the same event loop as itself.
This avoids the need to thread-hop in order to communicate between the
pooled connection and the user connection, reducing the latency of
operations.

Given the simplicity and latency benefits (which we deem particularly
important for Redis use-cases), we concluded that a good initial
implementation will be a pool that has a thread-safe interface, but is
tied to a single EventLoop. This allows a compact, easy-to-verify
implementation of the pool with great low-latency performance and simple
implementation logic, that can still be accessed from any EventLoop in
cases when latency is not a concern.

Modifications:

- Add new internal `ConnectionPool` object
- Add new `RedisConnectionPool` object
- Add new `RedisConnectionPoolError` type
- Add tests for new types

Results:

Users will have access to a pooled Redis client.
2020-06-03 16:43:10 +00:00
George Barnett 95ce2cd1ad Make RedisKey ExpressibleByStringInterpolation
Motivation:

`RedisKey` is `ExpressibleByStringLiteral` but not
`ExpressibleByStringInterpolation` which is often just as useful.

Modifications:

- Add `ExpressibleByStringInterpolation` conformance to `RedisKey`

Result:

Users can create `RedisKey`s using string interpolation
2020-06-03 14:39:42 +00:00
George Barnett 4b06ece03a Add SETNX command
Motivation:

The SETNX command is missing.

Modifications:

- Add SETNX command
- Add integration test

Result:

Users can set a key only if it does not already exist
2020-06-02 11:36:00 +01:00
Nathan Harris 06471a2a39 Change RedisClientError from enum to struct
Motivation:

The current state of Swift does not leave room for library evolution of enum types used for `Error`.

To avoid having to increment Major SemVer to add a new error case that might be needed to fix a bug, the `enum-like struct` idiom should be used.

Ideally this idiom will disappear, when Swift provides a way for Swift Packages to have a "library evolution" capability.

See https://forums.swift.org/t/extensible-enumerations-for-non-resilient-libraries/35900

Modifications:

- Change: `RedisClientError` to be struct with private enum value

Result:

Should new error cases be necessary to add, they can be in Minor SemVer releases, rather than Major SemVer.
2020-05-31 23:42:20 -07:00
George Barnett 4cd5855762 Add TTL and PTTL commands
Motivation:

The TTL and PTTL commands are missing.

Modifications:

- Add TTL and PTTL commands
- Add integration tests

Result:

- Users can query the ttl in seconds or milliseconds of a key
2020-05-29 12:40:35 +00:00
George Barnett 123d9c94fc Add EXISTS command
Motivation:

The EXISTS command was missing.

Modifications:

- Add 'EXISTS' to basic commands
- Add integration tests

Result:

The existence of a key can be checked.
2020-05-29 02:00:30 +00:00
Cory Benfield 2211dbf36b Detect and throw on invalid integer.
Motivation:

parseInteger did not distinguish between not having enough bytes for an
integer and not being able to parse the integer that was present. This
was a bit tricky for code internally, where some call sites had extra
code looking for spooky action at a distance in order to determine if
the integer failed to parse.

This is unnecessary: parseInteger is sufficiently aware of what's going
on to address this problem itself.

Modifications:

- Added a new parser error (acceptable as we haven't tagged 1.0 yet).
- Throw it from parseInteger if the integer is invalid.

Result:

parseInteger clearly communicates if the integer failed to parse.
2020-05-27 16:00:20 +00:00
Cory Benfield 638fbb0754 Clean up indexing of ByteBufferView
Motivation:

ByteBufferView is not zero indexed, but parseSimpleString assumes it is.

Modifications:

- Correctly compute on the distance between two indices.
- New, somewhat contrived, test case.

Result:

No functional change: because RediStack assumes the remote peer will
always correctly terminate with /r/n, there is no point at which this
code could misbehave in the current implementation. However, with small
changes it is possible to trigger it, as the new test demonstrates.
2020-05-27 10:44:38 +01:00
Cory Benfield f9579373f5 Avoid creating temporary arrays
Motivation:

When we only want the first byte, rather than create temporary
intermediate arrays we can just ask NIO to give us the first byte. This
avoids unnecessary allocations.

Modifications:

- Replace `readBytes(length: 1).first` with `readInteger(as:
  UInt8.self)`

Results:

11% performance improvement in load testing due to reduced allocator
pressure on the hot path.
2020-05-26 18:11:01 +00:00
Cory Benfield dd08685566 Avoid transient ByteBufferView
Motivation:

When attempting to locate a single byte, creating a transient
ByteBufferView is an excessively heavyweight operation compared to a
simple getInteger. In particular, a BBV requires retain/release
operations to enforce the CoW invariants, as well as requires jumps
through substantial amounts of generic Collection code. While this can
be specialized, so can getInteger, and getInteger has much less code in
the way to cause costs.

Modifications:

- Replace temporary view creation with getInteger.

Results:

5% performance improvement on raw throughput tests.
2020-05-26 15:43:11 +01:00
Nathan Harris 86d5466584 Make ActiveConnectionGauge.currentCount public 2020-04-20 02:22:52 +00:00
Nathan Harris c1ba671097 Reduce RESPValue initialization complexities and simplify RedisKey implementation
Motivation:

`RESPValue` exposes a fair amount of complexity on how to intialize a single instance with the various overloads.

This aims to simplify the complexity for developers by providing a single initializer and relying on `RESPValueConvertible` to handle the complexities.

In addition, the Swift complier synthesizes a lot of default conformances that `RedisKey` has manually written, which is just unnecessary code.

Modifications:

- Rename: `RESPValue.init(_:)` to `RESPValue.init(from:)`
- Change: `RESPValue.init` `String?` and `FixedWidthInteger` overloads from `public` to `internal`
- Remove: Unnecessary code for various protocol conformances for `RedisKey`

Result:

Developers should have a direct and guided way of making instances of `RESPValue`
2020-03-19 22:20:47 -07:00
Nathan Harris 41f9377d31 Refine Redis Command API
Motivation:

It was noticed that many of the commands are cumbersome to use with boilerplate type casting for each use that can be simplified within the library
by doing type conversion before returning the value to an end user.

Modifications:

Many APIs that return a `RESPValue` now have overloads to provide a `RESPValueConvertible` type that the value will be turned into before being returned.

For a few APIs that returned `RESPValue`, they did so as an Optional. Those APIs have been changed to always provide a `RESPValue` and return `.null` in cases where `nil` was returned.

In addition, the `@inlinable` attribute has been removed from any non-generic command API.

Result:

Developers should have less code boilerplate for turning values from `RESPValue` to their desired type with many commands.
2020-03-19 19:30:54 -07:00
Nathan Harris ea781e1bd4 73 -- Remove isConnected property requirement from RedisClient 2020-03-19 15:53:39 -07:00
Nathan Harris fb161021a9 Rename ELF.convertFromRESPValue to be an overload of map 2020-02-19 20:59:11 -08:00
Nathan Harris 6bd5df7d93 Add map overloads for casting RESPValue elements in a Collection 2020-02-19 20:44:27 -08:00
Nathan Harris 17fa5dad0a Cleanup Extensions by placing code in more appropriate places 2020-02-19 20:41:41 -08:00
Nathan Harris 249999851e Rework SortedSet and List range APIs
Motivation:

The SortedSet and List range commands (LTRIM, LRANGE, ZRANGE, etc.) are stringly-based and not flexible with Swift syntax.

Modifications:

- Add overloads of LTRIM that support the gambit of Range Standard Library types
- Rework LRANGE to mirror LTRIM method signatures
- Rework ZScore Range based commands to be more type-safe with `RedisZScoreBound` enum
- Rework ZLex Range based commands to be more type-safe with `RedisZLexBound` enum
- Rework ZCOUNT, ZLEXCOUNT, ZRANGE, ZREVRANGE, ZREMRANGEBYLEX, ZREMRANGEBYRANK, ZREMRANGEBYSCORE methods to be more type-safe and support Swift Range syntax

Result:

Working with SortedSet ranges should be much more type safe, and expressive with Swift's Range syntax.
2019-12-30 17:17:25 -08:00
Nathan Harris 8e3d8f6faf Revisit the SortedSet zadd command API
Motivation:

While reviewing the API, the current design does not read well, and still has room for misunderstanding the actual end result of a ZADD operation.

Modifications:

- Rename `RedisSortedSetAddOption` to `RedisZaddInsertBehavior` and update cases to match desired use site syntax.
- Add `RedisZaddReturnBehavior` enum to define how `zadd` should calculate the return value.
- Update `zadd` and its overloads to support the two new enums in the form of `zadd(_:to:inserting:returning:)`

Result:

The more "Swifty" API will make it much more clear to developers at the call site what the actual behavior of the ZADD command will be.
2019-12-27 23:49:44 -08:00
Nathan Harris 1ef315e255 Use TimeAmount for any timeout command arguments
Motivation:

The goal is to have a strong-typed API for type-safety in arbitrary values, such as trying to use
Int to represent time - as '3' could mean any unit of time, leaving many places for errors and bugs.

Modifications:

Switch all current APIs that accept a `timeout` argument to use `NIO.TimeAmount` instead of a plain `Int`.

Result:

Developers will have an easier time reasoning about their own code as to what values might mean when working with
timeouts in Redis APIs.
2019-12-27 22:29:28 -08:00
Nathan Harris a50a4d555d Add isConnected property to RedisClient protocol
Motivation:

It it pretty common as a developer when working with connections and "database" clients to want to know
if the connection is currently open before doing any work.

Modifications:

Add `var isConnected: Bool { get }` requirement to the `RedisClient` protocol

Result:

Developers should now have access to the connectivity state of any `RedisClient`
2019-12-27 21:52:20 -08:00
Nathan Harris ea6f427993 Add type-safe representation of Redis keys
Motivation:

Inspired by Swift by Sundell's article on type-safe identifers, the goal of this commit is to have the compiler
assist in preventing incorrect Redis key values from being used in API calls.

See https://www.swiftbysundell.com/articles/type-safe-identifiers-in-swift/ for the inspiration.

Modifications:

- Add new `RedisKey` struct that wraps around a single `String` value that conforms to several expected protocols
  (Hashable, Comparable, Codable, etc.)
- Change all command APIs to require `RedisKey` rather than plain strings

Result:

When encountering an API requiring a RedisKey, it should be much more apparant at the use site what form a value should take.
2019-12-27 21:38:35 -08:00
Nathan Harris 435cdb2ab0 Add authorize command
Motivation:

The library provides command implementations for almost every single Redis command, authorize is no different.

Modifications:

Add `authorize(with:)` command method on `RedisClient`
Replace the implementation in `RedisConnection.connect(...)`

Result:

Developers should now have independent access to the `AUTH` Redis command on `RedisClient` implementations.
2019-12-25 00:23:09 -08:00
Nathan Harris 8d85cb2bfa Update to use new NIOAtomic over deprecated Atomic 2019-12-16 15:47:03 -08:00
Nathan Harris 209ba87bf5 Revisit user Logging configuration for connections and clients
Motivation:

Logging is more dynamic in real world usage than the current static heavy API allows.

Users generally want to be capable of updating connection logger metadata to attach dynamic properties such as an HTTP request ID for log tracing.

Modifications:

- Move all logs to `RedisConnection`
- Add `id: UUID` property to `RedisConnection`
- Add `logging` property and `setLogging(to:)` method requirements to `RedisClient`
- Add chainable `logging(to:)` method extension to `RedisClient`
- Add additional `trace` log statements to `RedisConnection`
- Change when `RedisConnection.init` logging and metric calls are made
- Change some `debug` log statements to `trace in `RedisConnection`

Result:

Users should have infinitely more flexibility in how RedisConnection, and RedisClient  implementations in general, behave in regards to logging.
2019-12-13 23:47:32 +00:00
Nathan Harris adcff65030 Add variadic overloads for several commands
Motivation:

For ergonomics, users sometimes want to provide arguments as a variadic list rather than an array.

Modifications:

- Add variadic overloads for almost all methods that accept lists of homogenous types

Result:

Users should have more flexibility in the way arguments are passed to command methods
2019-10-26 23:55:47 -07:00
Nathan Harris 9e5179f3e4 Add RedisClient.get generic overload
Motivation:

It is wrong to always assume that a GET operation is expecting a String response type, as users may be storing other types of data.

Modifications:

- Add `get` generic method with a constraint for types of `RESPValueConvertible` to convert values to the user desired type
- Change existing `get` method to specialize the generic overload
- Fix incorrect doc block regarding the ELF failure condition

Result:

Users should now be able to specialize the return type of a "GET" command
2019-10-26 22:50:58 -07:00
Nathan Harris ba66ebf81e Remove unnecessary assertions in RedisCommandHandler
Motivation:

The assertions in `errorCaught(context:error:)` and `channelRead(context:data:)` are holdovers from when SwiftLog was not integrated into the package. The conditions where they were triggered are safely handled in other ways, so the asserts are not guarding against undefined behavior or bad app state.

Modifications:

Remove the two asserts regarding the `RedisCommandHandler.commandResponseQueue` to rely on Logging to bubble up errors to the user.

Result:

Debug builds using RediStack should not encounter unexpected assertions and should rely on other, better, error handling.

This contributes to issue #65
2019-10-07 07:24:00 -07:00
Nathan Harris 939e41b832 Fix data race with RedisMetrics.activeConnectionCount
Motivation:

After enabling the thread sanitizer during testing, a data race with the `activeConnectionCount` in `RedisMetrics` was caught due to changing a primitive `Int` across threads.

Modifications:

Add a specialized class `ActiveConnectionGauge` to wrap the semantics of the `activeConnectionCount` with an `Atomic<Int>` property.

Result:

No data races should occur with the `RedisMetrics` subsystem.
2019-09-23 20:03:20 -07: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 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 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 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 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 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 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.
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 7e7e354697 61 -- Rebrand from RedisNIO to RediStack 2019-07-08 19:45:33 -07: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 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 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