* See the file LICENSE for details.
* Heikki Levanto
*
+ * $Id: merge-d.c,v 1.4 1999-07-21 14:53:55 heikki Exp $
* merge-d.c: merge routines for isamd
*
* todo
static int separateDiffBlock(ISAMD_PP pp)
{
return ( 0 != pp->next);
+ /* Todo: This could be improved to check that there is a reasonable
+ amount of space in the block, or something... */
}
+/**************************************************************
+ * Reading
+ **************************************************************/
+
static void getDiffInfo(ISAMD_PP pp, int diffidx)
{ /* builds the diff info structures from a diffblock */
int maxinfos = pp->is->method->filecat[pp->cat].bsize / 5 +1;
} /* isamd_read_item */
+
+/*******************************************************************
+ * Building main blocks (no diffs)
+ *******************************************************************/
+
static void isamd_reduceblock(ISAMD_PP pp)
/* takes a large block, and reduces its category if possible */
/* Presumably the first block in an isam-list */
static int isamd_build_first_block(ISAMD is, ISAMD_I data)
{
- char i_item[128]; /* one input item */
+ struct it_key i_key; /* input key */
+ char *i_item= (char *) &i_key; /* same as char */
char *i_ptr=i_item;
int i_more =1;
int i_mode; /* 0 for delete, 1 for insert */
/* read first input */
i_ptr = i_item;
i_more = (*data->read_item)(data->clientData, &i_ptr, &i_mode);
+ if (i_more)
+ assert( i_ptr-i_item == sizeof(i_key) );
if (is->method->debug >3)
logf(LOG_LOG,"isamd: build_fi start: m=%d %s",
} /* build_first_block */
+/***************************************************************
+ * Appending diffs
+ ***************************************************************/
+
static int append_diffs(ISAMD is, ISAMD_P ipos, ISAMD_I data)
{
+/*************************************************************
+ * isamd_append itself, Sweet, isn't it
+ *************************************************************/
+
ISAMD_P isamd_append (ISAMD is, ISAMD_P ipos, ISAMD_I data)
{
int retval=0;
/*
* $Log: merge-d.c,v $
- * Revision 1.3 1999-07-21 14:24:50 heikki
- * isamd write and read functions ok, except when diff block full.
- * (merge not yet done)
+ * Revision 1.4 1999-07-21 14:53:55 heikki
+ * isamd read and write functions work, except when block full
+ * Merge missing still. Need to split some functions
*
* Revision 1.1 1999/07/14 13:14:47 heikki
* Created empty