Skip to content

Commit

Permalink
fix final docs issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ktoso committed Nov 8, 2024
1 parent 384ac21 commit 3219803
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 22 deletions.
3 changes: 3 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,6 @@ let package = Package(
),
]
)
package.dependencies.append(
.package(url: "https://github.com/swiftlang/swift-docc-plugin", "1.0.0"..<"1.4.0")
)
2 changes: 1 addition & 1 deletion Sources/RediStack/Cluster/RedisHashSlot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ extension RedisHashSlot: CustomStringConvertible {
}

extension RedisHashSlot {
/// Creates a slot for a given `key`. A ``HashSlot`` is used to determine which shard to connect to.
/// Creates a slot for a given `key`. A `HashSlot` is used to determine which shard to connect to.
/// - Parameter key: The key used in a redis command
public init(key: String) {
// Banging is safe because the modulo ensures we are in range
Expand Down
7 changes: 5 additions & 2 deletions Sources/RediStack/Commands/ListCommands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ extension RedisClient {
/// - Parameters:
/// - source: The key of the list to pop from.
/// - dest: The key of the list to push to.
/// - type: The type to convert the value to.
/// - valueType: Type of the value.
/// - Returns: The element that was moved. This value is `nil` if the `RESPValue` conversion failed.
@inlinable
public func rpoplpush<Value: RESPValueConvertible>(
Expand Down Expand Up @@ -601,7 +601,7 @@ extension RedisClient {
/// - source: The key of the list to pop from.
/// - dest: The key of the list to push to.
/// - timeout: The max time to wait for a value to use. `0` seconds means to wait indefinitely.
/// - type: The type to convert the value to.
/// - valueType: Type of the value.
/// - Returns: The element popped from the source list and pushed to the destination.
/// If the timeout was reached or `RESPValue` conversion failed, the returned value will be `nil`.
@inlinable
Expand Down Expand Up @@ -765,6 +765,7 @@ extension RedisClient {
///
/// See [https://redis.io/commands/rpop](https://redis.io/commands/rpop)
/// - Parameter key: The key of the list to pop from.
/// - Parameter type: The type of the value.
/// - Returns: The element that was popped from the list. If the list is empty or the `RESPValue` conversion fails, this value is `nil`.
@inlinable
public func rpop<Value: RESPValueConvertible>(from key: RedisKey, as type: Value.Type) -> EventLoopFuture<Value?> {
Expand Down Expand Up @@ -1058,6 +1059,7 @@ extension RedisClient {
/// - Parameters:
/// - keys: The keys of lists in Redis that should be popped from.
/// - timeout: The max time to wait for a value to use. `0`seconds means to wait indefinitely.
/// - valueType: Type of the value.
/// - Returns:
/// If timeout was reached or `RESPValue` conversion failed, `nil`.
///
Expand Down Expand Up @@ -1115,6 +1117,7 @@ extension RedisClient {
/// - Parameters:
/// - keys: The keys of lists in Redis that should be popped from.
/// - timeout: The max time to wait for a value to use. `0`seconds means to wait indefinitely.
/// - valueType: The type of the value.
/// - Returns:
/// If timeout was reached or `RESPValue` conversion failed, `nil`.
///
Expand Down
8 changes: 4 additions & 4 deletions Sources/RediStack/Commands/SetCommands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ extension RedisClient {
/// See [https://redis.io/commands/srandmember](https://redis.io/commands/srandmember)
/// - Parameters:
/// - key: The key of the set.
/// - type; The type to convert the values to.
/// - type: The type to convert the values to.
/// - count: The max number of elements to select from the set.
/// - Returns: The elements randomly selected from the set. Elements that fail the `RESPValue` conversion will be `nil`.
@inlinable
Expand Down Expand Up @@ -349,7 +349,7 @@ extension RedisClient {
/// See [https://redis.io/commands/sdiffstore](https://redis.io/commands/sdiffstore)
/// - Parameters:
/// - destination: The key of the new set from the result.
/// - sources: The list of source sets to calculate the difference of.
/// - keys: The list of source sets to calculate the difference of.
/// - Returns: The number of elements in the difference result.
public func sdiffstore(as destination: RedisKey, sources keys: [RedisKey]) -> EventLoopFuture<Int> {
assert(keys.count > 0, "At least 1 key should be provided.")
Expand Down Expand Up @@ -424,7 +424,7 @@ extension RedisClient {
/// See [https://redis.io/commands/sinterstore](https://redis.io/commands/sinterstore)
/// - Parameters:
/// - destination: The key of the new set from the result.
/// - sources: A list of source sets to calculate the intersection of.
/// - keys: A list of source sets to calculate the intersection of.
/// - Returns: The number of elements in the intersection result.
public func sinterstore(as destination: RedisKey, sources keys: [RedisKey]) -> EventLoopFuture<Int> {
assert(keys.count > 0, "At least 1 key should be provided.")
Expand Down Expand Up @@ -499,7 +499,7 @@ extension RedisClient {
/// See [https://redis.io/commands/sunionstore](https://redis.io/commands/sunionstore)
/// - Parameters:
/// - destination: The key of the new set from the result.
/// - sources: A list of source sets to calculate the union of.
/// - keys: A list of source sets to calculate the union of.
/// - Returns: The number of elements in the union result.
public func sunionstore(as destination: RedisKey, sources keys: [RedisKey]) -> EventLoopFuture<Int> {
assert(keys.count > 0, "At least 1 key should be provided.")
Expand Down
34 changes: 20 additions & 14 deletions Sources/RediStack/Commands/SortedSetCommands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,6 @@ extension RedisClient {
/// - Parameters:
/// - key: The key of the SortedSet that will be counted.
/// - maxScore: The maximum score bound an element in the SortedSet should have in order to be counted.
/// - exclusive: Should the `maxScore` provided be exclusive? If `true`, scores matching the `maxScore` will **not** be counted.
/// - Returns: The count of elements in the SortedSet below the `maxScore` threshold.
public func zcount(of key: RedisKey, withMaximumScoreOf maxScore: RedisZScoreBound) -> EventLoopFuture<Int> {
self.zcount(of: key, withScoresBetween: (.inclusive(-.infinity), maxScore))
Expand Down Expand Up @@ -808,7 +807,7 @@ extension RedisClient {
/// - destination: The key of the new sorted set from the result.
/// - sources: The list of sorted set keys to treat as the source of the union.
/// - weights: The multiplying factor to apply to the corresponding `sources` key based on index of the two parameters.
/// - aggregateMethod: The method of aggregating the values of the union. If one isn't specified, Redis will default to `.sum`.
/// - aggregate: The method of aggregating the values of the union. If one isn't specified, Redis will default to `.sum`.
/// - Returns: The number of elements in the new sorted set.
public func zunionstore(
as destination: RedisKey,
Expand All @@ -827,7 +826,7 @@ extension RedisClient {
/// - destination: The key of the new sorted set from the result.
/// - sources: The list of sorted set keys to treat as the source of the intersection.
/// - weights: The multiplying factor to apply to the corresponding `sources` key based on index of the two parameters.
/// - aggregateMethod: The method of aggregating the values of the intersection. If one isn't specified, Redis will default to `.sum`.
/// - aggregate: The method of aggregating the values of the intersection. If one isn't specified, Redis will default to `.sum`.
/// - Returns: The number of elements in the new sorted set.
public func zinterstore(
as destination: RedisKey,
Expand Down Expand Up @@ -884,6 +883,7 @@ extension RedisClient {
/// - key: The key of the SortedSet
/// - firstIndex: The index of the first element to include in the range of elements returned.
/// - lastIndex: The index of the last element to include in the range of elements returned.
/// - includeScores: If to include scores in result value.
/// - Returns: An array of elements found within the range specified.
public func zrange(
from key: RedisKey,
Expand Down Expand Up @@ -927,6 +927,7 @@ extension RedisClient {
/// - Parameters:
/// - key: The key of the SortedSet to return elements from.
/// - range: The range of inclusive indices of elements to get.
/// - includeScores: If to include scores in result value.
/// - Returns: An array of elements found within the range specified.
public func zrange(
from key: RedisKey,
Expand Down Expand Up @@ -974,6 +975,7 @@ extension RedisClient {
/// - Parameters:
/// - key: The key of the SortedSet to return elements from.
/// - range: The range of indices (inclusive lower, exclusive upper) elements to get.
/// - includeScores: If to include scores in result value.
/// - Returns: An array of elements found within the range specified.
public func zrange(
from key: RedisKey,
Expand Down Expand Up @@ -1007,6 +1009,7 @@ extension RedisClient {
/// - Parameters:
/// - key: The key of the SortedSet to return elements from.
/// - index: The index of the first element that will be in the returned values.
/// - includeScores: If to include scores in result value.
/// - Returns: An array of elements from the SortedSet between the index and the end.
public func zrange(
from key: RedisKey,
Expand Down Expand Up @@ -1035,6 +1038,7 @@ extension RedisClient {
/// - Parameters:
/// - key: The key of the SortedSet to return elements from.
/// - index: The index of the last element that will be in the returned values.
/// - includeScores: If to include scores in result value.
/// - Returns: An array of elements from the start of a SortedSet to the index.
public func zrange(
from key: RedisKey,
Expand Down Expand Up @@ -1238,6 +1242,7 @@ extension RedisClient {
/// - Parameters:
/// - key: The key of the SortedSet to return elements from.
/// - index: The index of the last element that will be in the returned values.
/// - includeScores: If to include scores in result value.
/// - Returns: An array of elements from the start of a SortedSet to the index.
public func zrevrange(
from key: RedisKey,
Expand Down Expand Up @@ -1266,6 +1271,7 @@ extension RedisClient {
/// - Parameters:
/// - key: The key of the SortedSet to return elements from.
/// - index: The index of the last element to not include in the returned values.
/// - includeScores: If to include scores in result value.
/// - Returns: An array of elements from the start of the SortedSet and up to the index.
public func zrevrange(
from key: RedisKey,
Expand Down Expand Up @@ -1385,7 +1391,7 @@ extension RedisClient {
/// For the inverse, see `zrevrangebyscore(from:withMinimumScoreOf:limitBy:includeScoresInResponse:)`.
/// - Parameters:
/// - key: The key of the SortedSet.
/// - range: The minimum score bound an element in the SortedSet should have to be included in the response.
/// - minScore: The minimum score bound an element in the SortedSet should have to be included in the response.
/// - limit: The optional offset and count of elements to query.
/// - includeScores: Should the response array contain the elements AND their scores? If `true`, the response array will follow the pattern [Item_1, Score_1, Item_2, ...]
/// - Returns: An array of elements from the SortedSet that were within the range provided, and optionally their scores.
Expand All @@ -1411,7 +1417,7 @@ extension RedisClient {
/// For the inverse, see `zrevrangebyscore(from:withMaximumScoreOf:limitBy:includeScoresInResponse:)`.
/// - Parameters:
/// - key: The key of the SortedSet.
/// - range: The maximum score bound an element in the SortedSet should have to be included in the response.
/// - maxScore: The maximum score bound an element in the SortedSet should have to be included in the response.
/// - limit: The optional offset and count of elements to query.
/// - includeScores: Should the response array contain the elements AND their scores? If `true`, the response array will follow the pattern [Item_1, Score_1, Item_2, ...]
/// - Returns: An array of elements from the SortedSet that were within the range provided, and optionally their scores.
Expand Down Expand Up @@ -1516,8 +1522,8 @@ extension RedisClient {
/// For the inverse, see `zrangebyscore(from:withMinimumScoreOf:limitBy:includeScoresInResponse:)`.
/// - Parameters:
/// - key: The key of the SortedSet.
/// - range: The minimum score bound an element in the SortedSet should have to be included in the response.
/// - limit: The optional offset and count of elements to query.
/// - limit: The minimum score bound an element in the SortedSet should have to be included in the response.
/// - minScore: The minimum score to compare against.
/// - includeScores: Should the response array contain the elements AND their scores? If `true`, the response array will follow the pattern [Item_1, Score_1, Item_2, ...]
/// - Returns: An array of elements from the SortedSet that were within the range provided, and optionally their scores.
public func zrevrangebyscore(
Expand All @@ -1542,8 +1548,8 @@ extension RedisClient {
/// For the inverse, see `zrangebyscore(from:withMaximumScoreOf:limitBy:includeScoresInResponse:)`.
/// - Parameters:
/// - key: The key of the SortedSet.
/// - range: The maximum score bound an element in the SortedSet should have to be included in the response.
/// - limit: The optional offset and count of elements to query.
/// - maxScore: The max score to compare against.
/// - limit: The maximum score bound an element in the SortedSet should have to be included in the response.
/// - includeScores: Should the response array contain the elements AND their scores? If `true`, the response array will follow the pattern [Item_1, Score_1, Item_2, ...]
/// - Returns: An array of elements from the SortedSet that were within the range provided, and optionally their scores.
public func zrevrangebyscore(
Expand Down Expand Up @@ -1605,7 +1611,7 @@ extension RedisClient {
/// - Parameters:
/// - key: The key of the SortedSet that will be counted.
/// - range: The min and max value bounds for filtering elements by.
/// - limitBy: The optional offset and count of elements to query.
/// - limit: The optional offset and count of elements to query.
/// - Returns: An array of elements from the SortedSet that were within the range provided.
@inlinable
public func zrangebylex<Value: CustomStringConvertible>(
Expand Down Expand Up @@ -1658,7 +1664,7 @@ extension RedisClient {
/// For the inverse, see `zrevrangebylex(from:withMaximumValueOf:limitBy:)`.
/// - Parameters:
/// - key: The key of the SortedSet.
/// - minValue: The maximum lexiographical value an element in the SortedSet should have to be included in the result set.
/// - maxValue: The maximum lexiographical value an element in the SortedSet should have to be included in the result set.
/// - limit: The optional offset and count of elements to query
/// - Returns: An array of elements from the SortedSet below the `maxValue` threshold.
@inlinable
Expand Down Expand Up @@ -1687,7 +1693,7 @@ extension RedisClient {
/// - Parameters:
/// - key: The key of the SortedSet that will be counted.
/// - range: The min and max value bounds for filtering elements by.
/// - limitBy: The optional offset and count of elements to query.
/// - limit: The optional offset and count of elements to query.
/// - Returns: An array of elements from the SortedSet that were within the range provided.
@inlinable
public func zrevrangebylex<Value: CustomStringConvertible>(
Expand Down Expand Up @@ -1740,7 +1746,7 @@ extension RedisClient {
/// For the inverse, see `zrangebylex(from:withMaximumValueOf:limitBy:)`.
/// - Parameters:
/// - key: The key of the SortedSet.
/// - minValue: The maximum lexiographical value an element in the SortedSet should have to be included in the result set.
/// - maxValue: The maximum lexiographical value an element in the SortedSet should have to be included in the result set.
/// - limit: The optional offset and count of elements to query
/// - Returns: An array of elements from the SortedSet below the `maxValue` threshold.
@inlinable
Expand Down Expand Up @@ -2046,7 +2052,7 @@ extension RedisClient {
/// See `RedisZScoreBound` and [https://redis.io/commands/zremrangebyscore](https://redis.io/commands/zremrangebyscore)
/// - Parameters:
/// - key: The key of the SortedSet to remove elements from.
/// - minScore: The maximum score bound an element in the SortedSet should have to be removed.
/// - maxScore: The maximum score bound an element in the SortedSet should have to be removed.
/// - Returns: The count of elements that were removed from the SortedSet.
public func zremrangebyscore(
from key: RedisKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ extension RedisConnectionPool {
/// Subsequent backoffs are computed by compounding this value by `connectionBackoffFactor`.
/// - connectionRetryTimeout: The max time to wait for a connection to be available before failing a particular command or connection operation.
/// The default is 60 seconds.
/// - onUnexpectedConnectionClose: Called when the connection unexpectedly is closed.
/// - poolDefaultLogger: The `Logger` used by the connection pool itself.
public init(
initialServerConnectionAddresses: [SocketAddress],
Expand Down
1 change: 1 addition & 0 deletions Sources/RediStack/ConnectionPool/RedisConnectionPool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import Logging
import NIOConcurrencyHelpers
import NIOCore

import struct Foundation.UUID

/// A `RedisConnectionPool` is an implementation of `RedisClient` backed by a pool of connections to Redis,
Expand Down
3 changes: 3 additions & 0 deletions Sources/RediStack/RESP/RESPValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ extension EventLoopFuture where Value == RESPValue {
/// This method is intended to be used much like a precondition in synchronous code, where a value is expected to be available from the `RESPValue`.
/// - Important: If the `RESPValueConvertible` initializer fails, then the `NIO.EventLoopFuture` will fail.
/// - Parameter to: The desired type to convert to.
/// - Parameter type: The resulting type.
/// - Parameter file: Source file location where the method was called.
/// - Parameter line: Source line location where the method was called.
/// - Throws: `RedisClientError.failedRESPConversion(to:)`
/// - Returns: A `NIO.EventLoopFuture` that resolves a value of the desired type or fails if the conversion does.
@usableFromInline
Expand Down
2 changes: 2 additions & 0 deletions Sources/RediStackTestUtils/_Deprecations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ extension RedisConnection {
/// If `REDIS_PW` is not defined, no authentication will happen on the connection.
/// - Parameters:
/// - eventLoop: The event loop that the connection should execute on.
/// - host: the host to connect to.
/// - port: The port to connect on.
/// - password: The optional password to use while connecting.
/// - Returns: A `NIO.EventLoopFuture` that resolves with the new connection.
@available(*, deprecated, message: "Use RedisConnection.make(configuration:boundEventLoop:) method")
public static func connect(
Expand Down
2 changes: 1 addition & 1 deletion Sources/RedisTypes/RedisSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ extension RedisSet {
/// Removes the given element from the set.
///
/// See `RediStack.RedisClient.srem(_:from:)`
/// - Parameter members: The element in the set to remove.
/// - Parameter member: The element in the set to remove.
/// - Returns: A `NIO.EventLoopFuture<Bool>` resolving `true` if `member` was removed from the set; otherwise, `false`.
public func remove(_ member: Element) -> EventLoopFuture<Bool> {
self.remove([member])
Expand Down

0 comments on commit 3219803

Please sign in to comment.