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