Struct PageAccessor
Lightweight, zero-overhead typed accessor for an 8KB page in the memory-mapped cache. Provides type-safe access to the three page regions: Header (64B), Metadata (128B), RawData (8000B).
public ref struct PageAccessor
- Inherited Members
Remarks
This is a ref struct wrapping a single byte*. The JIT elides the wrapper entirely when methods are inlined,
producing identical machine code to hand-written pointer arithmetic.
For heavy-duty internal use (e.g., Typhon.Engine.Internals.LogicalSegment`1.InitHeader(System.Byte*,Typhon.Engine.Internals.PageClearMode,Typhon.Engine.PageBlockFlags,Typhon.Engine.PageBlockType,System.Int16), Typhon.Engine.Internals.ChunkAccessor<TStore>),
use Address to get the raw pointer.
Properties
Address
Raw pointer to the page start. For InitHeader, ChunkAccessor, and similar internal use.
public byte* Address { get; }
Property Value
- byte*
Flags
Page block flags (first byte). No struct load — single byte read.
public PageBlockFlags Flags { get; }
Property Value
Header
Access the PageBaseHeader at offset 0.
public ref PageBaseHeader Header { get; }
Property Value
IsRoot
True if this page is the root page of its logical segment.
public bool IsRoot { get; }
Property Value
Methods
As<T>()
Access the full page start as an arbitrary unmanaged struct.
public ref T As<T>() where T : unmanaged
Returns
- T
Type Parameters
T
MetadataReadOnly<T>()
The 128-byte metadata region as ReadOnlySpan<T>.
public ReadOnlySpan<T> MetadataReadOnly<T>() where T : unmanaged
Returns
- ReadOnlySpan<T>
Type Parameters
T
MetadataReadOnly<T>(int, int)
A sub-region of metadata as ReadOnlySpan<T>.
public ReadOnlySpan<T> MetadataReadOnly<T>(int byteOffset, int count) where T : unmanaged
Parameters
Returns
- ReadOnlySpan<T>
Type Parameters
T
Metadata<T>()
The 128-byte metadata region (chunk occupancy bitmaps) as Span<T>.
public Span<T> Metadata<T>() where T : unmanaged
Returns
- Span<T>
Type Parameters
T
Metadata<T>(int, int)
A sub-region of metadata starting at byteOffset for count elements of T.
public Span<T> Metadata<T>(int byteOffset, int count) where T : unmanaged
Parameters
Returns
- Span<T>
Type Parameters
T
RawDataReadOnly<T>()
The full 8000-byte raw data region as ReadOnlySpan<T>.
public ReadOnlySpan<T> RawDataReadOnly<T>() where T : unmanaged
Returns
- ReadOnlySpan<T>
Type Parameters
T
RawDataReadOnly<T>(int, int)
A sub-region of raw data as ReadOnlySpan<T>.
public ReadOnlySpan<T> RawDataReadOnly<T>(int byteOffset, int count) where T : unmanaged
Parameters
Returns
- ReadOnlySpan<T>
Type Parameters
T
RawData<T>()
The full 8000-byte raw data region as Span<T>.
public Span<T> RawData<T>() where T : unmanaged
Returns
- Span<T>
Type Parameters
T
RawData<T>(int, int)
A sub-region of raw data starting at byteOffset for count elements of T.
public Span<T> RawData<T>(int byteOffset, int count) where T : unmanaged
Parameters
Returns
- Span<T>
Type Parameters
T
StructAt<T>(int)
Access an unmanaged struct at a specific byte offset within the page.
public ref T StructAt<T>(int byteOffset) where T : unmanaged
Parameters
byteOffsetint
Returns
- T
Type Parameters
T