codekingpro/portable-devtools
116k
1/*-------------------------------------------------------------------------2 *3 * sync.h4 * File synchronization management code.5 *6 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group7 * Portions Copyright (c) 1994, Regents of the University of California8 *9 * src/include/storage/sync.h10 *11 *-------------------------------------------------------------------------12 */13#ifndef SYNC_H14#define SYNC_H15 16#include "storage/relfilelocator.h"17 18/*19 * Type of sync request. These are used to manage the set of pending20 * requests to call a sync handler's sync or unlink functions at the next21 * checkpoint.22 */23typedef enum SyncRequestType24{25 SYNC_REQUEST, /* schedule a call of sync function */26 SYNC_UNLINK_REQUEST, /* schedule a call of unlink function */27 SYNC_FORGET_REQUEST, /* forget all calls for a tag */28 SYNC_FILTER_REQUEST /* forget all calls satisfying match fn */29} SyncRequestType;30 31/*32 * Which set of functions to use to handle a given request. The values of33 * the enumerators must match the indexes of the function table in sync.c.34 */35typedef enum SyncRequestHandler36{37 SYNC_HANDLER_MD = 0,38 SYNC_HANDLER_CLOG,39 SYNC_HANDLER_COMMIT_TS,40 SYNC_HANDLER_MULTIXACT_OFFSET,41 SYNC_HANDLER_MULTIXACT_MEMBER,42 SYNC_HANDLER_NONE43} SyncRequestHandler;44 45/*46 * A tag identifying a file. Currently it has the members required for md.c's47 * usage, but sync.c has no knowledge of the internal structure, and it is48 * liable to change as required by future handlers.49 */50typedef struct FileTag51{52 int16 handler; /* SyncRequestHandler value, saving space */53 int16 forknum; /* ForkNumber, saving space */54 RelFileLocator rlocator;55 uint32 segno;56} FileTag;57 58extern void InitSync(void);59extern void SyncPreCheckpoint(void);60extern void SyncPostCheckpoint(void);61extern void ProcessSyncRequests(void);62extern void RememberSyncRequest(const FileTag *ftag, SyncRequestType type);63extern bool RegisterSyncRequest(const FileTag *ftag, SyncRequestType type,64 bool retryOnError);65 66#endif /* SYNC_H */67 