forked from markfasheh/duperemove
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbfile.h
More file actions
47 lines (39 loc) · 1.32 KB
/
Copy pathdbfile.h
File metadata and controls
47 lines (39 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef __DBFILE_H__
#define __DBFILE_H__
#include <sqlite3.h>
struct filerec;
struct block;
int dbfile_create(char *filename);
int dbfile_open(char *filename);
void dbfile_close(void);
int dbfile_get_config(unsigned int *block_size,
uint64_t *num_hashes, uint64_t *num_files,
int *major, int *minor);
int dbfile_sync_config(unsigned int block_size);
struct hash_tree;
struct hash_file_header;
/* Used only by hashstats, will load *all* hashes into 'hash_tree' */
int dbfile_read_all_hashes(struct hash_tree *tree);
struct rb_root;
/*
* Scans hashes by digest, adding each one to our bloom filter. If we
* find a duplicate, it is inserted into d_tree.
*
* This effectively does 'scan #1' for us when we're loading from a
* dbfile instead of doing a file scan.
*/
int dbfile_populate_hashes(struct rb_root *d_tree);
/*
* Load hashes into hash_tree only if they have a duplicate in the db.
* The extent search is later run on the resulting hash_tree.
*/
int dbfile_load_hashes(struct hash_tree *scan_tree);
/*
* Following are used during file scan stage to get our hashes into
* the database.
*/
sqlite3 *dbfile_get_handle(void);
int dbfile_write_file_info(sqlite3 *db, struct filerec *file);
int dbfile_write_hashes(sqlite3 *db, struct filerec *file,
uint64_t nb_hash, struct block *hashes);
#endif /* __DBFILE_H__ */