Apply Verse discovery responses to catalogs

This commit is contained in:
Meta Vens 2026-05-19 21:29:18 +01:00
commit dfa7db607a
3 changed files with 52 additions and 0 deletions

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using GameCult.Networking;
using R3;
namespace GameCult.Mesh
@ -225,6 +226,19 @@ namespace GameCult.Mesh
_updates.OnNext(verse);
}
/// <summary>
/// Adds or replaces Verses from a wire catalog response.
/// </summary>
public void Upsert(CultMeshVerseCatalogResponseMessage response)
{
ThrowIfDisposed();
if (response == null) throw new ArgumentNullException(nameof(response));
foreach (var verse in response.Verses)
{
Upsert(verse.ToVerseDescriptor());
}
}
/// <summary>
/// Gets a Verse by id, if known.
/// </summary>

View file

@ -45,6 +45,8 @@ It can publish discovery updates and find compatible transfer targets.
`CultMesh.ServeVerseCatalog(node, catalog)` attaches schema-v0 Verse discovery
responses to a node. The wire contracts are
`cultmesh.verse_catalog_request.v0` and `cultmesh.verse_catalog_response.v0`.
Consumers can apply a response directly with
`CultMeshVerseCatalog.Upsert(CultMeshVerseCatalogResponseMessage)`.
### Shard Authority