OSDN Git Service

pgindent run. Make it all clean.
[pg-rex/syncrep.git] / src / include / utils / tuplestore.h
1 /*-------------------------------------------------------------------------
2  *
3  * tuplestore.h
4  *        Generalized routines for temporary tuple storage.
5  *
6  * This module handles temporary storage of tuples for purposes such
7  * as Materialize nodes, hashjoin batch files, etc.  It is essentially
8  * a dumbed-down version of tuplesort.c; it does no sorting of tuples
9  * but can only store a sequence of tuples and regurgitate it later.
10  * A temporary file is used to handle the data if it exceeds the
11  * space limit specified by the caller.
12  *
13  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
14  * Portions Copyright (c) 1994, Regents of the University of California
15  *
16  * $Id: tuplestore.h,v 1.3 2001/03/22 04:01:15 momjian Exp $
17  *
18  *-------------------------------------------------------------------------
19  */
20 #ifndef TUPLESTORE_H
21 #define TUPLESTORE_H
22
23 #include "access/htup.h"
24
25 /* Tuplestorestate is an opaque type whose details are not known outside
26  * tuplestore.c.
27  */
28 typedef struct Tuplestorestate Tuplestorestate;
29
30 /*
31  * Currently we only need to store HeapTuples, but it would be easy
32  * to support the same behavior for IndexTuples and/or bare Datums.
33  */
34
35 extern Tuplestorestate *tuplestore_begin_heap(bool randomAccess,
36                                           int maxKBytes);
37
38 extern void tuplestore_puttuple(Tuplestorestate *state, void *tuple);
39
40 extern void tuplestore_donestoring(Tuplestorestate *state);
41
42 extern void *tuplestore_gettuple(Tuplestorestate *state, bool forward,
43                                         bool *should_free);
44
45 #define tuplestore_getheaptuple(state, forward, should_free) \
46         ((HeapTuple) tuplestore_gettuple(state, forward, should_free))
47
48 extern void tuplestore_end(Tuplestorestate *state);
49
50 /*
51  * These routines may only be called if randomAccess was specified 'true'.
52  * Likewise, backwards scan in gettuple/getdatum is only allowed if
53  * randomAccess was specified.
54  */
55
56 extern void tuplestore_rescan(Tuplestorestate *state);
57 extern void tuplestore_markpos(Tuplestorestate *state);
58 extern void tuplestore_restorepos(Tuplestorestate *state);
59
60 #endif   /* TUPLESTORE_H */