Make CultMesh document writes authority-explicit

This commit is contained in:
Meta Vens 2026-08-17 19:47:10 +02:00
commit 98bec47d75
5 changed files with 485 additions and 338 deletions

View file

@ -503,6 +503,22 @@ namespace GameCult.Networking
/// </summary>
public IReadOnlyList<CultNetClientAuthorityScope> ClientAuthorityScopes => _clientAuthorityScopes;
/// <summary>Gets whether this database instance can authoritatively replace the document at a key.</summary>
public bool CanWriteAuthoritatively<T>(CultRecordKey key) where T : class
{
ThrowIfDisposed();
var descriptor = _cache.Registry.GetRequired<T>();
return ResolveShardInternal(descriptor, key).IsPrimary;
}
/// <summary>Gets whether this database instance can submit a prediction for the document at a key.</summary>
public bool CanSubmitPrediction<T>(CultRecordKey key) where T : class
{
ThrowIfDisposed();
var descriptor = _cache.Registry.GetRequired<T>();
return _clientAuthorityScopes.Any(scope => scope.Matches(_runtimeId, descriptor, key));
}
/// <summary>
/// Gets mutation log entries for a shard after the supplied sequence.
/// </summary>