Skip to content

Commit 5023075

Browse files
author
Nilanshu Sharma
committed
Custom responses for cluster commands
1 parent ee9ed4d commit 5023075

File tree

5 files changed

+595
-23
lines changed

5 files changed

+595
-23
lines changed

Sources/Valkey/Commands/ClusterCommands.swift

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,6 @@ public enum CLUSTER {
365365
/// Returns a list of all TCP links to and from peer nodes.
366366
@_documentation(visibility: internal)
367367
public struct LINKS: ValkeyCommand {
368-
public typealias Response = RESPToken.Array
369-
370368
@inlinable public static var name: String { "CLUSTER LINKS" }
371369

372370
@inlinable public init() {
@@ -789,8 +787,6 @@ public enum CLUSTER {
789787
}
790788
}
791789
}
792-
public typealias Response = RESPToken.Array
793-
794790
@inlinable public static var name: String { "CLUSTER SLOT-STATS" }
795791

796792
public var filter: Filter
@@ -807,8 +803,6 @@ public enum CLUSTER {
807803
/// Returns the mapping of cluster slots to nodes.
808804
@_documentation(visibility: internal)
809805
public struct SLOTS: ValkeyCommand {
810-
public typealias Response = RESPToken.Array
811-
812806
@inlinable public static var name: String { "CLUSTER SLOTS" }
813807

814808
@inlinable public init() {
@@ -1068,7 +1062,7 @@ extension ValkeyClientProtocol {
10681062
/// - Response: [Array]: An array of cluster links and their attributes.
10691063
@inlinable
10701064
@discardableResult
1071-
public func clusterLinks() async throws -> RESPToken.Array {
1065+
public func clusterLinks() async throws -> CLUSTER.LINKS.Response {
10721066
try await execute(CLUSTER.LINKS())
10731067
}
10741068

@@ -1229,7 +1223,7 @@ extension ValkeyClientProtocol {
12291223
/// - Response: [Array]: Array of nested arrays, where the inner array element represents a slot and its respective usage statistics.
12301224
@inlinable
12311225
@discardableResult
1232-
public func clusterSlotStats(filter: CLUSTER.SLOTSTATS.Filter) async throws -> RESPToken.Array {
1226+
public func clusterSlotStats(filter: CLUSTER.SLOTSTATS.Filter) async throws -> CLUSTER.SLOTSTATS.Response {
12331227
try await execute(CLUSTER.SLOTSTATS(filter: filter))
12341228
}
12351229

@@ -1244,7 +1238,7 @@ extension ValkeyClientProtocol {
12441238
/// - Response: [Array]: Nested list of slot ranges with networking information.
12451239
@inlinable
12461240
@discardableResult
1247-
public func clusterSlots() async throws -> RESPToken.Array {
1241+
public func clusterSlots() async throws -> CLUSTER.SLOTS.Response {
12481242
try await execute(CLUSTER.SLOTS())
12491243
}
12501244

0 commit comments

Comments
 (0)