Statistics
| Branch: | Revision:

grapes / som / TopologyManager / topocache.h @ 661d190d

History | View | Annotate | Download (1.44 KB)

1
struct peer_cache;
2
struct cache_entry;
3
typedef int (*ranking_function)(const void *target, const void *p1, const void *p2);        // FIXME!
4

    
5

    
6
struct nodeID *nodeid(const struct peer_cache *c, int i);
7
const void *get_metadata(const struct peer_cache *c, int *size);
8
int cache_metadata_update(struct peer_cache *c, struct nodeID *p, const void *meta, int meta_size);
9
int cache_add_ranked(struct peer_cache *c, struct nodeID *neighbour, const void *meta, int meta_size, ranking_function f, struct peer_cache *target);
10
int cache_add(struct peer_cache *c, struct nodeID *neighbour, const void *meta, int meta_size);
11
int cache_del(struct peer_cache *c, struct nodeID *neighbour);
12
struct peer_cache *cache_init(int n, int metadata_size);
13
int fill_cache_entry(struct cache_entry *c, const struct nodeID *s);
14
int in_cache(const struct peer_cache *c, const struct cache_entry *elem);
15
struct nodeID *rand_peer(struct peer_cache *c);
16
struct peer_cache *entries_undump(const uint8_t *buff, int size);
17
int cache_header_dump(uint8_t *b, const struct peer_cache *c);
18
int entry_dump(uint8_t *b, struct peer_cache *e, int i);
19
struct peer_cache *merge_caches_ranked(struct peer_cache *c1, struct peer_cache *c2, int newsize, int *source, ranking_function rank, struct peer_cache *me);
20
struct peer_cache *merge_caches(struct peer_cache *c1, struct peer_cache *c2, int newsize, int *source);
21
void cache_update(struct peer_cache *c);
22
int empty(struct peer_cache *c);
23
void cache_free(struct peer_cache *c);