24#define BLOOM_HASH_PROC 1
25#define BLOOM_OPTIONS_PROC 2
29#define BLOOM_EQUAL_STRATEGY 1
30#define BLOOM_NSTRATEGIES 1
46#define BLOOM_META (1<<0)
47#define BLOOM_DELETED (2<<0)
57#define BLOOM_PAGE_ID 0xFF83
60#define BloomPageGetOpaque(page) ((BloomPageOpaque) PageGetSpecialPointer(page))
61#define BloomPageGetMaxOffset(page) (BloomPageGetOpaque(page)->maxoff)
62#define BloomPageIsMeta(page) \
63 ((BloomPageGetOpaque(page)->flags & BLOOM_META) != 0)
64#define BloomPageIsDeleted(page) \
65 ((BloomPageGetOpaque(page)->flags & BLOOM_DELETED) != 0)
66#define BloomPageSetDeleted(page) \
67 (BloomPageGetOpaque(page)->flags |= BLOOM_DELETED)
68#define BloomPageSetNonDeleted(page) \
69 (BloomPageGetOpaque(page)->flags &= ~BLOOM_DELETED)
70#define BloomPageGetData(page) ((BloomTuple *)PageGetContents(page))
71#define BloomPageGetTuple(state, page, offset) \
72 ((BloomTuple *)(PageGetContents(page) \
73 + (state)->sizeOfBloomTuple * ((offset) - 1)))
74#define BloomPageGetNextTuple(state, tuple) \
75 ((BloomTuple *)((Pointer)(tuple) + (state)->sizeOfBloomTuple))
78#define BLOOM_METAPAGE_BLKNO (0)
79#define BLOOM_HEAD_BLKNO (1)
86#define SIGNWORDBITS ((int) (BITS_PER_BYTE * sizeof(BloomSignatureWord)))
91#define DEFAULT_BLOOM_LENGTH (5 * SIGNWORDBITS)
92#define MAX_BLOOM_LENGTH (256 * SIGNWORDBITS)
97#define DEFAULT_BLOOM_BITS 2
98#define MAX_BLOOM_BITS (MAX_BLOOM_LENGTH - 1)
128#define BLOOM_MAGICK_NUMBER (0xDBAC0DED)
131#define BloomMetaBlockN (sizeof(FreeBlockNumberArray) / sizeof(BlockNumber))
133#define BloomPageGetMeta(page) ((BloomMetaPageData *) PageGetContents(page))
149#define BloomPageGetFreeSpace(state, page) \
150 (BLCKSZ - MAXALIGN(SizeOfPageHeaderData) \
151 - BloomPageGetMaxOffset(page) * (state)->sizeOfBloomTuple \
152 - MAXALIGN(sizeof(BloomPageOpaqueData)))
163#define BLOOMTUPLEHDRSZ offsetof(BloomTuple, sign)
196 ScanKey orderbys,
int norderbys);
203 void *callback_state);
208 double loop_count,
Cost *indexStartupCost,
210 double *indexCorrelation,
double *indexPages);
IndexBuildResult * blbuild(Relation heap, Relation index, struct IndexInfo *indexInfo)
bool blvalidate(Oid opclassoid)
void BloomInitPage(Page page, uint16 flags)
int64 blgetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
IndexScanDesc blbeginscan(Relation r, int nkeys, int norderbys)
BloomTuple * BloomFormTuple(BloomState *state, ItemPointer iptr, Datum *values, bool *isnull)
bool BloomPageAddItem(BloomState *state, Page page, BloomTuple *tuple)
void blcostestimate(PlannerInfo *root, IndexPath *path, double loop_count, Cost *indexStartupCost, Cost *indexTotalCost, Selectivity *indexSelectivity, double *indexCorrelation, double *indexPages)
void blbuildempty(Relation index)
BloomPageOpaqueData * BloomPageOpaque
BlockNumber FreeBlockNumberArray[MAXALIGN_DOWN(BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(BloomPageOpaqueData)) - MAXALIGN(sizeof(uint16) *2+sizeof(uint32)+sizeof(BloomOptions)))/sizeof(BlockNumber)]
struct BloomMetaPageData BloomMetaPageData
struct BloomOptions BloomOptions
Buffer BloomNewBuffer(Relation index)
struct BloomPageOpaqueData BloomPageOpaqueData
IndexBulkDeleteResult * blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback, void *callback_state)
void BloomFillMetapage(Relation index, Page metaPage)
bool blinsert(Relation index, Datum *values, bool *isnull, ItemPointer ht_ctid, Relation heapRel, IndexUniqueCheck checkUnique, bool indexUnchanged, struct IndexInfo *indexInfo)
void BloomInitMetapage(Relation index, ForkNumber forknum)
struct BloomState BloomState
bytea * bloptions(Datum reloptions, bool validate)
IndexBulkDeleteResult * blvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
struct BloomTuple BloomTuple
uint16 BloomSignatureWord
void signValue(BloomState *state, BloomSignatureWord *sign, Datum value, int attno)
void initBloomState(BloomState *state, Relation index)
BloomScanOpaqueData * BloomScanOpaque
struct BloomScanOpaqueData BloomScanOpaqueData
void blendscan(IndexScanDesc scan)
void blrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, ScanKey orderbys, int norderbys)
static Datum values[MAXATTR]
#define SizeOfPageHeaderData
#define MAXALIGN_DOWN(LEN)
#define FLEXIBLE_ARRAY_MEMBER
bool(* IndexBulkDeleteCallback)(ItemPointer itemptr, void *state)
FreeBlockNumberArray notFullPage
int bitSize[INDEX_MAX_KEYS]
BloomSignatureWord * sign
Oid collations[INDEX_MAX_KEYS]
FmgrInfo hashFn[INDEX_MAX_KEYS]
BloomSignatureWord sign[FLEXIBLE_ARRAY_MEMBER]
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)