in below/store/src/cursor.rs [541:556]
fn set_offset(&mut self, offset: StoreOffset) {
if let Some(shard) = offset.get_shard() {
if self.shard == Some(shard) || self.update_shard(shard).unwrap_or(false) {
self.index_offset = offset.get_index_offset();
return;
}
}
// Set the shard even if it does not exist so that advance still finds
// the closest valid shard. Clear index_mmap as it no longer corresponds
// to this invalid or virtual shard. The index_offset does not matter
// much in this case as it will be overwritten once advance is called.
// Keep it so get_offset may get the same value back.
self.shard = offset.get_shard();
self.index_mmap = None;
self.index_offset = offset.get_index_offset();
}