Commit Graph
303 Commits
Author SHA1 Message Date
Nathan Harris b3bc95f118 Add CI jobs for Swift 5.3 development snapshots 2020-04-23 20:38:31 -07:00
Nathan Harris 86d5466584 Make ActiveConnectionGauge.currentCount public 2020-04-20 02:22:52 +00:00
Nathan Harris b462bdcf3f Update CodeClimate badge for renamed project 1.0.0-alpha.9 2020-03-27 14:28:21 -07:00
Nathan Harris 851c81ae79 Update CI to use official Swift 5.2 images and update README for current testing matrix 2020-03-27 14:19:27 -07: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 3e1a3d5e74 Add GitHub pull request template to direct devs to GitLab 2020-03-19 20:39:12 -07:00
Nathan Harris 543e27bde0 Move GitLab CI files to .gitlab 2020-03-19 20:39:12 -07:00
Nathan Harris ad00b0c582 Add GitHub Sponsor funding file 2020-03-19 20:39:11 -07:00
Nathan Harris 7850dee562 Add code owners file 2020-03-19 20:39:11 -07:00
Nathan Harris 9425c39d44 Add issue templates 2020-03-19 20:39:11 -07:00
Nathan Harris 8d19354e07 Add merge request templates 2020-03-19 20:39:11 -07:00
Nathan Harris fb921f2a62 Update CONTRIBUTING guide 2020-03-19 20:39:06 -07:00
Nathan Harris 83f8b78c2e Disable additional scan command unit tests until #23 is fixed 2020-03-19 19:43:21 -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 86f2eb69c9 Disable Scan command unit test until #23 is completed 2020-03-19 16:17:35 -07:00
Nathan Harris ea781e1bd4 73 -- Remove isConnected property requirement from RedisClient 2020-03-19 15:53:39 -07:00
Nathan Harris b08ad5461a Rename Package to "RediStack"
Motivation:

SwiftPM as of Swift 5.2 introduces a new package dependency graph and package description that makes the current naming of RediStack awkward to pull in.

Modifications:

- Change: Package.name to be "RediStack"

The git repo will be renamed to "mordil/redistack" in addition to this change.

Result:

Fixes #72 and makes it seamless to pull in RediStack as a Swift package dependency.
1.0.0-alpha.8
2020-03-11 20:35:15 -07:00
Nathan Harris 973a9162af 70 -- Update SwiftMetrics for ecosystem compatability 2020-03-06 03:13:19 +00: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 f2fb726904 Use latest Redis 5 in dev Docker Compose 2020-02-17 16:00:24 -08:00
Nathan Harris bd4a0dab84 Add documentation coverage badge to README 2020-02-04 23:10:18 -08:00
Nathan Harris b8bac7e896 Exclude Code Climate CI job for schedules 2020-02-04 22:45:39 -08:00
Nathan Harris 21d0a3120b Add code quality tracking from Code Climate 2020-02-04 22:33:33 -08:00
Nathan Harris a0b21e7b81 Update test matrix in README 2020-01-26 13:57:07 -08:00
Nathan Harris 02f3fb760c Update nightlies to use 'official' nightlies on all linux platforms 2020-01-26 13:16:10 -08:00
Nathan Harris 8e48e939e0 Update README to clarify Redis version support 2020-01-16 10:15:02 -08:00
Nathan Harris 4b2729c0ac Add Swift 5.2 branch testing to CI f10d6a0 Nathan Harris <nathan@mordil.info> Jan 16, 2020 at 08:08 2020-01-16 09:28:07 -08:00
Nathan Harris 6e45f56e00 Merge branch 'range-api' into 'master'
Rework SortedSet and List range APIs

See merge request Mordil/swift-redi-stack!98
2019-12-31 01:22:20 +00: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 47480b8074 Update Linux test manifest 2019-12-30 17:17:24 -08:00
Nathan Harris 346d37d636 Merge branch 'revisit-zadd' into 'master'
Revisit the SortedSet `zadd` command API

See merge request Mordil/swift-redi-stack!97
2019-12-28 07:58:24 +00: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 4350e01097 Merge branch 'blocking-timeamount' into 'master'
Use `TimeAmount` for any `timeout` command arguments

See merge request Mordil/swift-redi-stack!96
2019-12-28 06:35:14 +00: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 0007a08697 Merge branch 'isconnected-req' into 'master'
Add `isConnected` property to `RedisClient` protocol

See merge request Mordil/swift-redi-stack!95
2019-12-28 06:13:16 +00: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 a5f9d76cac Merge branch 'typed-keys' into 'master'
Add type-safe representation of Redis keys

See merge request Mordil/swift-redi-stack!93
2019-12-28 05:42:08 +00: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 5d6c3d3f28 Merge branch 'authorize' into 'master'
Add authorize command

See merge request Mordil/swift-redi-stack!94
2019-12-25 08:28:40 +00: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 1.0.0-alpha.7.1 2019-12-16 15:47:03 -08:00
Nathan Harris 9747cf2e2b Merge branch 'custom-logging' into 'master'
Revist user Logging configuration for connections and clients

See merge request Mordil/swift-redi-stack!92
1.0.0-alpha.7
2019-12-13 23:47:32 +00: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 e0ebf9266b Merge branch 'variadic-overloads' into 'master'
Add variadic overloads for several commands

See merge request Mordil/swift-redi-stack!87
1.0.0-alpha.6.1
2019-10-27 07:01:05 +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 8ce1dd8257 Merge branch 'generic-get' into 'master'
Add RedisClient.get generic overload

See merge request Mordil/swift-redi-stack!86
2019-10-27 06:28:52 +00: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 5c39c83663 Add dev Docker Compose file 2019-10-26 22:47:23 -07:00