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