Multi-ApplicationOnlineProfiling  2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nsc.h
Go to the documentation of this file.
1 #ifndef NSC_H
2 #define NSC_H
3 
4 #include "jsonCache.h"
5 
6 
7 struct Context
8 {
9  char *passwd;
10  char *addr;
11  char *s_port;
12  int port;
13 };
14 
15 
16 int Context_init( struct Context *ctx );
17 void Context_release( struct Context *ctx );
18 
19 enum
20 {
26 };
27 
28 
29 
31 {
32  struct Context ctx;
33 
35 
36  uint32_t max_key_len;
37  uint32_t max_buffer_size;
38 
39  pthread_t th;
40  int socket;
41  pthread_mutex_t socket_w_lock;
42  int connected;
43 
45  int *clients;
48  pthread_mutex_t *client_socket_w_lock;
49  pthread_t *client_threads;
50 
51  struct jsonCache cache;
52 };
53 
54 
55 void nodeSharedCache_set_handler( char *key, json_t *elem, void *ctx );
56 void nodeSharedCache_delete_handler( char *key, void *ctx );
57 
58 void nodeSharedCache_commit( struct nodeSharedCache *nsc, char *key );
59 void nodeSharedCache_delete( struct nodeSharedCache *nsc, char *key );
60 
61 char * nodeSharedCache_get_json( struct nodeSharedCache *nsc, char *key );
62 json_t * nodeSharedCache_get( struct nodeSharedCache *nsc, char *key );
63 
64 void nodeSharedCache_set( struct nodeSharedCache *nsc, char *key, json_t *json );
65 void nodeSharedCache_set_json( struct nodeSharedCache *nsc, char *key, char *json );
66 
67 void nodeSharedCache_reduce_json( struct nodeSharedCache *nsc, char *key, char *json );
68 void nodeSharedCache_reduce( struct nodeSharedCache *nsc, char *key, json_t *elem );
69 
70 int nodeSharedCache_init( struct nodeSharedCache *nsc );
71 int nodeSharedCache_proxy_init( struct nodeSharedCache *nsc, char *destination_server, int expected_clients );
73 void nodeSharedCache_wait( struct nodeSharedCache *nsc);
74 void nodeSharedCache_release( struct nodeSharedCache *nsc);
75 
76 
77 #endif /* NSC_H */
int Context_init(struct Context *ctx)
Definition: nsc.c:92
struct Context ctx
Definition: nsc.h:32
int nodeSharedCache_proxy_accept_clients(struct nodeSharedCache *nsc)
Definition: nsc.c:860
int nodeSharedCache_init(struct nodeSharedCache *nsc)
Definition: nsc.c:657
int connected_clients
Definition: nsc.h:47
void * ctx
Definition: jsonCache.h:366
void nodeSharedCache_commit(struct nodeSharedCache *nsc, char *key)
Definition: nsc.c:1235
char * nodeSharedCache_get_json(struct nodeSharedCache *nsc, char *key)
Definition: nsc.c:1215
void nodeSharedCache_reduce(struct nodeSharedCache *nsc, char *key, json_t *elem)
Definition: nsc.c:1189
pthread_mutex_t socket_w_lock
Definition: nsc.h:41
void nodeSharedCache_set_json(struct nodeSharedCache *nsc, char *key, char *json)
Definition: nsc.c:1167
void nodeSharedCache_wait(struct nodeSharedCache *nsc)
Definition: nsc.c:1096
int nodeSharedCache_proxy_init(struct nodeSharedCache *nsc, char *destination_server, int expected_clients)
Definition: nsc.c:962
void nodeSharedCache_delete_handler(char *key, void *ctx)
Definition: nsc.c:1159
int port
Definition: nsc.h:12
int socket
Definition: nsc.h:40
Definition: nsc.h:24
int * clients
Definition: nsc.h:45
Definition: nsc.h:22
uint32_t max_key_len
Definition: nsc.h:36
char * s_port
Definition: nsc.h:11
Definition: nsc.h:25
int connected
Definition: nsc.h:42
char * passwd
Definition: nsc.h:9
void nodeSharedCache_release(struct nodeSharedCache *nsc)
Definition: nsc.c:1123
void nodeSharedCache_delete(struct nodeSharedCache *nsc, char *key)
Definition: nsc.c:1230
uint32_t max_buffer_size
Definition: nsc.h:37
pthread_mutex_t * client_socket_w_lock
Definition: nsc.h:48
json_t * nodeSharedCache_get(struct nodeSharedCache *nsc, char *key)
Definition: nsc.c:1208
void nodeSharedCache_set(struct nodeSharedCache *nsc, char *key, json_t *json)
Definition: nsc.c:1175
int listening_socket
Definition: nsc.h:44
int expected_clients
Definition: nsc.h:46
pthread_t th
Definition: nsc.h:39
void Context_release(struct Context *ctx)
Definition: nsc.c:97
struct jsonCache cache
Definition: nsc.h:51
int been_waited
Definition: nsc.h:34
pthread_t * client_threads
Definition: nsc.h:49
Definition: nsc.h:7
void nodeSharedCache_reduce_json(struct nodeSharedCache *nsc, char *key, char *json)
Definition: nsc.c:1181
char * addr
Definition: nsc.h:10
Definition: nsc.h:23
Definition: nsc.h:21
void nodeSharedCache_set_handler(char *key, json_t *elem, void *ctx)
Definition: nsc.c:1143