PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
walmethods.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * walmethods.h
4  *
5  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
6  *
7  * IDENTIFICATION
8  * src/bin/pg_basebackup/walmethods.h
9  *-------------------------------------------------------------------------
10  */
11 
12 
13 typedef void *Walfile;
14 
15 typedef enum
16 {
21 
24 {
25  Walfile(*open_for_write) (const char *pathname, const char *temp_suffix, size_t pad_to_size);
26  int (*close) (Walfile f, WalCloseMethod method);
27  bool (*existsfile) (const char *pathname);
28  ssize_t (*get_file_size) (const char *pathname);
29 
30  ssize_t (*write) (Walfile f, const void *buf, size_t count);
31  off_t (*get_current_pos) (Walfile f);
32  int (*sync) (Walfile f);
33  bool (*finish) (void);
34  char *(*getlasterror) (void);
35 };
36 
37 /*
38  * Available WAL methods:
39  * - WalDirectoryMethod - write WAL to regular files in a standard pg_xlog
40  * - TarDirectoryMethod - write WAL to a tarfile corresponding to pg_xlog
41  * (only implements the methods required for pg_basebackup,
42  * not all those required for pg_receivewal)
43  */
45  int compression, bool sync);
46 WalWriteMethod *CreateWalTarMethod(const char *tarbase, int compression, bool sync);
47 
48 /* Cleanup routines for previously-created methods */
49 void FreeWalDirectoryMethod(void);
50 void FreeWalTarMethod(void);
WalCloseMethod
Definition: walmethods.h:15
WalWriteMethod * CreateWalDirectoryMethod(const char *basedir, int compression, bool sync)
Definition: walmethods.c:346
void * Walfile
Definition: walmethods.h:13
bool(* existsfile)(const char *pathname)
Definition: walmethods.h:27
static char * basedir
Definition: pg_basebackup.c:77
bool(* finish)(void)
Definition: walmethods.h:33
char bool
Definition: c.h:202
ssize_t(* get_file_size)(const char *pathname)
Definition: walmethods.h:28
static char * buf
Definition: pg_test_fsync.c:65
void FreeWalTarMethod(void)
Definition: walmethods.c:978
off_t(* get_current_pos)(Walfile f)
Definition: walmethods.h:31
WalWriteMethod * CreateWalTarMethod(const char *tarbase, int compression, bool sync)
Definition: walmethods.c:947
int(* sync)(Walfile f)
Definition: walmethods.h:32
ssize_t(* write)(Walfile f, const void *buf, size_t count)
Definition: walmethods.h:30
Walfile(* open_for_write)(const char *pathname, const char *temp_suffix, size_t pad_to_size)
Definition: walmethods.h:25
void FreeWalDirectoryMethod(void)
Definition: walmethods.c:370
int(* close)(Walfile f, WalCloseMethod method)
Definition: walmethods.h:26