-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathzoo_craq.Th
57 lines (47 loc) · 2.22 KB
/
zoo_craq.Th
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef ZOO_CRAQ_H_
#define ZOO_CRAQ_H_
#include <string>
#include <map>
#include <vector>
#include "zookeeper.h"
#include "tame.h"
#include "tame_rpcserver.h"
#include "parseopt.h"
#include "arpc.h"
#include "async.h"
#include "Node.h"
using namespace std;
extern string my_zoo_id;
extern int zoo_node_count;
extern map<string, Node> zoo_nodes;
extern zhandle_t * zh;
extern map<int, timecb_t *> read_timeouts;
extern map<int, timecb_t *> write_timeouts;
extern void czoo_watcher(zhandle_t *zzh, int type, int state, const char *path,
void* context);
extern void czoo_interest();
extern void czoo__interest_timer();
extern void czoo_fdcb_read_timeout(int fd);
extern void czoo_fdcb_read(int fd);
extern void czoo_fdcb_write_timeout(int fd);
extern void czoo_fdcb_write(int fd);
extern ptr<callback<void, bool> > init_cb;
extern void czoo_init(const char * host, ptr<callback<void, bool> > cb, ZooLogLevel log_level = ZOO_LOG_LEVEL_INFO, CLOSURE);
extern map<int, ptr<callback<void, int> > > czoo_create_cbs;
extern void czoo_create( string path, string value, const struct ACL_vector *acl,
int flags, ptr<callback<void, int> > cb, CLOSURE );
extern void czoo_created(int rc, const char *name, const void *data);
typedef void (*czoo_get_children_watcher)(string, ptr<closure_t>);
typedef void (*czoo_get_children_watcher_ctx)(string, void*, ptr<closure_t>);
extern map<int, ptr<callback<void, vector<string> *> > > czoo_get_children_cbs;
extern map<string, czoo_get_children_watcher> czoo_get_children_watches;
extern map<string, czoo_get_children_watcher_ctx> czoo_get_children_watches_ctx;
extern void czoo_got_children(int rc, const struct String_vector *strings, const void *data);
extern void czoo_get_children(string path, czoo_get_children_watcher func,
ptr<callback<void, vector<string> *> > cb, CLOSURE);
extern void czoo_get_children_2(string path, czoo_get_children_watcher_ctx func,
void* context, ptr<callback<void, vector<string> *> > cb, CLOSURE);
extern map<int, ptr<callback<void, string *> > > czoo_get_cbs;
extern void czoo_got(int rc, const char *value, int value_len, const struct Stat *stat, const void *data);
extern void czoo_get(string path, ptr<callback<void, string *> > cb, CLOSURE);
#endif /* ZOO_CRAQ_H_ */