Skip to content

Commit 06bedbf

Browse files
committed
Fix documentation snippets
Signed-off-by: Minh Vu <vuhoangminh97@gmail.com>
1 parent cb5ff91 commit 06bedbf

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

docs/cluster.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ See [include/valkey/cluster.h](../include/valkey/cluster.h) for more details.
6363

6464
```c
6565
valkeyClusterOptions opt = {
66-
.initial_nodes = "127.0.0.1:6379,127.0.0.1:6380"; // Addresses to initially connect to.
67-
.options = VALKEY_OPT_USE_CLUSTER_NODES; // See available option flags below.
68-
.password = "password"; // Authenticate connections using the `AUTH` command.
66+
.initial_nodes = "127.0.0.1:6379,127.0.0.1:6380", // Addresses to initially connect to.
67+
.options = VALKEY_OPT_USE_CLUSTER_NODES, // See available option flags below.
68+
.password = "password", // Authenticate connections using the `AUTH` command.
6969
};
7070

7171
valkeyClusterContext *cc = valkeyClusterConnectWithOptions(&opt);
@@ -185,8 +185,8 @@ void event_cb(const valkeyClusterContext *cc, int event, void *privdata) {
185185
}
186186

187187
valkeyClusterOptions opt = {
188-
.event_callback = event_cb;
189-
.event_privdata = my_privdata; // User defined data can be provided to the callback.
188+
.event_callback = event_cb,
189+
.event_privdata = my_privdata, // User defined data can be provided to the callback.
190190
};
191191
valkeyClusterContext *cc = valkeyClusterConnectWithOptions(&opt);
192192
```
@@ -214,7 +214,7 @@ void connect_cb(const valkeyContext *c, int status) {
214214
}
215215
216216
valkeyClusterOptions opt = {
217-
.connect_callback = connect_cb;
217+
.connect_callback = connect_cb,
218218
};
219219
valkeyClusterContext *cc = valkeyClusterConnectWithOptions(&opt);
220220
```
@@ -239,7 +239,7 @@ but it's also important to configure which event library to use before calling `
239239

240240
```c
241241
valkeyClusterOptions options = {
242-
.initial_nodes = "127.0.0.1:7000";
242+
.initial_nodes = "127.0.0.1:7000",
243243
};
244244

245245
// Use convenience function to set which event library to use.
@@ -341,9 +341,9 @@ The callbacks can be enabled using the following options when calling `valkeyClu
341341

342342
```c
343343
valkeyClusterOptions opt = {
344-
.async_connect_callback = connect_cb;
345-
.async_disconnect_callback = disconnect_cb;
346-
}
344+
.async_connect_callback = connect_cb,
345+
.async_disconnect_callback = disconnect_cb,
346+
};
347347
```
348348

349349
The connect callback function should have the following prototype, aliased to `valkeyConnectCallback`:
@@ -380,8 +380,8 @@ valkeyTLSContext *tls = valkeyCreateTLSContext("ca.crt", NULL, "client.crt",
380380
"client.key", NULL, NULL);
381381
// Set options to enable TLS on context.
382382
valkeyClusterOptions opt = {
383-
.tls = tls;
384-
.tls_init_fn = &valkeyInitiateTLSWithContext;
383+
.tls = tls,
384+
.tls_init_fn = &valkeyInitiateTLSWithContext,
385385
};
386386

387387
valkeyClusterContext *cc = valkeyClusterConnectWithOptions(&opt);
@@ -420,7 +420,7 @@ Another way to detect that the slot map has been updated is to [register an even
420420
421421
The list of commands and the position of the first key in the command line is defined in [`src/cmddef.h`](../src/cmddef.h) which is included in this repository.
422422
It has been generated using the `JSON` files describing the syntax of each command in the Valkey repository, which makes sure we support all commands in Valkey, at least in terms of cluster routing.
423-
To add support for custom commands defined in modules, you can regenerate `cmddef.h` using the script [`gencommands.py`](../script/gencommands.py).
423+
To add support for custom commands defined in modules, you can regenerate `cmddef.h` using the script [`gencommands.py`](../scripts/gencommands.py).
424424
Use the `JSON` files from Valkey and any additional files on the same format as arguments to the script.
425425
For details, see the comments inside `gencommands.py`.
426426

docs/standalone.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Commands may also be constructed by sending an array of arguments along with an
113113
114114
```c
115115
const char *argv[] = {"SET", "captain", "James Kirk"};
116-
sonst size_t argvlens[] = {3, 7, 10};
116+
const size_t argvlens[] = {3, 7, 10};
117117
118118
valkeyReply *reply = valkeyCommandArgv(ctx, 3, argv, argvlens);
119119
// Handle error conditions similarly to `valkeyCommand`
@@ -146,7 +146,7 @@ When a `valkeyReply` is returned, you should test the `valkeyReply->type` field
146146

147147
### Disconnecting/cleanup
148148

149-
When libvalkey returns non-null `valkeyReply` struts you are responsible for freeing them with `freeReplyObject`. In order to disconnect and free the context simply call `valkeyFree`.
149+
When libvalkey returns non-null `valkeyReply` structs you are responsible for freeing them with `freeReplyObject`. In order to disconnect and free the context simply call `valkeyFree`.
150150

151151
```c
152152
valkeyReply *reply = valkeyCommand(ctx, "set %s %s", "foo", "bar");

0 commit comments

Comments
 (0)