Permalink
Browse files

Updating wrappers

  • Loading branch information...
1 parent c256a50 commit 2088dda53b746fdf82ee14d78b0ed4f614e9b72d @eric eric committed Sep 9, 2013
Showing with 64 additions and 0 deletions.
  1. +44 −0 ext/zkrb_wrapper.c
  2. +20 −0 ext/zkrb_wrapper.h
View
@@ -381,6 +381,30 @@ int zkrb_call_zoo_aset_acl(zhandle_t *zh, const char *path, int version, struct
}
+static VALUE zkrb_gvl_zoo_amulti(void *data) {
+ zkrb_zoo_amulti_args_t *a = (zkrb_zoo_amulti_args_t *)data;
+ a->rc = zoo_amulti(a->zh, a->count, a->ops, a->results, a->void_completion_t, a->data);
+ return Qnil;
+}
+
+// wrapper that calls zoo_amulti via zkrb_gvl_zoo_amulti inside rb_thread_blocking_region
+int zkrb_call_zoo_amulti(zhandle_t *zh, int count, const zoo_op_t *ops, zoo_op_result_t *results, void_completion_t, const void *data) {
+ zkrb_zoo_amulti_args_t args = {
+ .rc = ZKRB_FAIL,
+ .zh = zh,
+ .count = count,
+ .ops = ops,
+ .results = results,
+ .void_completion_t = void_completion_t,
+ .data = data
+ };
+
+ zkrb_thread_blocking_region(zkrb_gvl_zoo_amulti, (void *)&args);
+
+ return args.rc;
+}
+
+
static VALUE zkrb_gvl_zoo_add_auth(void *data) {
zkrb_zoo_add_auth_args_t *a = (zkrb_zoo_add_auth_args_t *)data;
a->rc = zoo_add_auth(a->zh, a->scheme, a->cert, a->certLen, a->completion, a->data);
@@ -729,3 +753,23 @@ int zkrb_call_zoo_set_acl(zhandle_t *zh, const char *path, int version, const st
}
+static VALUE zkrb_gvl_zoo_multi(void *data) {
+ zkrb_zoo_multi_args_t *a = (zkrb_zoo_multi_args_t *)data;
+ a->rc = zoo_multi(a->zh, a->count, a->ops, a->results);
+ return Qnil;
+}
+
+// wrapper that calls zoo_multi via zkrb_gvl_zoo_multi inside rb_thread_blocking_region
+int zkrb_call_zoo_multi(zhandle_t *zh, int count, const zoo_op_t *ops, zoo_op_result_t *results) {
+ zkrb_zoo_multi_args_t args = {
+ .rc = ZKRB_FAIL,
+ .zh = zh,
+ .count = count,
+ .ops = ops,
+ .results = results
+ };
+
+ zkrb_thread_blocking_region(zkrb_gvl_zoo_multi, (void *)&args);
+
+ return args.rc;
+}
View
@@ -159,6 +159,16 @@ typedef struct {
typedef struct {
zhandle_t *zh;
+ int count;
+ const zoo_op_t *ops;
+ zoo_op_result_t *results;
+ void_completion_t;
+ const void *data;
+ int rc;
+} zkrb_zoo_amulti_args_t;
+
+typedef struct {
+ zhandle_t *zh;
const char* scheme;
const char* cert;
int certLen;
@@ -295,6 +305,14 @@ typedef struct {
int rc;
} zkrb_zoo_set_acl_args_t;
+typedef struct {
+ zhandle_t *zh;
+ int count;
+ const zoo_op_t *ops;
+ zoo_op_result_t *results;
+ int rc;
+} zkrb_zoo_multi_args_t;
+
int zkrb_call_zoo_recv_timeout(zhandle_t *zh);
int zkrb_call_zoo_state(zhandle_t *zh);
int zkrb_call_zoo_acreate(zhandle_t *zh, const char *path, const char *value, int valuelen, const struct ACL_vector *acl, int flags, string_completion_t completion, const void *data);
@@ -311,6 +329,7 @@ int zkrb_call_zoo_awget_children2(zhandle_t *zh, const char *path, watcher_fn wa
int zkrb_call_zoo_async(zhandle_t *zh, const char *path, string_completion_t completion, const void *data);
int zkrb_call_zoo_aget_acl(zhandle_t *zh, const char *path, acl_completion_t completion, const void *data);
int zkrb_call_zoo_aset_acl(zhandle_t *zh, const char *path, int version, struct ACL_vector *acl, void_completion_t completion, const void *data);
+int zkrb_call_zoo_amulti(zhandle_t *zh, int count, const zoo_op_t *ops, zoo_op_result_t *results, void_completion_t, const void *data);
int zkrb_call_zoo_add_auth(zhandle_t *zh, const char* scheme, const char* cert, int certLen, void_completion_t completion, const void *data);
int zkrb_call_zoo_create(zhandle_t *zh, const char *path, const char *value, int valuelen, const struct ACL_vector *acl, int flags, char *path_buffer, int path_buffer_len);
int zkrb_call_zoo_delete(zhandle_t *zh, const char *path, int version);
@@ -326,5 +345,6 @@ int zkrb_call_zoo_get_children2(zhandle_t *zh, const char *path, int watch, stru
int zkrb_call_zoo_wget_children2(zhandle_t *zh, const char *path, watcher_fn watcher, void* watcherCtx, struct String_vector *strings, struct Stat *stat);
int zkrb_call_zoo_get_acl(zhandle_t *zh, const char *path, struct ACL_vector *acl, struct Stat *stat);
int zkrb_call_zoo_set_acl(zhandle_t *zh, const char *path, int version, const struct ACL_vector *acl);
+int zkrb_call_zoo_multi(zhandle_t *zh, int count, const zoo_op_t *ops, zoo_op_result_t *results);
#endif /* ZKRB_WRAPPER_H */

0 comments on commit 2088dda

Please sign in to comment.