IDZEBRA 2.2.8
isam.h
Go to the documentation of this file.
1/* This file is part of the Zebra server.
2 Copyright (C) Index Data
3
4Zebra is free software; you can redistribute it and/or modify it under
5the terms of the GNU General Public License as published by the Free
6Software Foundation; either version 2, or (at your option) any later
7version.
8
9Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10WARRANTY; without even the implied warranty of MERCHANTABILITY or
11FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program; if not, write to the Free Software
16Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
18*/
19
53#ifndef ISAM_H
54#define ISAM_H
55
56#include <idzebra/bfile.h>
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61
62
72
76 int scope;
77
80 int (*cmp) (const void *p1, const void *p2);
81
83 void (*key_logdump_txt) (int logmask, const void *p, const char *txt);
84
87 zint (*getseq)(const void *p);
88
91};
92
93typedef struct key_control KEY_CONTROL;
94
96 /* FIXME - in zrpn.c, time being. Needs to be moved out */
97
98
102 int (*read_item)(void *clientData, char **dst, int *insertMode);
104};
105
106typedef struct isam_data_stram ISAM_DATA_STREAM;
107
108
111
113typedef struct ISAM_s *ISAM;
114
116typedef struct ISAM_CUR_s *ISAM_CUR;
117
121 char *desc;
123 const char *def_filename;
124
125 /* there is an isam_open function, but it is not part of this */
126 /* dynamic table, as it is what provides this table */
127
129 void (*f_close)(ISAM i);
130
133 ISAM_POS (*f_put)(ISAM is, ISAM_POS pos, const void *buf);
134
137 int (*f_del)(ISAM is, ISAM_POS pos, const void *buf);
138
141 int (*f_get)(ISAM is, ISAM_POS pos, void *buf );
142
145
148
150 int (*f_read)(ISAM_CUR cur, void *buf);
151
153 int (*f_forward)(ISAM_CUR cur, void *buf, const void *untilbuf);
154
156 void (*f_pos)(ISAM_CUR cur, double *current, double *total);
157
159 void (*f_cur_close)(ISAM_CUR cur);
160
162 int (*f_unlink)(ISAM is, ISAM_POS pos);
163
164};
165
167struct ISAM_s {
168 const struct isam_control *ictrl; /* the functions */
169 const KEY_CONTROL *kctrl; /* all about the keys stored in the isam */
170 BFiles bfs; /* The underlying block file system */
171 void *priv; /* various types of ISAMs hand their private parts here */
172};
173
175struct ISAM_CUR {
177 void *priv;
178};
179
180
181
184 const char *isamtype, /* usually "b" */
185 const char *filename, /* optional, use default from control ?? */
186 int flags, /* FIXME - define read/write, and some special ones */
187 const KEY_CONTROL *key_control);
188
189
192#define isam_close(is) (*(is)->ictrl->f_close)(is)
193
194#define isam_puf(is,pos,buf) (*(is)->ictrl->f_put)((is),(pos)(buf))
195
196#define isam_del(is,pos,buf) (*(is)->ictrl->f_del)((is),(pos)(buf))
197
198#define isam_get(is,pos,buf) (*(is)->ictrl->f_get)((is),(pos)(buf))
199
200#define isam_merge(is,pos,data) (*(is)->ictrl->f_merge)((is),(pos)(data))
201
202#define isam_cur_open(is,pos) (*(is)->ictrl->f_cur_open)((is),(pos))
203
204#define isam_read(cur,buf) (*(is)->ictrl->f_read)((cur),(buf))
205
206#define isam_forward(cur,buf,untilbuf) (*(is)->ictrl->f_forward)((cur),(buf)(untilbuf))
207
208#define isam_pos(cur,current,total) (*(is)->ictrl->f_pos)((cur),(current),(total))
209
210#define isam_cur_close(cur) (*(is)->ictrl->f_cur_close)(cur)
211
212#define isam_unlink(is,pos) (*(is)->ictrl->f_unlink)((is),(pos))
213
214
215#ifdef __cplusplus
216}
217#endif
218
219#endif /* ISAM_H */
220/*
221 * Local variables:
222 * c-basic-offset: 4
223 * c-file-style: "Stroustrup"
224 * indent-tabs-mode: nil
225 * End:
226 * vim: shiftwidth=4 tabstop=8 expandtab
227 */
228
Zebra Block File Layer.
const KEY_CONTROL * default_key_control()
struct ISAM_s * ISAM
Definition isam.h:113
zint ISAM_POS
Definition isam.h:110
ISAM isam_open(BFiles bfs, const char *isamtype, const char *filename, int flags, const KEY_CONTROL *key_control)
struct isam_data_stram ISAM_DATA_STREAM
Definition isam.h:106
ISAM is
Definition isam.h:176
void * priv
Definition isam.h:177
Definition isam.h:167
BFiles bfs
Definition isam.h:170
const struct isam_control * ictrl
Definition isam.h:168
const KEY_CONTROL * kctrl
Definition isam.h:169
void * priv
Definition isam.h:171
void(* f_cur_close)(ISAM_CUR cur)
Definition isam.h:159
const char * def_filename
Definition isam.h:123
int(* f_get)(ISAM is, ISAM_POS pos, void *buf)
Definition isam.h:141
char * desc
Definition isam.h:121
int(* f_del)(ISAM is, ISAM_POS pos, const void *buf)
Definition isam.h:137
int(* f_unlink)(ISAM is, ISAM_POS pos)
Definition isam.h:162
ISAM_POS(* f_put)(ISAM is, ISAM_POS pos, const void *buf)
Definition isam.h:133
int(* f_read)(ISAM_CUR cur, void *buf)
Definition isam.h:150
void(* f_close)(ISAM i)
Definition isam.h:129
ISAM_POS(* f_merge)(ISAM is, ISAM_POS pos, ISAM_DATA_STREAM *data)
Definition isam.h:144
void(* f_pos)(ISAM_CUR cur, double *current, double *total)
Definition isam.h:156
ISAM_CUR(* f_cur_open)(ISAM is, ISAM_POS pos)
Definition isam.h:147
int(* f_forward)(ISAM_CUR cur, void *buf, const void *untilbuf)
Definition isam.h:153
void * clientData
Definition isam.h:103
int(* read_item)(void *clientData, char **dst, int *insertMode)
Definition isam.h:102
ISAM_CODEC * codec
Definition isam.h:90
void(* key_logdump_txt)(int logmask, const void *p, const char *txt)
Definition isam.h:83
int(* cmp)(const void *p1, const void *p2)
Definition isam.h:80
zint(* getseq)(const void *p)
Definition isam.h:87
int scope
Definition isam.h:76
int key_size
Definition isam.h:71
long zint
Zebra integer.
Definition util.h:66