refactor: store-owned diff snapshot and drop dead ChunkJob.ExistingChunk

TryGetDiff now returns an independent copy so callers can safely retain the
reference; removes the defensive copy from ChunkStreamer.DispatchLoad.
ChunkJob.ExistingChunk was never populated (DispatchRemesh uses closures
instead), so the field is removed along with its misleading record-level
comment.
This commit is contained in:
2026-06-01 13:31:05 +02:00
parent 6b148362c0
commit 34f923cbca
3 changed files with 9 additions and 13 deletions

View File

@@ -10,7 +10,9 @@ public sealed class InMemoryChunkModificationStore : IChunkModificationStore
{
if (this._diffs.TryGetValue(chunkPos, out Dictionary<int, ushort>? d))
{
diff = d;
// Returned snapshot: callers may safely retain and enumerate even
// after concurrent RecordEdit on the same chunk.
diff = new Dictionary<int, ushort>(d);
return true;
}
diff = null;