Eneboo - Documentación para desarrolladores
|
00001 /*------------------------------------------------------------------------- 00002 * 00003 * tidbitmap.h 00004 * PostgreSQL tuple-id (TID) bitmap package 00005 * 00006 * This module provides bitmap data structures that are spiritually 00007 * similar to Bitmapsets, but are specially adapted to store sets of 00008 * tuple identifiers (TIDs), or ItemPointers. In particular, the division 00009 * of an ItemPointer into BlockNumber and OffsetNumber is catered for. 00010 * Also, since we wish to be able to store very large tuple sets in 00011 * memory with this data structure, we support "lossy" storage, in which 00012 * we no longer remember individual tuple offsets on a page but only the 00013 * fact that a particular page needs to be visited. 00014 * 00015 * 00016 * Copyright (c) 2003-2005, PostgreSQL Global Development Group 00017 * 00018 * $PostgreSQL: pgsql/src/include/nodes/tidbitmap.h,v 1.3 2005/10/15 02:49:45 momjian Exp $ 00019 * 00020 *------------------------------------------------------------------------- 00021 */ 00022 #ifndef TIDBITMAP_H 00023 #define TIDBITMAP_H 00024 00025 #include "storage/itemptr.h" 00026 00027 00028 /* 00029 * Actual bitmap representation is private to tidbitmap.c. Callers can 00030 * do IsA(x, TIDBitmap) on it, but nothing else. 00031 */ 00032 typedef struct TIDBitmap TIDBitmap; 00033 00034 /* Result structure for tbm_iterate */ 00035 typedef struct 00036 { 00037 BlockNumber blockno; /* page number containing tuples */ 00038 int ntuples; /* -1 indicates lossy result */ 00039 OffsetNumber offsets[1]; /* VARIABLE LENGTH ARRAY */ 00040 } TBMIterateResult; /* VARIABLE LENGTH STRUCT */ 00041 00042 /* function prototypes in nodes/tidbitmap.c */ 00043 00044 extern TIDBitmap *tbm_create(long maxbytes); 00045 extern void tbm_free(TIDBitmap *tbm); 00046 00047 extern void tbm_add_tuples(TIDBitmap *tbm, const ItemPointer tids, int ntids); 00048 00049 extern void tbm_union(TIDBitmap *a, const TIDBitmap *b); 00050 extern void tbm_intersect(TIDBitmap *a, const TIDBitmap *b); 00051 00052 extern bool tbm_is_empty(const TIDBitmap *tbm); 00053 00054 extern void tbm_begin_iterate(TIDBitmap *tbm); 00055 extern TBMIterateResult *tbm_iterate(TIDBitmap *tbm); 00056 00057 #endif /* TIDBITMAP_H */