Implements an incremental rehash.

This commit is contained in:
Andrea Mazzoleni 2013-07-01 23:08:25 +02:00
parent 2fdcecf350
commit 275ef2ed3c
17 changed files with 473 additions and 338 deletions

View file

@ -33,9 +33,11 @@ struct snapraid_import_block {
unsigned size; /**< Size of the block. */
data_off_t offset; /**< Position of the block in the file. */
unsigned char hash[HASH_SIZE]; /**< Hash of the block. */
unsigned char prevhash[HASH_SIZE]; /**< Previous hash of the block. Valid only if we are in rehash state. */
/* nodes for data structures */
tommy_hashdyn_node nodeset;
tommy_hashdyn_node prevnodeset;
};
/**
@ -61,7 +63,7 @@ void import_file_free(struct snapraid_import_file* file);
* Fetch a block from the specified hash.
* Return ==0 if the block is found, and copied into buffer.
*/
int state_import_fetch(struct snapraid_state* state, const unsigned char* hash, unsigned char* buffer);
int state_import_fetch(struct snapraid_state* state, int prevhash, const unsigned char* hash, unsigned char* buffer);
/**
* Import files from the specified directory.