Added remote record import using Z39.50 extended services and Segment
[idzebra-moved-to-github.git] / include / isamd.h
1 /*
2  * Copyright (c) 1995-2000, Index Data.
3  * See the file LICENSE for details.
4  *
5  * IsamH is a simple ISAM that can only append to the end of the list.
6  * It will need a clean-up process occasionally...  Code stolen from
7  * isamc...
8  * 
9  * Heikki Levanto
10  *
11  * Detailed log at the end of the file
12  *
13  */
14
15 #ifndef ISAMD_H
16 #define ISAMD_H
17
18 #include <bfile.h>
19
20 YAZ_BEGIN_CDECL
21
22 typedef struct ISAMD_s *ISAMD;
23 typedef int ISAMD_P;
24 typedef struct ISAMD_PP_s *ISAMD_PP;
25
26 typedef struct ISAMD_filecat_s {  /* filecategories, mostly block sizes */
27     int bsize;         /* block size */
28     int mblocks;       /* maximum keys before switching to larger sizes */
29 } *ISAMD_filecat;
30
31 typedef struct ISAMD_M_s {
32     ISAMD_filecat filecat;
33
34     int (*compare_item)(const void *a, const void *b);
35
36 #define ISAMD_DECODE 0
37 #define ISAMD_ENCODE 1
38     void *(*code_start)(int mode);
39     void (*code_stop)(int mode, void *p);
40     void (*code_item)(int mode, void *p, char **dst, char **src);
41     void (*code_reset)(void *p);
42
43     int max_blocks_mem;
44     int debug;
45 } *ISAMD_M;
46
47 typedef struct ISAMD_I_s {  /* encapsulation of input data */
48     int (*read_item)(void *clientData, char **dst, int *insertMode);
49     void *clientData;
50 } *ISAMD_I;
51
52 ISAMD_M isamd_getmethod (ISAMD_M me);
53
54 ISAMD isamd_open (BFiles bfs, const char *name, int writeflag, ISAMD_M method);
55 int isamd_close (ISAMD is);
56 ISAMD_P isamd_append (ISAMD is, ISAMD_P pos, ISAMD_I data);
57   /* corresponds to isc_merge */
58   
59   
60 ISAMD_PP isamd_pp_open (ISAMD is, ISAMD_P pos);
61 void isamd_pp_close (ISAMD_PP pp);
62 int isamd_read_item (ISAMD_PP pp, char **dst);
63 int isamd_read_main_item (ISAMD_PP pp, char **dst);
64 int isamd_pp_read (ISAMD_PP pp, void *buf);
65 int isamd_pp_num (ISAMD_PP pp);
66
67 int isamd_block_used (ISAMD is, int type);
68 int isamd_block_size (ISAMD is, int type);
69
70
71 #define isamd_type(x) ((x) & 7)
72 #define isamd_block(x) ((x) >> 3)
73 #define isamd_addr(blk,typ) (((blk)<<3)+(typ))
74
75 void isamd_buildfirstblock(ISAMD_PP pp);
76 void isamd_buildlaterblock(ISAMD_PP pp);
77
78 YAZ_END_CDECL
79
80 #endif  /* ISAMD_H */
81
82
83 /*
84  * $Log: isamd.h,v $
85  * Revision 1.3  1999/08/18 08:33:41  heikki
86  * Fixes
87  *
88  * Revision 1.2  1999/07/14 13:21:34  heikki
89  * Added isam-d files. Compiles (almost) clean. Doesn't work at all
90  *
91  * Revision 1.1  1999/07/14 12:34:43  heikki
92  * Copied from isamh, starting to change things...
93  *
94  *
95  */