X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=third_party%2Fchunk.h;fp=third_party%2Fchunk.h;h=6cc73923c98cdf185c6a5a55805d31781793a3e0;hb=35dd99aa3d47805b661fe3126a951710fa7dee11;hp=0000000000000000000000000000000000000000;hpb=cdbe16714a926da9f8ae752027138aa15cda7f60;p=cumulus.git diff --git a/third_party/chunk.h b/third_party/chunk.h new file mode 100644 index 0000000..6cc7392 --- /dev/null +++ b/third_party/chunk.h @@ -0,0 +1,41 @@ +/* Cumulus: Smart Filesystem Backup to Dumb Servers + * + * Copyright (C) 2006-2008 The Regents of the University of California + * Written by Michael Vrable + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/* Compute incremental backups at a sub-file level by chopping files up into + * blocks in a content-sensitive manner (using Rabin fingerprints). */ + +#ifndef _LBS_CHUNK_H +#define _LBS_CHUNK_H + +#include +#include + +/* Block breakpoints can only be computed for a single block of memory, all + * loaded at once. compute_breaks will, given a block of memory, compute the + * offsets at which successive blocks should end. These will be stored into + * the provided memory at breakpoints. The maximum possible number of blocks + * (given the block size constaints) can be computed by compute_max_num_breaks + * so that the breakpoints array can be properly sized. The actual number of + * blocks is returned by the compute_breaks function. */ +int chunk_compute_max_num_breaks(size_t buflen); +int chunk_compute_breaks(const char *buf, size_t len, size_t *breakpoints); +std::string chunk_algorithm_name(); + +#endif // _LBS_CHUNK_H