postgres

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HEAP_HASNULL          = 0x0001 /* has null attribute(s) */
	HEAP_HASVARWIDTH      = 0x0002 /* has variable-width attribute(s) */
	HEAP_HASEXTERNAL      = 0x0004 /* has external stored attribute(s) */
	HEAP_HASOID_OLD       = 0x0008 /* has an object-id field */
	HEAP_XMAX_KEYSHR_LOCK = 0x0010 /* xmax is a key-shared locker */
	HEAP_COMBOCID         = 0x0020 /* t_cid is a combo CID */
	HEAP_XMAX_EXCL_LOCK   = 0x0040 /* xmax is exclusive locker */
	HEAP_XMAX_LOCK_ONLY   = 0x0080 /* xmax, if valid, is only a locker */

	HEAP_XMAX_SHR_LOCK = HEAP_XMAX_EXCL_LOCK | HEAP_XMAX_KEYSHR_LOCK

	HEAP_LOCK_MASK = HEAP_XMAX_SHR_LOCK | HEAP_XMAX_EXCL_LOCK | HEAP_XMAX_KEYSHR_LOCK

	HEAP_XMIN_COMMITTED = 0x0100 /* t_xmin committed */
	HEAP_XMIN_INVALID   = 0x0200 /* t_xmin invalid/aborted */
	HEAP_XMIN_FROZEN    = HEAP_XMIN_COMMITTED | HEAP_XMIN_INVALID
	HEAP_XMAX_COMMITTED = 0x0400 /* t_xmax committed */
	HEAP_XMAX_INVALID   = 0x0800 /* t_xmax invalid/aborted */
	HEAP_XMAX_IS_MULTI  = 0x1000 /* t_xmax is a MultiXactId */
	HEAP_UPDATED        = 0x2000 /* this is UPDATEd version of row */
	HEAP_MOVED_OFF      = 0x4000 /* moved to another place by pre-9.0
	 * VACUUM FULL; kept for binary
	 * upgrade support */
	HEAP_MOVED_IN = 0x8000 /* moved from another place by pre-9.0
	 * VACUUM FULL; kept for binary
	 * upgrade support */
	HEAP_MOVED = HEAP_MOVED_OFF | HEAP_MOVED_IN
)
View Source
const (
	HEAP_KEYS_UPDATED = 0x2000 /* tuple was updated and key cols modified, or tuple deleted */
	HEAP_HOT_UPDATED  = 0x4000 /* tuple was HOT-updated */
	HEAP_ONLY_TUPLE   = 0x8000 /* this is heap-only tuple */
)
View Source
const SizeOfHeapTupleHeaderData = 24
type = struct HeapTupleHeaderData {
    0      |    12
union {
                12
    HeapTupleFields t_heap;
                12
    DatumTupleFields t_datum;

 total size (bytes):   12
 } t_choice;             //

/* 12 | 6 ItemPointerData t_ctid;

18      |     2

uint16 t_infomask2;

20      |     2

uint16 t_infomask;

22      |     1

uint8 t_hoff;

23      |     0

bits8 t_bits[];

XXX  1-byte padding

total size (bytes):   24

Variables

This section is empty.

Functions

func Decode

func Decode(heap *Heap, d *decode.D) any

func DecodeHeap

func DecodeHeap(d *decode.D, args format.Pg_Heap_In) any

func DecodeItemIds

func DecodeItemIds(page *HeapPage, d *decode.D)

func DecodePageHeader

func DecodePageHeader(page *HeapPage, d *decode.D)

Types

type Heap

type Heap struct {
	Args format.Pg_Heap_In

	// current Page
	Page *HeapPage
	// Page special data
	Special *PageSpecial

	// current tuple
	Tuple *TupleD

	DecodePageHeaderData func(page *HeapPage, d *decode.D)
	DecodePageSpecial    func(heap *Heap, d *decode.D)
}

type HeapPage

type HeapPage struct {
	// PageHeaderData fields
	PdChecksum        uint16
	PdLower           uint16
	PdUpper           uint16
	PdSpecial         uint16
	PdPageSizeVersion uint16

	// calculated bytes positions
	BytesPosBegin   int64 // bytes pos of page's beginning
	BytesPosEnd     int64 // bytes pos of page's ending
	BytesPosSpecial int64 // bytes pos of page's special

	// calculated bits positions
	PosItemsEnd     int64 // bits pos of items end
	PosFreeSpaceEnd int64 // bits pos free space end

	// parsed items positions
	ItemIds []ItemID
}

type ItemID

type ItemID struct {
	Off   uint32 // unsigned int lp_off: 15
	Flags uint32 // unsigned int lp_flags: 2
	Len   uint32 // unsigned int lp_len: 15
}

type PageSpecial

type PageSpecial struct {
	// pgproee
	PdXidBase   uint64 // 8 TransactionId pd_xid_base;
	PdMultiBase uint64 // 8 TransactionId pd_multi_base;
	PdPruneXid  uint64 // 4 ShortTransactionId pd_prune_xid;
	PdMagic     uint64 // 4 uint32 pd_magic;
}

type TransactionMapper

type TransactionMapper struct {
	Heap    *Heap
	Special *PageSpecial
	Tuple   *TupleD
}

func (TransactionMapper) MapUint

func (m TransactionMapper) MapUint(s scalar.Uint) (scalar.Uint, error)

type TupleD

type TupleD struct {
	IsMulti bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL