334 Commits

Author SHA1 Message Date
Nathan Harris 660d4e966f fixes 2020-06-01 00:16:18 -07:00
Nathan Harris 03c158fe3e fixes 2020-06-01 00:11:41 -07:00
Nathan Harris e06144216f fixes 2020-06-01 00:10:44 -07:00
Nathan Harris 8702dbac0f fixes 2020-06-01 00:03:58 -07:00
Nathan Harris 582ab18e20 fixes 2020-05-31 23:53:14 -07:00
Nathan Harris d320885e34 fixes 2020-05-31 23:47:55 -07:00
Nathan Harris 70a8134c63 SR-12142 questions 2020-05-31 23:45:12 -07:00
Nathan Harris 308f1656a3 test 2020-05-31 23:44:36 -07:00
Nathan Harris 88d38f7988 wip 2020-05-31 23:44:01 -07:00
Nathan Harris 7e0d6ae735 wip 2020-05-31 23:44:01 -07:00
Nathan Harris 182d8c56ba wip 2020-05-31 23:44:01 -07:00
Nathan Harris b939bc3aa9 wip 2020-05-31 23:44:00 -07:00
Nathan Harris a5d9233c1a wip 2020-05-31 23:44:00 -07:00
Nathan Harris 79f7fe36ee wip 2020-05-31 23:44:00 -07:00
Nathan Harris 45862a1a98 wip 2020-05-31 23:44:00 -07:00
Nathan Harris 9b67064587 wip 2020-05-31 23:44:00 -07:00
Nathan Harris 8350a6038d wip 2020-05-31 23:44:00 -07:00
Nathan Harris 696639cb65 wip 2020-05-31 23:43:59 -07:00
Nathan Harris ecf67de582 wip 2020-05-31 23:43:59 -07:00
Nathan Harris 1234c713be wip 2020-05-31 23:43:59 -07:00
Nathan Harris 14b7d88850 Add code coverage tracking 2020-05-31 23:43:59 -07: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 60e79b71b8 Update URLs from swift-redi-stack to RediStack
Motivation:

The project was moved from Mordil/swift-redi-stack to Mordil/RediStack;
some URLs still point to swift-redi-stack.

Modifications:

- Update URLs in README and CHANGELOG

Result:

More accurate URLs; fewer warnings from GitLab :)
2020-05-29 17:06:49 +00: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 20848b8093 Move quality checks to be after unit tests 2020-05-08 16:16:10 -07:00
Nathan Harris c699aca17c Add CI for nightly trunk images of new linux platforms 2020-05-08 16:14:47 -07:00
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