< Summary

Information
Class: Lattice.ECS.Session.SessionRuntimeDataBoundary
Assembly: Lattice
File(s): /home/runner/work/Sideline/Sideline/godot/scripts/lattice/ECS/Session/SessionRuntimeDataBoundary.cs
Line coverage
100%
Covered lines: 19
Uncovered lines: 0
Coverable lines: 19
Total lines: 122
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_InputStorageKind()100%11100%
get_HistoryStorageKind()100%11100%
get_CheckpointStorageKind()100%11100%
get_SupportedCapabilities()100%11100%
get_UnsupportedCapabilities()100%11100%
Supports(...)100%11100%
ExplicitlyDoesNotSupport(...)100%11100%

File(s)

/home/runner/work/Sideline/Sideline/godot/scripts/lattice/ECS/Session/SessionRuntimeDataBoundary.cs

#LineLine coverage
 1using System;
 2
 3namespace Lattice.ECS.Session
 4{
 5    /// <summary>
 6    /// 当前运行时的输入存取策略类型。
 7    /// </summary>
 8    public enum SessionInputStorageKind
 9    {
 10        /// <summary>
 11        /// 按 `(playerId, tick)` 访问的固定窗口输入存储。
 12        /// </summary>
 13        PlayerTickFixedWindow = 0
 14    }
 15
 16    /// <summary>
 17    /// 当前运行时的历史帧策略类型。
 18    /// </summary>
 19    public enum SessionHistoryStorageKind
 20    {
 21        /// <summary>
 22        /// 保留有限 live frame,并通过 sampled snapshot 按需重建更早历史。
 23        /// </summary>
 24        BoundedLiveFramesWithSampledSnapshots = 0
 25    }
 26
 27    /// <summary>
 28    /// 当前运行时的 checkpoint 存储策略类型。
 29    /// </summary>
 30    public enum SessionCheckpointStorageKind
 31    {
 32        /// <summary>
 33        /// 使用 packed frame snapshot 作为 checkpoint 主格式。
 34        /// </summary>
 35        PackedSnapshot = 0
 36    }
 37
 38    /// <summary>
 39    /// 当前运行时公开承诺的数据策略能力。
 40    /// </summary>
 41    [Flags]
 42    public enum SessionRuntimeDataCapability
 43    {
 44        None = 0,
 45        PlayerTickInputLookup = 1 << 0,
 46        BoundedInputRetention = 1 << 1,
 47        TickAddressableHistory = 1 << 2,
 48        SampledHistoryMaterialization = 1 << 3,
 49        ExplicitCheckpointRestore = 1 << 4,
 50        PackedCheckpointStorage = 1 << 5
 51    }
 52
 53    /// <summary>
 54    /// 当前运行时明确不承诺的数据策略能力。
 55    /// </summary>
 56    [Flags]
 57    public enum UnsupportedSessionRuntimeDataCapability
 58    {
 59        None = 0,
 60        ConfigurableInputRetention = 1 << 0,
 61        ConfigurableHistoryRetention = 1 << 1,
 62        ConfigurableSnapshotSampling = 1 << 2,
 63        PluggableHistoryStore = 1 << 3,
 64        AlternativeCheckpointFormats = 1 << 4,
 65        UnboundedPerTickRetention = 1 << 5
 66    }
 67
 68    /// <summary>
 69    /// Session 运行时的数据策略边界描述。
 70    /// 用于把“输入 / 历史 / checkpoint 的稳定公开契约”和“内部 sizing 策略”分开。
 71    /// </summary>
 72    public sealed class SessionRuntimeDataBoundary
 73    {
 174        public SessionRuntimeDataBoundary(
 175            SessionInputStorageKind inputStorageKind,
 176            SessionHistoryStorageKind historyStorageKind,
 177            SessionCheckpointStorageKind checkpointStorageKind,
 178            SessionRuntimeDataCapability supportedCapabilities,
 179            UnsupportedSessionRuntimeDataCapability unsupportedCapabilities)
 80        {
 181            InputStorageKind = inputStorageKind;
 182            HistoryStorageKind = historyStorageKind;
 183            CheckpointStorageKind = checkpointStorageKind;
 184            SupportedCapabilities = supportedCapabilities;
 185            UnsupportedCapabilities = unsupportedCapabilities;
 186        }
 87
 188        public SessionInputStorageKind InputStorageKind { get; }
 89
 190        public SessionHistoryStorageKind HistoryStorageKind { get; }
 91
 3292        public SessionCheckpointStorageKind CheckpointStorageKind { get; }
 93
 694        public SessionRuntimeDataCapability SupportedCapabilities { get; }
 95
 696        public UnsupportedSessionRuntimeDataCapability UnsupportedCapabilities { get; }
 97
 98        public bool Supports(SessionRuntimeDataCapability capability)
 99        {
 6100            return (SupportedCapabilities & capability) == capability;
 101        }
 102
 103        public bool ExplicitlyDoesNotSupport(UnsupportedSessionRuntimeDataCapability capability)
 104        {
 6105            return (UnsupportedCapabilities & capability) == capability;
 106        }
 107    }
 108
 109    /// <summary>
 110    /// 当前运行时内部使用的输入 / 历史策略默认 sizing。
 111    /// 这些值用于实现调优,不属于稳定公开 API。
 112    /// </summary>
 113    internal static class SessionRuntimeDataDefaults
 114    {
 115        internal const int MaxPredictionFrames = 8;
 116        internal const int HistorySize = 128;
 117        internal const int LiveHistorySize = MaxPredictionFrames + 4;
 118        internal const int HistorySnapshotInterval = 4;
 119        internal const int MaterializedHistoryCacheSize = 4;
 120        internal const int RecycledFrameLimit = LiveHistorySize + 4;
 121    }
 122}