From 3812d25ac4541a2c6db650fc41c99838781f7910 Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 18 Sep 2024 06:42:44 +0000 Subject: [PATCH] [automated site update] --- apidoc/html/index.html | 39 +++++++++++++++++++++++++------ apidoc/html/redisx-client_8c.html | 2 +- apidoc/html/redisx_8h.html | 2 +- apidoc/html/structRESP.html | 7 ++---- apidoc/man/man3/RESP.3 | 7 ++---- apidoc/man/man3/redisx-client.c.3 | 2 +- apidoc/man/man3/redisx.h.3 | 2 +- doc/README.md | 25 +++++++++++++++++++- 8 files changed, 64 insertions(+), 22 deletions(-) diff --git a/apidoc/html/index.html b/apidoc/html/index.html index e4c9c89..e9d33f7 100644 --- a/apidoc/html/index.html +++ b/apidoc/html/index.html @@ -187,7 +187,7 @@

// Abort: something did not got to plan...
return;
}
-
Redis * redisxInit(const char *server)
Definition redisx-net.c:608
+
Redis * redisxInit(const char *server)
Definition redisx-net.c:610
Structure that represents a Redis database instance, with one or more RedisClient connections.
Definition redisx.h:158

Before connecting to the Redis server, you may configure optional settings, such as the TCP port number to use (if not the default 6379), and the database authentication (if any):

Redis *redis = ...
@@ -206,7 +206,7 @@

// (optional) Set the TCP send/rcv buffer sizes to use if not default values.
// This setting applies to all new connections after...
-
void redisxSetTcpBuf(int size)
Definition redisx-net.c:708
+
void redisxSetTcpBuf(int size)
Definition redisx-net.c:710

Optionally, you can select the database index to use now (or later, after connecting), if not the default (index 0):

Redis *redis = ...
@@ -226,8 +226,8 @@

redisxDestroy(&redis);
...
}
-
void redisxDestroy(Redis *redis)
Definition redisx-net.c:678
-
int redisxConnect(Redis *redis, boolean usePipeline)
Definition redisx-net.c:754
+
void redisxDestroy(Redis *redis)
Definition redisx-net.c:680
+
int redisxConnect(Redis *redis, boolean usePipeline)
Definition redisx-net.c:756

The above will establish both an interactive connection and a pipelined connection client, for processing both synchronous and asynchronous requests (and responses).

@@ -291,7 +291,34 @@

RESP data type

-

All responses coming from the Redis server are represented by a dynamically allocated RESP type (defined in redisx.h) structure. Each RESP has a type (e.g. RESP_SIMPLE_STRING), an integer value n, and a value pointer to further data. If the type is RESP_INT, then n represents the actual return value (and the value pointer is not used). For string type values n is the number of characters in the string value (not including termination), while for RESP_ARRAY types the value is a pointer to an embedded RESP array and n is the number of elements in that.

+

All responses coming from the Redis server are represented by a dynamically allocated RESP type (defined in redisx.h) structure.

+
typedef struct RESP {
+
char type; // RESP type: RESP_ARRAY, RESP_INT ...
+
int n; // Either the integer value of a RESP_INT response, or the
+
// dimension of the value field.
+
void *value; // Pointer to text (char *) content or to an array of components
+
// (RESP**)...
+
} RESP;
+
Structure that represents a Redis response (RESP format).
Definition redisx.h:122
+
void * value
Pointer to text (char *) content to an array of components (RESP**)...
Definition redisx.h:126
+
int n
Definition redisx.h:124
+
char type
value type RESP_ARRAY, RESP_INT ...
Definition redisx.h:123
+

whose contents are:

+ + + + + + + + + + + + + +
RESP type Redis ID n value cast in C
RESP_ARRAY '*' number of RESP * pointers (RESP **)
RESP_INT ':' integer return value
RESP_SIMPLE_STRING '+' string length (char *)
RESP_ERROR '-' string length (char *)
RESP_BULK_STRING '$' string length or -1 if NULL (char *)
+

Each RESP has a type (e.g. RESP_SIMPLE_STRING), an integer value n, and a value pointer to further data. If the type is RESP_INT, then n represents the actual return value (and the value pointer is not used). For string type values n is the number of characters in the string value (not including termination), while for RESP_ARRAY types the value is a pointer to an embedded RESP array and n is the number of elements in that.

You may check the integrity of a RESP using redisxCheckRESP(). Since RESP data is dynamically allocated, the user is responsible for discarding them once they are no longer needed, e.g. by calling redisxDestroyRESP(). The two steps may be combined to automatically discard invalid or unexpected RESP data in a single step by calling redisxCheckDestroyRESP().

RESP *r = ...
@@ -309,7 +336,6 @@

int redisxCheckDestroyRESP(RESP *resp, char expectedType, int expectedSize)
Definition redisx.c:445
void redisxDestroyRESP(RESP *resp)
Definition redisx.c:391
#define RESP_ARRAY
RESP array type.
Definition redisx.h:88
-
Structure that represents a Redis response (RESP format).
Definition redisx.h:122

Before destroying a RESP structure, the caller may want to de-reference values within it if they are to be used as is (without making copies), e.g.:

RESP *r = ...
char *stringValue = NULL; // to be extracted from 'r'
@@ -329,7 +355,6 @@

redisxDestroyRESP(r); // The 'stringValue' is still a valid pointer after!
}
#define RESP_SIMPLE_STRING
RESP simple string type.
Definition redisx.h:90
-
void * value
Pointer to text (char *) content to an array of components (RESP**)...
Definition redisx.h:126


diff --git a/apidoc/html/redisx-client_8c.html b/apidoc/html/redisx-client_8c.html index 71078ee..06ebb0d 100644 --- a/apidoc/html/redisx-client_8c.html +++ b/apidoc/html/redisx-client_8c.html @@ -425,7 +425,7 @@

Returns
The RESP structure for the reponse received from Redis, or NULL if an error was encountered (errno will be set to describe the error, which may either be an errno produced by recv() or EBADMSG if the message was corrupted and/or unparseable.
-

References FALSE, RESP::n, REDIS_INCOMPLETE_TRANSFER, REDIS_SIMPLE_STRING_SIZE, REDIS_UNEXPECTED_RESP, redisxDestroyRESP(), redisxReadReplyAsync(), RESP_ARRAY, RESP_BULK_STRING, RESP_ERROR, RESP_INT, RESP_SIMPLE_STRING, RESP::type, RESP::value, x_error(), X_FAILURE, X_PARSE_ERROR, X_SUCCESS, and x_trace_null().

+

References FALSE, RESP::n, REDIS_INCOMPLETE_TRANSFER, REDIS_SIMPLE_STRING_SIZE, REDIS_UNEXPECTED_RESP, redisxDestroyRESP(), redisxReadReplyAsync(), RESP_ARRAY, RESP_BULK_STRING, RESP_ERROR, RESP_INT, RESP_SIMPLE_STRING, RESP::type, RESP::value, x_error(), X_FAILURE, X_PARSE_ERROR, X_SUCCESS, x_trace_null(), and xStringCopyOf().

diff --git a/apidoc/html/redisx_8h.html b/apidoc/html/redisx_8h.html index e8ebad1..7f23566 100644 --- a/apidoc/html/redisx_8h.html +++ b/apidoc/html/redisx_8h.html @@ -2234,7 +2234,7 @@

Returns
The RESP structure for the reponse received from Redis, or NULL if an error was encountered (errno will be set to describe the error, which may either be an errno produced by recv() or EBADMSG if the message was corrupted and/or unparseable.
-

References FALSE, RESP::n, REDIS_INCOMPLETE_TRANSFER, REDIS_SIMPLE_STRING_SIZE, REDIS_UNEXPECTED_RESP, redisxDestroyRESP(), redisxReadReplyAsync(), RESP_ARRAY, RESP_BULK_STRING, RESP_ERROR, RESP_INT, RESP_SIMPLE_STRING, RESP::type, RESP::value, x_error(), X_FAILURE, X_PARSE_ERROR, X_SUCCESS, and x_trace_null().

+

References FALSE, RESP::n, REDIS_INCOMPLETE_TRANSFER, REDIS_SIMPLE_STRING_SIZE, REDIS_UNEXPECTED_RESP, redisxDestroyRESP(), redisxReadReplyAsync(), RESP_ARRAY, RESP_BULK_STRING, RESP_ERROR, RESP_INT, RESP_SIMPLE_STRING, RESP::type, RESP::value, x_error(), X_FAILURE, X_PARSE_ERROR, X_SUCCESS, x_trace_null(), and xStringCopyOf().

diff --git a/apidoc/html/structRESP.html b/apidoc/html/structRESP.html index 017a23b..ca7be3d 100644 --- a/apidoc/html/structRESP.html +++ b/apidoc/html/structRESP.html @@ -126,11 +126,10 @@

Data Fields

int n - the value field.
  char type - RESP_ARRAY, RESP_INT ...
+ value type RESP_ARRAY, RESP_INT ...
  void * value @@ -152,9 +151,7 @@

- -

the value field.

-

Either the integer value of a RESP_INT response, or the dimension of

+

Either the integer value of a RESP_INT response, or the dimension of the value field.

diff --git a/apidoc/man/man3/RESP.3 b/apidoc/man/man3/RESP.3 index e8f5b26..27071e7 100644 --- a/apidoc/man/man3/RESP.3 +++ b/apidoc/man/man3/RESP.3 @@ -15,11 +15,10 @@ RESP \- Structure that represents a \fBRedis\fP response (\fBRESP\fP format)\&. .ti -1c .RI "int \fBn\fP" .br -.RI "the value field\&. " .ti -1c .RI "char \fBtype\fP" .br -.RI "RESP_ARRAY, RESP_INT \&.\&.\&. " +.RI "value type RESP_ARRAY, RESP_INT \&.\&.\&. " .ti -1c .RI "void * \fBvalue\fP" .br @@ -40,9 +39,7 @@ Structure that represents a \fBRedis\fP response (\fBRESP\fP format)\&. .SH "Field Documentation" .PP .SS "int n" - -.PP -the value field\&. Either the integer value of a RESP_INT response, or the dimension of +Either the integer value of a RESP_INT response, or the dimension of the value field\&. .SH "Author" .PP diff --git a/apidoc/man/man3/redisx-client.c.3 b/apidoc/man/man3/redisx-client.c.3 index 2294e2a..103fec8 100644 --- a/apidoc/man/man3/redisx-client.c.3 +++ b/apidoc/man/man3/redisx-client.c.3 @@ -249,7 +249,7 @@ The \fBRESP\fP structure for the reponse received from \fBRedis\fP, or NULL if a .PP .PP -References \fBFALSE\fP, \fBRESP::n\fP, \fBREDIS_INCOMPLETE_TRANSFER\fP, \fBREDIS_SIMPLE_STRING_SIZE\fP, \fBREDIS_UNEXPECTED_RESP\fP, \fBredisxDestroyRESP()\fP, \fBredisxReadReplyAsync()\fP, \fBRESP_ARRAY\fP, \fBRESP_BULK_STRING\fP, \fBRESP_ERROR\fP, \fBRESP_INT\fP, \fBRESP_SIMPLE_STRING\fP, \fBRESP::type\fP, \fBRESP::value\fP, \fBx_error()\fP, \fBX_FAILURE\fP, \fBX_PARSE_ERROR\fP, \fBX_SUCCESS\fP, and \fBx_trace_null()\fP\&. +References \fBFALSE\fP, \fBRESP::n\fP, \fBREDIS_INCOMPLETE_TRANSFER\fP, \fBREDIS_SIMPLE_STRING_SIZE\fP, \fBREDIS_UNEXPECTED_RESP\fP, \fBredisxDestroyRESP()\fP, \fBredisxReadReplyAsync()\fP, \fBRESP_ARRAY\fP, \fBRESP_BULK_STRING\fP, \fBRESP_ERROR\fP, \fBRESP_INT\fP, \fBRESP_SIMPLE_STRING\fP, \fBRESP::type\fP, \fBRESP::value\fP, \fBx_error()\fP, \fBX_FAILURE\fP, \fBX_PARSE_ERROR\fP, \fBX_SUCCESS\fP, \fBx_trace_null()\fP, and \fBxStringCopyOf()\fP\&. .SS "int redisxResetClient (\fBRedisClient\fP * cl)" Sends a \fCRESET\fP request to the specified \fBRedis\fP client\&. The server will perform a reset as if the client disconnected and reconnected again\&. .PP diff --git a/apidoc/man/man3/redisx.h.3 b/apidoc/man/man3/redisx.h.3 index 5a0182a..31c6b57 100644 --- a/apidoc/man/man3/redisx.h.3 +++ b/apidoc/man/man3/redisx.h.3 @@ -1361,7 +1361,7 @@ The \fBRESP\fP structure for the reponse received from \fBRedis\fP, or NULL if a .PP .PP -References \fBFALSE\fP, \fBRESP::n\fP, \fBREDIS_INCOMPLETE_TRANSFER\fP, \fBREDIS_SIMPLE_STRING_SIZE\fP, \fBREDIS_UNEXPECTED_RESP\fP, \fBredisxDestroyRESP()\fP, \fBredisxReadReplyAsync()\fP, \fBRESP_ARRAY\fP, \fBRESP_BULK_STRING\fP, \fBRESP_ERROR\fP, \fBRESP_INT\fP, \fBRESP_SIMPLE_STRING\fP, \fBRESP::type\fP, \fBRESP::value\fP, \fBx_error()\fP, \fBX_FAILURE\fP, \fBX_PARSE_ERROR\fP, \fBX_SUCCESS\fP, and \fBx_trace_null()\fP\&. +References \fBFALSE\fP, \fBRESP::n\fP, \fBREDIS_INCOMPLETE_TRANSFER\fP, \fBREDIS_SIMPLE_STRING_SIZE\fP, \fBREDIS_UNEXPECTED_RESP\fP, \fBredisxDestroyRESP()\fP, \fBredisxReadReplyAsync()\fP, \fBRESP_ARRAY\fP, \fBRESP_BULK_STRING\fP, \fBRESP_ERROR\fP, \fBRESP_INT\fP, \fBRESP_SIMPLE_STRING\fP, \fBRESP::type\fP, \fBRESP::value\fP, \fBx_error()\fP, \fBX_FAILURE\fP, \fBX_PARSE_ERROR\fP, \fBX_SUCCESS\fP, \fBx_trace_null()\fP, and \fBxStringCopyOf()\fP\&. .SS "int redisxReconnect (\fBRedis\fP * redis, \fBboolean\fP usePipeline)" Disconnects from \fBRedis\fP, and then connects again\&.\&.\&. .PP diff --git a/doc/README.md b/doc/README.md index 1bf0a96..d538794 100644 --- a/doc/README.md +++ b/doc/README.md @@ -278,7 +278,30 @@ with that response (or `NULL` if there was an error). ### RESP data type All responses coming from the Redis server are represented by a dynamically allocated `RESP` type (defined in -`redisx.h`) structure. Each `RESP` has a type (e.g. `RESP_SIMPLE_STRING`), an integer value `n`, and a `value` pointer +`redisx.h`) structure. + +```c +typedef struct RESP { + char type; // RESP type: RESP_ARRAY, RESP_INT ... + int n; // Either the integer value of a RESP_INT response, or the + // dimension of the value field. + void *value; // Pointer to text (char *) content or to an array of components + // (RESP**)... +} RESP; +``` + +whose contents are: + + | RESP `type` | Redis ID | `n` |`value` cast in C | + |-------------------------|----------|-------------------------------|-----------------------| + | `RESP_ARRAY` | '*' | number of `RESP *` pointers | `(RESP **)` | + | `RESP_INT` | ':' | integer return value | | + | `RESP_SIMPLE_STRING` | '+' | string length | `(char *)` | + | `RESP_ERROR` | '-' | string length | `(char *)` | + | `RESP_BULK_STRING` | '$' | string length or -1 if `NULL` | `(char *)` | + + +Each `RESP` has a type (e.g. `RESP_SIMPLE_STRING`), an integer value `n`, and a `value` pointer to further data. If the type is `RESP_INT`, then `n` represents the actual return value (and the `value` pointer is not used). For string type values `n` is the number of characters in the string `value` (not including termination), while for `RESP_ARRAY` types the `value` is a pointer to an embedded `RESP` array and `n` is the number of elements