diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2020-11-04 11:21:18 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2020-11-04 11:21:18 +0200 |
commit | 37d2ff38031262a1778bc76a9c55fff7afbcf275 (patch) | |
tree | 309e1c231f9acfbd012c139b816cf5384b00d52a /src/bin/pg_rewind/fetch.h | |
parent | f81e97d0475cd4bc597adc23b665bd84fbf79a0d (diff) |
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/fetch.h')
-rw-r--r-- | src/bin/pg_rewind/fetch.h | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/bin/pg_rewind/fetch.h b/src/bin/pg_rewind/fetch.h deleted file mode 100644 index b20df8b1537..00000000000 --- a/src/bin/pg_rewind/fetch.h +++ /dev/null @@ -1,44 +0,0 @@ -/*------------------------------------------------------------------------- - * - * fetch.h - * Fetching data from a local or remote data directory. - * - * This file includes the prototypes for functions used to copy files from - * one data directory to another. The source to copy from can be a local - * directory (copy method), or a remote PostgreSQL server (libpq fetch - * method). - * - * Copyright (c) 2013-2020, PostgreSQL Global Development Group - * - *------------------------------------------------------------------------- - */ -#ifndef FETCH_H -#define FETCH_H - -#include "access/xlogdefs.h" - -#include "filemap.h" - -/* - * Common interface. Calls the copy or libpq method depending on global - * config options. - */ -extern void fetchSourceFileList(void); -extern char *fetchFile(const char *filename, size_t *filesize); -extern void execute_file_actions(filemap_t *filemap); - -/* in libpq_fetch.c */ -extern void libpqProcessFileList(void); -extern char *libpqGetFile(const char *filename, size_t *filesize); -extern void libpq_executeFileMap(filemap_t *map); - -extern void libpqConnect(const char *connstr); -extern XLogRecPtr libpqGetCurrentXlogInsertLocation(void); - -/* in copy_fetch.c */ -extern void copy_executeFileMap(filemap_t *map); - -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 /* FETCH_H */ |