Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
brin_internal.h116 linesDownload Raw Back to access
1/*2 * brin_internal.h3 *		internal declarations for BRIN indexes4 *5 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group6 * Portions Copyright (c) 1994, Regents of the University of California7 *8 * IDENTIFICATION9 *		src/include/access/brin_internal.h10 */11#ifndef BRIN_INTERNAL_H12#define BRIN_INTERNAL_H13 14#include "access/amapi.h"15#include "storage/bufpage.h"16#include "utils/typcache.h"17 18 19/*20 * A BrinDesc is a struct designed to enable decoding a BRIN tuple from the21 * on-disk format to an in-memory tuple and vice-versa.22 */23 24/* struct returned by "OpcInfo" amproc */25typedef struct BrinOpcInfo26{27	/* Number of columns stored in an index column of this opclass */28	uint16		oi_nstored;29 30	/* Regular processing of NULLs in BrinValues? */31	bool		oi_regular_nulls;32 33	/* Opaque pointer for the opclass' private use */34	void	   *oi_opaque;35 36	/* Type cache entries of the stored columns */37	TypeCacheEntry *oi_typcache[FLEXIBLE_ARRAY_MEMBER];38} BrinOpcInfo;39 40/* the size of a BrinOpcInfo for the given number of columns */41#define SizeofBrinOpcInfo(ncols) \42	(offsetof(BrinOpcInfo, oi_typcache) + sizeof(TypeCacheEntry *) * ncols)43 44typedef struct BrinDesc45{46	/* Containing memory context */47	MemoryContext bd_context;48 49	/* the index relation itself */50	Relation	bd_index;51 52	/* tuple descriptor of the index relation */53	TupleDesc	bd_tupdesc;54 55	/* cached copy for on-disk tuples; generated at first use */56	TupleDesc	bd_disktdesc;57 58	/* total number of Datum entries that are stored on-disk for all columns */59	int			bd_totalstored;60 61	/* per-column info; bd_tupdesc->natts entries long */62	BrinOpcInfo *bd_info[FLEXIBLE_ARRAY_MEMBER];63} BrinDesc;64 65/*66 * Globally-known function support numbers for BRIN indexes.  Individual67 * opclasses can define more function support numbers, which must fall into68 * BRIN_FIRST_OPTIONAL_PROCNUM .. BRIN_LAST_OPTIONAL_PROCNUM.69 */70#define BRIN_PROCNUM_OPCINFO		171#define BRIN_PROCNUM_ADDVALUE		272#define BRIN_PROCNUM_CONSISTENT		373#define BRIN_PROCNUM_UNION			474#define BRIN_MANDATORY_NPROCS		475#define BRIN_PROCNUM_OPTIONS 		5	/* optional */76/* procedure numbers up to 10 are reserved for BRIN future expansion */77#define BRIN_FIRST_OPTIONAL_PROCNUM 1178#define BRIN_LAST_OPTIONAL_PROCNUM	1579 80#undef BRIN_DEBUG81 82#ifdef BRIN_DEBUG83#define BRIN_elog(args)			elog args84#else85#define BRIN_elog(args)			((void) 0)86#endif87 88/* brin.c */89extern BrinDesc *brin_build_desc(Relation rel);90extern void brin_free_desc(BrinDesc *bdesc);91extern IndexBuildResult *brinbuild(Relation heap, Relation index,92								   struct IndexInfo *indexInfo);93extern void brinbuildempty(Relation index);94extern bool brininsert(Relation idxRel, Datum *values, bool *nulls,95					   ItemPointer heaptid, Relation heapRel,96					   IndexUniqueCheck checkUnique,97					   bool indexUnchanged,98					   struct IndexInfo *indexInfo);99extern IndexScanDesc brinbeginscan(Relation r, int nkeys, int norderbys);100extern int64 bringetbitmap(IndexScanDesc scan, TIDBitmap *tbm);101extern void brinrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys,102					   ScanKey orderbys, int norderbys);103extern void brinendscan(IndexScanDesc scan);104extern IndexBulkDeleteResult *brinbulkdelete(IndexVacuumInfo *info,105											 IndexBulkDeleteResult *stats,106											 IndexBulkDeleteCallback callback,107											 void *callback_state);108extern IndexBulkDeleteResult *brinvacuumcleanup(IndexVacuumInfo *info,109												IndexBulkDeleteResult *stats);110extern bytea *brinoptions(Datum reloptions, bool validate);111 112/* brin_validate.c */113extern bool brinvalidate(Oid opclassoid);114 115#endif							/* BRIN_INTERNAL_H */116 
codekingpro/portable-devtools · Team Ai