1996-08-27 21:59:28 -04:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
*
|
1999-02-13 18:22:53 -05:00
|
|
|
* lselect.h
|
1997-09-07 01:04:48 -04:00
|
|
|
* definitions for the replacement selection algorithm.
|
1996-08-27 21:59:28 -04:00
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* Copyright (c) 1994, Regents of the University of California
|
|
|
|
|
*
|
1999-02-13 18:22:53 -05:00
|
|
|
* $Id: lselect.h,v 1.12 1999/02/13 23:22:24 momjian Exp $
|
1997-09-07 01:04:48 -04:00
|
|
|
*
|
1996-08-27 21:59:28 -04:00
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
1997-09-07 01:04:48 -04:00
|
|
|
#ifndef LSELECT_H
|
|
|
|
|
#define LSELECT_H
|
1996-08-27 21:59:28 -04:00
|
|
|
|
1996-11-04 06:51:27 -05:00
|
|
|
#include <stdio.h>
|
1997-11-25 20:14:33 -05:00
|
|
|
|
|
|
|
|
#include "access/skey.h"
|
|
|
|
|
#include "access/tupdesc.h"
|
1997-08-05 23:42:21 -04:00
|
|
|
#include "access/htup.h"
|
1997-11-25 20:14:33 -05:00
|
|
|
#include "utils/syscache.h"
|
1996-08-27 21:59:28 -04:00
|
|
|
|
1997-09-07 01:04:48 -04:00
|
|
|
struct leftist
|
|
|
|
|
{
|
1997-09-07 22:41:22 -04:00
|
|
|
short lt_dist; /* distance to leaf/empty node */
|
|
|
|
|
short lt_devnum; /* device number of tuple */
|
|
|
|
|
HeapTuple lt_tuple;
|
1997-09-07 01:04:48 -04:00
|
|
|
struct leftist *lt_left;
|
|
|
|
|
struct leftist *lt_right;
|
1996-08-27 21:59:28 -04:00
|
|
|
};
|
|
|
|
|
|
1997-08-05 23:42:21 -04:00
|
|
|
/* replaces global variables in lselect.c to make it reentrant */
|
1997-09-07 01:04:48 -04:00
|
|
|
typedef struct
|
|
|
|
|
{
|
1997-09-07 22:41:22 -04:00
|
|
|
TupleDesc tupDesc;
|
|
|
|
|
int nKeys;
|
|
|
|
|
ScanKey scanKeys;
|
|
|
|
|
int sortMem; /* needed for psort */
|
1997-09-08 17:56:23 -04:00
|
|
|
} LeftistContextData;
|
1997-08-05 23:42:21 -04:00
|
|
|
typedef LeftistContextData *LeftistContext;
|
1996-08-27 21:59:28 -04:00
|
|
|
|
1998-09-01 00:40:42 -04:00
|
|
|
extern struct leftist *lmerge(struct leftist * pt, struct leftist * qt,
|
1997-09-07 01:04:48 -04:00
|
|
|
LeftistContext context);
|
1998-09-01 00:40:42 -04:00
|
|
|
extern HeapTuple gettuple(struct leftist ** treep, short *devnum,
|
1997-09-07 01:04:48 -04:00
|
|
|
LeftistContext context);
|
1998-09-01 00:40:42 -04:00
|
|
|
extern void puttuple(struct leftist ** treep, HeapTuple newtuple, short devnum,
|
1997-09-07 01:04:48 -04:00
|
|
|
LeftistContext context);
|
1997-09-07 22:41:22 -04:00
|
|
|
extern int tuplecmp(HeapTuple ltup, HeapTuple rtup, LeftistContext context);
|
1996-08-27 21:59:28 -04:00
|
|
|
|
|
|
|
|
#ifdef EBUG
|
1997-09-07 22:41:22 -04:00
|
|
|
extern void checktree(struct leftist * tree, LeftistContext context);
|
|
|
|
|
extern int checktreer(struct leftist * tree, int level, LeftistContext context);
|
1997-09-07 01:04:48 -04:00
|
|
|
|
1998-09-01 00:40:42 -04:00
|
|
|
#endif /* EBUG */
|
1996-08-27 21:59:28 -04:00
|
|
|
|
1998-09-01 00:40:42 -04:00
|
|
|
#endif /* LSELECT_H */
|