itacart.serialization.tree_blob.serialize_to_blob
- itacart.serialization.tree_blob.serialize_to_blob(index, compact=True)[source]
Encode an index, compacting first by default.
Convenience wrapper over
encode_tree(); the name callers coming from a storage or blockchain context tend to reach for.Compaction changes the leaf set, and a blob’s identity is its leaf set, so two calls differing only in
compactproduce different blobs on purpose.- Parameters:
- Return type:
- Returns:
The binary blob.
- Raises:
InvalidIndexError – If the index is malformed, or if it names row 1000, which holds the polar caps: this version of the binary codecs does not serialize them. They exist, so this is the one refusal here of a cell the grid has.
NonExistentCellError – If any cell of the index names no cell. A blob is a record of cells, so writing one for an address with no cell under it would put the fold into storage, where the next reader has no way left to tell.