2 * index.h: Manage indexes for agedu.
8 * Given the size of an existing data file and the number of
9 * entries required in the index, calculate and return an upper
10 * bound on the required size of the index file after an index has
11 * been written on to the end of it.
13 off_t
index_compute_size(off_t currentsize
, int nodecount
);
16 * Build an index, given the address of a memory-mapped data file
17 * and the starting offset within it.
19 * trie_file structures passed to tf must of course be within the
20 * bounds of the memory-mapped file.
22 * indexbuild_realsize returns the total amount of data _actually_
23 * written into the file, to allow it to be truncated afterwards.
25 typedef struct indexbuild indexbuild
;
26 indexbuild
*indexbuild_new(void *t
, off_t startoff
, int nodecount
);
27 void indexbuild_add(indexbuild
*ib
, const struct trie_file
*tf
);
28 void indexbuild_tag(indexbuild
*ib
);
29 off_t
indexbuild_realsize(indexbuild
*ib
);
30 void indexbuild_free(indexbuild
*ib
);
33 * Query an index to find the total size of records with name
34 * index strictly less than n, with atime less than at.
36 unsigned long long index_query(const void *t
, int n
, unsigned long long at
);
39 * Retrieve an order statistic from the index: given a fraction f,
40 * return an atime such that (at most) the requested fraction of
41 * the total data is older than it.
43 unsigned long long index_order_stat(const void *t
, double f
);