33 int page_size =
dict->head.page_size;
35 int compact_flag =
dict->head.compact_flag;
37 memset(
dict->head.magic_str, 0,
sizeof(
dict->head.magic_str));
41 dict->head.freelist = 0;
42 dict->head.page_size = page_size;
43 dict->head.compact_flag = compact_flag;
51 int compact_flag,
int page_size)
61 dict->grep_cmap = NULL;
65 yaz_log(YLOG_WARN,
"Page size for dict %s %d<2048. Set to 2048",
77 yaz_log(YLOG_WARN,
"Cannot open `%s'", name);
83 dict->head.page_size = page_size;
84 dict->head.compact_flag = compact_flag;
89 memcpy(&
dict->head, head_buf,
sizeof(
dict->head));
92 yaz_log(YLOG_WARN,
"Bad magic of `%s'", name);
97 if (
dict->head.page_size != page_size)
99 yaz_log(YLOG_WARN,
"Page size for existing dict %s is %d. Current is %d",
100 name,
dict->head.page_size, page_size);
103 if (
dict->head.compact_flag)
110 return strcmp((
const char *) s1, (
const char *) s2);
115 return strncmp((
const char *) s1, (
const char *) s2, n);
120 return strlen((
const char *) s);
125 return dict->no_lookup;
130 return dict->no_insert;
135 return dict->no_split;
struct BFiles_struct * BFiles
A collection of BFile(s).
int dict_bf_close(Dict_BFile dbf)
Dict_BFile dict_bf_open(BFiles bfs, const char *name, int block_size, int cache, int rw)
void dict_bf_compact(Dict_BFile dbf)
int dict_bf_readp(Dict_BFile bf, int no, void **bufp)
#define DICT_DEFAULT_PAGESIZE
int dict_bf_newp(Dict_BFile bf, int no, void **bufp, int nbytes)
struct Dict_struct * Dict
Dictionary handle.
int dict_strncmp(const Dict_char *s1, const Dict_char *s2, size_t n)
zint dict_get_no_split(Dict dict)
get number of page split operations, since dict_open
Dict dict_open(BFiles bfs, const char *name, int cache, int rw, int compact_flag, int page_size)
open dictionary
void dict_clean(Dict dict)
reset Dictionary (makes it empty)
zint dict_get_no_insert(Dict dict)
get number of insert operations, since dict_open
int dict_strlen(const Dict_char *s)
int dict_strcmp(const Dict_char *s1, const Dict_char *s2)
zint dict_get_no_lookup(Dict dict)
get number of lookup operations, since dict_open