-/* $Id: extract.c,v 1.229 2006-09-08 14:40:52 adam Exp $
+/* $Id: extract.c,v 1.230 2006-09-15 10:45:12 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
}
rec_del (zh->reg->records, &rec);
}
- rec_rm (&rec);
+ rec_free(&rec);
logRecord(zh);
return ZEBRA_OK;
}
-/* $Id: recindex.c,v 1.51 2006-08-14 10:40:15 adam Exp $
+/* $Id: recindex.c,v 1.52 2006-09-15 10:45:13 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
for (i = 0; i<p->cache_cur - saveCount; i++)
{
struct record_cache_entry *e = p->record_cache + i;
- rec_rm(&e->rec);
+ rec_free(&e->rec);
}
/* i still being used ... */
for (j = 0; j<saveCount; j++, i++)
(p->head.no_records)--;
if ((recp = rec_cache_lookup(p, (*recpp)->sysno, recordFlagDelete)))
{
- rec_rm(recp);
+ rec_free(recp);
*recp = *recpp;
}
else
{
ret = rec_cache_insert(p, *recpp, recordFlagDelete);
- rec_rm(recpp);
+ rec_free(recpp);
}
zebra_mutex_unlock(&p->mutex);
*recpp = NULL;
zebra_mutex_lock(&p->mutex);
if ((recp = rec_cache_lookup(p, (*recpp)->sysno, recordFlagWrite)))
{
- rec_rm(recp);
+ rec_free(recp);
*recp = *recpp;
}
else
{
ret = rec_cache_insert(p, *recpp, recordFlagWrite);
- rec_rm(recpp);
+ rec_free(recpp);
}
zebra_mutex_unlock(&p->mutex);
*recpp = NULL;
return ret;
}
-void rec_rm(Record *recpp)
+void rec_free(Record *recpp)
{
int i;
-/* $Id: recindex.h,v 1.28 2006-08-14 10:40:15 adam Exp $
+/* $Id: recindex.h,v 1.29 2006-09-15 10:45:13 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
typedef struct records_info *Records;
-Record rec_cp(Record rec);
+/** \brief marks record for deletion (on file storage)
+ \param p records handle
+ \param recpp record pointer
+ \returns ZEBRA_OK / ZEBRA_FAIL
+*/
ZEBRA_RES rec_del(Records p, Record *recpp);
-void rec_rm(Record *recpp);
+
+/** \brief frees record (from memory)
+ \param recpp record pointer
+*/
+void rec_free(Record *recpp);
+
+/** \brief puts record (writes into file storage)
+ \param p records handle
+ \param recpp record pointer
+ \returns ZEBRA_OK / ZEBRA_FAIL
+*/
ZEBRA_RES rec_put(Records p, Record *recpp);
+
+/** \brief creates new record (to be written to file storage)
+ \param p records handle
+ \returns record pointer (or NULL on error)
+*/
Record rec_new(Records p);
+/** \brief gets record - with given system number
+ \param p records handle
+ \param sysno system ID (external number)
+ \returns record pointer (or NULL on error)
+*/
Record rec_get(Records p, SYSNO sysno);
+
+/** \brief gets root record
+ \param p records handle
+ \returns record pointer (or NULL on error)
+*/
Record rec_get_root(Records p);
ZEBRA_RES rec_close (Records *p);
+
+/** \brief opens records system
+ \param bfs block file storage
+ \param rw read-write flag(0=read only, 1=write)
+ \param compression_method REC_COMPRESS_ type
+*/
Records rec_open(BFiles bfs, int rw, int compression_method);
+
char *rec_strdup(const char *s, size_t *len);
void rec_prstat(Records p);
SYSNO rec_sysno_to_int(SYSNO sysno);
+/** \brief compression types */
#define REC_COMPRESS_NONE 0
#define REC_COMPRESS_BZIP2 1
-/* $Id: recindxp.h,v 1.19 2006-08-14 10:40:15 adam Exp $
+/* $Id: recindxp.h,v 1.20 2006-09-15 10:45:13 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
int size; /* size of record or 0 if free entry */
};
+Record rec_cp(Record rec);
+
YAZ_END_CDECL
/*
* Local variables:
-/* $Id: retrieve.c,v 1.44 2006-08-22 13:39:27 adam Exp $
+/* $Id: retrieve.c,v 1.45 2006-09-15 10:45:13 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
*rec_lenp = rec->size[recInfo_storeData];
*rec_bufp = (char *) odr_malloc(odr, *rec_lenp);
memcpy(*rec_bufp, rec->info[recInfo_storeData], *rec_lenp);
- rec_rm (&rec);
+ rec_free(&rec);
stream.destroy(&stream);
return 0;
}
{
yaz_log (YLOG_WARN|YLOG_ERRNO, "Retrieve fail; missing file: %s",
full_rep);
- rec_rm (&rec);
+ rec_free(&rec);
stream.destroy(&stream);
return 14;
}
*rec_lenp = recordAttr->recordSize;
*rec_bufp = (char *) odr_malloc(odr, *rec_lenp);
stream.readf(&stream, *rec_bufp, *rec_lenp);
- rec_rm (&rec);
+ rec_free(&rec);
stream.destroy(&stream);
return 0;
}
stream.destroy(&stream);
- rec_rm (&rec);
+ rec_free(&rec);
*addinfo = retrieveCtrl.addinfo;
return retrieveCtrl.diagnostic;
-/* $Id: zinfo.c,v 1.68 2006-08-14 10:40:15 adam Exp $
+/* $Id: zinfo.c,v 1.69 2006-09-15 10:45:13 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
yaz_log(YLOG_DEBUG, "read runnumber=" ZINT_FORMAT, zei->runNumber);
*zdip = NULL;
}
- rec_rm(&trec);
+ rec_free(&trec);
}
else /* create initial targetInfo */
{
trec->size[recInfo_storeData] = sgml_len;
rec_put(records, &trec);
- rec_rm(&trec);
+ rec_free(&trec);
}
zebraExplain_newDatabase(zei, "IR-Explain-1", 0);
}
*zsuip = NULL;
zad->readFlag = 0;
- rec_rm (&rec);
+ rec_free(&rec);
}
static void zebraExplain_readDatabase (ZebraExplainInfo zei,
np->child->u.data.len);
}
zdi->readFlag = 0;
- rec_rm (&rec);
+ rec_free(&rec);
}
int zebraExplain_removeDatabase(ZebraExplainInfo zei, void *update_handle)
rec = rec_get(zei->records, zad->sysno);
(*zei->updateFunc)(zei->updateHandle, rec, 0);
- rec_rm(&rec);
+ rec_free(&rec);
}
/* remove database record keys and delete it */
rec = rec_get (zei->records, zdi->sysno);
(*zei->updateFunc)(zei->updateHandle, rec, 0);
- rec_rm(&rec);
+ rec_free(&rec);
/* remove from list */
*zdip = zdi->next;