Statistics
| Branch: | Revision:

grapes / src / TopologyManager / blist_cache.h @ 60fa723d

History | View | Annotate | Download (1.66 KB)

1
#ifndef BLIST_CACHE
2
#define BLIST_CACHE
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 *blist_cache_init(int n, int metadata_size, int max_timestamp);
9
void blist_cache_free(struct peer_cache *c);
10
void blist_cache_update(struct peer_cache *c);
11
void blist_cache_update_tout(struct peer_cache *c);
12

    
13
struct nodeID *blist_nodeid(const struct peer_cache *c, int i);
14
const void *blist_get_metadata(const struct peer_cache *c, int *size);
15
int blist_cache_metadata_update(struct peer_cache *c, struct nodeID *p, const void *meta, int meta_size);
16
int blist_cache_add_ranked(struct peer_cache *c, struct nodeID *neighbour, const void *meta, int meta_size, ranking_function f, const void *tmeta);
17
int blist_cache_add(struct peer_cache *c, struct nodeID *neighbour, const void *meta, int meta_size);
18
int blist_cache_del(struct peer_cache *c, struct nodeID *neighbour);
19

    
20
struct nodeID *blist_rand_peer(struct peer_cache *c, void **meta, int max);
21

    
22
struct peer_cache *blist_entries_undump(const uint8_t *buff, int size);
23
int blist_cache_header_dump(uint8_t *b, const struct peer_cache *c);
24
int blist_entry_dump(uint8_t *b, struct peer_cache *e, int i, size_t max_write_size);
25

    
26
struct peer_cache *blist_merge_caches(struct peer_cache *c1, struct peer_cache *c2, int newsize, int *source);
27
struct peer_cache *blist_cache_rank (const struct peer_cache *c, ranking_function rank, const struct nodeID *target, const void *target_meta);
28
struct peer_cache *blist_cache_union(struct peer_cache *c1, struct peer_cache *c2, int *size);
29
int blist_cache_resize (struct peer_cache *c, int size);
30

    
31
#endif        /* BLIST_CACHE */