Skip to content

Commit 90e3a29

Browse files
committed
Add static name to Valkey commands
1 parent 48287fc commit 90e3a29

22 files changed

+859
-9
lines changed

Sources/Valkey/Commands/BitmapCommands.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ public struct BITCOUNT: ValkeyCommand {
8282
}
8383
public typealias Response = Int
8484

85+
@inlinable public static var name: String { "BITCOUNT" }
86+
8587
public var key: ValkeyKey
8688
public var range: Range?
8789

@@ -247,6 +249,8 @@ public struct BITFIELD: ValkeyCommand {
247249
}
248250
public typealias Response = RESPToken.Array
249251

252+
@inlinable public static var name: String { "BITFIELD" }
253+
250254
public var key: ValkeyKey
251255
public var operations: [Operation]
252256

@@ -287,6 +291,8 @@ public struct BITFIELDRO: ValkeyCommand {
287291
}
288292
public typealias Response = [Int]
289293

294+
@inlinable public static var name: String { "BITFIELD_RO" }
295+
290296
public var key: ValkeyKey
291297
public var getBlocks: [GetBlock]
292298

@@ -328,6 +334,8 @@ public struct BITOP: ValkeyCommand {
328334
}
329335
public typealias Response = Int
330336

337+
@inlinable public static var name: String { "BITOP" }
338+
331339
public var operation: Operation
332340
public var destkey: ValkeyKey
333341
public var keys: [ValkeyKey]
@@ -405,6 +413,8 @@ public struct BITPOS: ValkeyCommand {
405413
}
406414
public typealias Response = Int
407415

416+
@inlinable public static var name: String { "BITPOS" }
417+
408418
public var key: ValkeyKey
409419
public var bit: Int
410420
public var range: Range?
@@ -429,6 +439,8 @@ public struct BITPOS: ValkeyCommand {
429439
public struct GETBIT: ValkeyCommand {
430440
public typealias Response = Int
431441

442+
@inlinable public static var name: String { "GETBIT" }
443+
432444
public var key: ValkeyKey
433445
public var offset: Int
434446

@@ -451,6 +463,8 @@ public struct GETBIT: ValkeyCommand {
451463
public struct SETBIT: ValkeyCommand {
452464
public typealias Response = Int
453465

466+
@inlinable public static var name: String { "SETBIT" }
467+
454468
public var key: ValkeyKey
455469
public var offset: Int
456470
public var value: Int

Sources/Valkey/Commands/ClusterCommands.swift

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public enum CLUSTER {
2828
/// Assigns new hash slots to a node.
2929
@_documentation(visibility: internal)
3030
public struct ADDSLOTS: ValkeyCommand {
31+
@inlinable public static var name: String { "CLUSTER ADDSLOTS" }
32+
3133
public var slots: [Int]
3234

3335
@inlinable public init(slots: [Int]) {
@@ -62,6 +64,8 @@ public enum CLUSTER {
6264
endSlot.encode(into: &commandEncoder)
6365
}
6466
}
67+
@inlinable public static var name: String { "CLUSTER ADDSLOTSRANGE" }
68+
6569
public var ranges: [Range]
6670

6771
@inlinable public init(ranges: [Range]) {
@@ -78,6 +82,8 @@ public enum CLUSTER {
7882
public struct BUMPEPOCH: ValkeyCommand {
7983
public typealias Response = ByteBuffer
8084

85+
@inlinable public static var name: String { "CLUSTER BUMPEPOCH" }
86+
8187
@inlinable public init() {
8288
}
8389

@@ -91,6 +97,8 @@ public enum CLUSTER {
9197
public struct COUNTFAILUREREPORTS<NodeId: RESPStringRenderable>: ValkeyCommand {
9298
public typealias Response = Int
9399

100+
@inlinable public static var name: String { "CLUSTER COUNT-FAILURE-REPORTS" }
101+
94102
public var nodeId: NodeId
95103

96104
@inlinable public init(nodeId: NodeId) {
@@ -107,6 +115,8 @@ public enum CLUSTER {
107115
public struct COUNTKEYSINSLOT: ValkeyCommand {
108116
public typealias Response = Int
109117

118+
@inlinable public static var name: String { "CLUSTER COUNTKEYSINSLOT" }
119+
110120
public var slot: Int
111121

112122
@inlinable public init(slot: Int) {
@@ -121,6 +131,8 @@ public enum CLUSTER {
121131
/// Sets hash slots as unbound for a node.
122132
@_documentation(visibility: internal)
123133
public struct DELSLOTS: ValkeyCommand {
134+
@inlinable public static var name: String { "CLUSTER DELSLOTS" }
135+
124136
public var slots: [Int]
125137

126138
@inlinable public init(slots: [Int]) {
@@ -155,6 +167,8 @@ public enum CLUSTER {
155167
endSlot.encode(into: &commandEncoder)
156168
}
157169
}
170+
@inlinable public static var name: String { "CLUSTER DELSLOTSRANGE" }
171+
158172
public var ranges: [Range]
159173

160174
@inlinable public init(ranges: [Range]) {
@@ -184,6 +198,8 @@ public enum CLUSTER {
184198
}
185199
}
186200
}
201+
@inlinable public static var name: String { "CLUSTER FAILOVER" }
202+
187203
public var options: Options?
188204

189205
@inlinable public init(options: Options? = nil) {
@@ -198,6 +214,8 @@ public enum CLUSTER {
198214
/// Deletes all slots information from a node.
199215
@_documentation(visibility: internal)
200216
public struct FLUSHSLOTS: ValkeyCommand {
217+
@inlinable public static var name: String { "CLUSTER FLUSHSLOTS" }
218+
201219
@inlinable public init() {
202220
}
203221

@@ -209,6 +227,8 @@ public enum CLUSTER {
209227
/// Removes a node from the nodes table.
210228
@_documentation(visibility: internal)
211229
public struct FORGET<NodeId: RESPStringRenderable>: ValkeyCommand {
230+
@inlinable public static var name: String { "CLUSTER FORGET" }
231+
212232
public var nodeId: NodeId
213233

214234
@inlinable public init(nodeId: NodeId) {
@@ -225,6 +245,8 @@ public enum CLUSTER {
225245
public struct GETKEYSINSLOT: ValkeyCommand {
226246
public typealias Response = RESPToken.Array
227247

248+
@inlinable public static var name: String { "CLUSTER GETKEYSINSLOT" }
249+
228250
public var slot: Int
229251
public var count: Int
230252

@@ -243,6 +265,8 @@ public enum CLUSTER {
243265
public struct HELP: ValkeyCommand {
244266
public typealias Response = RESPToken.Array
245267

268+
@inlinable public static var name: String { "CLUSTER HELP" }
269+
246270
@inlinable public init() {
247271
}
248272

@@ -256,6 +280,8 @@ public enum CLUSTER {
256280
public struct INFO: ValkeyCommand {
257281
public typealias Response = ByteBuffer
258282

283+
@inlinable public static var name: String { "CLUSTER INFO" }
284+
259285
@inlinable public init() {
260286
}
261287

@@ -269,6 +295,8 @@ public enum CLUSTER {
269295
public struct KEYSLOT<Key: RESPStringRenderable>: ValkeyCommand {
270296
public typealias Response = Int
271297

298+
@inlinable public static var name: String { "CLUSTER KEYSLOT" }
299+
272300
public var key: Key
273301

274302
@inlinable public init(_ key: Key) {
@@ -285,6 +313,8 @@ public enum CLUSTER {
285313
public struct LINKS: ValkeyCommand {
286314
public typealias Response = RESPToken.Array
287315

316+
@inlinable public static var name: String { "CLUSTER LINKS" }
317+
288318
@inlinable public init() {
289319
}
290320

@@ -296,6 +326,8 @@ public enum CLUSTER {
296326
/// Forces a node to handshake with another node.
297327
@_documentation(visibility: internal)
298328
public struct MEET<Ip: RESPStringRenderable>: ValkeyCommand {
329+
@inlinable public static var name: String { "CLUSTER MEET" }
330+
299331
public var ip: Ip
300332
public var port: Int
301333
public var clusterBusPort: Int?
@@ -316,6 +348,8 @@ public enum CLUSTER {
316348
public struct MYID: ValkeyCommand {
317349
public typealias Response = ByteBuffer
318350

351+
@inlinable public static var name: String { "CLUSTER MYID" }
352+
319353
@inlinable public init() {
320354
}
321355

@@ -329,6 +363,8 @@ public enum CLUSTER {
329363
public struct MYSHARDID: ValkeyCommand {
330364
public typealias Response = ByteBuffer
331365

366+
@inlinable public static var name: String { "CLUSTER MYSHARDID" }
367+
332368
@inlinable public init() {
333369
}
334370

@@ -342,6 +378,8 @@ public enum CLUSTER {
342378
public struct NODES: ValkeyCommand {
343379
public typealias Response = ByteBuffer
344380

381+
@inlinable public static var name: String { "CLUSTER NODES" }
382+
345383
@inlinable public init() {
346384
}
347385

@@ -355,6 +393,8 @@ public enum CLUSTER {
355393
public struct REPLICAS<NodeId: RESPStringRenderable>: ValkeyCommand {
356394
public typealias Response = RESPToken.Array
357395

396+
@inlinable public static var name: String { "CLUSTER REPLICAS" }
397+
358398
public var nodeId: NodeId
359399

360400
@inlinable public init(nodeId: NodeId) {
@@ -369,6 +409,8 @@ public enum CLUSTER {
369409
/// Configure a node as replica of a primary node.
370410
@_documentation(visibility: internal)
371411
public struct REPLICATE<NodeId: RESPStringRenderable>: ValkeyCommand {
412+
@inlinable public static var name: String { "CLUSTER REPLICATE" }
413+
372414
public var nodeId: NodeId
373415

374416
@inlinable public init(nodeId: NodeId) {
@@ -398,6 +440,8 @@ public enum CLUSTER {
398440
}
399441
}
400442
}
443+
@inlinable public static var name: String { "CLUSTER RESET" }
444+
401445
public var resetType: ResetType?
402446

403447
@inlinable public init(resetType: ResetType? = nil) {
@@ -412,6 +456,8 @@ public enum CLUSTER {
412456
/// Forces a node to save the cluster configuration to disk.
413457
@_documentation(visibility: internal)
414458
public struct SAVECONFIG: ValkeyCommand {
459+
@inlinable public static var name: String { "CLUSTER SAVECONFIG" }
460+
415461
@inlinable public init() {
416462
}
417463

@@ -423,6 +469,8 @@ public enum CLUSTER {
423469
/// Sets the configuration epoch for a new node.
424470
@_documentation(visibility: internal)
425471
public struct SETCONFIGEPOCH: ValkeyCommand {
472+
@inlinable public static var name: String { "CLUSTER SET-CONFIG-EPOCH" }
473+
426474
public var configEpoch: Int
427475

428476
@inlinable public init(configEpoch: Int) {
@@ -463,6 +511,8 @@ public enum CLUSTER {
463511
}
464512
}
465513
}
514+
@inlinable public static var name: String { "CLUSTER SETSLOT" }
515+
466516
public var slot: Int
467517
public var subcommand: Subcommand
468518
public var timeout: Int?
@@ -481,6 +531,8 @@ public enum CLUSTER {
481531
/// Returns the mapping of cluster slots to shards.
482532
@_documentation(visibility: internal)
483533
public struct SHARDS: ValkeyCommand {
534+
@inlinable public static var name: String { "CLUSTER SHARDS" }
535+
484536
@inlinable public init() {
485537
}
486538

@@ -494,6 +546,8 @@ public enum CLUSTER {
494546
public struct SLAVES<NodeId: RESPStringRenderable>: ValkeyCommand {
495547
public typealias Response = RESPToken.Array
496548

549+
@inlinable public static var name: String { "CLUSTER SLAVES" }
550+
497551
public var nodeId: NodeId
498552

499553
@inlinable public init(nodeId: NodeId) {
@@ -588,6 +642,8 @@ public enum CLUSTER {
588642
}
589643
public typealias Response = RESPToken.Array
590644

645+
@inlinable public static var name: String { "CLUSTER SLOT-STATS" }
646+
591647
public var filter: Filter
592648

593649
@inlinable public init(filter: Filter) {
@@ -604,6 +660,8 @@ public enum CLUSTER {
604660
public struct SLOTS: ValkeyCommand {
605661
public typealias Response = RESPToken.Array
606662

663+
@inlinable public static var name: String { "CLUSTER SLOTS" }
664+
607665
@inlinable public init() {
608666
}
609667

@@ -617,6 +675,8 @@ public enum CLUSTER {
617675
/// Signals that a cluster client is following an -ASK redirect.
618676
@_documentation(visibility: internal)
619677
public struct ASKING: ValkeyCommand {
678+
@inlinable public static var name: String { "ASKING" }
679+
620680
@inlinable public init() {
621681
}
622682

@@ -628,6 +688,8 @@ public struct ASKING: ValkeyCommand {
628688
/// Enables read-only queries for a connection to a Valkey replica node.
629689
@_documentation(visibility: internal)
630690
public struct READONLY: ValkeyCommand {
691+
@inlinable public static var name: String { "READONLY" }
692+
631693
@inlinable public init() {
632694
}
633695

@@ -639,6 +701,8 @@ public struct READONLY: ValkeyCommand {
639701
/// Enables read-write queries for a connection to a Valkey replica node.
640702
@_documentation(visibility: internal)
641703
public struct READWRITE: ValkeyCommand {
704+
@inlinable public static var name: String { "READWRITE" }
705+
642706
@inlinable public init() {
643707
}
644708

0 commit comments

Comments
 (0)