1 /* $Id: isamg.h,v 1.2 2002-08-02 19:26:55 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
28 /* #include <bfile.h> */
32 typedef struct ISAMG_s *ISAMG;
34 typedef struct ISAMG_PP_s *ISAMG_PP;
37 /* File categories etc are no business of users of ISAM-G (or what?) */
38 typedef struct ISAMG_filecat_s { /* filecategories, mostly block sizes */
39 int bsize; /* block size */
40 int mblocks; /* maximum keys before switching to larger sizes */
46 /* The (delta?)encoding will be encapsulated so deep in the isams that */
47 /* nobody needs to see it here... If different encodings needed, make */
50 typedef struct ISAMG_M_s {
51 ISAMG_filecat filecat;
53 int (*compare_item)(const void *a, const void *b);
55 #define ISAMG_DECODE 0
56 #define ISAMG_ENCODE 1
57 void *(*code_start)(int mode);
58 void (*code_stop)(int mode, void *p);
59 void (*code_item)(int mode, void *p, char **dst, char **src);
60 void (*code_reset)(void *p);
68 /* Is this needed? Shouldn't they all be using the same encapsulation */
70 typedef struct ISAMG_I_s { /* encapsulation of input data */
71 int (*read_item)(void *clientData, char **dst, int *insertMode);
77 ISAMG_M isamg_getmethod (ISAMG_M me);
78 /* Does anyone really need this method thing ?? */
81 ISAMG isamg_open (BFiles bfs, int writeflag, char *isam_type_name, Res res);
83 int isamg_close (ISAMG is);
85 ISAMG_P isamg_append (ISAMG is, ISAMG_P pos, ISAMG_I data);
86 /* This may be difficult to generalize! */
89 ISAMG_PP isamg_pp_open (ISAMG is, ISAMG_P pos);
90 void isamg_pp_close (ISAMG_PP pp);
91 /* int isamg_read_item (ISAMG_PP pp, char **dst); */
92 /* int isamg_read_main_item (ISAMG_PP pp, char **dst); */
93 int isamg_pp_read (ISAMG_PP pp, void *buf);
94 int isamg_pp_num (ISAMG_PP pp);
97 /* all internal stuff */
98 int isamg_block_used (ISAMG is, int type);
99 int isamg_block_size (ISAMG is, int type);
102 #define isamg_type(x) ((x) & 7)
103 #define isamg_block(x) ((x) >> 3)
104 #define isamg_addr(blk,typ) (((blk)<<3)+(typ))
106 void isamg_buildfirstblock(ISAMG_PP pp);
107 void isamg_buildlaterblock(ISAMG_PP pp);
117 * Revision 1.2 2002-08-02 19:26:55 adam
120 * Revision 1.1 2001/01/16 19:05:11 heikki
121 * Started to add isamg