Statistics
| Branch: | Revision:

grapes / som / TopologyManager / topocache.h @ eb29e340

History | View | Annotate | Download (1.44 KB)

1 11485577 Luca Abeni
struct peer_cache;
2 480921a6 Luca Abeni
struct cache_entry;
3 393aa781 Luca Abeni
typedef int (*ranking_function)(const void *target, const void *p1, const void *p2);        // FIXME!
4
5 b81d3f0f Luca
struct peer_cache *cache_init(int n, int metadata_size);
6
void cache_free(struct peer_cache *c);
7
void cache_update(struct peer_cache *c);
8 ac9b476d Luca Abeni
void cache_update_tout(struct peer_cache *c);
9 480921a6 Luca Abeni
10 11485577 Luca Abeni
struct nodeID *nodeid(const struct peer_cache *c, int i);
11 fe701696 Luca
const void *get_metadata(const struct peer_cache *c, int *size);
12 90cea048 Luca
int cache_metadata_update(struct peer_cache *c, struct nodeID *p, const void *meta, int meta_size);
13 d74d9d89 Luca Abeni
int cache_add_ranked(struct peer_cache *c, struct nodeID *neighbour, const void *meta, int meta_size, ranking_function f, const void *tmeta);
14 886456d7 Luca
int cache_add(struct peer_cache *c, struct nodeID *neighbour, const void *meta, int meta_size);
15 11485577 Luca Abeni
int cache_del(struct peer_cache *c, struct nodeID *neighbour);
16 b81d3f0f Luca
17 29ab6bd0 Luca Abeni
struct nodeID *rand_peer(struct peer_cache *c, void **meta);
18 b81d3f0f Luca
19 11485577 Luca Abeni
struct peer_cache *entries_undump(const uint8_t *buff, int size);
20
int cache_header_dump(uint8_t *b, const struct peer_cache *c);
21
int entry_dump(uint8_t *b, struct peer_cache *e, int i);
22 b81d3f0f Luca
23 661d190d Luca Abeni
struct peer_cache *merge_caches(struct peer_cache *c1, struct peer_cache *c2, int newsize, int *source);
24 973fb1fd Marco Biazzini
struct peer_cache *cache_rank (const struct peer_cache *c, ranking_function rank, const struct nodeID *target, const void *target_meta);
25 6f80ff91 Marco Biazzini
struct peer_cache *cache_union(struct peer_cache *c1, struct peer_cache *c2, int *size);
26
int cache_resize (struct peer_cache *c, int size);