Because BPv7 structures are encoded so much differently than BPv6 structures, some of the assumptions made in bplib for v6 are no longer valid/applicable. In particular maintaining offsets into the encoded payload for future updates are no longer feasible, because everything moves with every change. Instead data needs to be organized at the block level, and final encoding needs to be deferred until all fields are known and not going to change anymore.
Ideally the implementation would support the following:
Pull blocks from a pool of a predetermined size (this can be based on user configuration) rather than dynamically allocating from the system heap (this will prevent bplib memory footprint from growing boundlessly; one can always create a large pool if need be).
Blocks should be suitably organized to facilitate fast/easy manipulation, chaining together, and replacement.
Must integrate well with a CBOR encoder/decoder (e.g. tinycbor)
Should support preemptive allocation, so data can be stored directly in the place it will remain, rather than copying it to the place it will remain.
Should keep blocks separate, so if one encoded block is invalidated by a field change, the other blocks do not need to be touched, and that block can be re-encoded without affecting the other encoded blocks.
Because BPv7 structures are encoded so much differently than BPv6 structures, some of the assumptions made in bplib for v6 are no longer valid/applicable. In particular maintaining offsets into the encoded payload for future updates are no longer feasible, because everything moves with every change. Instead data needs to be organized at the block level, and final encoding needs to be deferred until all fields are known and not going to change anymore.
Ideally the implementation would support the following: