Implemented structure=105 searching.
[idzebra-moved-to-github.git] / isamc / isamd-p.h
index bffb923..843a183 100644 (file)
@@ -1,4 +1,4 @@
-/*
+/* $Id: isamd-p.h,v 1.7 1999-09-20 15:48:06 heikki Exp $
  * Copyright (c) 1995-1996, Index Data.
  * See the file LICENSE for details.
  * Heikki Levanto
@@ -39,6 +39,14 @@ typedef struct ISAMD_file_s {
     int no_next;
     int no_prev;
 
+    int no_op_nodiff; /* existing blocks opened for reading without diffs */
+    int no_op_intdiff; /* - with internal diffs */
+    int no_op_extdiff; /* with separate diff blocks */
+    int no_fbuilds;    /* number of first-time builds */
+    int no_appds;      /* number of appends */
+    int no_merges;     /* number of merges done */
+    int no_remerges;   /* number of times more than one merge needed */
+
     char *alloc_buf;    /* free-list handling (?) */
     int alloc_entries_num;
     int alloc_entries_max;
@@ -50,24 +58,26 @@ typedef struct ISAMD_file_s {
 struct ISAMD_s {
     int no_files;
     int max_cat;
-    //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;
 }; 
 
+
+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 */
+    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; /* either block or offset (in head) of start of diffs */
+    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;
 };
 
@@ -76,13 +86,16 @@ 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);
 
 #ifdef __cplusplus
 }
@@ -92,7 +105,20 @@ int isamd_write_block (ISAMD is, int cat, int pos, char *src);
 
 /*
  * $Log: isamd-p.h,v $
- * Revision 1.3  1999-07-14 15:05:30  heikki
+ * 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