Towards GPL
[idzebra-moved-to-github.git] / index / recindxp.h
1 /* $Id: recindxp.h,v 1.12 2002-08-02 19:26:55 adam Exp $
2    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
3    Index Data Aps
4
5 This file is part of the Zebra server.
6
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
11
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Zebra; see the file LICENSE.zebra.  If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA.
21 */
22
23
24
25 #include "recindex.h"
26
27 #include <bfile.h>
28
29 YAZ_BEGIN_CDECL
30
31 #define REC_BLOCK_TYPES 2
32 #define REC_HEAD_MAGIC "recindex"
33 #define REC_VERSION 4
34
35 struct records_info {
36     int rw;
37     int compression_method;
38
39     char *index_fname;
40     BFile index_BFile;
41
42     char *data_fname[REC_BLOCK_TYPES];
43     BFile data_BFile[REC_BLOCK_TYPES];
44
45     char *tmp_buf;
46     int tmp_size;
47
48     struct record_cache_entry *record_cache;
49     int cache_size;
50     int cache_cur;
51     int cache_max;
52
53     Zebra_mutex mutex;
54
55     struct records_head {
56         char magic[8];
57         char version[4];
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
85 YAZ_END_CDECL