charslaw / Pando

Pando serializes and tracks the history of a state tree
MIT License
2 stars 0 forks source link

Consider using a `Range` struct instead of a `DataSlice` in the data source node index #67

Open schultzcole opened 2 years ago

schultzcole commented 2 years ago

DataSlice is a custom struct created for pando. It's mostly not used externally, but can be exposed to consumers in some cases (especially if they're making their own DataSource implementation). It might be more ergonomic for other developers to use a built in type like Range as opposed to the custom DataSlice.

Some consideration will have to be taken as to how the range will be stored on disk via the StreamDataSource. A Range is 8 bytes (4 for both the start and end index). It may be more compact to store it on disk as a start index (4 bytes, or maybe even 3 if we can get away with it) and length (could be as small as 1 or 2 bytes depending on what limitations we want to impose).