24 #include <sys/socket.h>
27 #include "winconfig.h"
33 #include "zookeeper_version.h"
35 #include "zookeeper.jute.h"
69 # define ZOOAPI __declspec(dllexport)
71 # if (defined(__CYGWIN__) || defined(WIN32)) && !defined(USE_STATIC_LIB)
72 # define ZOOAPI __declspec(dllimport)
126 typedef enum {ZOO_LOG_LEVEL_ERROR=1,ZOO_LOG_LEVEL_WARN=2,ZOO_LOG_LEVEL_INFO=3,ZOO_LOG_LEVEL_DEBUG=4} ZooLogLevel;
131 extern ZOOAPI
const int ZOO_PERM_READ;
132 extern ZOOAPI
const int ZOO_PERM_WRITE;
133 extern ZOOAPI
const int ZOO_PERM_CREATE;
134 extern ZOOAPI
const int ZOO_PERM_DELETE;
135 extern ZOOAPI
const int ZOO_PERM_ADMIN;
136 extern ZOOAPI
const int ZOO_PERM_ALL;
161 extern ZOOAPI
const int ZOOKEEPER_WRITE;
162 extern ZOOAPI
const int ZOOKEEPER_READ;
172 extern ZOOAPI
const int ZOO_EPHEMERAL;
173 extern ZOOAPI
const int ZOO_SEQUENCE;
182 extern ZOOAPI
const int ZOO_EXPIRED_SESSION_STATE;
183 extern ZOOAPI
const int ZOO_AUTH_FAILED_STATE;
184 extern ZOOAPI
const int ZOO_CONNECTING_STATE;
185 extern ZOOAPI
const int ZOO_ASSOCIATING_STATE;
186 extern ZOOAPI
const int ZOO_CONNECTED_STATE;
279 const struct ACL_vector *acl;
331 int valuelen,
const struct ACL_vector *acl,
int flags,
332 char *path_buffer,
int path_buffer_len);
364 int buflen,
int version,
struct Stat *stat);
419 int state,
const char *path,
void *watcherCtx);
450 int recv_timeout,
const clientid_t *clientid,
void *context,
int flags);
511 struct sockaddr *addr, socklen_t *addr_len);
628 const struct Stat *stat,
const void *data);
652 const struct String_vector *strings,
const void *data);
680 const struct String_vector *strings,
const struct Stat *stat,
728 struct Stat *stat,
const void *data);
770 int valuelen,
const struct ACL_vector *acl,
int flags,
935 ZOOAPI
int zoo_aset(
zhandle_t *zh,
const char *path,
const char *buffer,
int buflen,
1142 ZOOAPI
const char*
zerror(
int c);
1249 int valuelen,
const struct ACL_vector *acl,
int flags,
1250 char *path_buffer,
int path_buffer_len);
1319 watcher_fn watcher,
void* watcherCtx,
struct Stat *stat);
1341 ZOOAPI
int zoo_get(
zhandle_t *zh,
const char *path,
int watch,
char *buffer,
1342 int* buffer_len,
struct Stat *stat);
1372 char *buffer,
int* buffer_len,
struct Stat *stat);
1397 int buflen,
int version);
1424 int buflen,
int version,
struct Stat *stat);
1444 struct String_vector *strings);
1471 struct String_vector *strings);
1494 struct String_vector *strings,
struct Stat *stat);
1524 struct String_vector *strings,
struct Stat *stat);
1564 const struct ACL_vector *acl);
ZOOAPI int zoo_aget_acl(zhandle_t *zh, const char *path, acl_completion_t completion, const void *data)
gets the acl associated with a node.
ZOOAPI int zoo_awget_children(zhandle_t *zh, const char *path, watcher_fn watcher, void *watcherCtx, strings_completion_t completion, const void *data)
lists the children of a node.
Definition: zookeeper.h:107
ZOOAPI void zoo_set_log_stream(FILE *logStream)
sets the stream to be used by the library for logging
Definition: zookeeper.h:88
Definition: zookeeper.h:115
ZOOAPI int zoo_set(zhandle_t *zh, const char *path, const char *buffer, int buflen, int version)
sets the data associated with a node. See zoo_set2 function if you require access to the stat informa...
ZOOAPI struct Id ZOO_AUTH_IDS
Definition: zookeeper.h:90
ZOOAPI int zoo_awget_children2(zhandle_t *zh, const char *path, watcher_fn watcher, void *watcherCtx, strings_stat_completion_t completion, const void *data)
lists the children of a node, and get the parent stat.
ZOOAPI int zoo_aget_children2(zhandle_t *zh, const char *path, int watch, strings_stat_completion_t completion, const void *data)
lists the children of a node, and get the parent stat.
Definition: zookeeper.h:89
void(* strings_completion_t)(int rc, const struct String_vector *strings, const void *data)
signature of a completion function that returns a list of strings.
Definition: zookeeper.h:651
Definition: zookeeper.h:94
ZOOAPI int zoo_aset_acl(zhandle_t *zh, const char *path, int version, struct ACL_vector *acl, void_completion_t, const void *data)
sets the acl associated with a node.
void(* stat_completion_t)(int rc, const struct Stat *stat, const void *data)
signature of a completion function that returns a Stat structure.
Definition: zookeeper.h:600
zoo_op_result structure.
Definition: zookeeper.h:385
ZOOAPI int zoo_get_children2(zhandle_t *zh, const char *path, int watch, struct String_vector *strings, struct Stat *stat)
lists the children of a node and get its stat synchronously.
ZOOAPI int zoo_aget(zhandle_t *zh, const char *path, int watch, data_completion_t completion, const void *data)
gets the data associated with a node.
ZOOAPI int zoo_get_acl(zhandle_t *zh, const char *path, struct ACL_vector *acl, struct Stat *stat)
gets the acl associated with a node synchronously.
ZOOAPI zhandle_t * zookeeper_init(const char *host, watcher_fn fn, int recv_timeout, const clientid_t *clientid, void *context, int flags)
create a handle to used communicate with zookeeper.
ZOOAPI void zoo_set_context(zhandle_t *zh, void *context)
set the context for this handle.
ZOOAPI int zoo_amulti(zhandle_t *zh, int count, const zoo_op_t *ops, zoo_op_result_t *results, void_completion_t, const void *data)
atomically commits multiple zookeeper operations.
Definition: zookeeper.h:110
struct _zhandle zhandle_t
ZooKeeper handle.
Definition: zookeeper.h:246
ZOOAPI int zoo_exists(zhandle_t *zh, const char *path, int watch, struct Stat *stat)
checks the existence of a node in zookeeper synchronously.
ZOOAPI int zoo_async(zhandle_t *zh, const char *path, string_completion_t completion, const void *data)
Flush leader channel.
ZOOAPI struct ACL_vector ZOO_CREATOR_ALL_ACL
Definition: zookeeper.h:111
ZOOAPI void zoo_set_debug_level(ZooLogLevel logLevel)
sets the debugging level for the library
ZOOAPI const int ZOO_NOTWATCHING_EVENT
a watch has been removed.
Definition: zookeeper.h:104
Definition: zookeeper.h:91
ZOOAPI struct Id ZOO_ANYONE_ID_UNSAFE
struct zoo_op zoo_op_t
zoo_op structure.
Definition: zookeeper.h:114
void(* strings_stat_completion_t)(int rc, const struct String_vector *strings, const struct Stat *stat, const void *data)
signature of a completion function that returns a list of strings and stat.
Definition: zookeeper.h:679
ZOOAPI int zoo_delete(zhandle_t *zh, const char *path, int version)
delete a node in zookeeper synchronously.
ZOOAPI int zoo_adelete(zhandle_t *zh, const char *path, int version, void_completion_t completion, const void *data)
delete a node in zookeeper.
Definition: zookeeper.h:93
ZOOAPI int zoo_state(zhandle_t *zh)
get the state of the zookeeper connection.
ZOOAPI watcher_fn zoo_set_watcher(zhandle_t *zh, watcher_fn newFn)
set a watcher function
ZOOAPI int 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)
create a node synchronously.
ZOOAPI int zoo_aexists(zhandle_t *zh, const char *path, int watch, stat_completion_t completion, const void *data)
checks the existence of a node in zookeeper.
client id structure.
Definition: zookeeper.h:255
ZOOAPI int zoo_wexists(zhandle_t *zh, const char *path, watcher_fn watcher, void *watcherCtx, struct Stat *stat)
checks the existence of a node in zookeeper synchronously.
ZOOAPI int zoo_aget_children(zhandle_t *zh, const char *path, int watch, strings_completion_t completion, const void *data)
lists the children of a node.
Definition: zookeeper.h:106
ZOOAPI struct ACL_vector ZOO_READ_ACL_UNSAFE
struct zoo_op_result zoo_op_result_t
zoo_op_result structure.
Definition: zookeeper.h:109
ZOOAPI int zoo_set_acl(zhandle_t *zh, const char *path, int version, const struct ACL_vector *acl)
sets the acl associated with a node synchronously.
Definition: zookeeper.h:112
ZOOAPI int zoo_get(zhandle_t *zh, const char *path, int watch, char *buffer, int *buffer_len, struct Stat *stat)
gets the data associated with a node synchronously.
ZOOAPI const int ZOO_CHANGED_EVENT
a node has changed.
ZOOAPI int zoo_wget_children2(zhandle_t *zh, const char *path, watcher_fn watcher, void *watcherCtx, struct String_vector *strings, struct Stat *stat)
lists the children of a node and get its stat synchronously.
ZOOAPI int zoo_set2(zhandle_t *zh, const char *path, const char *buffer, int buflen, int version, struct Stat *stat)
sets the data associated with a node. This function is the same as zoo_set except that it also provid...
ZOOAPI int 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)
create a node.
Definition: zookeeper.h:95
void(* watcher_fn)(zhandle_t *zh, int type, int state, const char *path, void *watcherCtx)
signature of a watch function.
Definition: zookeeper.h:418
Definition: zookeeper.h:87
void(* string_completion_t)(int rc, const char *value, const void *data)
signature of a completion function that returns a list of strings.
Definition: zookeeper.h:702
void(* acl_completion_t)(int rc, struct ACL_vector *acl, struct Stat *stat, const void *data)
signature of a completion function that returns an ACL.
Definition: zookeeper.h:727
ZOOAPI int zoo_awexists(zhandle_t *zh, const char *path, watcher_fn watcher, void *watcherCtx, stat_completion_t completion, const void *data)
checks the existence of a node in zookeeper.
Definition: zookeeper.h:116
void zoo_create_op_init(zoo_op_t *op, const char *path, const char *value, int valuelen, const struct ACL_vector *acl, int flags, char *path_buffer, int path_buffer_len)
zoo_create_op_init.
ZOOAPI const int ZOO_CHILD_EVENT
a change as occurred in the list of children.
zoo_op structure.
Definition: zookeeper.h:269
ZOOAPI int zookeeper_close(zhandle_t *zh)
close the zookeeper handle and free up any resources.
ZOOAPI int zoo_wget(zhandle_t *zh, const char *path, watcher_fn watcher, void *watcherCtx, char *buffer, int *buffer_len, struct Stat *stat)
gets the data associated with a node synchronously.
ZOOAPI int zookeeper_interest(zhandle_t *zh, int *fd, int *interest, struct timeval *tv)
Returns the events that zookeeper is interested in.
ZOOAPI int zoo_get_children(zhandle_t *zh, const char *path, int watch, struct String_vector *strings)
lists the children of a node synchronously.
ZOOAPI const clientid_t * zoo_client_id(zhandle_t *zh)
return the client session id, only valid if the connections is currently connected (ie...
ZOO_ERRORS
Definition: zookeeper.h:80
Definition: zookeeper.h:92
Definition: zookeeper.h:105
ZOOAPI struct sockaddr * zookeeper_get_connected_host(zhandle_t *zh, struct sockaddr *addr, socklen_t *addr_len)
returns the socket address for the current connection
ZOOAPI const int ZOO_DELETED_EVENT
a node has been deleted.
ZOOAPI const int ZOO_CREATED_EVENT
a node has been created.
Definition: zookeeper.h:81
ZOOAPI int zoo_multi(zhandle_t *zh, int count, const zoo_op_t *ops, zoo_op_result_t *results)
atomically commits multiple zookeeper operations synchronously.
void zoo_check_op_init(zoo_op_t *op, const char *path, int version)
zoo_check_op_init.
ZOOAPI const char * zerror(int c)
return an error string.
ZOOAPI int zookeeper_process(zhandle_t *zh, int events)
Notifies zookeeper that an event of interest has happened.
ZOOAPI int zoo_awget(zhandle_t *zh, const char *path, watcher_fn watcher, void *watcherCtx, data_completion_t completion, const void *data)
gets the data associated with a node.
ZOOAPI const void * zoo_get_context(zhandle_t *zh)
return the context for this handle.
Definition: zookeeper.h:103
Definition: zookeeper.h:108
ZOOAPI int zoo_recv_timeout(zhandle_t *zh)
return the timeout for this session, only valid if the connections is currently connected (ie...
ZOOAPI struct ACL_vector ZOO_OPEN_ACL_UNSAFE
void(* void_completion_t)(int rc, const void *data)
signature of a completion function for a call that returns void.
Definition: zookeeper.h:578
ZOOAPI int zoo_aset(zhandle_t *zh, const char *path, const char *buffer, int buflen, int version, stat_completion_t completion, const void *data)
sets the data associated with a node.
ZOOAPI int is_unrecoverable(zhandle_t *zh)
checks if the current zookeeper connection state can't be recovered.
ZOOAPI int zoo_add_auth(zhandle_t *zh, const char *scheme, const char *cert, int certLen, void_completion_t completion, const void *data)
specify application credentials.
void(* data_completion_t)(int rc, const char *value, int value_len, const struct Stat *stat, const void *data)
signature of a completion function that returns data.
Definition: zookeeper.h:627
void zoo_set_op_init(zoo_op_t *op, const char *path, const char *buffer, int buflen, int version, struct Stat *stat)
zoo_set_op_init.
ZOOAPI int zoo_wget_children(zhandle_t *zh, const char *path, watcher_fn watcher, void *watcherCtx, struct String_vector *strings)
lists the children of a node synchronously.
Definition: zookeeper.h:113
void zoo_delete_op_init(zoo_op_t *op, const char *path, int version)
zoo_delete_op_init.
ZOOAPI const int ZOO_SESSION_EVENT
a session has been lost.
ZOOAPI void zoo_deterministic_conn_order(int yesOrNo)
enable/disable quorum endpoint order randomization