Updated WIN32 code specific sections. Changed header.
[idzebra-moved-to-github.git] / index / recindxp.h
1 /*
2  * Copyright (C) 1994-1999, Index Data
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: recindxp.h,v $
7  * Revision 1.5  1999-02-02 14:51:05  adam
8  * Updated WIN32 code specific sections. Changed header.
9  *
10  * Revision 1.4  1998/03/05 08:45:12  adam
11  * New result set model and modular ranking system. Moved towards
12  * descent server API. System information stored as "SGML" records.
13  *
14  * Revision 1.3  1995/12/11 11:45:55  adam
15  * Removed commented code.
16  *
17  * Revision 1.2  1995/12/11  09:12:51  adam
18  * The rec_get function returns NULL if record doesn't exist - will
19  * happen in the server if the result set records have been deleted since
20  * the creation of the set (i.e. the search).
21  * The server saves a result temporarily if it is 'volatile', i.e. the
22  * set is register dependent.
23  *
24  * Revision 1.1  1995/12/06  12:41:25  adam
25  * New command 'stat' for the index program.
26  * Filenames can be read from stdin by specifying '-'.
27  * Bug fix/enhancement of the transformation from terms to regular
28  * expressons in the search engine.
29  *
30  */
31
32 #include "recindex.h"
33
34 #include <bfile.h>
35
36 #define REC_BLOCK_TYPES 2
37 #define REC_HEAD_MAGIC "recindx"
38
39 struct records_info {
40     int rw;
41
42     char *index_fname;
43     BFile index_BFile;
44
45     char *data_fname[REC_BLOCK_TYPES];
46     BFile data_BFile[REC_BLOCK_TYPES];
47
48     char *tmp_buf;
49     int tmp_size;
50
51     struct record_cache_entry *record_cache;
52     int cache_size;
53     int cache_cur;
54     int cache_max;
55
56     struct records_head {
57         char magic[8];
58         int block_size[REC_BLOCK_TYPES];
59         int block_free[REC_BLOCK_TYPES];
60         int block_last[REC_BLOCK_TYPES];
61         int block_used[REC_BLOCK_TYPES];
62         int block_move[REC_BLOCK_TYPES];
63
64         int total_bytes;
65         int index_last;
66         int index_free;
67         int no_records;
68
69     } head;
70 };
71
72 enum recordCacheFlag { recordFlagNop, recordFlagWrite, recordFlagNew,
73                        recordFlagDelete };
74
75 struct record_cache_entry {
76     Record rec;
77     enum recordCacheFlag flag;
78 };
79
80 struct record_index_entry {
81     int next;         /* first block of record info / next free entry */
82     int size;         /* size of record or 0 if free entry */
83 };
84