StorageObject
Reference for the StorageObject module: a content-addressed, immutable node store. It saves a whole object as a set of hash-addressed, deduplicated, structurally shared blocks, plus a header row that records a saved object's id, module, type and root hash. The store guarantees the integrity of the hash tree; schema and type checking live in the layer above.
This page is a pure reference. For how the framework fits together, see the Guide.
StorageObjectBlockDatabase- the content-addressed node store: load and save a tree of blocks.StorageObjectChunk- content-defined chunking for long strings and sequences.StorageObjectDatabase- the object header store: create and read saved-object rows.StorageObjectIngest- the safety gate that verifies untrusted uploaded blocks.StorageObjectNode- storage-representation operations for a single node.StorageObjectNodeType- the node kind constants, one tiny integer per row.StorageObjectRead- the decode half of the block codec: read typed values by hash.StorageObjectWire- convert between the on-the-wire block form and block data.StorageObjectWrite- the encode half of the block codec: build blocks for a typed value.StorageObjectArrayData- an array node: an ordered list of element hashes.StorageObjectBlockData- one block: a content hash and the node it holds.StorageObjectData- a persisted object header row.StorageObjectFieldData- one struct field: a name and a value hash.StorageObjectFloatsData- a packed-floats leaf: 2, 3 or 4 inline floats.StorageObjectInnerData- an inner spine node: an ordered list of child hashes.StorageObjectNodeUnion- a stored node: exactly one node variant.StorageObjectStructData- a struct node: an ordered list of named fields.StorageObjectTreeData- a whole object as a root hash plus its blocks.StorageObjectValueUnion- a basic scalar value: exactly one variant.StorageObjectCorruptException- thrown when the hash tree fails an integrity check.
StorageObjectBlockDatabase
The content-addressed node store (the storage_object_block table). Integrity only: it knows nothing about schemas or application types; it stores and returns a tree of hash-addressed nodes and guarantees the tree's hash integrity. The object header that names a root is the separate StorageObjectDatabase.
GetRaw
StorageObjectBlockDatabase::GetRaw(string $hash): object
The raw stored row (id, hash, type, data) for a hash, for admin or debug.
| Name | Type | Description |
|---|---|---|
$hash | string | The content hash of the block. |
Returns object The raw stored row.
Load
StorageObjectBlockDatabase::Load(string $rootHash): array
The whole object rooted at the given hash, as blocks, by following the hashes from the root through the store. Throws when a referenced block is missing (store corruption).
| Name | Type | Description |
|---|---|---|
$rootHash | string | The root block hash to load from. |
Returns array A list of StorageObjectBlockData.
Save
StorageObjectBlockDatabase::Save(array $blocks, string $rootHash): void
Save a whole object; the blocks must contain every block reachable from the root hash. Walks the tree in memory to find the blocks actually needed and checks that every reference is present and every block's hash matches its content, then bulk inserts them. Throws StorageObjectCorruptException on any missing block or bad hash.
| Name | Type | Description |
|---|---|---|
$blocks | array | The object's blocks, as StorageObjectBlockData. |
$rootHash | string | The root block hash of the object. |
Returns void
StorageObjectChunk
Content-defined chunking for long strings and long sequences. A value too big for one node is split into leaves so that a small edit re-mints only the leaf it lands in, and identical runs dedup by hash. It decides only where the cuts fall; StorageObjectWrite turns the cuts into the actual node tree.
ChunkText
StorageObjectChunk::ChunkText(string $text): array
The byte ranges of the text as an ordered list of chunk strings; concatenating them reproduces the text exactly. A string that produces no cut comes back as a single chunk. Cuts are snapped forward to the next UTF-8 code-point boundary so every chunk is valid text.
| Name | Type | Description |
|---|---|---|
$text | string | The string to chunk. |
Returns array The ordered chunk strings.
GroupHashes
StorageObjectChunk::GroupHashes(array $hashes): array
Group an ordered list of child hashes into runs by the same content-defined rule. A short list comes back as a single group; a longer one splits into runs that become the next spine level. Always returns at least one group.
| Name | Type | Description |
|---|---|---|
$hashes | array | The ordered child hashes to group. |
Returns array A list of hash groups.
StorageObjectDatabase
The object header store (the storage_object table). A header is one saved object instance: its owning module and type name, the root hash of its content, and when it was added. Objects are an append log, so Create always inserts a new row and many rows may share a root hash (identical content dedupes at the block level, not here).
Create
StorageObjectDatabase::Create(string $module, string $typeName, string $rootHash): int
Insert a new object header pointing at the root hash and return its new id. The blocks under the root hash must already be saved. The module and type name are short identifiers for navigation and future per-type configuration.
| Name | Type | Description |
|---|---|---|
$module | string | The owning module identifier. |
$typeName | string | The type name identifier. |
$rootHash | string | The root block hash of the saved content. |
Returns int The new object id.
Get
StorageObjectDatabase::Get(int $id): StorageObjectData
The object header for an id; throws if none exists.
| Name | Type | Description |
|---|---|---|
$id | int | The object id to read. |
Returns StorageObjectData The object header.
GetByIdOptional
StorageObjectDatabase::GetByIdOptional(int $id): ?StorageObjectData
The object header for an id, or null if none exists.
| Name | Type | Description |
|---|---|---|
$id | int | The object id to read. |
Returns ?StorageObjectData The object header, or null.
StorageObjectIngest
The safety gate for untrusted uploaded blocks (the editor save path). It runs before the decode walk so a malformed or hostile upload is rejected up front. It does the set-level checks that need no root and no walk: resource caps on total node count, per-node data size and per-node fanout, and a rehash where every block's claimed hash must equal the hash of its content.
Constants
| Constant | Value | Description |
|---|---|---|
StorageObjectIngest::MAX_NODES | 50000 | The maximum number of nodes in an uploaded set. |
StorageObjectIngest::MAX_NODE_BYTES | 2048 | The maximum serialised data size of one node. |
StorageObjectIngest::MAX_FANOUT | 32 | The maximum number of references from one node. |
Verify
StorageObjectIngest::Verify(array $blocks): array
Verify an untrusted uploaded block set, returning it unchanged if it passes. Throws StorageObjectCorruptException on the first violation.
| Name | Type | Description |
|---|---|---|
$blocks | array | The uploaded blocks, as StorageObjectBlockData. |
Returns array The blocks, unchanged.
StorageObjectNode
The storage-representation operations for a node: how a node is written to a row, read back, addressed, and how its references are enumerated. It knows nothing about application types; it works only with the generic node kinds. The hash is the 28-char base64 of a 160-bit truncated SHA-256 over a canonical preimage.
Deserialize
StorageObjectNode::Deserialize(int $type, string $data): StorageObjectNodeUnion
Rebuild a node from its stored type and data. Throws StorageObjectCorruptException on an unknown node type.
| Name | Type | Description |
|---|---|---|
$type | int | The stored node kind (a StorageObjectNodeType constant). |
$data | string | The stored data column. |
Returns StorageObjectNodeUnion The rebuilt node.
Hash
StorageObjectNode::Hash(StorageObjectNodeUnion $node): string
The 28-char content hash of a node, the base64 of a 160-bit truncated SHA-256 over the node's canonical preimage.
| Name | Type | Description |
|---|---|---|
$node | StorageObjectNodeUnion | The node to hash. |
Returns string The content hash.
Refs
StorageObjectNode::Refs(StorageObjectNodeUnion $node): array
The child hashes a node references: struct field hashes, array item hashes, or inner child hashes. Value and packed-floats leaves reference nothing.
| Name | Type | Description |
|---|---|---|
$node | StorageObjectNodeUnion | The node to read references from. |
Returns array The referenced child hashes.
Serialize
StorageObjectNode::Serialize(StorageObjectNodeUnion $node): array
A node as a type and data pair for storage.
| Name | Type | Description |
|---|---|---|
$node | StorageObjectNodeUnion | The node to serialise. |
Returns array A two-element array of node type and data.
StorageObjectNodeType
The stored node kind, one tiny integer per row. A node is a struct, an array (a sequence root), an inner spine node, a packed-floats leaf, or a basic value (integer, float, boolean, string). The value subtypes are distinct kinds so a row is fully self-describing and the hash preimage is unambiguous.
Constants
| Constant | Value | Description |
|---|---|---|
StorageObjectNodeType::STRUCT | 1 | A struct node (named fields to hashes). |
StorageObjectNodeType::ARRAY | 2 | An array node (a sequence root). |
StorageObjectNodeType::INTEGER | 3 | An integer value. |
StorageObjectNodeType::FLOAT | 4 | A float value. |
StorageObjectNodeType::BOOLEAN | 5 | A boolean value. |
StorageObjectNodeType::STRING | 6 | A string value. |
StorageObjectNodeType::INNER | 7 | An inner spine node. |
StorageObjectNodeType::FLOAT2 | 8 | A packed-floats leaf of 2 floats. |
StorageObjectNodeType::FLOAT3 | 9 | A packed-floats leaf of 3 floats. |
StorageObjectNodeType::FLOAT4 | 10 | A packed-floats leaf of 4 floats. |
StorageObjectRead
The decode half of the block codec: read typed values out of a materialised block set (hash to node) by hash. Build the map once with Index. Every getter asserts the node's kind and throws StorageObjectCorruptException on a missing block or a kind mismatch. Sequences are content-defined chunked; Text and Items flatten the spine transparently.
Bool
StorageObjectRead::Bool(array $map, string $hash): bool
The boolean value at the hash.
| Name | Type | Description |
|---|---|---|
$map | array | The block set indexed as hash to node. |
$hash | string | The hash of the value node. |
Returns bool The boolean value.
ColourOpaque
StorageObjectRead::ColourOpaque(array $map, string $hash): ColourOpaqueData
A ColourOpaqueData from a FLOAT3 leaf (red, green, blue).
| Name | Type | Description |
|---|---|---|
$map | array | The block set indexed as hash to node. |
$hash | string | The hash of the FLOAT3 leaf. |
Returns ColourOpaqueData The opaque colour.
ColourTransparent
StorageObjectRead::ColourTransparent(array $map, string $hash): ColourTransparentData
A ColourTransparentData from a FLOAT4 leaf (red, green, blue, alpha).
| Name | Type | Description |
|---|---|---|
$map | array | The block set indexed as hash to node. |
$hash | string | The hash of the FLOAT4 leaf. |
Returns ColourTransparentData The transparent colour.
Field
StorageObjectRead::Field(array $fields, string $name): string
A required field hash from a struct field map (as returned by Struct), or a corrupt exception if absent.
| Name | Type | Description |
|---|---|---|
$fields | array | The struct field map of name to hash. |
$name | string | The field name to read. |
Returns string The field's value hash.
Float
StorageObjectRead::Float(array $map, string $hash): float
The float value at the hash.
| Name | Type | Description |
|---|---|---|
$map | array | The block set indexed as hash to node. |
$hash | string | The hash of the value node. |
Returns float The float value.
Index
StorageObjectRead::Index(array $blocks): array
Index a block list by hash for random access.
| Name | Type | Description |
|---|---|---|
$blocks | array | The blocks, as StorageObjectBlockData. |
Returns array The map of hash to node.
Int
StorageObjectRead::Int(array $map, string $hash): int
The integer value at the hash.
| Name | Type | Description |
|---|---|---|
$map | array | The block set indexed as hash to node. |
$hash | string | The hash of the value node. |
Returns int The integer value.
Items
StorageObjectRead::Items(array $map, string $hash): array
The element hashes of a sequence, in order, flattening the spine. The node at the hash must be an ARRAY root; its INNER spine is descended and the leaf element hashes returned. A nested array element is returned as its own hash for the caller to decode.
| Name | Type | Description |
|---|---|---|
$map | array | The block set indexed as hash to node. |
$hash | string | The hash of the ARRAY root. |
Returns array The ordered element hashes.
Quaternion
StorageObjectRead::Quaternion(array $map, string $hash): MathsQuaternionData
A MathsQuaternionData from a FLOAT4 leaf (x, y, z, w).
| Name | Type | Description |
|---|---|---|
$map | array | The block set indexed as hash to node. |
$hash | string | The hash of the FLOAT4 leaf. |
Returns MathsQuaternionData The quaternion.
Struct
StorageObjectRead::Struct(array $map, string $hash): array
The fields of a struct node as name to child hash.
| Name | Type | Description |
|---|---|---|
$map | array | The block set indexed as hash to node. |
$hash | string | The hash of the struct node. |
Returns array The map of field name to child hash.
Text
StorageObjectRead::Text(array $map, string $hash): string
The string at the hash, reassembling a chunked string. A single bare string value is returned directly; an ARRAY root is flattened and its string-chunk leaves are concatenated byte-exact.
| Name | Type | Description |
|---|---|---|
$map | array | The block set indexed as hash to node. |
$hash | string | The hash of the string value or ARRAY root. |
Returns string The reassembled string.
Vector2
StorageObjectRead::Vector2(array $map, string $hash): MathsVector2Data
A MathsVector2Data from a FLOAT2 leaf.
| Name | Type | Description |
|---|---|---|
$map | array | The block set indexed as hash to node. |
$hash | string | The hash of the FLOAT2 leaf. |
Returns MathsVector2Data The vector.
Vector3
StorageObjectRead::Vector3(array $map, string $hash): MathsVector3Data
A MathsVector3Data from a FLOAT3 leaf.
| Name | Type | Description |
|---|---|---|
$map | array | The block set indexed as hash to node. |
$hash | string | The hash of the FLOAT3 leaf. |
Returns MathsVector3Data The vector.
Vector4
StorageObjectRead::Vector4(array $map, string $hash): MathsVector4Data
A MathsVector4Data from a FLOAT4 leaf.
| Name | Type | Description |
|---|---|---|
$map | array | The block set indexed as hash to node. |
$hash | string | The hash of the FLOAT4 leaf. |
Returns MathsVector4Data The vector.
StorageObjectWire
Convert between the on-the-wire block form and the in-memory StorageObjectBlockData. A wire block is a plain object of hash, type and data, the same three columns the store persists, so JSON on the wire and rows at rest share one representation. An uploaded hash is carried but not trusted; the store rehashes every block on Save.
BlocksToWire
StorageObjectWire::BlocksToWire(array $blocks): array
Serialise blocks to the wire form of hash, type and data for download.
| Name | Type | Description |
|---|---|---|
$blocks | array | The blocks, as StorageObjectBlockData. |
Returns array A list of wire objects.
ParseBlocks
StorageObjectWire::ParseBlocks(array $rawBlocks): array
Rebuild uploaded wire blocks into StorageObjectBlockData. Each raw item has hash, type and data; the node is reconstructed from type and data, and the hash is preserved as given (the Save walk verifies it).
| Name | Type | Description |
|---|---|---|
$rawBlocks | array | The uploaded wire objects. |
Returns array A list of StorageObjectBlockData.
StorageObjectWrite
The encode half of the block codec: build a StorageObjectTreeData (a root hash plus the blocks reachable from it) for a typed value. Every hash is minted here from the node's canonical form, so the server is always the authority on hashes. Long strings and sequences are content-defined chunked; vectors, quaternions and colours are packed into a single FLOAT2/3/4 leaf.
ArrayNode
StorageObjectWrite::ArrayNode(array $children): StorageObjectTreeData
A sequence from ordered children (each a child StorageObjectTreeData). Content-defined chunked into an ARRAY root over an INNER spine when large; a short list stays one flat ARRAY node.
| Name | Type | Description |
|---|---|---|
$children | array | The ordered child trees, as StorageObjectTreeData. |
Returns StorageObjectTreeData The sequence tree.
Bool
StorageObjectWrite::Bool(bool $flag): StorageObjectTreeData
A boolean value node.
| Name | Type | Description |
|---|---|---|
$flag | bool | The boolean value. |
Returns StorageObjectTreeData The value tree.
ColourOpaque
StorageObjectWrite::ColourOpaque(ColourOpaqueData $colour): StorageObjectTreeData
An opaque colour as a FLOAT3 leaf (red, green, blue).
| Name | Type | Description |
|---|---|---|
$colour | ColourOpaqueData | The opaque colour. |
Returns StorageObjectTreeData The leaf tree.
ColourTransparent
StorageObjectWrite::ColourTransparent(ColourTransparentData $colour): StorageObjectTreeData
A transparent colour as a FLOAT4 leaf (red, green, blue, alpha).
| Name | Type | Description |
|---|---|---|
$colour | ColourTransparentData | The transparent colour. |
Returns StorageObjectTreeData The leaf tree.
Float
StorageObjectWrite::Float(float $number): StorageObjectTreeData
A float value node.
| Name | Type | Description |
|---|---|---|
$number | float | The float value. |
Returns StorageObjectTreeData The value tree.
Int
StorageObjectWrite::Int(int $number): StorageObjectTreeData
An integer value node.
| Name | Type | Description |
|---|---|---|
$number | int | The integer value. |
Returns StorageObjectTreeData The value tree.
Quaternion
StorageObjectWrite::Quaternion(MathsQuaternionData $quaternion): StorageObjectTreeData
A quaternion as a FLOAT4 leaf (x, y, z, w).
| Name | Type | Description |
|---|---|---|
$quaternion | MathsQuaternionData | The quaternion. |
Returns StorageObjectTreeData The leaf tree.
Struct
StorageObjectWrite::Struct(array $childrenByName): StorageObjectTreeData
A struct node from named children (name to child StorageObjectTreeData). A null child is skipped entirely, which is how an unset optional field is encoded. The hash is order-independent (the canonical form sorts keys).
| Name | Type | Description |
|---|---|---|
$childrenByName | array | The map of field name to child tree or null. |
Returns StorageObjectTreeData The struct tree.
Text
StorageObjectWrite::Text(string $text): StorageObjectTreeData
A string value. Content-defined chunked: a string that fits in one chunk becomes a single bare string value node; a long string becomes an ARRAY root over an INNER spine of string-chunk leaves.
| Name | Type | Description |
|---|---|---|
$text | string | The string to encode. |
Returns StorageObjectTreeData The string tree.
Vector2
StorageObjectWrite::Vector2(MathsVector2Data $vector): StorageObjectTreeData
A vec2 as a FLOAT2 leaf (two packed floats).
| Name | Type | Description |
|---|---|---|
$vector | MathsVector2Data | The vector. |
Returns StorageObjectTreeData The leaf tree.
Vector3
StorageObjectWrite::Vector3(MathsVector3Data $vector): StorageObjectTreeData
A vec3 as a FLOAT3 leaf (three packed floats).
| Name | Type | Description |
|---|---|---|
$vector | MathsVector3Data | The vector. |
Returns StorageObjectTreeData The leaf tree.
Vector4
StorageObjectWrite::Vector4(MathsVector4Data $vector): StorageObjectTreeData
A vec4 as a FLOAT4 leaf (four packed floats).
| Name | Type | Description |
|---|---|---|
$vector | MathsVector4Data | The vector. |
Returns StorageObjectTreeData The leaf tree.
StorageObjectArrayData
An array node: an ordered list of the content hashes of its element nodes. Also used to spine a long string or a large array into a tree. Fields and constructor only.
Properties
| Property | Type | Description |
|---|---|---|
$array->hashes | string[] | The ordered element hashes (readonly). |
__construct
new StorageObjectArrayData(array $hashes = [])
Create an array node from an ordered list of content hashes.
| Name | Type | Description |
|---|---|---|
$hashes | string[] | The ordered element hashes. |
Returns StorageObjectArrayData
StorageObjectBlockData
One block of a stored object: its content hash and the node it holds. An object is transferred as a set of these blocks plus a root hash. Fields and constructor only.
Properties
| Property | Type | Description |
|---|---|---|
$block->hash | string | The content hash of the node (readonly). |
$block->node | StorageObjectNodeUnion | The node the block holds (readonly). |
__construct
new StorageObjectBlockData(string $hash, StorageObjectNodeUnion $node)
Create a block from a content hash and the node it holds.
| Name | Type | Description |
|---|---|---|
$hash | string | The content hash of the node. |
$node | StorageObjectNodeUnion | The node the block holds. |
Returns StorageObjectBlockData
StorageObjectData
A persisted storage object: one row of the storage_object table. It is the header record for a saved object. The content itself lives as deduplicated blocks, reached from the root hash. Fields and constructor only.
Properties
| Property | Type | Description |
|---|---|---|
$object->id | int | The numeric object id (readonly). |
$object->module | string | The owning module name (readonly). |
$object->typeName | string | The type name (readonly). |
$object->rootHash | string | The root block hash of the content (readonly). |
$object->addedTimestamp | int | The Unix timestamp when the row was added (readonly). |
$object->addedDate | string | The added datetime as a string (readonly). |
__construct
new StorageObjectData(int $id, string $module, string $typeName, string $rootHash, int $addedTimestamp, string $addedDate)
Create a persisted object header from its stored fields.
| Name | Type | Description |
|---|---|---|
$id | int | The numeric object id. |
$module | string | The owning module name. |
$typeName | string | The type name. |
$rootHash | string | The root block hash of the content. |
$addedTimestamp | int | The Unix timestamp when the row was added. |
$addedDate | string | The added datetime as a string. |
Returns StorageObjectData
StorageObjectFieldData
One field of a struct node: a field name and the content hash of the field's value node. A struct node is an ordered list of these. Fields and constructor only.
Properties
| Property | Type | Description |
|---|---|---|
$field->name | string | The field name (readonly). |
$field->hash | string | The content hash of the field's value node (readonly). |
__construct
new StorageObjectFieldData(string $name, string $hash)
Create a struct field from a name and a value hash.
| Name | Type | Description |
|---|---|---|
$name | string | The field name. |
$hash | string | The content hash of the field's value node. |
Returns StorageObjectFieldData
StorageObjectFloatsData
A packed-floats leaf: 2, 3 or 4 floats stored inline in one ref-free node. This is the store form of a fixed small float composite (a vector, a quaternion, or a colour). Fields and constructor only.
Properties
| Property | Type | Description |
|---|---|---|
$floats->components | float[] | The 2, 3 or 4 floats (readonly). |
__construct
new StorageObjectFloatsData(array $components = [])
Create a packed-floats leaf from 2, 3 or 4 floats.
| Name | Type | Description |
|---|---|---|
$components | float[] | The 2, 3 or 4 floats. |
Returns StorageObjectFloatsData
StorageObjectInnerData
An inner (spine) node: an ordered list of the content hashes of its children, where each child is either another inner node or a leaf element of the sequence. Inner nodes exist only inside a sequence's chunk tree. Fields and constructor only.
Properties
| Property | Type | Description |
|---|---|---|
$inner->hashes | string[] | The ordered child hashes (readonly). |
__construct
new StorageObjectInnerData(array $hashes = [])
Create an inner spine node from an ordered list of child hashes.
| Name | Type | Description |
|---|---|---|
$hashes | string[] | The ordered child hashes. |
Returns StorageObjectInnerData
StorageObjectNodeUnion
A stored node: exactly one of a struct, an array (a sequence root), an inner spine node, a packed-floats leaf, or a basic value. Construct with the static factories; read the variant by testing the fields directly (exactly one is non-null).
Properties
| Property | Type | Description |
|---|---|---|
$node->struct | ?StorageObjectStructData | The struct variant, or null (readonly). |
$node->array | ?StorageObjectArrayData | The array variant, or null (readonly). |
$node->inner | ?StorageObjectInnerData | The inner spine variant, or null (readonly). |
$node->floats | ?StorageObjectFloatsData | The packed-floats variant, or null (readonly). |
$node->value | ?StorageObjectValueUnion | The basic value variant, or null (readonly). |
ArrayNode
StorageObjectNodeUnion::ArrayNode(StorageObjectArrayData $array): self
A node union holding an array node.
| Name | Type | Description |
|---|---|---|
$array | StorageObjectArrayData | The array node. |
Returns StorageObjectNodeUnion The node union.
Floats
StorageObjectNodeUnion::Floats(StorageObjectFloatsData $floats): self
A node union holding a packed-floats leaf.
| Name | Type | Description |
|---|---|---|
$floats | StorageObjectFloatsData | The packed-floats leaf. |
Returns StorageObjectNodeUnion The node union.
Inner
StorageObjectNodeUnion::Inner(StorageObjectInnerData $inner): self
A node union holding an inner spine node.
| Name | Type | Description |
|---|---|---|
$inner | StorageObjectInnerData | The inner spine node. |
Returns StorageObjectNodeUnion The node union.
Struct
StorageObjectNodeUnion::Struct(StorageObjectStructData $struct): self
A node union holding a struct node.
| Name | Type | Description |
|---|---|---|
$struct | StorageObjectStructData | The struct node. |
Returns StorageObjectNodeUnion The node union.
Value
StorageObjectNodeUnion::Value(StorageObjectValueUnion $value): self
A node union holding a basic value.
| Name | Type | Description |
|---|---|---|
$value | StorageObjectValueUnion | The basic value. |
Returns StorageObjectNodeUnion The node union.
StorageObjectStructData
A struct node: an ordered list of named fields, each a name and the hash of the field's value node. This is the object spine; every field points at another node by hash. Fields and constructor only.
Properties
| Property | Type | Description |
|---|---|---|
$struct->fields | StorageObjectFieldData[] | The ordered named fields (readonly). |
__construct
new StorageObjectStructData(array $fields = [])
Create a struct node from an ordered list of named fields.
| Name | Type | Description |
|---|---|---|
$fields | StorageObjectFieldData[] | The ordered named fields. |
Returns StorageObjectStructData
StorageObjectTreeData
A whole object encoded as content-addressed blocks: the root node's hash plus the blocks reachable from it. This is the ToBlocks codec output and the shape the backend sends to reconstruct an object. Fields and constructor only.
Properties
| Property | Type | Description |
|---|---|---|
$tree->rootHash | string | The root node's content hash (readonly). |
$tree->blocks | StorageObjectBlockData[] | The blocks reachable from the root (readonly). |
__construct
new StorageObjectTreeData(string $rootHash, array $blocks = [])
Create a tree from a root hash and its reachable blocks.
| Name | Type | Description |
|---|---|---|
$rootHash | string | The root node's content hash. |
$blocks | StorageObjectBlockData[] | The blocks reachable from the root. |
Returns StorageObjectTreeData
StorageObjectValueUnion
A basic scalar value held by a value node: exactly one of integer, float, boolean, or string. Construct with the static factories; read the variant by testing the fields directly (exactly one is non-null).
Properties
| Property | Type | Description |
|---|---|---|
$value->integer | ?int | The integer variant, or null (readonly). |
$value->float | ?float | The float variant, or null (readonly). |
$value->boolean | ?bool | The boolean variant, or null (readonly). |
$value->string | ?string | The string variant, or null (readonly). |
Boolean
StorageObjectValueUnion::Boolean(bool $value): self
A value union holding a boolean.
| Name | Type | Description |
|---|---|---|
$value | bool | The boolean value. |
Returns StorageObjectValueUnion The value union.
Float
StorageObjectValueUnion::Float(float $value): self
A value union holding a float.
| Name | Type | Description |
|---|---|---|
$value | float | The float value. |
Returns StorageObjectValueUnion The value union.
Integer
StorageObjectValueUnion::Integer(int $value): self
A value union holding an integer.
| Name | Type | Description |
|---|---|---|
$value | int | The integer value. |
Returns StorageObjectValueUnion The value union.
StringValue
StorageObjectValueUnion::StringValue(string $value): self
A value union holding a string.
| Name | Type | Description |
|---|---|---|
$value | string | The string value. |
Returns StorageObjectValueUnion The value union.
StorageObjectCorruptException
Thrown when the tree of hashes fails an integrity check: a referenced block is missing (an incomplete object), a block's stored hash does not match the canonical hash of its content, or a node cannot be decoded. This is corruption of the hash tree, not a type error; schema and type validation happen in the layer above. Extends Exception and adds no members.