Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael-grunder <michael.grunder@gmail.com>2014-07-04 00:45:48 +0400
committermichael-grunder <michael.grunder@gmail.com>2015-05-06 01:02:04 +0300
commitc434f0ad8f8dbbedd1ddaf794206b0d04e31cfab (patch)
tree86b2c9482fe9b68bf5a91816319f750ad832b936 /cluster_library.h
parentf3440ad9ae4c72101771ec7fedfa03b23d1346cc (diff)
Added hiredis like response handling
Added a couple of simple mechanisms that parse Redis responses in a hiredis-like way, where replies are returned in clusterReply structures, and can handle N level deep nesting, etc
Diffstat (limited to 'cluster_library.h')
-rw-r--r--cluster_library.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/cluster_library.h b/cluster_library.h
index 7884f1bf..402b04d7 100644
--- a/cluster_library.h
+++ b/cluster_library.h
@@ -320,6 +320,22 @@ typedef struct clusterMultiCmd {
smart_str args;
} clusterMultiCmd;
+/* Hiredis like structure for processing any sort of reply Redis Cluster might
+ * give us, including N level deep nested multi-bulk replies. Unlike hiredis
+ * we don't encode errors, here as that's handled in the cluster structure. */
+typedef struct clusterReply {
+ REDIS_REPLY_TYPE type; /* Our reply type */
+ long long integer; /* Integer reply */
+ size_t len; /* Length of our string */
+ char *str; /* String reply */
+ size_t elements; /* Count of array elements */
+ struct clusterReply **element; /* Array elements */
+} clusterReply;
+
+/* Direct variant response handler */
+clusterReply *cluster_read_resp(redisCluster *c TSRMLS_DC);
+void cluster_free_reply(clusterReply *reply, int free_data);
+
/* Cluster distribution helpers for WATCH */
HashTable *cluster_dist_create();
void cluster_dist_free(HashTable *ht);