Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
relpath.h98 linesDownload Raw Back to common
1/*-------------------------------------------------------------------------2 *3 * relpath.h4 *		Declarations for GetRelationPath() and friends5 *6 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group7 * Portions Copyright (c) 1994, Regents of the University of California8 *9 * src/include/common/relpath.h10 *11 *-------------------------------------------------------------------------12 */13#ifndef RELPATH_H14#define RELPATH_H15 16/*17 *	'pgrminclude ignore' needed here because CppAsString2() does not throw18 *	an error if the symbol is not defined.19 */20#include "catalog/catversion.h" /* pgrminclude ignore */21 22/*23 * RelFileNumber data type identifies the specific relation file name.24 */25typedef Oid RelFileNumber;26#define InvalidRelFileNumber		((RelFileNumber) InvalidOid)27#define RelFileNumberIsValid(relnumber) \28				((bool) ((relnumber) != InvalidRelFileNumber))29 30/*31 * Name of major-version-specific tablespace subdirectories32 */33#define TABLESPACE_VERSION_DIRECTORY	"PG_" PG_MAJORVERSION "_" \34									CppAsString2(CATALOG_VERSION_NO)35 36/* Characters to allow for an OID in a relation path */37#define OIDCHARS		10		/* max chars printed by %u */38 39/*40 * Stuff for fork names.41 *42 * The physical storage of a relation consists of one or more forks.43 * The main fork is always created, but in addition to that there can be44 * additional forks for storing various metadata. ForkNumber is used when45 * we need to refer to a specific fork in a relation.46 */47typedef enum ForkNumber48{49	InvalidForkNumber = -1,50	MAIN_FORKNUM = 0,51	FSM_FORKNUM,52	VISIBILITYMAP_FORKNUM,53	INIT_FORKNUM54 55	/*56	 * NOTE: if you add a new fork, change MAX_FORKNUM and possibly57	 * FORKNAMECHARS below, and update the forkNames array in58	 * src/common/relpath.c59	 */60} ForkNumber;61 62#define MAX_FORKNUM		INIT_FORKNUM63 64#define FORKNAMECHARS	4		/* max chars for a fork name */65 66extern PGDLLIMPORT const char *const forkNames[];67 68extern ForkNumber forkname_to_number(const char *forkName);69extern int	forkname_chars(const char *str, ForkNumber *fork);70 71/*72 * Stuff for computing filesystem pathnames for relations.73 */74extern char *GetDatabasePath(Oid dbOid, Oid spcOid);75 76extern char *GetRelationPath(Oid dbOid, Oid spcOid, RelFileNumber relNumber,77							 int backendId, ForkNumber forkNumber);78 79/*80 * Wrapper macros for GetRelationPath.  Beware of multiple81 * evaluation of the RelFileLocator or RelFileLocatorBackend argument!82 */83 84/* First argument is a RelFileLocator */85#define relpathbackend(rlocator, backend, forknum) \86	GetRelationPath((rlocator).dbOid, (rlocator).spcOid, (rlocator).relNumber, \87					backend, forknum)88 89/* First argument is a RelFileLocator */90#define relpathperm(rlocator, forknum) \91	relpathbackend(rlocator, InvalidBackendId, forknum)92 93/* First argument is a RelFileLocatorBackend */94#define relpath(rlocator, forknum) \95	relpathbackend((rlocator).locator, (rlocator).backend, forknum)96 97#endif							/* RELPATH_H */98 
codekingpro/portable-devtools · Team Ai