1. 21 Jun, 2020 1 commit
    • Nathan Harris's avatar
      Rename ELF extension `map` to `tryConverting` and make internal · c4ff3fc3
      Nathan Harris authored
      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.
      c4ff3fc3
  2. 20 Mar, 2020 2 commits
    • Nathan Harris's avatar
      Reduce RESPValue initialization complexities and simplify RedisKey implementation · c1ba6710
      Nathan Harris authored
      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`
      c1ba6710
    • Nathan Harris's avatar
      Refine Redis Command API · 41f9377d
      Nathan Harris authored
      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.
      41f9377d
  3. 20 Feb, 2020 1 commit
  4. 28 Dec, 2019 1 commit
    • Nathan Harris's avatar
      Add type-safe representation of Redis keys · ea6f4279
      Nathan Harris authored
      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.
      ea6f4279
  5. 27 Oct, 2019 1 commit
    • Nathan Harris's avatar
      Add variadic overloads for several commands · adcff650
      Nathan Harris authored
      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
      adcff650
  6. 09 Jul, 2019 1 commit
  7. 04 Jul, 2019 1 commit
    • Nathan Harris's avatar
      59 -- Use `RESPValueConvertible` as Generic Constraint · fa227b0e
      Nathan Harris authored
      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.
      fa227b0e
  8. 25 Jun, 2019 1 commit
  9. 06 Jun, 2019 1 commit
    • Nathan Harris's avatar
      Rename `NIORedis` to `RedisNIO` · e81f9546
      Nathan Harris authored
      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.
      e81f9546
  10. 01 May, 2019 1 commit
  11. 01 Apr, 2019 1 commit
    • Nathan Harris's avatar
      Replace `Foundation.Data` with `[UInt8]` type everywhere · 3c53d440
      Nathan Harris authored
      Motivation:
      
      `Foundation.Data` is known to be more expensive than is necessary for this low level of a library, and has some quirks with its usage.
      
      Results:
      
      This library now works with byte arrays (`[UInt8]`) directly, and all references to `Foundation` now explicitly import the exact types they need.
      3c53d440
  12. 28 Mar, 2019 1 commit
    • Nathan Harris's avatar
      Simplify `RedisCommandExecutor` and `RedisConnection` · 9f049eb4
      Nathan Harris authored
      Motivation:
      
      `RedisCommandExecutor` was a complex and "wordy" name that was not 100% clear as to how it relates to other types.
      
      `RedisConnection` also has not had a strong use case shown for it to exists as a separate protocol - using up a great name for the "out of the box" implementation.
      
      Result:
      
      `RedisClient` instead of `RedisCommandExecutor` is more clear as to what it is, in Redis terminology, a communication client.
      
      `RedisConnection` as a concrete class provides an identifiable basic block for making connections to Redis.
      
      `RedisConnection` also saw some fixes to `close()` while having some names and comment blocks tweaked for updated naming.
      9f049eb4
  13. 25 Mar, 2019 1 commit
  14. 21 Mar, 2019 1 commit
  15. 20 Mar, 2019 1 commit
  16. 19 Mar, 2019 1 commit
    • Nathan Harris's avatar
      Refactor `RedisConnection` and `RedisPipeline` into protocols. · 6b30127f
      Nathan Harris authored
      Motivation:
      
      The goal of this commit is to make it easier for library users to implement their own types for creating connections and pipelines without losing all of the convenience command extensions.
      
      This also splits executing commands from the concept of a "connection" to make it more swifty in `RedisPipeline`.
      6b30127f
  17. 13 Mar, 2019 1 commit