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