Statistics
| Branch: | Revision:

grapes / som / TopologyManager / topocache.h @ 28399cdc

History | View | Annotate | Download (1.34 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
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
void cache_update_tout(struct peer_cache *c);
9

    
10
struct nodeID *nodeid(const struct peer_cache *c, int i);
11
const void *get_metadata(const struct peer_cache *c, int *size);
12
int cache_metadata_update(struct peer_cache *c, struct nodeID *p, const void *meta, int meta_size);
13
int cache_add_ranked(struct peer_cache *c, struct nodeID *neighbour, const void *meta, int meta_size, ranking_function f, const void *tmeta);
14
int cache_add(struct peer_cache *c, struct nodeID *neighbour, const void *meta, int meta_size);
15
int cache_del(struct peer_cache *c, struct nodeID *neighbour);
16

    
17
struct nodeID *rand_peer(struct peer_cache *c, void **meta);
18

    
19
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, size_t max_write_size);
22

    
23
struct peer_cache *merge_caches_ranked(struct peer_cache *c1, struct peer_cache *c2, int newsize, int *source, ranking_function rank, void *mymeta);
24
struct peer_cache *merge_caches(struct peer_cache *c1, struct peer_cache *c2, int newsize, int *source);