995bd9104e966a2261705055a84b8e556f3e9831
[idzebra-moved-to-github.git] / isamc / isamc-p.h
1 /* $Id: isamc-p.h,v 1.8 2002-08-02 19:26:56 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 <bfile.h>
26 #include <isamc.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 typedef struct {
33     int lastblock;
34     int freelist;
35 } ISAMC_head;
36
37 typedef unsigned ISAMC_BLOCK_SIZE;
38
39 typedef struct ISAMC_file_s {
40     ISAMC_head head;
41     BFile bf;
42     int head_is_dirty;
43     
44     int no_writes;
45     int no_reads;
46     int no_skip_writes;
47     int no_allocated;
48     int no_released;
49     int no_remap;
50
51     int no_forward;
52     int no_backward;
53     int sum_forward;
54     int sum_backward;
55     int no_next;
56     int no_prev;
57
58     char *alloc_buf;
59     int alloc_entries_num;
60     int alloc_entries_max;
61
62     int fc_max;
63     int *fc_list;
64 } *ISAMC_file;
65
66 struct ISAMC_s {
67     int no_files;
68     int max_cat;
69     char *merge_buf;
70     ISAMC_M method;
71     ISAMC_file files;
72 }; 
73
74 struct ISAMC_PP_s {
75     char *buf;
76     ISAMC_BLOCK_SIZE offset;
77     ISAMC_BLOCK_SIZE size;
78     int cat;
79     int pos;
80     int next;
81     ISAMC is;
82     void *decodeClientData;
83     int deleteFlag;
84     int numKeys;
85 };
86
87 #define ISAMC_BLOCK_OFFSET_N (sizeof(int)+sizeof(ISAMC_BLOCK_SIZE)) 
88 #define ISAMC_BLOCK_OFFSET_1 (sizeof(int)+sizeof(ISAMC_BLOCK_SIZE)+sizeof(int)) 
89 int isc_alloc_block (ISAMC is, int cat);
90 void isc_release_block (ISAMC is, int cat, int pos);
91 int isc_read_block (ISAMC is, int cat, int pos, char *dst);
92 int isc_write_block (ISAMC is, int cat, int pos, char *src);
93
94 #ifdef __cplusplus
95 }
96 #endif
97