1 /* This file is part of the Zebra server. 2 Copyright (C) 2004-2013 Index Data 3 4 Zebra is free software; you can redistribute it and/or modify it under 5 the terms of the GNU General Public License as published by the Free 6 Software Foundation; either version 2, or (at your option) any later 7 version. 8 9 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY 10 WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, write to the Free Software 16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 18 */ 19 20 21 22 #include <idzebra/bfile.h> 23 #include <idzebra/isamc.h> 24 25 YAZ_BEGIN_CDECL 26 27 typedef struct { 28 zint lastblock; 29 zint freelist; 30 } ISAMC_head; 31 32 typedef unsigned ISAMC_BLOCK_SIZE; 33 34 typedef struct ISAMC_file_s { 35 ISAMC_head head; 36 BFile bf; 37 int head_is_dirty; 38 39 int no_writes; 40 int no_reads; 41 int no_skip_writes; 42 int no_allocated; 43 int no_released; 44 int no_remap; 45 46 int no_forward; 47 int no_backward; 48 zint sum_forward; 49 zint sum_backward; 50 int no_next; 51 int no_prev; 52 53 char *alloc_buf; 54 int alloc_entries_num; 55 int alloc_entries_max; 56 57 int fc_max; 58 zint *fc_list; 59 } *ISAMC_file; 60 61 struct ISAMC_s { 62 int no_files; 63 int max_cat; 64 char *merge_buf; 65 ISAMC_M *method; 66 ISAMC_file files; 67 }; 68 69 struct ISAMC_PP_s { 70 char *buf; 71 ISAMC_BLOCK_SIZE offset; 72 ISAMC_BLOCK_SIZE size; 73 int cat; 74 zint pos; 75 zint next; 76 ISAMC is; 77 void *decodeClientData; 78 int deleteFlag; 79 zint numKeys; 80 }; 81 82 /* 83 first block consists of 84 next pointer : zint 85 size : ISAMC_BLOCK_SIZE (int) 86 numkeys : zint 87 data 88 other blocks consists of 89 next pointer : zint 90 size : ISAMC_BLOCK_SIZE (int) 91 data 92 */ 93 #define ISAMC_BLOCK_OFFSET_1 (sizeof(zint)+sizeof(ISAMC_BLOCK_SIZE)+sizeof(zint)) 94 #define ISAMC_BLOCK_OFFSET_N (sizeof(zint)+sizeof(ISAMC_BLOCK_SIZE)) 95 96 zint isamc_alloc_block (ISAMC is, int cat); 97 void isamc_release_block (ISAMC is, int cat, zint pos); 98 int isamc_read_block (ISAMC is, int cat, zint pos, char *dst); 99 int isamc_write_block (ISAMC is, int cat, zint pos, char *src); 100 101 YAZ_END_CDECL 102 103 104 /* 105 * Local variables: 106 * c-basic-offset: 4 107 * c-file-style: "Stroustrup" 108 * indent-tabs-mode: nil 109 * End: 110 * vim: shiftwidth=4 tabstop=8 expandtab 111 */ 112 113