Skip to content

Commit d710923

Browse files
committed
docs: mark the whole Pub/Sub surface as experimental
Tag every command in PubSubCommands with `@api experimental` plus a visible `@note`, including the eight that remain public (publish, spublish, the five pubsub_* introspection commands, and the pubsub convenience method). Pub/Sub is only partially implemented, so none of it should be read as covered by 1.0.0's semantic-versioning guarantees. `@api` alone renders nothing in YARD's default template - only `@api private` has a built-in banner - so each entry pairs the tag with an `@note`, which does render. The tag stays machine-readable for `yard list --query '@api.text == "experimental"'` and for `--hide-api experimental`. Notes differ by group: the six privatized subscription commands say withheld-and-raises-NoMethodError, the public ones say usable-but-not- versioned. Also fixes the `@api private` tag on pubsub_callback. Trailing prose on the same line as the tag becomes part of the tag's value, so `@api private Invoked by...` did not match `@api.text == "private"` and rendered no private-API banner. Moving the prose to its own line restores both. Signed-off-by: Alex Le <alex.le@improving.com>
1 parent 8bb7bd9 commit d710923

2 files changed

Lines changed: 70 additions & 1 deletion

File tree

lib/valkey/commands/pubsub_commands.rb

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,19 @@ module Commands
66
# Pub/Sub is not yet supported and is partially implemented.
77
# Use at your own risks.
88
#
9+
# @api experimental
10+
# @note EXPERIMENTAL: the entire Pub/Sub surface is subject to change and
11+
# is not covered by semantic versioning.
12+
#
913
# @see https://valkey.io/commands/#pubsub
1014
#
1115
module PubSubCommands
1216
# Subscribe to one or more channels.
1317
#
18+
# @api experimental
19+
# @note EXPERIMENTAL and withheld: private for 1.0.0 because the message
20+
# delivery path is incomplete. Calling this raises NoMethodError.
21+
#
1422
# @param [Array<String>] channels the channels to subscribe to
1523
# @return [String] "OK"
1624
#
@@ -21,6 +29,10 @@ def subscribe(*channels)
2129

2230
# Unsubscribe from one or more channels.
2331
#
32+
# @api experimental
33+
# @note EXPERIMENTAL and withheld: private for 1.0.0 because the message
34+
# delivery path is incomplete. Calling this raises NoMethodError.
35+
#
2436
# @param [Array<String>] channels the channels to unsubscribe from (empty for all)
2537
# @return [String] "OK"
2638
#
@@ -31,6 +43,10 @@ def unsubscribe(*channels)
3143

3244
# Subscribe to one or more patterns.
3345
#
46+
# @api experimental
47+
# @note EXPERIMENTAL and withheld: private for 1.0.0 because the message
48+
# delivery path is incomplete. Calling this raises NoMethodError.
49+
#
3450
# @param [Array<String>] patterns the patterns to subscribe to
3551
# @return [String] "OK"
3652
#
@@ -41,6 +57,10 @@ def psubscribe(*patterns)
4157

4258
# Unsubscribe from one or more patterns.
4359
#
60+
# @api experimental
61+
# @note EXPERIMENTAL and withheld: private for 1.0.0 because the message
62+
# delivery path is incomplete. Calling this raises NoMethodError.
63+
#
4464
# @param [Array<String>] patterns the patterns to unsubscribe from (empty for all)
4565
# @return [String] "OK"
4666
#
@@ -51,6 +71,10 @@ def punsubscribe(*patterns)
5171

5272
# Publish a message to a channel.
5373
#
74+
# @api experimental
75+
# @note EXPERIMENTAL: usable today, but part of the Pub/Sub surface and
76+
# not covered by semantic versioning; may change in a future minor.
77+
#
5478
# @example Publish a message
5579
# valkey.publish("channel1", "Hello, World!")
5680
# # => 2
@@ -66,6 +90,10 @@ def publish(channel, message)
6690

6791
# Subscribe to one or more shard channels.
6892
#
93+
# @api experimental
94+
# @note EXPERIMENTAL and withheld: private for 1.0.0 because the message
95+
# delivery path is incomplete. Calling this raises NoMethodError.
96+
#
6997
# @param [Array<String>] channels the shard channels to subscribe to
7098
# @return [String] "OK"
7199
#
@@ -76,6 +104,10 @@ def ssubscribe(*channels)
76104

77105
# Unsubscribe from one or more shard channels.
78106
#
107+
# @api experimental
108+
# @note EXPERIMENTAL and withheld: private for 1.0.0 because the message
109+
# delivery path is incomplete. Calling this raises NoMethodError.
110+
#
79111
# @param [Array<String>] channels the shard channels to unsubscribe from (empty for all)
80112
# @return [String] "OK"
81113
#
@@ -86,6 +118,10 @@ def sunsubscribe(*channels)
86118

87119
# Publish a message to a shard channel.
88120
#
121+
# @api experimental
122+
# @note EXPERIMENTAL: usable today, but part of the Pub/Sub surface and
123+
# not covered by semantic versioning; may change in a future minor.
124+
#
89125
# @example Publish a message to a shard channel
90126
# valkey.spublish("shard1", "Hello, Shard!")
91127
# # => 1
@@ -101,6 +137,10 @@ def spublish(channel, message)
101137

102138
# List active channels.
103139
#
140+
# @api experimental
141+
# @note EXPERIMENTAL: usable today, but part of the Pub/Sub surface and
142+
# not covered by semantic versioning; may change in a future minor.
143+
#
104144
# @example List all active channels
105145
# valkey.pubsub_channels
106146
# # => ["channel1", "channel2"]
@@ -119,6 +159,10 @@ def pubsub_channels(pattern = nil)
119159

120160
# Get the number of unique patterns subscribed to.
121161
#
162+
# @api experimental
163+
# @note EXPERIMENTAL: usable today, but part of the Pub/Sub surface and
164+
# not covered by semantic versioning; may change in a future minor.
165+
#
122166
# @example Get pattern count
123167
# valkey.pubsub_numpat
124168
# # => 3
@@ -132,6 +176,10 @@ def pubsub_numpat
132176

133177
# Get the number of subscribers for channels.
134178
#
179+
# @api experimental
180+
# @note EXPERIMENTAL: usable today, but part of the Pub/Sub surface and
181+
# not covered by semantic versioning; may change in a future minor.
182+
#
135183
# @example Get subscriber counts
136184
# valkey.pubsub_numsub("channel1", "channel2")
137185
# # => ["channel1", 5, "channel2", 3]
@@ -146,6 +194,10 @@ def pubsub_numsub(*channels)
146194

147195
# List active shard channels.
148196
#
197+
# @api experimental
198+
# @note EXPERIMENTAL: usable today, but part of the Pub/Sub surface and
199+
# not covered by semantic versioning; may change in a future minor.
200+
#
149201
# @example List all active shard channels
150202
# valkey.pubsub_shardchannels
151203
# # => ["shard1", "shard2"]
@@ -164,6 +216,10 @@ def pubsub_shardchannels(pattern = nil)
164216

165217
# Get the number of subscribers for shard channels.
166218
#
219+
# @api experimental
220+
# @note EXPERIMENTAL: usable today, but part of the Pub/Sub surface and
221+
# not covered by semantic versioning; may change in a future minor.
222+
#
167223
# @example Get shard subscriber counts
168224
# valkey.pubsub_shardnumsub("shard1", "shard2")
169225
# # => ["shard1", 2, "shard2", 1]
@@ -178,6 +234,12 @@ def pubsub_shardnumsub(*channels)
178234

179235
# Control pub/sub operations (convenience method).
180236
#
237+
# @api experimental
238+
# @note EXPERIMENTAL: usable today, but part of the Pub/Sub surface and
239+
# not covered by semantic versioning; may change in a future minor.
240+
# Only the introspection subcommands are reachable - `channels`,
241+
# `numpat`, `numsub`, `shardchannels`, `shardnumsub`.
242+
#
181243
# @example List active channels
182244
# valkey.pubsub(:channels)
183245
# # => ["channel1", "channel2"]

lib/valkey/pubsub_callback.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,17 @@ class Valkey
1010
# vector, so it is private - `Valkey#initialize` still reaches it via
1111
# `method(:pubsub_callback)`, which resolves private methods and preserves
1212
# arity.
13+
# @api private
14+
# @note EXPERIMENTAL: part of the unfinished Pub/Sub surface; not covered by
15+
# semantic versioning.
1316
module PubSubCallback
1417
private
1518

16-
# @api private Invoked by libglide_ffi on an incoming Pub/Sub push message.
19+
# Invoked by libglide_ffi on an incoming Pub/Sub push message.
20+
#
21+
# @api private
22+
# @note EXPERIMENTAL: signature is dictated by the FFI callback contract and
23+
# may change when full Pub/Sub support lands.
1724
def pubsub_callback(_client_ptr, kind, msg_ptr, msg_len, chan_ptr, chan_len, pat_ptr, pat_len)
1825
puts "PubSub received kind=#{kind}, message=#{msg_ptr.read_string(msg_len)}" \
1926
", channel=#{chan_ptr.read_string(chan_len)}, pattern=#{pat_ptr.read_string(pat_len)}"

0 commit comments

Comments
 (0)