+++ /dev/null
-/* $Id: isamg.h,v 1.2 2002-08-02 19:26:55 adam Exp $
- Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
- Index Data Aps
-
-This file is part of the Zebra server.
-
-Zebra is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Zebra; see the file LICENSE.zebra. If not, write to the
-Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.
-*/
-
-
-
-#ifndef ISAMG_H
-#define ISAMG_H
-
-/* #include <bfile.h> */
-
-YAZ_BEGIN_CDECL
-
-typedef struct ISAMG_s *ISAMG;
-typedef int ISAMG_P;
-typedef struct ISAMG_PP_s *ISAMG_PP;
-
-#ifdef SKIPTHIS
-/* File categories etc are no business of users of ISAM-G (or what?) */
-typedef struct ISAMG_filecat_s { /* filecategories, mostly block sizes */
- int bsize; /* block size */
- int mblocks; /* maximum keys before switching to larger sizes */
-} *ISAMG_filecat;
-#endif
-
-
-#ifdef SKIPTHIS
-/* The (delta?)encoding will be encapsulated so deep in the isams that */
-/* nobody needs to see it here... If different encodings needed, make */
-/* new isam types! */
-
-typedef struct ISAMG_M_s {
- ISAMG_filecat filecat;
-
- int (*compare_item)(const void *a, const void *b);
-
-#define ISAMG_DECODE 0
-#define ISAMG_ENCODE 1
- void *(*code_start)(int mode);
- void (*code_stop)(int mode, void *p);
- void (*code_item)(int mode, void *p, char **dst, char **src);
- void (*code_reset)(void *p);
-
- int max_blocks_mem;
- int debug;
-} *ISAMG_M;
-#endif
-
-#ifdef SKIPTHIS
-/* Is this needed? Shouldn't they all be using the same encapsulation */
-
-typedef struct ISAMG_I_s { /* encapsulation of input data */
- int (*read_item)(void *clientData, char **dst, int *insertMode);
- void *clientData;
-} *ISAMG_I;
-#endif
-
-#ifdef SKIPTHIS
-ISAMG_M isamg_getmethod (ISAMG_M me);
-/* Does anyone really need this method thing ?? */
-#endif
-
-ISAMG isamg_open (BFiles bfs, int writeflag, char *isam_type_name, Res res);
-
-int isamg_close (ISAMG is);
-
-ISAMG_P isamg_append (ISAMG is, ISAMG_P pos, ISAMG_I data);
-/* This may be difficult to generalize! */
-
-
-ISAMG_PP isamg_pp_open (ISAMG is, ISAMG_P pos);
-void isamg_pp_close (ISAMG_PP pp);
-/* int isamg_read_item (ISAMG_PP pp, char **dst); */
-/* int isamg_read_main_item (ISAMG_PP pp, char **dst); */
-int isamg_pp_read (ISAMG_PP pp, void *buf);
-int isamg_pp_num (ISAMG_PP pp);
-
-#ifdef SKIPTHIS
-/* all internal stuff */
-int isamg_block_used (ISAMG is, int type);
-int isamg_block_size (ISAMG is, int type);
-
-
-#define isamg_type(x) ((x) & 7)
-#define isamg_block(x) ((x) >> 3)
-#define isamg_addr(blk,typ) (((blk)<<3)+(typ))
-
-void isamg_buildfirstblock(ISAMG_PP pp);
-void isamg_buildlaterblock(ISAMG_PP pp);
-#endif
-
-YAZ_END_CDECL
-
-#endif /* ISAMG_H */
-
-
-/*
- * $Log: isamg.h,v $
- * Revision 1.2 2002-08-02 19:26:55 adam
- * Towards GPL
- *
- * Revision 1.1 2001/01/16 19:05:11 heikki
- * Started to add isamg
- *
- *
- *
- */
+++ /dev/null
-/* $Id: isamg.c,v 1.4 2004-11-19 10:27:10 heikki Exp $
- Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
- Index Data Aps
-
-This file is part of the Zebra server.
-
-Zebra is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Zebra; see the file LICENSE.zebra. If not, write to the
-Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.
-*/
-
-
-
-#include <bfile.h>
-#include <isamg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Local type declarations
- * Not to be used from outside this module
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-enum isam_types {
- isamtype_unknown=0,
- isamtype_d=1,
- }
-
-/* The isam type itself. File handles, statistics, block sizes */
-typedef struct ISAMG_file_s {
- char *isam_type_name;
- enum isam_types isam_type;
-
- /* these might be better off as an union of different types. */
- ISAMD isamd;
- ISAMD_M isamd_m;
-
-} *ISAMG_file;
-
-struct ISAMG_s {
-/*
- int no_files;
- ISAMG_M method;
- ISAMG_file files;
-*/
-};
-
-
-typedef struct ISAMG_DIFF_s *ISAMG_DIFF;
-
-/* ISAMG position structure. Used for reading through the isam */
-struct ISAMG_PP_s {
-#ifdef SKIPTHIS
- char *buf; /* buffer for read/write operations */
- ISAMG_BLOCK_SIZE offset; /* position for next read/write */
- ISAMG_BLOCK_SIZE size; /* size of actual data */
- int cat; /* category of this block */
- int pos; /* block number of this block */
- int next; /* number of the next block */
- int diffs; /* not used in the modern isam-d, but kept for stats compatibility */
- /* never stored on disk, though */
-#endif
- ISAMG is; /* the isam itself */
- void *decodeClientData; /* delta-encoder's own data */
-#ifdef SKIPTHIS
- ISAMG_DIFF diffinfo;
- char *diffbuf; /* buffer for the diff block */
- int numKeys;
-#endif
-};
-
-#ifdef SKIPTHIS
-#define ISAMG_BLOCK_OFFSET_N (sizeof(int) + \
- sizeof(ISAMG_BLOCK_SIZE))
-/* == 8 */
-#define ISAMG_BLOCK_OFFSET_1 (sizeof(int) + \
- sizeof(ISAMG_BLOCK_SIZE) + \
- sizeof(ISAMG_BLOCK_SIZE))
-/* == 12 (was 16) */
-
-
-int isamg_alloc_block (ISAMG is, int cat);
-void isamg_release_block (ISAMG is, int cat, int pos);
-int isamg_read_block (ISAMG is, int cat, int pos, char *dst);
-int isamg_write_block (ISAMG is, int cat, int pos, char *src);
-void isamg_free_diffs(ISAMG_PP pp);
-
-int is_singleton(ISAMG_P ipos);
-void singleton_decode (int code, struct it_key *k);
-int singleton_encode(struct it_key *k);
-#endif
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Splitter functions
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-ISAMG isamg_open (BFiles bfs, int writeflag, char *isam_type_name, Res res){
- ISAMG is;
- is = (ISAMD) xmalloc(sizeof(*is));
- is->isam_type_name = strdup(isam_type_name);
- if ( (0==strcmp(isam_type_name,"d") ||
- (0==strcmp(isam_type_name,"isam_d")) {
- is->isam_type = isamtype_isamd;
- is->isamd = isamd_open(bfs,FNAME_ISAMD,
- writeflag, key_isamd_m (res,&isamd_m)
- }
- else {
- yaz_log (YLOG_FATAL, "isamg: Unknown isam type: %s", isam_type_name);
- exit(1);
- }
-} /* open */
-
-int isamg_close (ISAMG is){
- assert(is);
- assert(is->isam_type);
- select (is->isam_type) {
- case isamtype_isamd: return isams_close(is->isamd);
- }
-} /* close */
-
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Log
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-
-/*
- * $Log: isamg.c,v $
- * Revision 1.4 2004-11-19 10:27:10 heikki
- * Using the new ylog.h everywhere, and fixing what that breaks!
- *
- * Revision 1.3 2003/04/02 19:01:47 adam
- * Remove // comment
- *
- * Revision 1.2 2002/08/02 19:26:56 adam
- * Towards GPL
- *
- * Revision 1.1 2001/01/16 19:05:45 heikki
- * Started to work on isamg
- *
- *
- *
- */