mirror of
https://github.com/postgres/postgres.git
synced 2025-10-28 11:55:03 +03:00
Use callbacks in SlruScanDirectory for the actual action
Previously, the code assumed that the only possible action to take was to delete files behind a certain cutoff point. The async notify code was already a crock: it used a different "pagePrecedes" function for truncation than for regular operation. By allowing it to pass a callback to SlruScanDirectory it can do cleanly exactly what it needs to do. The clog.c code also had its own use for SlruScanDirectory, which is made a bit simpler with this.
This commit is contained in:
@@ -145,6 +145,15 @@ extern int SimpleLruReadPage_ReadOnly(SlruCtl ctl, int pageno,
|
||||
extern void SimpleLruWritePage(SlruCtl ctl, int slotno);
|
||||
extern void SimpleLruFlush(SlruCtl ctl, bool checkpoint);
|
||||
extern void SimpleLruTruncate(SlruCtl ctl, int cutoffPage);
|
||||
extern bool SlruScanDirectory(SlruCtl ctl, int cutoffPage, bool doDeletions);
|
||||
|
||||
typedef bool (*SlruScanCallback) (SlruCtl ctl, char *filename, int segpage,
|
||||
void *data);
|
||||
extern bool SlruScanDirectory(SlruCtl ctl, SlruScanCallback callback, void *data);
|
||||
|
||||
/* SlruScanDirectory public callbacks */
|
||||
extern bool SlruScanDirCbReportPresence(SlruCtl ctl, char *filename,
|
||||
int segpage, void *data);
|
||||
extern bool SlruScanDirCbDeleteAll(SlruCtl ctl, char *filename, int segpage,
|
||||
void *data);
|
||||
|
||||
#endif /* SLRU_H */
|
||||
|
||||
Reference in New Issue
Block a user