SwayDB
SwayDB copied to clipboard
Implement a read-only Slice type
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.