Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 10 additions & 117 deletions client/priskv.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,128 +79,21 @@ typedef struct priskv_sgl {
} priskv_sgl;

typedef enum priskv_status {
PRISKV_STATUS_OK = 0x00,

/* unrecognized command, typically protocol error */
PRISKV_STATUS_INVALID_COMMAND = 0x100,

/* zero length key in use? Note that '\0' is allowed */
PRISKV_STATUS_KEY_EMPTY,

/* does the length of key exceed @max_key_length? */
PRISKV_STATUS_KEY_TOO_BIG,

/* zero length value in use? Note that '\0' is allowed */
PRISKV_STATUS_VALUE_EMPTY,

/* the length of @priskv_sgl is smaller than the length of value */
PRISKV_STATUS_VALUE_TOO_BIG,

/* no such command */
PRISKV_STATUS_NO_SUCH_COMMAND,

/* no such key */
PRISKV_STATUS_NO_SUCH_KEY,

/* no such token */
PRISKV_STATUS_NO_SUCH_TOKEN,

/* invalid SGL. the number of SGL within a command must not exceed @max_sgl */
PRISKV_STATUS_INVALID_SGL,

/* invalid regex */
PRISKV_STATUS_INVALID_REGEX,

/* key is updating */
PRISKV_STATUS_KEY_UPDATING,

/* connect to server side failed */
PRISKV_STATUS_CONNECT_ERROR,

/* generic server side failure */
PRISKV_STATUS_SERVER_ERROR,

/* operation not permitted (e.g., SEAL/RELEASE/DROP with wrong token) */
PRISKV_STATUS_PERMISSION_DENIED,

/* no enough memory reported by server side */
PRISKV_STATUS_NO_MEM = 0x200,

/* RDMA disconnected from the server side */
PRISKV_STATUS_DISCONNECTED = 0xF00,

/* local transport error occurs */
PRISKV_STATUS_TRANSPORT_ERROR,

/* does inflight requests exceed @max_inflight_command? */
PRISKV_STATUS_BUSY,

/* unexpected protocol error */
PRISKV_STATUS_PROTOCOL_ERROR,
#undef PRISKV_DECLARE_STATUS
#define PRISKV_DECLARE_STATUS(NAME, CODE, STR, IS_RESP_STATUS) PRISKV_STATUS_##NAME = CODE,
#include "priskv-status.inc"
#undef PRISKV_DECLARE_STATUS
} priskv_status;

static inline const char *priskv_status_str(priskv_status status)
{
switch (status) {
case PRISKV_STATUS_OK:
return "OK";

case PRISKV_STATUS_INVALID_COMMAND:
return "Invalid command";

case PRISKV_STATUS_KEY_EMPTY:
return "Empty key";

case PRISKV_STATUS_KEY_TOO_BIG:
return "Key too big";

case PRISKV_STATUS_VALUE_EMPTY:
return "Empty Value";

case PRISKV_STATUS_VALUE_TOO_BIG:
return "Value too big";

case PRISKV_STATUS_NO_SUCH_COMMAND:
return "No such command";

case PRISKV_STATUS_NO_SUCH_KEY:
return "No such key";

case PRISKV_STATUS_NO_SUCH_TOKEN:
return "No such token";

case PRISKV_STATUS_INVALID_SGL:
return "Invalid SGL";

case PRISKV_STATUS_INVALID_REGEX:
return "Invalid regex";

case PRISKV_STATUS_KEY_UPDATING:
return "Key is updating";

case PRISKV_STATUS_CONNECT_ERROR:
return "Connect error";

case PRISKV_STATUS_SERVER_ERROR:
return "Server internal error";

case PRISKV_STATUS_PERMISSION_DENIED:
return "Permission denied";

case PRISKV_STATUS_NO_MEM:
return "No memory";

case PRISKV_STATUS_DISCONNECTED:
return "Disconnected";

case PRISKV_STATUS_TRANSPORT_ERROR:
return "Transport error";

case PRISKV_STATUS_BUSY:
return "Busy";

case PRISKV_STATUS_PROTOCOL_ERROR:
return "Protocol error";
#undef PRISKV_DECLARE_STATUS
#define PRISKV_DECLARE_STATUS(NAME, CODE, STR, IS_RESP_STATUS) \
case CODE: \
return STR;
#include "priskv-status.inc"
#undef PRISKV_DECLARE_STATUS
}

return "Unknown";
Expand Down
2 changes: 1 addition & 1 deletion cluster/client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ifneq (,$(filter $(PRISKV_USE_CUDA),yes YES y Y 1))
CFLAGS += $(CUDA_LDFLAGS) -DPRISKV_USE_CUDA
endif

PRISKV_CLUSTER_TARGETS = priskv-cluster-benchmark priskv-cluster-example priskv-cluster-test_status
PRISKV_CLUSTER_TARGETS = priskv-cluster-benchmark priskv-cluster-example
PRISKV_CLUSTER_TARGETS_SRCS = $(patsubst priskv-cluster-%, %.c, $(PRISKV_CLUSTER_TARGETS))
ALL_SRCS = $(wildcard *.c)
LIB_SRCS = $(filter-out $(PRISKV_CLUSTER_TARGETS_SRCS), $(wildcard *.c))
Expand Down
126 changes: 10 additions & 116 deletions cluster/client/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,127 +47,21 @@ typedef struct priskvClusterSGL {
} priskvClusterSGL;

typedef enum priskvClusterStatus {
PRISKV_CLUSTER_STATUS_OK = 0x00,
/* unrecognized command, typically protocol error */
PRISKV_CLUSTER_STATUS_INVALID_COMMAND = 0x100,

/* zero length key in use? Note that '\0' is allowed */
PRISKV_CLUSTER_STATUS_KEY_EMPTY,

/* does the length of key exceed @max_key_length? */
PRISKV_CLUSTER_STATUS_KEY_TOO_BIG,

/* zero length value in use? Note that '\0' is allowed */
PRISKV_CLUSTER_STATUS_VALUE_EMPTY,

/* the length of @priskv_sgl is smaller than the length of value */
PRISKV_CLUSTER_STATUS_VALUE_TOO_BIG,

/* no such command */
PRISKV_CLUSTER_STATUS_NO_SUCH_COMMAND,

/* no such key */
PRISKV_CLUSTER_STATUS_NO_SUCH_KEY,

/* no such token */
PRISKV_CLUSTER_STATUS_NO_SUCH_TOKEN,

/* invalid SGL. the number of SGL within a command must not exceed @max_sgl */
PRISKV_CLUSTER_STATUS_INVALID_SGL,

/* invalid regex */
PRISKV_CLUSTER_STATUS_INVALID_REGEX,

/* key is updating */
PRISKV_CLUSTER_STATUS_KEY_UPDATING,

/* connect to server side failed */
PRISKV_CLUSTER_STATUS_CONNECT_ERROR,

/* generic server side failure */
PRISKV_CLUSTER_STATUS_SERVER_ERROR,

/* operation not permitted (e.g., SEAL/RELEASE/DROP with wrong token) */
PRISKV_CLUSTER_STATUS_PERMISSION_DENIED,

/* no enough memory reported by server side */
PRISKV_CLUSTER_STATUS_NO_MEM = 0x200,

/* RDMA disconnected from the server side */
PRISKV_CLUSTER_STATUS_DISCONNECTED = 0xF00,

/* local RDMA error occurs */
PRISKV_CLUSTER_STATUS_TRANSPORT_ERROR,

/* does inflight requests exceed @max_inflight_command? */
PRISKV_CLUSTER_STATUS_BUSY,

/* unexpected protocol error */
PRISKV_CLUSTER_STATUS_PROTOCOL_ERROR,
#undef PRISKV_DECLARE_STATUS
#define PRISKV_DECLARE_STATUS(NAME, CODE, STR, IS_RESP_STATUS) PRISKV_CLUSTER_STATUS_##NAME = CODE,
#include "priskv-cluster-status.inc"
#undef PRISKV_DECLARE_STATUS
} priskvClusterStatus;

static inline const char *priskv_cluster_status_str(priskvClusterStatus status)
{
switch (status) {
case PRISKV_CLUSTER_STATUS_OK:
return "OK";

case PRISKV_CLUSTER_STATUS_INVALID_COMMAND:
return "Invalid command";

case PRISKV_CLUSTER_STATUS_KEY_EMPTY:
return "Empty key";

case PRISKV_CLUSTER_STATUS_KEY_TOO_BIG:
return "Key too big";

case PRISKV_CLUSTER_STATUS_VALUE_EMPTY:
return "Empty Value";

case PRISKV_CLUSTER_STATUS_VALUE_TOO_BIG:
return "Value too big";

case PRISKV_CLUSTER_STATUS_NO_SUCH_COMMAND:
return "No such command";

case PRISKV_CLUSTER_STATUS_NO_SUCH_KEY:
return "No such key";

case PRISKV_CLUSTER_STATUS_NO_SUCH_TOKEN:
return "No such token";

case PRISKV_CLUSTER_STATUS_INVALID_SGL:
return "Invalid SGL";

case PRISKV_CLUSTER_STATUS_INVALID_REGEX:
return "Invalid regex";

case PRISKV_CLUSTER_STATUS_KEY_UPDATING:
return "Key is updating";

case PRISKV_CLUSTER_STATUS_CONNECT_ERROR:
return "Connect error";

case PRISKV_CLUSTER_STATUS_SERVER_ERROR:
return "Server internal error";

case PRISKV_CLUSTER_STATUS_PERMISSION_DENIED:
return "Permission denied";

case PRISKV_CLUSTER_STATUS_NO_MEM:
return "No memory";

case PRISKV_CLUSTER_STATUS_DISCONNECTED:
return "Disconnected";

case PRISKV_CLUSTER_STATUS_TRANSPORT_ERROR:
return "Transport error";

case PRISKV_CLUSTER_STATUS_BUSY:
return "Busy";

case PRISKV_CLUSTER_STATUS_PROTOCOL_ERROR:
return "Protocol error";
#undef PRISKV_DECLARE_STATUS
#define PRISKV_DECLARE_STATUS(NAME, CODE, STR, IS_RESP_STATUS) \
case CODE: \
return STR;
#include "priskv-cluster-status.inc"
#undef PRISKV_DECLARE_STATUS
}

return "Unknown";
Expand Down
71 changes: 0 additions & 71 deletions cluster/client/test_status.c

This file was deleted.

4 changes: 4 additions & 0 deletions include/priskv-cluster-status.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* Arguments: NAME, CODE, MESSAGE, IS_RESP_STATUS */
#include "priskv-status.inc"

/* Declare cluster-specific status codes below this line */
Loading