feat: mark WriteDeltaTime obsolete; document ReadDeltaTime as legacy-decode-only
WriteDeltaTime has no remaining callers - with warnings-as-errors, any new delta-time write now fails the build with migration instructions in the message. ReadDeltaTime stays un-attributed: its ~25 remaining callers (old- version fallbacks and generated migration replays) decode existing bytes and are correct forever; its docs now say exactly that. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
8d1283ba27
commit
3c7355f5c4
3 changed files with 10 additions and 0 deletions
|
|
@ -384,6 +384,7 @@ public class BufferWriter : IGenericWriter
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
[Obsolete("Delta time rewrites its bytes on every save. Write anchored time instead (WriteAnchoredTime, or [AnchoredDateTime] on generated fields); bump the containing type's version, as the wire format changes. Existing delta payloads remain readable through ReadDeltaTime in old-version fallbacks.")]
|
||||||
public void WriteDeltaTime(DateTime value)
|
public void WriteDeltaTime(DateTime value)
|
||||||
{
|
{
|
||||||
if (value == DateTime.MinValue)
|
if (value == DateTime.MinValue)
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,12 @@ public interface IGenericReader
|
||||||
DateTime ReadDateTime() => new(ReadLong(), DateTimeKind.Utc);
|
DateTime ReadDateTime() => new(ReadLong(), DateTimeKind.Utc);
|
||||||
TimeSpan ReadTimeSpan() => new(ReadLong());
|
TimeSpan ReadTimeSpan() => new(ReadLong());
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Decodes a legacy delta-time value. Only for reading old-version payloads (version
|
||||||
|
/// fallbacks and migration replays) — current formats store anchored time and read it
|
||||||
|
/// with <see cref="ReadAnchoredTime" />. <see cref="IGenericWriter.WriteDeltaTime" /> is
|
||||||
|
/// obsolete: no current-version format may write delta time.
|
||||||
|
/// </summary>
|
||||||
DateTime ReadDeltaTime()
|
DateTime ReadDeltaTime()
|
||||||
{
|
{
|
||||||
return ReadLong() switch
|
return ReadLong() switch
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,10 @@ public interface IGenericWriter
|
||||||
void Write(decimal value);
|
void Write(decimal value);
|
||||||
void WriteEncodedInt(int value);
|
void WriteEncodedInt(int value);
|
||||||
void Write(DateTime value);
|
void Write(DateTime value);
|
||||||
|
|
||||||
|
[Obsolete("Delta time rewrites its bytes on every save. Write anchored time instead (WriteAnchoredTime, or [AnchoredDateTime] on generated fields); bump the containing type's version, as the wire format changes. Existing delta payloads remain readable through ReadDeltaTime in old-version fallbacks.")]
|
||||||
void WriteDeltaTime(DateTime value);
|
void WriteDeltaTime(DateTime value);
|
||||||
|
|
||||||
void WriteAnchoredTime(DateTime value);
|
void WriteAnchoredTime(DateTime value);
|
||||||
void Write(IPAddress value);
|
void Write(IPAddress value);
|
||||||
void Write(TimeSpan value);
|
void Write(TimeSpan value);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue