1 /*-------------------------------------------------------------------------
2  *
3  *	scripts_parallel.h
4  *		Parallel support for bin/scripts/
5  *
6  *	Copyright (c) 2003-2020, PostgreSQL Global Development Group
7  *
8  *	src/bin/scripts/scripts_parallel.h
9  *
10  *-------------------------------------------------------------------------
11  */
12 #ifndef SCRIPTS_PARALLEL_H
13 #define SCRIPTS_PARALLEL_H
14 
15 #include "common.h"
16 #include "libpq-fe.h"
17 
18 
19 typedef struct ParallelSlot
20 {
21 	PGconn	   *connection;		/* One connection */
22 	bool		isFree;			/* Is it known to be idle? */
23 } ParallelSlot;
24 
25 extern ParallelSlot *ParallelSlotsGetIdle(ParallelSlot *slots, int numslots);
26 
27 extern ParallelSlot *ParallelSlotsSetup(const ConnParams *cparams,
28 										const char *progname, bool echo,
29 										PGconn *conn, int numslots);
30 
31 extern void ParallelSlotsTerminate(ParallelSlot *slots, int numslots);
32 
33 extern bool ParallelSlotsWaitCompletion(ParallelSlot *slots, int numslots);
34 
35 
36 #endif							/* SCRIPTS_PARALLEL_H */
37