SwayDB icon indicating copy to clipboard operation
SwayDB copied to clipboard

Implement a read-only Slice type

Open simerplaha opened this issue 4 years ago • 0 comments

There are cases where multiple cached byte slices from HashMap[FileId, Slice[Byte]] are read and concatenated to complete a read request which currently requires copying (Related - #327).

This copying can be complete avoided by implementing a read-only SliceRO[T] type which builds lazy iterators on multiple Slice[T] for search & iteration.

With SliceRO[T] we can also ensure that we do not write code which mutates within Comparator & Ordering function.

This read-only SliceRO would be used by all read-apis to avoid any accidentally mutation by clients.

simerplaha avatar Nov 13 '21 12:11 simerplaha