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
32 typedef struct ISAMD_s *ISAMD;
34 typedef struct ISAMD_PP_s *ISAMD_PP;
36 typedef struct ISAMD_filecat_s { /* filecategories, mostly block sizes */
37 int bsize; /* block size */
38 int mblocks; /* maximum keys before switching to larger sizes */
41 typedef struct ISAMD_M_s {
42 ISAMD_filecat filecat;
44 int (*compare_item)(const void *a, const void *b);
46 #define ISAMD_DECODE 0
47 #define ISAMD_ENCODE 1
48 void *(*code_start)(int mode);
49 void (*code_stop)(int mode, void *p);
50 void (*code_item)(int mode, void *p, char **dst, char **src);
51 void (*code_reset)(void *p);
57 typedef struct ISAMD_I_s { /* encapsulation of input data */
58 int (*read_item)(void *clientData, char **dst, int *insertMode);
62 ISAMD_M isamd_getmethod (ISAMD_M me);
64 ISAMD isamd_open (BFiles bfs, const char *name, int writeflag, ISAMD_M method);
65 int isamd_close (ISAMD is);
66 /*ISAMD_P isamd_append (ISAMD is, ISAMD_P pos, ISAMD_I data);*/
67 int isamd_append (ISAMD is, char *dictentry, int dictlen, ISAMD_I data);
71 /* Shortcut: If the isam is relatively short, we store the */
72 /* whole thing in the dictionary, and allocate no blocks at all! */
73 #define ISAMD_MAX_DICT_LEN 16
75 /*ISAMD_PP isamd_pp_open (ISAMD is, const char *dictbuf);*/
76 ISAMD_PP isamd_pp_open (ISAMD is, const char *dictbuf, int dictlen);
77 ISAMD_PP isamd_pp_create (ISAMD is, int cat);
79 void isamd_pp_close (ISAMD_PP pp);
80 int isamd_read_item (ISAMD_PP pp, char **dst);
81 int isamd_read_main_item (ISAMD_PP pp, char **dst);
82 int isamd_pp_read (ISAMD_PP pp, void *buf);
83 int isamd_pp_num (ISAMD_PP pp);
85 int isamd_block_used (ISAMD is, int type);
86 int isamd_block_size (ISAMD is, int type);
89 #define isamd_type(x) ((x) & 7)
90 #define isamd_block(x) ((x) >> 3)
91 #define isamd_addr(blk,typ) (((blk)<<3)+(typ))
93 void isamd_buildfirstblock(ISAMD_PP pp);
94 void isamd_buildlaterblock(ISAMD_PP pp);
103 * Revision 1.3 1999/08/18 08:33:41 heikki
106 * Revision 1.2 1999/07/14 13:21:34 heikki
107 * Added isam-d files. Compiles (almost) clean. Doesn't work at all
109 * Revision 1.1 1999/07/14 12:34:43 heikki
110 * Copied from isamh, starting to change things...