X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=isamc%2Fisamd-p.h;h=22859e22b1ca1cc6d0883aa4bedb7db27473611c;hb=ae14be135d7d1a0b8d428977d5e6d4d03c660b3b;hp=0c624190b2fd354d5978fb891848a0f9393fc75a;hpb=8e5f17591325078343ec4dff4708a12c78863f78;p=idzebra-moved-to-github.git diff --git a/isamc/isamd-p.h b/isamc/isamd-p.h index 0c62419..22859e2 100644 --- a/isamc/isamd-p.h +++ b/isamc/isamd-p.h @@ -3,7 +3,7 @@ * See the file LICENSE for details. * Heikki Levanto * - * + * log at the end */ #include @@ -16,16 +16,16 @@ extern "C" { typedef struct { int lastblock; int freelist; -} ISAMH_head; +} ISAMD_head; -typedef unsigned ISAMH_BLOCK_SIZE; +typedef unsigned ISAMD_BLOCK_SIZE; -typedef struct ISAMH_file_s { - ISAMH_head head; +typedef struct ISAMD_file_s { + ISAMD_head head; 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; @@ -39,50 +39,54 @@ typedef struct ISAMH_file_s { int no_next; int no_prev; - char *alloc_buf; + char *alloc_buf; /* free-list handling (?) */ int alloc_entries_num; int alloc_entries_max; int fc_max; int *fc_list; -} *ISAMH_file; +} *ISAMD_file; -struct ISAMH_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 */ - ISAMH_M method; - ISAMH_file files; + ISAMD_M method; + ISAMD_file files; }; -struct ISAMH_PP_s { - char *buf; - ISAMH_BLOCK_SIZE offset; - ISAMH_BLOCK_SIZE size; + +typedef struct ISAMD_DIFF_s *ISAMD_DIFF; + +struct ISAMD_PP_s { + char *buf; /* buffer for read/write operations */ + ISAMD_BLOCK_SIZE offset; /* position for next read/write */ + ISAMD_BLOCK_SIZE size; /* size of actual pointer data */ int cat; /* category of this block */ int pos; /* block number of this block */ int next; /* number of the next block */ - ISAMH is; + int diffs; /* either block or offset (in head) of start of diffs */ + ISAMD is; void *decodeClientData; - int deleteFlag; + ISAMD_DIFF diffinfo; + char *diffbuf; /* buffer for the diff block, only when reading */ int numKeys; - ISAMH_BLOCK_SIZE lastblock; /* last block in chain */ }; -#define ISAMH_BLOCK_OFFSET_N (sizeof(int) + \ - sizeof(ISAMH_BLOCK_SIZE)) +#define ISAMD_BLOCK_OFFSET_N (sizeof(int) + \ + sizeof(ISAMD_BLOCK_SIZE)) /* == 8 */ -#define ISAMH_BLOCK_OFFSET_1 (sizeof(int) + \ - sizeof(ISAMH_BLOCK_SIZE) + \ +#define ISAMD_BLOCK_OFFSET_1 (sizeof(int) + \ + sizeof(ISAMD_BLOCK_SIZE) + \ sizeof(int) + \ - sizeof(ISAMH_BLOCK_SIZE)) + sizeof(ISAMD_BLOCK_SIZE)) /* == 16 */ -int isamd_alloc_block (ISAMH is, int cat); -void isamd_release_block (ISAMH is, int cat, int pos); -int isamd_read_block (ISAMH is, int cat, int pos, char *dst); -int isamd_write_block (ISAMH is, int cat, int pos, char *src); + + +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); #ifdef __cplusplus } @@ -92,7 +96,14 @@ int isamd_write_block (ISAMH is, int cat, int pos, char *src); /* * $Log: isamd-p.h,v $ - * Revision 1.1 1999-07-14 12:34:43 heikki + * 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... * *