1 /*-------------------------------------------------------------------------
4 * File synchronization management code.
6 * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
9 * src/include/storage/sync.h
11 *-------------------------------------------------------------------------
16 #include "storage/relfilelocator.h"
19 * Type of sync request. These are used to manage the set of pending
20 * requests to call a sync handler's sync or unlink functions at the next
23 typedef enum SyncRequestType
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 */
32 * Which set of functions to use to handle a given request. The values of
33 * the enumerators must match the indexes of the function table in sync.c.
35 typedef enum SyncRequestHandler
39 SYNC_HANDLER_COMMIT_TS
,
40 SYNC_HANDLER_MULTIXACT_OFFSET
,
41 SYNC_HANDLER_MULTIXACT_MEMBER
,
46 * A tag identifying a file. Currently it has the members required for md.c's
47 * usage, but sync.c has no knowledge of the internal structure, and it is
48 * liable to change as required by future handlers.
50 typedef struct FileTag
52 int16 handler
; /* SyncRequestHandler value, saving space */
53 int16 forknum
; /* ForkNumber, saving space */
54 RelFileLocator rlocator
;
58 extern void InitSync(void);
59 extern void SyncPreCheckpoint(void);
60 extern void SyncPostCheckpoint(void);
61 extern void ProcessSyncRequests(void);
62 extern void RememberSyncRequest(const FileTag
*ftag
, SyncRequestType type
);
63 extern bool RegisterSyncRequest(const FileTag
*ftag
, SyncRequestType type
,