Add Python CultMesh catalog factories
This commit is contained in:
parent
0308167c3e
commit
9120d0a372
5 changed files with 83 additions and 4 deletions
|
|
@ -296,6 +296,10 @@ Current progress:
|
|||
subscription flows. The default factory opens the existing TCP-framed schema
|
||||
transport, but the raw client no longer owns inline socket setup as its
|
||||
request truth.
|
||||
- Python's branded `CultMesh` facade now creates schema catalogs, built-in
|
||||
schema catalogs, and shard catalogs by delegating to the existing
|
||||
`cultnet_py` owners, matching the TypeScript/Kotlin/Rust entrypoint pattern
|
||||
without creating a second catalog authority.
|
||||
- Rust now has a poll-driven `CultNetRudpReconnectLoop` for substrate callers:
|
||||
service loops report closure, ask `reconnect_if_due(now_ms)` inside their own
|
||||
reactor, and the shared controller owns retry delay/exhaustion state while the
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ CultMesh.
|
|||
| Runtime | Role | Claimed parity | Not claimed |
|
||||
| --- | --- | --- | --- |
|
||||
| C# | Reference implementation and production game/server substrate | CultCache typed documents and SoA, CultNet schema-v0, LiteNetLib production path with adapter profile, shared transport profiles, shared RUDP socket transport, RUDP reconnect policy/controller and reconnect-loop helper, LiteNetLib client reconnect-controller adoption, schema-client transport port for service request/response clients, CultMesh node/session/catalog/stream/simulation surfaces | No need to abandon LiteNetLib before the CultNet adapter fully owns production service adoption |
|
||||
| Python | Package runtime, local daemon endpoint, raw interop peer, typed state participant | CultCache/CultNet/CultMesh package surface, schema catalogs, shard catalogs/logs, schema-transport factory for raw client request/subscription flows, local TCP CultMesh server, session/prediction/simulation fact helpers, authority leases, streams, RUDP codec/session/socket transport, RUDP reconnect policy/controller and reconnect-loop helper, schema-v0 MessagePack over RUDP evidence, benchmark evidence against C# cache paths | Universal C# throughput, full C# daemon/server stack, and RUDP as the only public service pipe |
|
||||
| Python | Package runtime, local daemon endpoint, raw interop peer, typed state participant | CultCache/CultNet/CultMesh package surface, branded CultMesh node/schema/shard/Verse/peer/authority/stream ergonomics, shard catalogs/logs, schema-transport factory for raw client request/subscription flows, local TCP CultMesh server, session/prediction/simulation fact helpers, RUDP codec/session/socket transport, RUDP reconnect policy/controller and reconnect-loop helper, schema-v0 MessagePack over RUDP evidence, benchmark evidence against C# cache paths | Universal C# throughput, full C# daemon/server stack, and RUDP as the only public service pipe |
|
||||
| TypeScript | Node/browser-adjacent projection and interop runtime | CultCache parity tests, CultNet schema-v0 peer, advertised schema/shard catalog wire contracts plus request/sync helpers, transport profiles, TCP-framed transport port and peer helper, shared RUDP socket transport, RUDP reconnect policy/controller, RUDP reconnect-loop helper, branded CultMesh node/schema/shard/Verse/peer/authority/stream ergonomics | Full C# game session/server stack |
|
||||
| Rust | Low-level cache/transport/runtime substrate | CultCache/CultNet interop lane, schema and shard catalog helpers, transport profiles, TCP-framed port, shared RUDP codec/session/socket transport, RUDP reconnect policy/controller and reconnect-loop helper, schema-v0 MessagePack over RUDP evidence, small CultMesh facade for schema registry, shard catalog, peer cards, authority leases, RUDP endpoint parsing, and peer-card RUDP client construction | Full CultMesh game-session/server facade, stream catalog, or production game-session server |
|
||||
| Kotlin | JVM/Android client substrate | Typed MessagePack cache, built-in schema catalog advertisement, schema/shard catalogs with shared schema-message transport fetch/sync helpers, authority leases, stream catalog, branded `CultMesh` facade, WebSocket transport profile/connection helper, RUDP client/server sugar, RUDP reconnect policy/controller and reconnect-loop helper, schema-v0 MessagePack over RUDP evidence | C# SoA store, full C# server daemon, or Unity hot-loop memory layout |
|
||||
|
|
|
|||
|
|
@ -127,10 +127,13 @@ CultCache, CultNet, and CultMesh. It is evidence, not confetti.
|
|||
as the C# discovery clients.
|
||||
- Python CultMesh facade:
|
||||
Exposes C#-matching client entrypoints for Verse discovery, peer exchange,
|
||||
raw CultNet client construction, local nodes, catalogs, sessions, streams,
|
||||
raw CultNet client construction, local nodes, Verse catalogs, peer catalogs,
|
||||
schema catalogs, built-in schema catalogs, shard catalogs, sessions, streams,
|
||||
authority leases, local TCP node serving, simulation fact commits, and the
|
||||
durable shard-log node option that attaches a file-backed authoritative log
|
||||
store beside the cache file by default. The `cultmesh-py-daemon` /
|
||||
store beside the cache file by default. Schema and shard catalog factories
|
||||
delegate to the existing `cultnet_py` owners, so the branded entrypoint does
|
||||
not create a second source of discovery truth. The `cultmesh-py-daemon` /
|
||||
`python -m cultmesh_py.daemon` entrypoint launches that same local TCP server
|
||||
body and emits a bounded readiness document for process supervisors while the
|
||||
served CultNet endpoint remains the capability owner. Readiness now mirrors
|
||||
|
|
|
|||
|
|
@ -2,7 +2,13 @@ from __future__ import annotations
|
|||
|
||||
from pathlib import Path
|
||||
|
||||
from cultnet_py import CultNetRawClient, CultNetSimulationObservationHub
|
||||
from cultnet_py import (
|
||||
CultNetRawClient,
|
||||
CultNetSchemaCatalog,
|
||||
CultNetShardCatalog,
|
||||
CultNetSimulationObservationHub,
|
||||
wire_message_schema_catalog,
|
||||
)
|
||||
|
||||
from .client import CultMeshPeerExchangeClient, CultMeshVerseDiscoveryClient
|
||||
from .node import CultMeshNode, CultMeshNodeOptions, create_node
|
||||
|
|
@ -76,6 +82,27 @@ class CultMesh:
|
|||
def create_stream_catalog() -> CultMeshStreamCatalog:
|
||||
return CultMeshStreamCatalog()
|
||||
|
||||
@staticmethod
|
||||
def create_schema_catalog() -> CultNetSchemaCatalog:
|
||||
return CultNetSchemaCatalog()
|
||||
|
||||
@staticmethod
|
||||
def create_builtin_schema_catalog(
|
||||
*,
|
||||
include_schema_json: bool = True,
|
||||
schema_ids: list[str] | None = None,
|
||||
kinds: list[str] | None = None,
|
||||
) -> CultNetSchemaCatalog:
|
||||
catalog = CultNetSchemaCatalog()
|
||||
builtins = wire_message_schema_catalog(include_schema_json=include_schema_json)
|
||||
for descriptor in builtins.list(schema_ids=schema_ids, kinds=kinds):
|
||||
catalog.upsert(descriptor)
|
||||
return catalog
|
||||
|
||||
@staticmethod
|
||||
def create_shard_catalog() -> CultNetShardCatalog:
|
||||
return CultNetShardCatalog()
|
||||
|
||||
@staticmethod
|
||||
def create_verse_discovery_client(
|
||||
host: str = "localhost",
|
||||
|
|
|
|||
|
|
@ -2732,6 +2732,51 @@ class CultCacheTests(unittest.TestCase):
|
|||
self.assertIsInstance(CultMesh.create_peer_catalog(), CultMeshPeerCatalog)
|
||||
self.assertIsInstance(CultMesh.create_authority_lease_catalog(), CultMeshAuthorityLeaseCatalog)
|
||||
self.assertIsInstance(CultMesh.create_stream_catalog(), CultMeshStreamCatalog)
|
||||
self.assertIsInstance(CultMesh.create_schema_catalog(), CultNetSchemaCatalog)
|
||||
self.assertIsInstance(CultMesh.create_builtin_schema_catalog(), CultNetSchemaCatalog)
|
||||
self.assertIsInstance(CultMesh.create_shard_catalog(), CultNetShardCatalog)
|
||||
builtins = CultMesh.create_builtin_schema_catalog(
|
||||
include_schema_json=False,
|
||||
kinds=["shared_contract"],
|
||||
)
|
||||
self.assertEqual(
|
||||
builtins.list()[0].schema_id,
|
||||
"https://github.com/GameCult/cultnet-ts/contracts/cultnet.transport-profile.schema.json",
|
||||
)
|
||||
self.assertIsNone(builtins.list()[0].schema_json)
|
||||
peer_exchange_schema_id = (
|
||||
"https://github.com/GameCult/cultnet-ts/contracts/cultmesh.peer-exchange-request.schema.json"
|
||||
)
|
||||
filtered_builtin = CultMesh.create_builtin_schema_catalog(
|
||||
include_schema_json=True,
|
||||
schema_ids=[peer_exchange_schema_id],
|
||||
)
|
||||
self.assertEqual(
|
||||
filtered_builtin.list()[0].schema_version,
|
||||
"cultmesh.peer_exchange_request.v0",
|
||||
)
|
||||
self.assertIn(
|
||||
"cultmesh.peer_exchange_request.v0",
|
||||
filtered_builtin.list()[0].schema_json or "",
|
||||
)
|
||||
shard_catalog = CultMesh.create_shard_catalog()
|
||||
shard_catalog.upsert(
|
||||
CultNetShardDescriptor(
|
||||
shard_id="python-notes-a",
|
||||
owner_runtime_id="mesh-facade",
|
||||
epoch=7,
|
||||
is_primary=True,
|
||||
schema_ids=("python.note.v1",),
|
||||
key_prefix="note:",
|
||||
)
|
||||
)
|
||||
self.assertEqual(
|
||||
[
|
||||
shard.shard_id
|
||||
for shard in shard_catalog.list(schema_ids=["python.note.v1"], record_keys=["note:1"])
|
||||
],
|
||||
["python-notes-a"],
|
||||
)
|
||||
verse_client = CultMesh.create_verse_discovery_client("127.0.0.1", 4010, timeout_seconds=1.5)
|
||||
peer_client = CultMesh.create_peer_exchange_client("127.0.0.1", 4011, timeout_seconds=1.5)
|
||||
raw_client = CultMesh.create_client("127.0.0.1", 4012, timeout_seconds=1.5)
|
||||
|
|
|
|||
Loading…
Reference in a new issue