Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 334cf92

Browse files
authoredOct 21, 2023
Merge branch 'main' into feature/jo/resp-benchmarker
2 parents 55313ea + e243c4e commit 334cf92

18 files changed

+840
-188
lines changed
 

Diff for: ‎.github/release.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
changelog:
2+
categories:
3+
- title: SemVer Major
4+
labels:
5+
- semver/major
6+
- title: SemVer Minor
7+
labels:
8+
- semver/minor
9+
- title: SemVer Patch
10+
labels:
11+
- semver/patch
12+
- title: Other Changes
13+
labels:
14+
- semver/none
15+
- title: 🚨🚨🚨 Missing Labels - Add labels to the prs listed here and generate the release notes again
16+
labels:
17+
- "*"
18+

Diff for: ‎NOTICE.txt

+33-68
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ components that this product depends on.
2626

2727
-------------------------------------------------------------------------------
2828

29-
This product was heavily influenced by implementations from the Vapor and NozeIO frameworks.
29+
This product was heavily influenced by Vapor and NozeIO.
3030

3131
* NozeIO
3232
* LICENSE (Apache License 2.0)
@@ -41,71 +41,36 @@ This product was heavily influenced by implementations from the Vapor and NozeIO
4141

4242
---
4343

44-
This product contains the entire library from Apple's SwiftLog API.
45-
46-
* LICENSE (Apache License 2.0):
47-
* https://github.com/apple/swift-log/blob/master/LICENSE.txt
48-
* HOMEPAGE:
49-
* https://github.com/apple/swift-log
50-
51-
---
52-
53-
This product contains the entire library from Apple's SwiftMetrics API.
54-
55-
* LICENSE (Apache License 2.0):
56-
* https://github.com/apple/swift-metrics/blob/master/LICENSE.txt
57-
* HOMEPAGE:
58-
* https://github.com/apple/swift-metrics
59-
60-
---
61-
62-
This product contains the entire library and derivations of various scripts from Apple's SwiftNIO.
63-
64-
* LICENSE (Apache License 2.0):
65-
* https://github.com/apple/swift-nio/blob/master/LICENSE.txt
66-
* HOMEPAGE:
67-
* https://github.com/apple/swift-nio
68-
69-
---
70-
71-
This product contains a derivation of the Tony Stone's 'process_test_files.rb'.
72-
73-
* LICENSE (Apache License 2.0):
74-
* https://www.apache.org/licenses/LICENSE-2.0
75-
* HOMEPAGE:
76-
* https://codegists.com/snippet/ruby/generate_xctest_linux_runnerrb_tonystone_ruby
77-
78-
---
79-
80-
This product contains NodeJS's http-parser.
81-
82-
* LICENSE (MIT):
83-
* https://github.com/nodejs/http-parser/blob/master/LICENSE-MIT
84-
* HOMEPAGE:
85-
* https://github.com/nodejs/http-parser
86-
87-
---
88-
89-
This product contains "cpp_magic.h" from Thomas Nixon & Jonathan Heathcote's uSHET
90-
91-
* LICENSE (MIT):
92-
* https://github.com/18sg/uSHET/blob/master/LICENSE
93-
* HOMEPAGE:
94-
* https://github.com/18sg/uSHET
95-
96-
---
97-
98-
This product contains "sha1.c" and "sha1.h" from FreeBSD (Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project)
99-
100-
* LICENSE (BSD-3):
101-
* https://opensource.org/licenses/BSD-3-Clause
102-
* HOMEPAGE:
103-
* https://github.com/freebsd/freebsd/tree/master/sys/crypto
104-
105-
---
106-
This product contains "ifaddrs-android.c" and "ifaddrs-android.h" from dxr.mozilla.org. Webrtc is the owner, but we use edited version from mozilla repo (Copyright (c) 2011, The WebRTC project authors. All rights reserved)
107-
108-
* LICENSE (BSD):
109-
* https://webrtc.googlesource.com/src/+/master/LICENSE
44+
This product contains a a derivation of Georges Menie's crc16 algorithm that was adopted
45+
to Redis coding style by Salvatore Sanfilippo.
46+
47+
* LICENSE:
48+
/*
49+
* Copyright 2001-2010 Georges Menie (www.menie.org)
50+
* Copyright 2010 Salvatore Sanfilippo (adapted to Redis coding style)
51+
* All rights reserved.
52+
* Redistribution and use in source and binary forms, with or without
53+
* modification, are permitted provided that the following conditions are met:
54+
*
55+
* * Redistributions of source code must retain the above copyright
56+
* notice, this list of conditions and the following disclaimer.
57+
* * Redistributions in binary form must reproduce the above copyright
58+
* notice, this list of conditions and the following disclaimer in the
59+
* documentation and/or other materials provided with the distribution.
60+
* * Neither the name of the University of California, Berkeley nor the
61+
* names of its contributors may be used to endorse or promote products
62+
* derived from this software without specific prior written permission.
63+
*
64+
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
65+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
66+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
67+
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
68+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
69+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
70+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
71+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
72+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
73+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
74+
*/
11075
* HOMEPAGE:
111-
* https://webrtc.googlesource.com/
76+
* https://redis.io/docs/reference/cluster-spec/#appendix-a-crc16-reference-implementation-in-ansi-c

Diff for: ‎README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ dependencies: [
2929

3030
## Getting Started
3131

32-
**RediStack** is quick to use - all you need is an [`EventLoop`](https://apple.github.io/swift-nio/docs/current/NIO/Protocols/EventLoop.html) from **SwiftNIO**.
32+
**RediStack** is quick to use - all you need is an [`EventLoop`](https://swiftpackageindex.com/apple/swift-nio/main/documentation/niocore/eventloop) from **SwiftNIO**.
3333

3434
```swift
3535
import NIOCore
36+
import NIOPosix
3637
import RediStack
3738

38-
let eventLoop: EventLoop = ...
39+
let eventLoop: EventLoop = NIOSingletons.posixEventLoopGroup.any()
3940
let connection = RedisConnection.make(
4041
configuration: try .init(hostname: "127.0.0.1"),
4142
boundEventLoop: eventLoop
@@ -76,7 +77,7 @@ Check out [CONTRIBUTORS.txt](https://github.com/swift-server/RediStack/blob/main
7677

7778
| Proposal | Pitch | Discussion | Review | Vote |
7879
|:---:|:---:|:---:|:---:|:---:|
79-
| [SSWG-0004](https://github.com/swift-server/sswg/blob/master/proposals/0004-nio-redis.md) | [2019-01-07](https://forums.swift.org/t/swiftnio-redis-client/19325) | [2019-04-01](https://forums.swift.org/t/discussion-nioredis-nio-based-redis-driver/22455) | [2019-06-09](https://forums.swift.org/t/feedback-redisnio-a-nio-based-redis-driver/25521) | [2019-06-27](https://forums.swift.org/t/june-27th-2019/26580) |
80+
| [SSWG-0004](https://github.com/swift-server/sswg/blob/main/proposals/0004-nio-redis.md) | [2019-01-07](https://forums.swift.org/t/swiftnio-redis-client/19325) | [2019-04-01](https://forums.swift.org/t/discussion-nioredis-nio-based-redis-driver/22455) | [2019-06-09](https://forums.swift.org/t/feedback-redisnio-a-nio-based-redis-driver/25521) | [2019-06-27](https://forums.swift.org/t/june-27th-2019/26580) |
8081

8182
## Language and Platform Support
8283

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the RediStack open source project
4+
//
5+
// Copyright (c) 2023 RediStack project authors
6+
// Licensed under Apache License v2.0
7+
//
8+
// See LICENSE.txt for license information
9+
// See CONTRIBUTORS.txt for the list of RediStack project authors
10+
//
11+
// SPDX-License-Identifier: Apache-2.0
12+
//
13+
//===----------------------------------------------------------------------===//
14+
15+
import NIOCore
16+
17+
/// A description of a single node that is part of a redis cluster
18+
public protocol RedisClusterNodeDescriptionProtocol: Sendable, Equatable {
19+
/// The node's host name.
20+
var host: String? { get }
21+
/// The node's ip address.
22+
var ip: String? { get }
23+
/// The nodes endpoint. This should normally be the ``host`` if the node has a routable hostname.
24+
/// Otherwise it is the ``ip``. This property is used to create connections to the node.
25+
var endpoint: String { get }
26+
/// The node's redis port
27+
var port: Int { get }
28+
/// Defines if TLS shall be used to create a connection to the node
29+
var useTLS: Bool { get }
30+
31+
/// A resolved SocketAddress to the node. We will remove this property as soon as we have fixed
32+
/// the underlying Redis implementation.
33+
var socketAddress: SocketAddress { get }
34+
}
35+
36+
extension RedisClusterNodeDescriptionProtocol {
37+
func isSame<Other: RedisClusterNodeDescriptionProtocol>(_ other: Other) -> Bool {
38+
return self.ip == other.ip
39+
&& self.port == other.port
40+
&& self.endpoint == other.endpoint
41+
&& self.useTLS == other.useTLS
42+
&& self.host == other.host
43+
}
44+
}
45+
46+
extension RedisClusterNodeDescriptionProtocol {
47+
@inlinable
48+
public var id: RedisClusterNodeID {
49+
RedisClusterNodeID(endpoint: self.endpoint, port: self.port)
50+
}
51+
}

Diff for: ‎Sources/RediStack/Cluster/RedisClusterNodeID.swift

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the RediStack open source project
4+
//
5+
// Copyright (c) 2023 RediStack project authors
6+
// Licensed under Apache License v2.0
7+
//
8+
// See LICENSE.txt for license information
9+
// See CONTRIBUTORS.txt for the list of RediStack project authors
10+
//
11+
// SPDX-License-Identifier: Apache-2.0
12+
//
13+
//===----------------------------------------------------------------------===//
14+
15+
/// Properties to identifiy a Node in a Redis cluster
16+
public struct RedisClusterNodeID: Hashable, Sendable {
17+
/// The node's endpoint. This might be the hostname (preferred) or ip address
18+
public var endpoint: String
19+
/// The node's redis port
20+
public var port: Int
21+
22+
public init(endpoint: String, port: Int) {
23+
self.endpoint = endpoint
24+
self.port = port
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the RediStack open source project
4+
//
5+
// Copyright (c) 2023 RediStack project authors
6+
// Licensed under Apache License v2.0
7+
//
8+
// See LICENSE.txt for license information
9+
// See CONTRIBUTORS.txt for the list of RediStack project authors
10+
//
11+
// SPDX-License-Identifier: Apache-2.0
12+
//
13+
//===----------------------------------------------------------------------===//
14+
15+
/// A description of a single shard that is part of a redis cluster
16+
public protocol RedisClusterShardDescriptionProtocol: Identifiable, Sendable {
17+
associatedtype NodeDescription: RedisClusterNodeDescriptionProtocol
18+
19+
/// The shard's master node
20+
var master: NodeDescription { get }
21+
22+
/// The shard's replica nodes
23+
var replicas: [NodeDescription] { get }
24+
}

0 commit comments

Comments
 (0)
Please sign in to comment.