* Sebastian Hammer, Adam Dickmeiss
*
* $Log: extract.c,v $
- * Revision 1.24 1995-11-15 19:13:08 adam
+ * Revision 1.25 1995-11-16 15:34:54 adam
+ * Uses new record management system in both indexer and server.
+ *
+ * Revision 1.24 1995/11/15 19:13:08 adam
* Work on record management.
*
* Revision 1.23 1995/10/27 14:00:10 adam
#include <recctrl.h>
#include "index.h"
-#define RECORD_BASE 1
-
#if RECORD_BASE
#include "recindex.h"
#endif
rec->info[0] = rec_strdup (file_type);
rec->info[1] = rec_strdup (kname);
rec_put (records, rec);
+ rec_rm (rec);
#else
sysno = sysno_next++;
dict_insert (file_idx, kname, sizeof(sysno), &sysno);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: index.h,v $
- * Revision 1.20 1995-11-15 14:46:18 adam
+ * Revision 1.21 1995-11-16 15:34:55 adam
+ * Uses new record management system in both indexer and server.
+ *
+ * Revision 1.20 1995/11/15 14:46:18 adam
* Started work on better record management system.
*
* Revision 1.19 1995/10/27 14:00:11 adam
#define FNAME_WORD_DICT "worddict"
#define FNAME_WORD_ISAM "wordisam"
#define FNAME_FILE_DICT "filedict"
+
+#define RECORD_BASE 1
+
+#if !RECORD_BASE
#define FNAME_SYS_IDX "sysidx"
#define SYS_IDX_ENTRY_LEN 120
+#endif
struct strtab *strtab_mk (void);
int strtab_src (struct strtab *t, const char *name, void ***infop);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: recindex.c,v $
- * Revision 1.2 1995-11-15 19:13:08 adam
+ * Revision 1.3 1995-11-16 15:34:55 adam
+ * Uses new record management system in both indexer and server.
+ *
+ * Revision 1.2 1995/11/15 19:13:08 adam
* Work on record management.
*
* Revision 1.1 1995/11/15 14:46:20 adam
logf (LOG_FATAL|LOG_ERRNO, "read %s", p->index_fname);
exit (1);
case 0:
+ memcpy (p->head.magic, REC_HEAD_MAGIC, sizeof(p->head.magic));
p->head.index_free = 0;
p->head.index_last = 1;
p->head.no_records = 0;
logf (LOG_FATAL|LOG_ERRNO, "open %s", p->data_fname);
exit (1);
}
- p->cache_max = 100;
+ p->cache_max = 10;
p->cache_cur = 0;
if (!(p->record_cache = malloc (sizeof(*p->record_cache)*p->cache_max)))
{
logf (LOG_FATAL|LOG_ERRNO, "write of %s", p->data_fname);
exit (1);
}
- got += r;
}
}
assert (p->cache_cur < p->cache_max);
e = p->record_cache + (p->cache_cur)++;
- e->dirty = 1;
+ e->dirty = dirty;
e->rec = rec_cp (rec);
}
rec_cache_flush (*p);
free ((*p)->record_cache);
+ if ((*p)->rw)
+ rec_write_head (*p);
+
if ((*p)->index_fd != -1)
close ((*p)->index_fd);
logf (LOG_FATAL|LOG_ERRNO, "read of %s", p->data_fname);
exit (1);
}
- got += r;
}
rec->sysno = sysno;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zserver.c,v $
- * Revision 1.21 1995-11-01 16:25:52 quinn
+ * Revision 1.22 1995-11-16 15:34:55 adam
+ * Uses new record management system in both indexer and server.
+ *
+ * Revision 1.21 1995/11/01 16:25:52 quinn
* *** empty log message ***
*
* Revision 1.20 1995/10/27 14:00:12 adam
logf (LOG_DEBUG, "bend_init");
data1_tabpath = res_get(common_resource, "data1_tabpath");
server_info.sets = NULL;
+#if RECORD_BASE
+ server_info.records = rec_open (0);
+#else
if (!(server_info.sys_idx_fd = open (FNAME_SYS_IDX, O_RDONLY)))
{
logf (LOG_WARN|LOG_ERRNO, "sys_idx open fail");
r.errstring = "sys_idx open fail";
return &r;
}
+#endif
if (!(server_info.fileDict = dict_open (FNAME_FILE_DICT, 10, 0)))
{
logf (LOG_WARN, "dict_open fail: fname dict");
oid_value *output_format, char **rec_bufp,
int *rec_lenp)
{
+#if RECORD_BASE
+ Record rec;
+#else
char record_info[SYS_IDX_ENTRY_LEN];
+#endif
char *fname, *file_type;
RecType rt;
struct recRetrieveCtrl retrieveCtrl;
+#if RECORD_BASE
+ rec = rec_get (zi->records, sysno);
+ file_type = rec->info[0];
+ fname = rec->info[1];
+#else
if (lseek (zi->sys_idx_fd, sysno * SYS_IDX_ENTRY_LEN,
SEEK_SET) == -1)
{
}
file_type = record_info;
fname = record_info + strlen(record_info) + 1;
+#endif
+
if (!(rt = recType_byName (file_type)))
{
logf (LOG_FATAL|LOG_ERRNO, "Retrieve: Cannot handle type %s",
*output_format = VAL_SUTRS;
*rec_bufp = msg;
*rec_lenp = strlen (msg);
+#if RECORD_BASE
+ rec_rm (rec);
+#endif
return 0; /* or 14: System error in presenting records */
}
retrieveCtrl.localno = sysno;
*rec_bufp = retrieveCtrl.rec_buf;
*rec_lenp = retrieveCtrl.rec_len;
close (retrieveCtrl.fd);
+#if RECORD_BASE
+ rec_rm (rec);
+#endif
return retrieveCtrl.diagnostic;
}
dict_close (server_info.fileDict);
dict_close (server_info.wordDict);
is_close (server_info.wordIsam);
+#if RECORD_BASE
+ rec_close (&server_info.records);
+#else
close (server_info.sys_idx_fd);
+#endif
return;
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zserver.h,v $
- * Revision 1.12 1995-10-27 14:00:12 adam
+ * Revision 1.13 1995-11-16 15:34:56 adam
+ * Uses new record management system in both indexer and server.
+ *
+ * Revision 1.12 1995/10/27 14:00:12 adam
* Implemented detection of database availability.
*
* Revision 1.11 1995/10/17 18:02:12 adam
*
*/
-#include "index.h"
#include <backend.h>
#include <rset.h>
+#include "index.h"
+#if RECORD_BASE
+#include "recindex.h"
+#endif
+
typedef struct {
int sysno;
int score;
Dict wordDict;
ISAM wordIsam;
Dict fileDict;
+#if RECORD_BASE
+ Records records;
+#else
int sys_idx_fd;
+#endif
int errCode;
char *errString;
ODR odr;