hypercore-protocol / hypercore-next

Hypercore 10 is an append only log with multi-writer primitives built in.
MIT License
150 stars 15 forks source link

Add `core.contiguousLength` #99

Closed kasperisager closed 2 years ago

kasperisager commented 2 years ago

This PR adds a core.contiguousLength property, stored in the oplog header, that tracks the number of contiguously available blocks starting from the first block of a core.

mafintosh commented 2 years ago

Excellent! I think there is an edge case when the feed is truncated, can you test that?

We need an additional feature to this. A new flag sparse that defaults to true, that when false makes .length === .contigiousLength and also sets byteLength to the equi. We can look into that in another PR tho.

kasperisager commented 2 years ago

Added an ABI compatibility test to ensure that these and future changes maintain ABI backwards compatibility.