diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/nodes/nodes.h | 13 | ||||
-rw-r--r-- | src/include/nodes/tidbitmap.h | 55 |
2 files changed, 64 insertions, 4 deletions
diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index 4822b5f6cc4..3c5528546af 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.165 2005/04/06 16:34:07 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.166 2005/04/17 22:24:02 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -304,11 +304,16 @@ typedef enum NodeTag T_FunctionParameter, /* - * TAGS FOR FUNCTION-CALL CONTEXT AND RESULTINFO NODES (see fmgr.h) + * TAGS FOR RANDOM OTHER STUFF + * + * These are objects that aren't part of parse/plan/execute node tree + * structures, but we give them NodeTags anyway for identification + * purposes (usually because they are involved in APIs where we want + * to pass multiple object types through the same pointer). */ T_TriggerData = 900, /* in commands/trigger.h */ - T_ReturnSetInfo /* in nodes/execnodes.h */ - + T_ReturnSetInfo, /* in nodes/execnodes.h */ + T_TIDBitmap /* in nodes/tidbitmap.h */ } NodeTag; /* diff --git a/src/include/nodes/tidbitmap.h b/src/include/nodes/tidbitmap.h new file mode 100644 index 00000000000..2c90c01d815 --- /dev/null +++ b/src/include/nodes/tidbitmap.h @@ -0,0 +1,55 @@ +/*------------------------------------------------------------------------- + * + * tidbitmap.h + * PostgreSQL tuple-id (TID) bitmap package + * + * This module provides bitmap data structures that are spiritually + * similar to Bitmapsets, but are specially adapted to store sets of + * tuple identifiers (TIDs), or ItemPointers. In particular, the division + * of an ItemPointer into BlockNumber and OffsetNumber is catered for. + * Also, since we wish to be able to store very large tuple sets in + * memory with this data structure, we support "lossy" storage, in which + * we no longer remember individual tuple offsets on a page but only the + * fact that a particular page needs to be visited. + * + * + * Copyright (c) 2003-2005, PostgreSQL Global Development Group + * + * $PostgreSQL: pgsql/src/include/nodes/tidbitmap.h,v 1.1 2005/04/17 22:24:02 tgl Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef TIDBITMAP_H +#define TIDBITMAP_H + +#include "storage/itemptr.h" + + +/* + * Actual bitmap representation is private to tidbitmap.c. Callers can + * do IsA(x, TIDBitmap) on it, but nothing else. + */ +typedef struct TIDBitmap TIDBitmap; + +/* Result structure for tbm_iterate */ +typedef struct +{ + BlockNumber blockno; /* page number containing tuples */ + int ntuples; /* -1 indicates lossy result */ + OffsetNumber offsets[1]; /* VARIABLE LENGTH ARRAY */ +} TBMIterateResult; /* VARIABLE LENGTH STRUCT */ + +/* function prototypes in nodes/tidbitmap.c */ + +extern TIDBitmap *tbm_create(long maxbytes); +extern void tbm_free(TIDBitmap *tbm); + +extern void tbm_add_tuples(TIDBitmap *tbm, const ItemPointer tids, int ntids); + +extern void tbm_union(TIDBitmap *a, const TIDBitmap *b); +extern void tbm_intersect(TIDBitmap *a, const TIDBitmap *b); + +extern void tbm_begin_iterate(TIDBitmap *tbm); +extern TBMIterateResult *tbm_iterate(TIDBitmap *tbm); + +#endif /* TIDBITMAP_H */ |