29 #include <yaz/yaz-util.h>
32 #define RIDX_CHUNK 128
54 memcpy(&sys, b,
sizeof(sys));
55 len = ((
const char *) b)[
sizeof(sys)];
59 memcpy(&
ent, (
const char *)b +
sizeof(sys) + 1, len);
72 memcpy(&s_a, a,
sizeof(s_a));
73 memcpy(&s_b, b,
sizeof(s_b));
92 memcpy(&sys, *src,
sizeof(sys));
94 (*src) +=
sizeof(sys);
101 memcpy(*dst, *src, len);
112 memcpy(*dst, &sys,
sizeof(sys));
120 memcpy(*dst, *src, len);
144 yaz_log(YLOG_FATAL|YLOG_ERRNO,
"open %s", p->
index_fname);
151 int isam_block_size = 4096;
178 yaz_log(YLOG_LOG,
"%s", txt);
219 yaz_log(YLOG_FATAL|YLOG_ERRNO,
"write head of %s", p->
index_fname);
235 char untilbuf[
sizeof(
zint) + 1];
239 memcpy(untilbuf, &sysno,
sizeof(sysno));
240 untilbuf[
sizeof(sysno)] = 0;
247 if (item[
sizeof(sysno)] != itemsize)
249 yaz_log(YLOG_WARN,
"unexpected entry size %d != %d",
250 item[
sizeof(sysno)], itemsize);
253 memcpy(buf, item +
sizeof(sysno) + 1, itemsize);
258 zint pos = (sysno-1)*itemsize;
266 if (r == 1 && sz1 < itemsize)
269 if (r != 1 && !ignoreError)
271 yaz_log(YLOG_FATAL|YLOG_ERRNO,
"read in %s at pos %ld",
279 " sz=%d", r, sysno, ep->
next, ep->
size);
303 *dst +=
sizeof(
zint);
326 isamc_i.clientData = &input;
int bf_read(BFile bf, zint no, int offset, int nbytes, void *buf)
read from block file (may call exit)
void bf_close(BFile bf)
closes a Block file (may call exit)
BFile bf_open(BFiles bfs, const char *name, int block_size, int wflag)
opens and returns a Block file handle
int bf_write(BFile bf, zint no, int offset, int nbytes, const void *buf)
writes block of bytes to file (may call exit)
ISAMB_PP isamb_pp_open(ISAMB isamb, ISAM_P pos, int scope)
zint isamb_get_root_ptr(ISAMB b)
void isamb_dump(ISAMB b, ISAM_P pos, void(*pr)(const char *str))
void isamb_close(ISAMB isamb)
void isamb_set_root_ptr(ISAMB b, zint root_ptr)
int isamb_pp_forward(ISAMB_PP pp, void *buf, const void *untilbuf)
ISAMB isamb_open2(BFiles bfs, const char *name, int writeflag, ISAMC_M *method, int cache, int no_cat, int *sizes, int use_root_ptr)
void isamb_pp_close(ISAMB_PP pp)
void isamb_merge(ISAMB b, ISAM_P *pos, ISAMC_I *data)
void rect_code_reset(void *p)
int bt_code_read(void *vp, char **dst, int *insertMode)
int recindex_read_indx(recindex_t p, zint sysno, void *buf, int itemsize, int ignoreError)
struct record_index_entry ent
void recindex_write_indx(recindex_t p, zint sysno, void *buf, int itemsize)
void rect_encode(void *p, char **dst, const char **src)
static void rect_log_item(int level, const void *b, const char *txt)
recindex_t recindex_open(BFiles bfs, int rw, int use_isamb)
opens record index handle
static void log_pr(const char *txt)
void * rect_code_start(void)
void rect_decode(void *p, char **dst, const char **src)
void recindex_close(recindex_t p)
closes record index handle
void rect_code_stop(void *p)
const char * recindex_get_fname(recindex_t p)
int rect_compare(const void *a, const void *b)
ZEBRA_RES recindex_write_head(recindex_t p, const void *buf, size_t len)
int recindex_read_head(recindex_t p, void *buf)
int(* compare_item)(const void *a, const void *b)
void(* log_item)(int logmask, const void *p, const char *txt)
void(* decode)(void *p, char **dst, const char **src)
void(* encode)(void *p, char **dst, const char **src)
void zebra_zint_decode(const char **src, zint *pos)
void zebra_zint_encode(char **dst, zint pos)
#define CAST_ZINT_TO_INT(x)
short ZEBRA_RES
Common return type for Zebra API.