Commit Graph

284 Commits

Author SHA1 Message Date
Nathan Harris 755f6311a0 Merge pull request #34 from Mordil/bytebuffers
Rework RESPValue to use ByteBuffers for .simpleString and .bulkString
2019-04-09 16:32:31 -07:00
Nathan Harris d93511b8d0 Rework RESPValue to use ByteBuffers for .simpleString and .bulkString
Motivation:

Throughout the process of creating and using RESPValue, many unnecessary allocations happened translating ByteBuffers into [Int8] raw byte arrays.

Results:

RESPValue has a more conherent underlying data structure and computed properties, while decoding RESP is more straight forward and performant

Resolves #31
2019-04-09 16:29:24 -07:00
Nathan Harris 741482dbfb Update CI Config to test both Ubuntu Xenial & Bionic and to use official Swift images 2019-04-09 11:55:15 -07:00
Nathan Harris 4cfc326c4d Update to latest SwiftLog names 2019-04-09 11:42:52 -07:00
Nathan Harris b3c1afa27a Merge pull request #30 from Mordil/29-replace-data
Replace `Foundation.Data` with `[UInt8]` type everywhere
2019-04-01 09:25:06 -07:00
Nathan Harris 3c53d4404b Replace Foundation.Data with [UInt8] type everywhere
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.
2019-04-01 09:23:45 -07:00
Nathan Harris 51dd32dabd Add a warning log in RedisConnection deinit 2019-03-28 22:03:17 -07:00
Nathan Harris 0797c3f44a Merge pull request #27 from Mordil/remove-authorize
Remove `authorize` convenience command method
0.6.0
2019-03-27 23:08:16 -07:00
Nathan Harris 2b7b2130ca Remove authorize convenience command method
Motivation:

As this command is embedded in the creation of a `RedisConnection` and you authorize an entire connection to a Redis instance - this command serves no purpose and could make it easier for users to shoot themselves in the foot.

Results:

`authorize(with:)` convenience method is removed, and the `RedisConnection.connect` method now sends a raw command
2019-03-27 23:07:01 -07:00
Nathan Harris 152eb30fa1 Merge pull request #25 from Mordil/remove-driver
Remove `RedisDriver`
2019-03-27 23:02:07 -07:00
Nathan Harris db4a156d05 Remove RedisDriver
Motivation:

`RedisDriver` has one of the weakest use cases for existence, as its entire purpose can be solved with a static function on `RedisConnection`.

Result:

`RedisDriver` no longer is a thing, and a simpler process of creating a `RedisConnection` is available through the static method `connect(to:with:on:logger:)`.

Also, the `ClientBootstrap.makeForRedis(using:)` method has been cleaned up and renamed to `ClientBootstrap.makeRedisDefault(using:)`.
2019-03-27 22:56:40 -07:00
Nathan Harris ba6bf6d8d2 Merge pull request #26 from Mordil/redis-pipeline
Simplify `RedisPipeline`
2019-03-27 22:45:54 -07:00
Nathan Harris c4ea8f9e49 Simplify RedisPipeline
Motivation:

`RedisPipeline` has a weak use case as a protocol, as it is more than likely 98% of use cases will end up using the `NIORedisPipeline` implementation.

Result:

`RedisPipeline` is more direct in its intended usage, with comment blocks being more clear.
2019-03-27 22:44:46 -07:00
Nathan Harris 0f7b53f243 Merge pull request #24 from Mordil/redis-client
Simplify `RedisCommandExecutor` and `RedisConnection`
2019-03-27 22:39:52 -07:00
Nathan Harris 9f049eb4b5 Simplify RedisCommandExecutor and RedisConnection
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.
2019-03-27 22:36:52 -07:00
Nathan Harris 869625d47d Update to use NIO 2 2019-03-26 08:46:51 -07:00
Nathan Harris 2dd1d309c0 Merge pull request #22 from Mordil/command-audit
Command audit
0.5.0
2019-03-25 13:39:42 -07:00
Nathan Harris 16dc4ac1bf Updated unit tests to use new syntax and to remove a bunch of optional crud 2019-03-25 13:37:40 -07:00
Nathan Harris f4e646c1aa Audit convenience commands
Motivation:

Performance, clarity, and uniformity with code documentation, Swift API, and data types.
2019-03-25 13:37:40 -07:00
Nathan Harris 601431ac9e Merge pull request #21 from Mordil/sorted-set-commands
Add convenience command methods for Sorted Set with unit tests
2019-03-23 22:31:00 -07:00
Nathan Harris bcc7f71186 Add convenience command methods for Sorted Set with unit tests 2019-03-23 22:29:38 -07:00
Nathan Harris 1c5eab6030 Merge pull request #20 from Mordil/list-commands
Add list convenience commands with unit tests
2019-03-21 19:45:32 -07:00
Nathan Harris 050ad64eaa Add list convenience commands with unit tests 2019-03-21 19:41:29 -07:00
Nathan Harris 21fc0a4031 Make extension properties on RESPValue to all be public 2019-03-21 19:41:08 -07:00
Nathan Harris f3a9b321a6 Merge pull request #19 from Mordil/hash-commands
Add hash convenience commands with unit tests
2019-03-21 16:05:04 -07:00
Nathan Harris 39feecb4cb Add hash convenience commands with unit tests 2019-03-21 16:00:19 -07:00
Nathan Harris 17f77363ae Fix scan method and add unit test 2019-03-21 14:07:15 -07:00
Nathan Harris d7b029fe29 Add scan convenience method and refactor sscan to use new generic internal implementation for scan 2019-03-20 22:18:34 -07:00
Nathan Harris 9a51cf95eb Merge pull request #18 from Mordil/more-basic-commands
More basic commands
2019-03-20 14:16:41 -07:00
Nathan Harris 4c7fe40419 Add mset, msetnx, mget, incr, incrby, incrbyfloat, decr, and decrby convenience methods with unit tests 2019-03-20 14:13:11 -07:00
Nathan Harris 55fbbcc1f5 Reorganize code into related extensions 2019-03-20 13:22:40 -07:00
Nathan Harris 5a35a918ae Add extension to EventLoopFuture for RESPValueConvertible Values for easier mapping 2019-03-20 12:43:08 -07:00
Nathan Harris e4e32fd59a Merge pull request #17 from Mordil/14-logging
Add initial `swift-log` support for most paths
0.4.0
2019-03-18 22:06:20 -07:00
Nathan Harris 73d5930f34 Add initial swift-log support for most paths
Closes #14
2019-03-18 22:04:47 -07:00
Nathan Harris b6f53cfa8c Merge pull request #15 from Mordil/redis-protocols
Refactor `RedisConnection` and `RedisPipeline` into protocols.
2019-03-18 19:51:29 -07:00
Nathan Harris 6b30127f6b Refactor RedisConnection and RedisPipeline into protocols.
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`.
2019-03-18 19:48:36 -07:00
Nathan Harris 6825451963 Improve RedisConnection.close() to send a QUIT command to Redis before closing the channel from the client 2019-03-18 19:19:46 -07:00
Nathan Harris 35a4fa02ac Merge pull request #16 from Mordil/general-commands
General commands
2019-03-18 19:01:00 -07:00
Nathan Harris 9f505be4d2 Add echo, ping, and swapdb command extensions with unit tests 2019-03-18 18:59:12 -07:00
Nathan Harris 618481fe1e Add RESPValueConvertible conformance to Optional 2019-03-18 18:57:59 -07:00
Nathan Harris 5c32b97a0c Remove DispatchRedis 2019-03-17 14:06:21 -07:00
Nathan Harris 596b9b98cb Merge pull request #13 from Mordil/set-commands
Add all Set commands with unit tests
0.3.0
2019-03-12 23:15:48 -07:00
Nathan Harris 00bf027330 Add all Set commands with unit tests
This contributes to #10
2019-03-12 23:14:44 -07:00
Nathan Harris 571d7bce02 Housekeeping of code
- Move: `String.convertedToData()` to `NIORedisTests` as a test utility
- Change: URLs in code comments to be Markdown links
- Change: Code comments to be more correct
2019-03-12 14:42:11 -07:00
Nathan Harris a17bfff3ff Merge pull request #12 from Mordil/9-direct-bytebuffer
Update `RESPEncoder` to write to `ByteBuffer` directly
2019-03-12 14:35:15 -07:00
Nathan Harris 9c5db400b2 Update RESPEncoder to write to ByteBuffer directly
This is to remove the need of allocations with Foundation.Data before writing to the buffer.

We should see an estimated ~10% performance boost to encoding values.
2019-03-12 14:31:42 -07:00
Nathan Harris b4fc9f3ae5 Update to latest SwiftNIO 2019-03-11 21:41:13 -07:00
Nathan Harris 0e2808c9f7 Merge pull request #11 from tanner0101/nio2-ctx-fixes
nio 2 ctx fixes
2019-02-28 23:02:59 -08:00
tanner0101 5a831fad05 nio 2 ctx fixes 2019-02-28 22:05:42 -05:00
Nathan Harris 4d9afa5ba0 Update to latest NIO2 changes 2019-02-12 22:45:25 -08:00