2012-11-19 16:11:56 +00:00
|
|
|
/*
|
|
|
|
* This file is a part of Pcompress, a chunked parallel multi-
|
|
|
|
* algorithm lossless compression and decompression program.
|
|
|
|
*
|
2013-03-07 14:56:48 +00:00
|
|
|
* Copyright (C) 2012-2013 Moinak Ghosh. All rights reserved.
|
2012-11-19 16:11:56 +00:00
|
|
|
* Use is subject to license terms.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 3 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
2013-03-07 14:56:48 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this program.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
2012-11-19 16:11:56 +00:00
|
|
|
* moinakg@belenix.org, http://moinakg.wordpress.com/
|
|
|
|
*/
|
|
|
|
|
2013-04-09 16:53:51 +00:00
|
|
|
#ifndef _INDEX_H
|
|
|
|
#define _INDEX_H
|
2012-11-19 16:11:56 +00:00
|
|
|
|
2013-02-17 15:35:40 +00:00
|
|
|
#include <dedupe_config.h>
|
|
|
|
|
2012-11-19 16:11:56 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2013-03-21 16:30:38 +00:00
|
|
|
/*
|
|
|
|
* Publically visible In-memory hashtable entry.
|
|
|
|
*/
|
|
|
|
typedef struct _hash_entry {
|
|
|
|
uint64_t item_offset;
|
|
|
|
uint32_t item_size;
|
|
|
|
struct _hash_entry *next;
|
|
|
|
uchar_t cksum[1];
|
|
|
|
} hash_entry_t;
|
|
|
|
|
2013-02-12 16:23:04 +00:00
|
|
|
archive_config_t *init_global_db(char *configfile);
|
2013-04-06 09:45:27 +00:00
|
|
|
int setup_db_config_s(archive_config_t *cfg, uint32_t chunksize, uint64_t *user_chunk_sz,
|
|
|
|
int *pct_interval, const char *algo, cksum_t ck, cksum_t ck_sim,
|
|
|
|
size_t file_sz, uint32_t *hash_slots, int *hash_entry_size,
|
2013-04-18 15:56:24 +00:00
|
|
|
uint64_t *memreqd, size_t memlimit);
|
2013-02-17 15:35:40 +00:00
|
|
|
archive_config_t *init_global_db_s(char *path, char *tmppath, uint32_t chunksize,
|
2013-03-21 16:30:38 +00:00
|
|
|
uint64_t user_chunk_sz, int pct_interval, const char *algo,
|
2013-03-19 14:43:44 +00:00
|
|
|
cksum_t ck, cksum_t ck_sim, size_t file_sz, size_t memlimit,
|
|
|
|
int nthreads);
|
2013-03-21 16:30:38 +00:00
|
|
|
hash_entry_t *db_lookup_insert_s(archive_config_t *cfg, uchar_t *sim_cksum, int interval,
|
2013-03-20 17:17:03 +00:00
|
|
|
uint64_t item_offset, uint32_t item_size, int do_insert);
|
2013-03-25 15:34:16 +00:00
|
|
|
void destroy_global_db_s(archive_config_t *cfg);
|
2012-11-19 16:11:56 +00:00
|
|
|
|
2013-04-14 18:21:54 +00:00
|
|
|
int db_segcache_write(archive_config_t *cfg, int tid, uchar_t *buf, uint32_t len, uint32_t blknum, uint64_t file_offset);
|
|
|
|
int db_segcache_pos(archive_config_t *cfg, int tid);
|
2013-04-18 15:56:24 +00:00
|
|
|
int db_segcache_map(archive_config_t *cfg, int tid, uint32_t *blknum, uint64_t *offset, uchar_t *blocks);
|
2013-04-14 18:21:54 +00:00
|
|
|
int db_segcache_unmap(archive_config_t *cfg, int tid);
|
|
|
|
|
2012-11-19 16:11:56 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|