Skip to content

PgNodes

Namespace: Ankus

Assembly: Ankus.Runtime.dll

Creates checked node views over generated PostgreSQL representations and explicit native lifetimes.

public static class PgNodes

Inheritance: object

Borrows a node view while retaining the reference’s original storage bounds and lifetime anchor.

public static PgNodeReference<T> Borrow<T>(PgNativeReference<T> reference) where T : unmanaged, IPgNativeNode

Type parameters:

T

The generated native node representation.

Parameters:

reference — PgNativeReference<T>

The initialized complete native value to view.

Returns: PgNodeReference<T>

A node view without allocation or release rights.

The representation’s complete size, alignment and selected-header ABI are checked. The caller remains responsible for the validity and lifetime of native pointer members. A tag does not prove that those members refer to valid objects.

DangerousAllocate<T>(uint, PgMemoryContext?)

Section titled “DangerousAllocate<T>(uint, PgMemoryContext?)”

Allocates a zeroed native node and writes its caller-supplied tag without invoking a constructor.

public static PgNativeBox<T> DangerousAllocate<T>(uint tag, PgMemoryContext? context = null) where T : unmanaged, IPgNativeNode

Type parameters:

T

The complete generated native representation.

Parameters:

tag — uint

The exact tag appropriate for this complete representation.

context — PgMemoryContext

The allocation owner, or null for the current context.

Returns: PgNativeBox<T>

An individually owned box, which can transfer ownership to its context.

The caller must choose a tag whose complete native representation fits T and initialize all fields required by subsequent native operations. A base node’s accepted cast tags do not make it large enough to allocate its descendants. Pointer fields retain native lifetime obligations. Native allocator restrictions apply to individual disposal and ownership transfer.