summaryrefslogtreecommitdiff
path: root/src/swarmkv_mesh.h
blob: 59d19733bff244110e4b37c5556bfc463c14bb87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "swarmkv_message.h"
#include "swarmkv_common.h"

struct swarmkv_mesh;
//The swarmkv_mesh_send takes the ownership of msg.
int swarmkv_mesh_send(struct swarmkv_mesh *mesh, int current_thread_id, int dest_thread_id, struct swarmkv_msg *msg);
//on_msg_callback_t transfers ownership of msg to the callback function
typedef void on_mesh_msg_callback_t(struct swarmkv_msg *msg, int src_tid, void *arg);
void swarmkv_mesh_set_on_msg_cb(struct swarmkv_mesh *mesh, on_mesh_msg_callback_t *cb_func, void *cb_arg);
struct swarmkv_mesh *swarmkv_mesh_new(struct event_base *evbase[], int nthreads, struct log_handle *logger);
void swarmkv_mesh_free(struct swarmkv_mesh *mesh);
struct mesh_info
{
	long long queued_msgs;
	long long enqueue_drops;
};
void swarmkv_mesh_info(struct swarmkv_mesh *mesh, struct mesh_info *info);