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