Statistics
| Branch: | Revision:

grapes / som / TopologyManager / topocache.h @ df98cd3a

History | View | Annotate | Download (1.28 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

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

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

    
18
struct peer_cache *entries_undump(const uint8_t *buff, int size);
19
int cache_header_dump(uint8_t *b, const struct peer_cache *c);
20
int entry_dump(uint8_t *b, struct peer_cache *e, int i);
21

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