Add a cache around getpwuid/getgrgid to avoid repeated calls.
[cumulus.git] / chunk.h
1 /* Cumulus: Smart Filesystem Backup to Dumb Servers
2  *
3  * Copyright (C) 2006-2008  The Regents of the University of California
4  * Written by Michael Vrable <mvrable@cs.ucsd.edu>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20
21 /* Compute incremental backups at a sub-file level by chopping files up into
22  * blocks in a content-sensitive manner (using Rabin fingerprints). */
23
24 #ifndef _LBS_CHUNK_H
25 #define _LBS_CHUNK_H
26
27 #include <stdint.h>
28 #include <string>
29
30 /* Block breakpoints can only be computed for a single block of memory, all
31  * loaded at once.  compute_breaks will, given a block of memory, compute the
32  * offsets at which successive blocks should end.  These will be stored into
33  * the provided memory at breakpoints.  The maximum possible number of blocks
34  * (given the block size constaints) can be computed by compute_max_num_breaks
35  * so that the breakpoints array can be properly sized.  The actual number of
36  * blocks is returned by the compute_breaks function. */
37 int chunk_compute_max_num_breaks(size_t buflen);
38 int chunk_compute_breaks(const char *buf, size_t len, size_t *breakpoints);
39 std::string chunk_algorithm_name();
40
41 #endif // _LBS_CHUNK_H