Skip to content

Commit 4d963b5

Browse files
authored
Initial docc setup (#110)
* Setup docc * Markdown * Don't include command types * Fix up function docc comment headers * Remove public from ConnectionIDGenerator and RESPTokenDecoder * Fix compile error in command renderer
1 parent fb5c39d commit 4d963b5

31 files changed

+572
-26
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ DerivedData/
1010
Package.resolved
1111
.benchmarkBaselines/
1212
.devcontainer
13-
.swift-version
13+
.swift-version
14+
.docc-build

Sources/Valkey/Cluster/ValkeyNodeDiscovery.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public struct ValkeyStaticNodeDiscovery: ValkeyNodeDiscovery {
8787

8888
private var nodes: [NodeDescription]
8989

90-
/// Initializes a ``ValkeyStaticClusterDiscovery`` with a list of nodes.
90+
/// Initializes a ``ValkeyStaticNodeDiscovery`` with a list of nodes.
9191
///
9292
/// - Parameter nodes: An array of ``ValkeyStaticNodeDiscovery/NodeDescription`` objects representing the nodes in the cluster.
9393
public init(_ nodes: [NodeDescription]) {

Sources/Valkey/Commands/BitmapCommands.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import Foundation
2323
#endif
2424

2525
/// Counts the number of set bits (population counting) in a string.
26+
@_documentation(visibility: internal)
2627
public struct BITCOUNT: ValkeyCommand {
2728
public enum RangeEndUnitBlockUnit: RESPRenderable, Sendable, Hashable {
2829
case byte
@@ -99,6 +100,7 @@ public struct BITCOUNT: ValkeyCommand {
99100
}
100101

101102
/// Performs arbitrary bitfield integer operations on strings.
103+
@_documentation(visibility: internal)
102104
public struct BITFIELD: ValkeyCommand {
103105
public struct OperationGetBlock: RESPRenderable, Sendable, Hashable {
104106
@usableFromInline let encoding: String
@@ -261,6 +263,7 @@ public struct BITFIELD: ValkeyCommand {
261263
}
262264

263265
/// Performs arbitrary read-only bitfield integer operations on strings.
266+
@_documentation(visibility: internal)
264267
public struct BITFIELDRO: ValkeyCommand {
265268
public struct GetBlock: RESPRenderable, Sendable, Hashable {
266269
@usableFromInline let encoding: String
@@ -302,6 +305,7 @@ public struct BITFIELDRO: ValkeyCommand {
302305
}
303306

304307
/// Performs bitwise operations on multiple strings, and stores the result.
308+
@_documentation(visibility: internal)
305309
public struct BITOP: ValkeyCommand {
306310
public enum Operation: RESPRenderable, Sendable, Hashable {
307311
case and
@@ -342,6 +346,7 @@ public struct BITOP: ValkeyCommand {
342346
}
343347

344348
/// Finds the first set (1) or clear (0) bit in a string.
349+
@_documentation(visibility: internal)
345350
public struct BITPOS: ValkeyCommand {
346351
public enum RangeEndUnitBlockUnit: RESPRenderable, Sendable, Hashable {
347352
case byte
@@ -420,6 +425,7 @@ public struct BITPOS: ValkeyCommand {
420425
}
421426

422427
/// Returns a bit value by offset.
428+
@_documentation(visibility: internal)
423429
public struct GETBIT: ValkeyCommand {
424430
public typealias Response = Int
425431

@@ -441,6 +447,7 @@ public struct GETBIT: ValkeyCommand {
441447
}
442448

443449
/// Sets or clears the bit at offset of the string value. Creates the key if it doesn't exist.
450+
@_documentation(visibility: internal)
444451
public struct SETBIT: ValkeyCommand {
445452
public typealias Response = Int
446453

Sources/Valkey/Commands/ClusterCommands.swift

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ import Foundation
2323
#endif
2424

2525
/// A container for Cluster commands.
26+
@_documentation(visibility: internal)
2627
public enum CLUSTER {
2728
/// Assigns new hash slots to a node.
29+
@_documentation(visibility: internal)
2830
public struct ADDSLOTS: ValkeyCommand {
2931
public var slot: [Int]
3032

@@ -38,6 +40,7 @@ public enum CLUSTER {
3840
}
3941

4042
/// Assigns new hash slot ranges to a node.
43+
@_documentation(visibility: internal)
4144
public struct ADDSLOTSRANGE: ValkeyCommand {
4245
public struct Range: RESPRenderable, Sendable, Hashable {
4346
@usableFromInline let startSlot: Int
@@ -71,6 +74,7 @@ public enum CLUSTER {
7174
}
7275

7376
/// Advances the cluster config epoch.
77+
@_documentation(visibility: internal)
7478
public struct BUMPEPOCH: ValkeyCommand {
7579
@inlinable public init() {
7680
}
@@ -81,6 +85,7 @@ public enum CLUSTER {
8185
}
8286

8387
/// Returns the number of active failure reports active for a node.
88+
@_documentation(visibility: internal)
8489
public struct COUNTFAILUREREPORTS<NodeId: RESPStringRenderable>: ValkeyCommand {
8590
public typealias Response = Int
8691

@@ -96,6 +101,7 @@ public enum CLUSTER {
96101
}
97102

98103
/// Returns the number of keys in a hash slot.
104+
@_documentation(visibility: internal)
99105
public struct COUNTKEYSINSLOT: ValkeyCommand {
100106
public typealias Response = Int
101107

@@ -111,6 +117,7 @@ public enum CLUSTER {
111117
}
112118

113119
/// Sets hash slots as unbound for a node.
120+
@_documentation(visibility: internal)
114121
public struct DELSLOTS: ValkeyCommand {
115122
public var slot: [Int]
116123

@@ -124,6 +131,7 @@ public enum CLUSTER {
124131
}
125132

126133
/// Sets hash slot ranges as unbound for a node.
134+
@_documentation(visibility: internal)
127135
public struct DELSLOTSRANGE: ValkeyCommand {
128136
public struct Range: RESPRenderable, Sendable, Hashable {
129137
@usableFromInline let startSlot: Int
@@ -157,6 +165,7 @@ public enum CLUSTER {
157165
}
158166

159167
/// Forces a replica to perform a manual failover of its primary.
168+
@_documentation(visibility: internal)
160169
public struct FAILOVER: ValkeyCommand {
161170
public enum Options: RESPRenderable, Sendable, Hashable {
162171
case force
@@ -185,6 +194,7 @@ public enum CLUSTER {
185194
}
186195

187196
/// Deletes all slots information from a node.
197+
@_documentation(visibility: internal)
188198
public struct FLUSHSLOTS: ValkeyCommand {
189199
@inlinable public init() {
190200
}
@@ -195,6 +205,7 @@ public enum CLUSTER {
195205
}
196206

197207
/// Removes a node from the nodes table.
208+
@_documentation(visibility: internal)
198209
public struct FORGET<NodeId: RESPStringRenderable>: ValkeyCommand {
199210
public var nodeId: NodeId
200211

@@ -208,6 +219,7 @@ public enum CLUSTER {
208219
}
209220

210221
/// Returns the key names in a hash slot.
222+
@_documentation(visibility: internal)
211223
public struct GETKEYSINSLOT: ValkeyCommand {
212224
public typealias Response = RESPToken.Array
213225

@@ -225,6 +237,7 @@ public enum CLUSTER {
225237
}
226238

227239
/// Returns helpful text about the different subcommands.
240+
@_documentation(visibility: internal)
228241
public struct HELP: ValkeyCommand {
229242
public typealias Response = RESPToken.Array
230243

@@ -237,6 +250,7 @@ public enum CLUSTER {
237250
}
238251

239252
/// Returns information about the state of a node.
253+
@_documentation(visibility: internal)
240254
public struct INFO: ValkeyCommand {
241255
@inlinable public init() {
242256
}
@@ -247,6 +261,7 @@ public enum CLUSTER {
247261
}
248262

249263
/// Returns the hash slot for a key.
264+
@_documentation(visibility: internal)
250265
public struct KEYSLOT<Key: RESPStringRenderable>: ValkeyCommand {
251266
public typealias Response = Int
252267

@@ -262,6 +277,7 @@ public enum CLUSTER {
262277
}
263278

264279
/// Returns a list of all TCP links to and from peer nodes.
280+
@_documentation(visibility: internal)
265281
public struct LINKS: ValkeyCommand {
266282
public typealias Response = RESPToken.Array
267283

@@ -274,6 +290,7 @@ public enum CLUSTER {
274290
}
275291

276292
/// Forces a node to handshake with another node.
293+
@_documentation(visibility: internal)
277294
public struct MEET<Ip: RESPStringRenderable>: ValkeyCommand {
278295
public var ip: Ip
279296
public var port: Int
@@ -291,6 +308,7 @@ public enum CLUSTER {
291308
}
292309

293310
/// Returns the ID of a node.
311+
@_documentation(visibility: internal)
294312
public struct MYID: ValkeyCommand {
295313
@inlinable public init() {
296314
}
@@ -301,6 +319,7 @@ public enum CLUSTER {
301319
}
302320

303321
/// Returns the shard ID of a node.
322+
@_documentation(visibility: internal)
304323
public struct MYSHARDID: ValkeyCommand {
305324
@inlinable public init() {
306325
}
@@ -311,6 +330,7 @@ public enum CLUSTER {
311330
}
312331

313332
/// Returns the cluster configuration for a node.
333+
@_documentation(visibility: internal)
314334
public struct NODES: ValkeyCommand {
315335
@inlinable public init() {
316336
}
@@ -321,6 +341,7 @@ public enum CLUSTER {
321341
}
322342

323343
/// Lists the replica nodes of a primary node.
344+
@_documentation(visibility: internal)
324345
public struct REPLICAS<NodeId: RESPStringRenderable>: ValkeyCommand {
325346
public typealias Response = RESPToken.Array
326347

@@ -336,6 +357,7 @@ public enum CLUSTER {
336357
}
337358

338359
/// Configure a node as replica of a primary node.
360+
@_documentation(visibility: internal)
339361
public struct REPLICATE<NodeId: RESPStringRenderable>: ValkeyCommand {
340362
public var nodeId: NodeId
341363

@@ -349,6 +371,7 @@ public enum CLUSTER {
349371
}
350372

351373
/// Resets a node.
374+
@_documentation(visibility: internal)
352375
public struct RESET: ValkeyCommand {
353376
public enum ResetType: RESPRenderable, Sendable, Hashable {
354377
case hard
@@ -377,6 +400,7 @@ public enum CLUSTER {
377400
}
378401

379402
/// Forces a node to save the cluster configuration to disk.
403+
@_documentation(visibility: internal)
380404
public struct SAVECONFIG: ValkeyCommand {
381405
@inlinable public init() {
382406
}
@@ -387,6 +411,7 @@ public enum CLUSTER {
387411
}
388412

389413
/// Sets the configuration epoch for a new node.
414+
@_documentation(visibility: internal)
390415
public struct SETCONFIGEPOCH: ValkeyCommand {
391416
public var configEpoch: Int
392417

@@ -400,6 +425,7 @@ public enum CLUSTER {
400425
}
401426

402427
/// Binds a hash slot to a node.
428+
@_documentation(visibility: internal)
403429
public struct SETSLOT: ValkeyCommand {
404430
public enum Subcommand: RESPRenderable, Sendable, Hashable {
405431
case importing(String)
@@ -443,6 +469,7 @@ public enum CLUSTER {
443469
}
444470

445471
/// Returns the mapping of cluster slots to shards.
472+
@_documentation(visibility: internal)
446473
public struct SHARDS: ValkeyCommand {
447474
@inlinable public init() {
448475
}
@@ -453,6 +480,7 @@ public enum CLUSTER {
453480
}
454481

455482
/// Lists the replica nodes of a primary node.
483+
@_documentation(visibility: internal)
456484
public struct SLAVES<NodeId: RESPStringRenderable>: ValkeyCommand {
457485
public typealias Response = RESPToken.Array
458486

@@ -468,6 +496,7 @@ public enum CLUSTER {
468496
}
469497

470498
/// Return an array of slot usage statistics for slots assigned to the current node.
499+
@_documentation(visibility: internal)
471500
public struct SLOTSTATS: ValkeyCommand {
472501
public struct FilterSlotsrange: RESPRenderable, Sendable, Hashable {
473502
@usableFromInline let startSlot: Int
@@ -561,6 +590,7 @@ public enum CLUSTER {
561590
}
562591

563592
/// Returns the mapping of cluster slots to nodes.
593+
@_documentation(visibility: internal)
564594
public struct SLOTS: ValkeyCommand {
565595
public typealias Response = RESPToken.Array
566596

@@ -575,6 +605,7 @@ public enum CLUSTER {
575605
}
576606

577607
/// Signals that a cluster client is following an -ASK redirect.
608+
@_documentation(visibility: internal)
578609
public struct ASKING: ValkeyCommand {
579610
@inlinable public init() {
580611
}
@@ -585,6 +616,7 @@ public struct ASKING: ValkeyCommand {
585616
}
586617

587618
/// Enables read-only queries for a connection to a Valkey replica node.
619+
@_documentation(visibility: internal)
588620
public struct READONLY: ValkeyCommand {
589621
@inlinable public init() {
590622
}
@@ -595,6 +627,7 @@ public struct READONLY: ValkeyCommand {
595627
}
596628

597629
/// Enables read-write queries for a connection to a Valkey replica node.
630+
@_documentation(visibility: internal)
598631
public struct READWRITE: ValkeyCommand {
599632
@inlinable public init() {
600633
}

0 commit comments

Comments
 (0)