Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RESP2REDIS: Refine error reporting from server #25

Merged
merged 13 commits into from
Oct 26, 2023
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# librdb

C library for parsing RDB files.
This is C library for parsing RDB files.

The Parser is implemented in the spirit of SAX parser. It fires off a series of events as
it reads the RDB file from beginning to end, and callbacks to handlers registered on
Expand Down Expand Up @@ -123,9 +123,9 @@ Level0. The same goes between Level2 and Level1 correspondingly.
### Handlers
The **Handlers** represent a set of builtin or user-defined functions that will be called on the
parsed data. Future plan to support built-in Handlers:
* Convert RDB to JSON file handlers. (Status: WIP)
* Convert RDB to RESP protocol handlers. (Status: WIP)
* Memory Analyze (Status: Todo)
* Convert RDB to JSON file handlers.
* Convert RDB to RESP protocol handlers.
* Memory Analyze (TODO)

It is possible to attach to parser more than one set of handlers at the same level.
That is, for a given data at a given level, the parser will call each of the handlers that
Expand Down
9 changes: 8 additions & 1 deletion api/librdb-ext-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,19 @@ _LIBRDB_API RdbxToResp *RDBX_createHandlersToResp(RdbParser *, RdbxToRespConf *)
* <user-defined-writer>
****************************************************************/

/* On start command pass command info. NULL otherwise. */
typedef struct RdbxRespWriterStartCmd {
const char *cmd; /* Redis Command name (Ex: "SET", "RESTORE") */
const char *key; /* If key available as part of command. Else empty string */
} RdbxRespWriterStartCmd;

typedef struct RdbxRespWriter {
void *ctx;
void (*delete)(void *ctx);

/* return 0 on success. Otherwise 1 */
int (*writev) (void *ctx, struct iovec *ioVec, int iovCnt, int startCmd, int endCmd);
int (*writev) (void *ctx, struct iovec *ioVec, int iovCnt,
RdbxRespWriterStartCmd *startCmd, int endCmd);
moticless marked this conversation as resolved.
Show resolved Hide resolved
int (*flush) (void *ctx);
} RdbxRespWriter;

Expand Down
Loading