-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdmap-neighbor.h
64 lines (47 loc) · 1.57 KB
/
dmap-neighbor.h
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
58
59
60
61
62
63
64
#ifndef __DMAP_NEIGHBOR_H__
#define __DMAP_NEIGHBOR_H__
#include "dmap-const.h"
#include "dmap-connection.h"
enum {
DMAP_NEIGHBOR_S_INIT = 1,
DMAP_NEIGHBOR_S_HELLO = 3,
DMAP_NEIGHBOR_S_BROKEN = 4,
};
struct dmap;
struct dmap_neighbor {
struct dmap *map;
struct mutex mutex;
struct list_head list;
struct dmap_address addr;
int state;
atomic_t ref_count;
struct dmap_connection con;
struct dmap_packet request;
struct dmap_packet response;
struct rb_node rb_link;
u64 ping_us;
};
void dmap_neighbor_put(struct dmap_neighbor *neighbor);
void dmap_neighbor_get(struct dmap_neighbor *neighbor);
struct dmap_neighbor *dmap_neighbor_create(struct dmap *map,
char *host, int port);
int dmap_neighbor_hello(struct dmap_neighbor *neighbor);
int dmap_neighbor_bye(struct dmap_neighbor *neighbor);
int dmap_neighbor_ping(struct dmap_neighbor *neighbor);
void dmap_neighbor_set_state(struct dmap_neighbor *neighbor, int state);
int dmap_neighbor_set_key(struct dmap_neighbor *neighbor,
struct dmap_req_set_key *req,
struct dmap_resp_set_key *resp);
int dmap_neighbor_get_key(struct dmap_neighbor *neighbor,
struct dmap_req_get_key *req,
struct dmap_resp_get_key *resp);
int dmap_neighbor_del_key(struct dmap_neighbor *neighbor,
struct dmap_req_del_key *req,
struct dmap_resp_del_key *resp);
int dmap_neighbor_upd_key(struct dmap_neighbor *neighbor,
struct dmap_req_upd_key *req,
struct dmap_resp_upd_key *resp);
int dmap_neighbor_cmpxchg_key(struct dmap_neighbor *neighbor,
struct dmap_req_cmpxchg_key *req,
struct dmap_resp_cmpxchg_key *resp);
#endif