Module spacetimedb_table::page

source ·
Expand description

Provides a Page abstraction that stores rows and an associated header necessary for the page to work. Consult the documentation of this type for a list of operations and a description of how page work.

A page can provide a split mutable view of its fixed section and its variable section. This is provided through Page::split_fixed_var_mut with view operations defined on FixedView and VarView.

Technical terms:

  • valid refers to, when referring to a type, granule, or row, depending on the context, a memory location that holds a safe object. When “valid for writes” is used, the location must be properly aligned and none of its bytes may be uninit, but the value need not be valid at the type in question. “Valid for writes” is equivalent to valid-unconstrained.

  • valid-unconstrained, when referring to a memory location with a given type, that the location stores a byte pattern which Rust/LLVM’s memory model recognizes as valid, and therefore must not contain any uninit, but the value is not required to be logically meaningful, and no code may depend on the data within it to uphold any invariants. E.g. an unallocated VarLenGranule within a page stores valid-unconstrained bytes, because the bytes are either 0 from the initial [alloc_zeroed] of the page, or contain stale data from a previously freed VarLenGranule.

  • unused means that it is safe to overwrite a block of memory without cleaning up its previous value.

    See the post [Two Kinds of Invariants: Safety and Validity][ralf_safe_valid] for a discussion on safety and validity invariants.

Structs§

  • An iterator over the PageOffsets of all present fixed-length rows in a Page.
  • A mutable view of the fixed-len section of a Page.
  • An iterator yielding the offsets to the granules of a var-len object.
  • A page of row data with an associated header and the raw row_data itself.
  • A mutable view of the var-len section of a Page.

Enums§

Functions§

  • Returns a reference to the [T] pointed to at by offset.