#ifndef RELSCAN_H
#define RELSCAN_H
#include "access/htup_details.h"
#include "access/itup.h"
#include "port/atomics.h"
#include "storage/buf.h"
#include "storage/spin.h"
#include "utils/relcache.h"
struct ParallelTableScanDescData;
typedef struct TableScanDescData
{
Relation rs_rd;
struct SnapshotData *rs_snapshot;
int rs_nkeys;
struct ScanKeyData *rs_key;
ItemPointerData rs_mintid;
ItemPointerData rs_maxtid;
uint32 rs_flags;
struct ParallelTableScanDescData *rs_parallel;
} TableScanDescData;
typedef struct TableScanDescData *TableScanDesc;
typedef struct ParallelTableScanDescData
{
Oid phs_relid;
bool phs_syncscan;
bool phs_snapshot_any;
Size phs_snapshot_off;
} ParallelTableScanDescData;
typedef struct ParallelTableScanDescData *ParallelTableScanDesc;
typedef struct ParallelBlockTableScanDescData
{
ParallelTableScanDescData base;
BlockNumber phs_nblocks;
slock_t phs_mutex;
BlockNumber phs_startblock;
pg_atomic_uint64 phs_nallocated;
} ParallelBlockTableScanDescData;
typedef struct ParallelBlockTableScanDescData *ParallelBlockTableScanDesc;
typedef struct ParallelBlockTableScanWorkerData
{
uint64 phsw_nallocated;
uint32 phsw_chunk_remaining;
uint32 phsw_chunk_size;
} ParallelBlockTableScanWorkerData;
typedef struct ParallelBlockTableScanWorkerData *ParallelBlockTableScanWorker;
typedef struct IndexFetchTableData
{
Relation rel;
} IndexFetchTableData;
typedef struct IndexScanDescData
{
Relation heapRelation;
Relation indexRelation;
struct SnapshotData *xs_snapshot;
int numberOfKeys;
int numberOfOrderBys;
struct ScanKeyData *keyData;
struct ScanKeyData *orderByData;
bool xs_want_itup;
bool xs_temp_snap;
bool kill_prior_tuple;
bool ignore_killed_tuples;
bool xactStartedInRecovery;
void *opaque;
IndexTuple xs_itup;
struct TupleDescData *xs_itupdesc;
HeapTuple xs_hitup;
struct TupleDescData *xs_hitupdesc;
ItemPointerData xs_heaptid;
bool xs_heap_continue;
IndexFetchTableData *xs_heapfetch;
bool xs_recheck;
Datum *xs_orderbyvals;
bool *xs_orderbynulls;
bool xs_recheckorderby;
struct ParallelIndexScanDescData *parallel_scan;
} IndexScanDescData;
typedef struct ParallelIndexScanDescData
{
Oid ps_relid;
Oid ps_indexid;
Size ps_offset;
char ps_snapshot_data[FLEXIBLE_ARRAY_MEMBER];
} ParallelIndexScanDescData;
struct TupleTableSlot;
typedef struct SysScanDescData
{
Relation heap_rel;
Relation irel;
struct TableScanDescData *scan;
struct IndexScanDescData *iscan;
struct SnapshotData *snapshot;
struct TupleTableSlot *slot;
} SysScanDescData;
#endif