1/*-------------------------------------------------------------------------
2 *
3 * fetch.h
4 * Fetching data from a local or remote data directory.
5 *
6 * This file includes the prototypes for functions used to copy files from
7 * one data directory to another. The source to copy from can be a local
8 * directory (copy method), or a remote PostgreSQL server (libpq fetch
9 * method).
10 *
11 * Copyright (c) 2013-2019, PostgreSQL Global Development Group
12 *
13 *-------------------------------------------------------------------------
14 */
15#ifndef FETCH_H
16#define FETCH_H
17
18#include "access/xlogdefs.h"
19
20#include "filemap.h"
21
22/*
23 * Common interface. Calls the copy or libpq method depending on global
24 * config options.
25 */
26extern void fetchSourceFileList(void);
27extern char *fetchFile(const char *filename, size_t *filesize);
28extern void executeFileMap(void);
29
30/* in libpq_fetch.c */
31extern void libpqProcessFileList(void);
32extern char *libpqGetFile(const char *filename, size_t *filesize);
33extern void libpq_executeFileMap(filemap_t *map);
34
35extern void libpqConnect(const char *connstr);
36extern XLogRecPtr libpqGetCurrentXlogInsertLocation(void);
37
38/* in copy_fetch.c */
39extern void copy_executeFileMap(filemap_t *map);
40
41typedef void (*process_file_callback_t) (const char *path, file_type_t type, size_t size, const char *link_target);
42extern void traverse_datadir(const char *datadir, process_file_callback_t callback);
43
44#endif /* FETCH_H */
45