Minima: Inside a Stable Block
Chapters
- Follow the vector descriptor
- Read one value
- Read a span for two requests
- One physical stable memory
Transcript
Follow the vector descriptor
Payloads has the vector the last update replaced. Its Nyxus data holds the Minima root and the descriptors for a fixed vector and a slot arena. We'll read the fixed vector. The vector descriptor identifies the block. The canister's stable provider reads the requested bytes from it. Minima allocates whole sixty-four kibibyte blocks. This vector uses one block with sixteen aligned node positions.
Read one value
Each unsigned sixty-four bit integer takes eight encoded bytes. For index seven, the vector can compute the exact position inside this node. The read starts fifty-six bytes into the vector's first block. The storage call copies eight bytes into a buffer the caller lends as workspace. The vector decodes those bytes and hands back one thousand one hundred and thirty-one. The caller can use this same buffer for the next operation.
Read a span for two requests
Suppose the caller asks for indices seven and nine together. Both are in this node, so get many makes one contiguous read. It starts at index seven and ends just after index nine, for twenty-four bytes in all. That span also contains index eight. The visitor receives only the requested values, one thousand one hundred and thirty-one and one thousand one hundred and sixty-five. The workspace holds those bytes for the call. The next vector read asks the provider for its span again.
One physical stable memory
The slot arena has its own block. Hylix sees a contiguous virtual image for Records. Its page map lives in the Minima root in Payloads. Each virtual page points to a different physical block in the same stable memory. The payloads module still declares Nyxus memory. Minima is the stable storage engine its collections use through these retained descriptors. The fixed vector knew exactly where to look. With a map, the collection also has to find the key.