ArcticDB
ArcticDB copied to clipboard
More changes for segment ownership, get rid of mutable segment()
A follow up to https://github.com/man-group/ArcticDB/pull/1756 .
This change is not essential and we should only merge it if we think it makes it easier to use the KeySegmentPair
API correctly.
The non-const Segment& KeySegmentPair#segment()
API on KeySegmentPair
is a bit dangerous and error prone, because it isn't obvious that what it lets you modify is actually a resource that might be shared across several KeySegmentPair
objects.
Instead we replace it with segment_ptr()
and release_segment()
APIs that return shared ptrs and unique ptrs, rather than hiding the ownership model from the KeySegmentPair API.