grapes / src / TopologyManager / topocache.h @ 88f5c397
History | View | Annotate | Download (1.74 KB)
1 |
#ifndef TOPOCACHE
|
---|---|
2 |
#define TOPOCACHE
|
3 |
|
4 |
struct peer_cache;
|
5 |
struct cache_entry;
|
6 |
typedef int (*ranking_function)(const void *target, const void *p1, const void *p2); // FIXME! |
7 |
|
8 |
struct peer_cache *cache_init(int n, int metadata_size, int max_timestamp); |
9 |
void cache_free(struct peer_cache *c); |
10 |
void cache_update(struct peer_cache *c); |
11 |
struct nodeID *nodeid(const struct peer_cache *c, int i); |
12 |
const void *get_metadata(const struct peer_cache *c, int *size); |
13 |
int cache_metadata_update(struct peer_cache *c, struct nodeID *p, const void *meta, int meta_size); |
14 |
int cache_add_ranked(struct peer_cache *c, struct nodeID *neighbour, const void *meta, int meta_size, ranking_function f, const void *tmeta); |
15 |
int cache_add(struct peer_cache *c, struct nodeID *neighbour, const void *meta, int meta_size); |
16 |
int cache_del(struct peer_cache *c, struct nodeID *neighbour); |
17 |
|
18 |
struct nodeID *rand_peer(struct peer_cache *c, void **meta, int max); |
19 |
struct nodeID *last_peer(struct peer_cache *c); |
20 |
struct peer_cache *rand_cache(struct peer_cache *c, int n); |
21 |
|
22 |
struct peer_cache *entries_undump(const uint8_t *buff, int size); |
23 |
int cache_header_dump(uint8_t *b, const struct peer_cache *c, int include_me); |
24 |
int entry_dump(uint8_t *b, struct peer_cache *e, int i, size_t max_write_size); |
25 |
|
26 |
struct peer_cache *merge_caches(struct peer_cache *c1, struct peer_cache *c2, int newsize, int *source); |
27 |
struct peer_cache *cache_rank (const struct peer_cache *c, ranking_function rank, const struct nodeID *target, const void *target_meta); |
28 |
struct peer_cache *cache_union(struct peer_cache *c1, struct peer_cache *c2, int *size); |
29 |
int cache_resize (struct peer_cache *c, int size); |
30 |
|
31 |
void cache_check(const struct peer_cache *c); |
32 |
|
33 |
void cache_log(const struct peer_cache *c, const char *name); |
34 |
|
35 |
#endif /* TOPOCACHE */ |