1 /* $Id: isamd-p.h,v 1.12 2002-11-26 22:18:34 adam Exp $
2 Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
5 This file is part of the Zebra server.
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
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
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
37 typedef unsigned ISAMD_BLOCK_SIZE;
39 typedef struct ISAMD_file_s {
44 int no_writes; /* statistics, to be used properly... */
51 int no_forward; /* stats from pp_read, for isam-c compatibility */
58 int no_op_diffonly;/* number of opens without mainblock */
59 int no_op_main; /* number of opens with a main block */
61 char *alloc_buf; /* free-list handling (?) */
62 int alloc_entries_num;
63 int alloc_entries_max;
74 int last_pos; /* last read/write position for seek stats */
75 int last_cat; /* same for category */
76 int no_read; /* blocks read (in all categories) */
77 int no_write; /* blocks written (in all categories) */
78 int no_op_single;/* singleton "blocks" opened */
79 int no_read_keys;/* number of keys read (occurences of words) */
80 int no_read_main;/* number of main keys read (not diffs) */
81 int no_read_eof; /* number of key sequence ends read (no of words read) */
82 int no_seek_nxt; /* seeks to the next record (fast) */
83 int no_seek_sam; /* seeks to same record (fast) */
84 int no_seek_fwd; /* seeks forward */
85 int no_seek_prv; /* seeks to previous */
86 int no_seek_bak; /* seeks backwards */
87 int no_seek_cat; /* seeks to different category (expensive) */
88 int no_op_new; /* "open"s for new blocks */
89 int no_fbuilds; /* number of first-time builds */
90 int no_appds; /* number of appends */
91 int no_merges; /* number of merges done */
92 int no_non; /* merges without any work */
93 int no_singles; /* new items resulting in singletons */
97 typedef struct ISAMD_DIFF_s *ISAMD_DIFF;
100 char *buf; /* buffer for read/write operations */
101 ISAMD_BLOCK_SIZE offset; /* position for next read/write */
102 ISAMD_BLOCK_SIZE size; /* size of actual data */
103 int cat; /* category of this block */
104 int pos; /* block number of this block */
105 int next; /* number of the next block */
106 int diffs; /* not used in the modern isam-d, but kept for stats compatibility */
107 /* never stored on disk, though */
109 void *decodeClientData; /* delta-encoder's own data */
111 char *diffbuf; /* buffer for the diff block */
115 #define ISAMD_BLOCK_OFFSET_N (sizeof(int) + \
116 sizeof(ISAMD_BLOCK_SIZE))
118 #define ISAMD_BLOCK_OFFSET_1 (sizeof(int) + \
119 sizeof(ISAMD_BLOCK_SIZE) + \
120 sizeof(ISAMD_BLOCK_SIZE))
125 int isamd_alloc_block (ISAMD is, int cat);
126 void isamd_release_block (ISAMD is, int cat, int pos);
127 int isamd_read_block (ISAMD is, int cat, int pos, char *dst);
128 int isamd_write_block (ISAMD is, int cat, int pos, char *src);
129 void isamd_free_diffs(ISAMD_PP pp);
131 int is_singleton(ISAMD_P ipos);
132 void singleton_decode (int code, struct it_key *k);
133 int singleton_encode(struct it_key *k);
143 * $Log: isamd-p.h,v $
144 * Revision 1.12 2002-11-26 22:18:34 adam
147 * Revision 1.11 2002/08/02 19:26:56 adam
150 * Revision 1.10 2002/04/29 18:10:24 adam
151 * Newline at end of file
153 * Revision 1.9 1999/10/05 09:57:40 heikki
154 * Tuning the isam-d (and fixed a small "detail")
156 * Revision 1.8 1999/09/23 18:01:18 heikki
157 * singleton optimising
159 * Revision 1.7 1999/09/20 15:48:06 heikki
162 * Revision 1.6 1999/08/25 18:09:23 heikki
163 * Starting to optimize
165 * Revision 1.5 1999/08/20 12:25:58 heikki
166 * Statistics in isamd
168 * Revision 1.4 1999/07/21 14:24:50 heikki
169 * isamd write and read functions ok, except when diff block full.
170 * (merge not yet done)
172 * Revision 1.3 1999/07/14 15:05:30 heikki
173 * slow start on isam-d
175 * Revision 1.1 1999/07/14 12:34:43 heikki
176 * Copied from isamh, starting to change things...