X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=isamc%2Fisamd-p.h;h=84f8b82795feb2d986d4ece95bb2c19276197ad1;hb=2b33b395b50c562323ea2b0251f9b798cf5241d2;hp=81d1530f7707aab4128afc7a38728e3ed279e4e7;hpb=e8f4cf34c75ffdc7bbfaf3fa232f29cc1384b60c;p=idzebra-moved-to-github.git diff --git a/isamc/isamd-p.h b/isamc/isamd-p.h index 81d1530..84f8b82 100644 --- a/isamc/isamd-p.h +++ b/isamc/isamd-p.h @@ -1,9 +1,9 @@ -/* +/* $Id: isamd-p.h,v 1.9 1999-10-05 09:57:40 heikki Exp $ * Copyright (c) 1995-1996, Index Data. * See the file LICENSE for details. * Heikki Levanto * - * + * log at the end */ #include @@ -25,21 +25,24 @@ typedef struct ISAMD_file_s { BFile bf; int head_is_dirty; - int no_writes; + int no_writes; /* statistics, to be used properly... */ int no_reads; int no_skip_writes; int no_allocated; int no_released; int no_remap; - int no_forward; + int no_forward; /* stats from pp_read, for isam-c compatibility */ int no_backward; int sum_forward; int sum_backward; int no_next; int no_prev; - char *alloc_buf; + int no_op_diffonly;/* number of opens without mainblock */ + int no_op_main; /* number of opens with a main block */ + + char *alloc_buf; /* free-list handling (?) */ int alloc_entries_num; int alloc_entries_max; @@ -50,25 +53,47 @@ typedef struct ISAMD_file_s { struct ISAMD_s { int no_files; int max_cat; - // char *merge_buf; - char *startblock; /* start of the chain, update lastptr and numKeys here */ - char *lastblock; /* end of the chain, append here */ ISAMD_M method; ISAMD_file files; + int last_pos; /* last read/write position for seek stats */ + int last_cat; /* same for category */ + int no_read; /* blocks read (in all categories) */ + int no_write; /* blocks written (in all categories) */ + int no_op_single;/* singleton "blocks" opened */ + int no_read_keys;/* number of keys read (occurences of words) */ + int no_read_main;/* number of main keys read (not diffs) */ + int no_read_eof; /* number of key sequence ends read (no of words read) */ + int no_seek_nxt; /* seeks to the next record (fast) */ + int no_seek_sam; /* seeks to same record (fast) */ + int no_seek_fwd; /* seeks forward */ + int no_seek_prv; /* seeks to previous */ + int no_seek_bak; /* seeks backwards */ + int no_seek_cat; /* seeks to different category (expensive) */ + int no_op_new; /* "open"s for new blocks */ + int no_fbuilds; /* number of first-time builds */ + int no_appds; /* number of appends */ + int no_merges; /* number of merges done */ + int no_non; /* merges without any work */ + int no_singles; /* new items resulting in singletons */ }; + +typedef struct ISAMD_DIFF_s *ISAMD_DIFF; + struct ISAMD_PP_s { - char *buf; - ISAMD_BLOCK_SIZE offset; - ISAMD_BLOCK_SIZE size; + char *buf; /* buffer for read/write operations */ + ISAMD_BLOCK_SIZE offset; /* position for next read/write */ + ISAMD_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 */ ISAMD is; - void *decodeClientData; - int deleteFlag; + void *decodeClientData; /* delta-encoder's own data */ + ISAMD_DIFF diffinfo; + char *diffbuf; /* buffer for the diff block */ int numKeys; - ISAMD_BLOCK_SIZE lastblock; /* last block in chain */ }; #define ISAMD_BLOCK_OFFSET_N (sizeof(int) + \ @@ -76,13 +101,21 @@ struct ISAMD_PP_s { /* == 8 */ #define ISAMD_BLOCK_OFFSET_1 (sizeof(int) + \ sizeof(ISAMD_BLOCK_SIZE) + \ - sizeof(int) + \ sizeof(ISAMD_BLOCK_SIZE)) -/* == 16 */ +/* == 12 (was 16) */ +// sizeof(int) + + + int isamd_alloc_block (ISAMD is, int cat); void isamd_release_block (ISAMD is, int cat, int pos); int isamd_read_block (ISAMD is, int cat, int pos, char *dst); int isamd_write_block (ISAMD is, int cat, int pos, char *src); +void isamd_free_diffs(ISAMD_PP pp); + +int is_singleton(ISAMD_P ipos); +void singleton_decode (int code, struct it_key *k); +int singleton_encode(struct it_key *k); + #ifdef __cplusplus } @@ -92,8 +125,27 @@ int isamd_write_block (ISAMD is, int cat, int pos, char *src); /* * $Log: isamd-p.h,v $ - * Revision 1.2 1999-07-14 13:21:34 heikki - * Added isam-d files. Compiles (almost) clean. Doesn't work at all + * Revision 1.9 1999-10-05 09:57:40 heikki + * Tuning the isam-d (and fixed a small "detail") + * + * Revision 1.8 1999/09/23 18:01:18 heikki + * singleton optimising + * + * Revision 1.7 1999/09/20 15:48:06 heikki + * Small changes + * + * Revision 1.6 1999/08/25 18:09:23 heikki + * Starting to optimize + * + * Revision 1.5 1999/08/20 12:25:58 heikki + * Statistics in isamd + * + * Revision 1.4 1999/07/21 14:24:50 heikki + * isamd write and read functions ok, except when diff block full. + * (merge not yet done) + * + * Revision 1.3 1999/07/14 15:05:30 heikki + * slow start on isam-d * * Revision 1.1 1999/07/14 12:34:43 heikki * Copied from isamh, starting to change things...