aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_rewind/file_ops.h
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2020-11-04 11:21:18 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2020-11-04 11:21:18 +0200
commit37d2ff38031262a1778bc76a9c55fff7afbcf275 (patch)
tree309e1c231f9acfbd012c139b816cf5384b00d52a /src/bin/pg_rewind/file_ops.h
parentf81e97d0475cd4bc597adc23b665bd84fbf79a0d (diff)
downloadpostgresql-37d2ff38031262a1778bc76a9c55fff7afbcf275.tar.gz
postgresql-37d2ff38031262a1778bc76a9c55fff7afbcf275.zip
pg_rewind: Refactor the abstraction to fetch from local/libpq source.
This makes the abstraction of a "source" server more clear, by introducing a common abstract class, borrowing the object-oriented programming term, that represents all the operations that can be done on the source server. There are two implementations of it, one for fetching via libpq, and another to fetch from a local directory. This adds some code, but makes it easier to understand what's going on. The copy_executeFileMap() and libpq_executeFileMap() functions contained basically the same logic, just calling different functions to fetch the source files. Refactor so that the common logic is in one place, in a new function called perform_rewind(). Reviewed-by: Kyotaro Horiguchi, Soumyadeep Chakraborty Discussion: https://www.postgresql.org/message-id/0c5b3783-af52-3ee5-f8fa-6e794061f70d%40iki.fi
Diffstat (limited to 'src/bin/pg_rewind/file_ops.h')
-rw-r--r--src/bin/pg_rewind/file_ops.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/bin/pg_rewind/file_ops.h b/src/bin/pg_rewind/file_ops.h
index d8466385cf5..c7630859768 100644
--- a/src/bin/pg_rewind/file_ops.h
+++ b/src/bin/pg_rewind/file_ops.h
@@ -23,4 +23,7 @@ extern void sync_target_dir(void);
extern char *slurpFile(const char *datadir, const char *path, size_t *filesize);
+typedef void (*process_file_callback_t) (const char *path, file_type_t type, size_t size, const char *link_target);
+extern void traverse_datadir(const char *datadir, process_file_callback_t callback);
+
#endif /* FILE_OPS_H */