maybe_reshard is created to filter out unnecessary calls to request_reshard.
The intended use is to let just request maybe_reshard, and delegate check
if the action is really necessary to the implementation detail level.
Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
Extent *le = new Extent(logical_offset, blob_offset, length, b);
extent_map.insert(*le);
- if (spans_shard(logical_offset, length)) {
- request_reshard(logical_offset, logical_offset + length);
- }
+ maybe_reshard(logical_offset, logical_offset + length);
return le;
}
needs_reshard_end = end;
}
}
+ // signals that there was a modification on range <begin, end)
+ // if this spans over a shard boundary, then shards no longer
+ // can be encoded separately, and reshard run is needed
+ void maybe_reshard(uint32_t begin, uint32_t end) {
+ if (spans_shard(begin, end - begin)) {
+ request_reshard(begin, end);
+ }
+ }
struct DeleteDisposer {
void operator()(Extent *e) { delete e; }