PostgreSQL Source Code  git master
sharedfileset.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * sharedfileset.h
4  * Shared temporary file management.
5  *
6  *
7  * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/storage/sharedfileset.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 
15 #ifndef SHAREDFILESET_H
16 #define SHAREDFILESET_H
17 
18 #include "storage/dsm.h"
19 #include "storage/fd.h"
20 #include "storage/spin.h"
21 
22 /*
23  * A set of temporary files that can be shared by multiple backends.
24  */
25 typedef struct SharedFileSet
26 {
27  pid_t creator_pid; /* PID of the creating process */
28  uint32 number; /* per-PID identifier */
29  slock_t mutex; /* mutex protecting the reference count */
30  int refcnt; /* number of attached backends */
31  int ntablespaces; /* number of tablespaces to use */
32  Oid tablespaces[8]; /* OIDs of tablespaces to use. Assumes that
33  * it's rare that there more than temp
34  * tablespaces. */
36 
37 extern void SharedFileSetInit(SharedFileSet *fileset, dsm_segment *seg);
38 extern void SharedFileSetAttach(SharedFileSet *fileset, dsm_segment *seg);
39 extern File SharedFileSetCreate(SharedFileSet *fileset, const char *name);
40 extern File SharedFileSetOpen(SharedFileSet *fileset, const char *name);
41 extern bool SharedFileSetDelete(SharedFileSet *fileset, const char *name,
42  bool error_on_failure);
43 extern void SharedFileSetDeleteAll(SharedFileSet *fileset);
44 
45 #endif
int slock_t
Definition: s_lock.h:934
bool SharedFileSetDelete(SharedFileSet *fileset, const char *name, bool error_on_failure)
unsigned int Oid
Definition: postgres_ext.h:31
struct SharedFileSet SharedFileSet
File SharedFileSetCreate(SharedFileSet *fileset, const char *name)
unsigned int uint32
Definition: c.h:358
void SharedFileSetInit(SharedFileSet *fileset, dsm_segment *seg)
Definition: sharedfileset.c:49
Oid tablespaces[8]
Definition: sharedfileset.h:32
const char * name
Definition: encode.c:521
void SharedFileSetAttach(SharedFileSet *fileset, dsm_segment *seg)
Definition: sharedfileset.c:78
File SharedFileSetOpen(SharedFileSet *fileset, const char *name)
void SharedFileSetDeleteAll(SharedFileSet *fileset)
int File
Definition: fd.h:45