Add Kotlin schema shard facade sugar

This commit is contained in:
Meta Vens 2026-06-16 10:43:54 +01:00
commit e2ea266136
3 changed files with 42 additions and 6 deletions

View file

@ -293,12 +293,12 @@ Current progress:
max in-flight frame pressure, latest-frame cursors, and watch callbacks for
stream declarations plus latest-frame publication.
- Kotlin now has a branded `CultMesh` facade matching the C#/TypeScript/Python
entrypoint pattern for local nodes, Verse catalogs, peer catalogs, authority
lease catalogs, stream catalogs, and RUDP client/server construction. Kotlin
also parses advertised `rudp://host:port` endpoints and can build a RUDP
client directly from a peer card contact hint. The facade delegates to the
same owners as the top-level helpers instead of creating a second authority
path.
entrypoint pattern for local nodes, schema catalogs, shard catalogs, Verse
catalogs, peer catalogs, authority lease catalogs, stream catalogs, and RUDP
client/server construction. Kotlin also parses advertised
`rudp://host:port` endpoints and can build a RUDP client directly from a peer
card contact hint. The facade delegates to the same owners as the top-level
helpers instead of creating a second authority path.
- Kotlin authority lease catalogs now also expose watch callbacks, so JVM and
Android clients can react to lease changes without treating peer-card contact
hints as trust.

View file

@ -14,6 +14,8 @@ val verses = CultMesh.createVerseCatalog()
val peers = CultMesh.createPeerCatalog()
val leases = CultMesh.createAuthorityLeaseCatalog()
val streams = CultMesh.createStreamCatalog()
val schemas = CultMesh.createSchemaCatalog()
val shards = CultMesh.createShardCatalog()
```
## CultCache Happy Path

View file

@ -285,6 +285,10 @@ object CultMesh {
fun createStreamCatalog(): CultMeshStreamCatalog = CultMeshStreamCatalog()
fun createSchemaCatalog(): CultNetSchemaCatalog = CultNetSchemaCatalog()
fun createShardCatalog(): CultNetShardCatalog = CultNetShardCatalog()
fun createRudpServer(
runtimeId: String,
connectionId: Long,
@ -2671,6 +2675,36 @@ private fun cultMeshFacadeRoutesErgonomicEntrypoints() {
val streams = CultMesh.createStreamCatalog()
check(streams.streams.isEmpty())
val schemas = CultMesh.createSchemaCatalog()
schemas.upsert(
defineCultNetSchemaDescriptor(
schemaId = notes.schemaVersion,
kind = "document_payload",
documentType = notes.documentType,
title = "Facade Note",
schemaJson = """{"type":"string"}""",
),
)
check(schemas.get(notes.schemaVersion)?.documentType == notes.documentType)
val shards = CultMesh.createShardCatalog()
shards.upsert(
CultNetShardDescriptor(
shardId = "facade-shard",
ownerRuntimeId = "facade-owner",
epoch = 1,
isPrimary = true,
schemaIds = listOf(notes.schemaVersion),
keyPrefix = "note:",
),
)
check(
shards.list(
schemaIds = listOf(notes.schemaVersion),
recordKeys = listOf("note:facade"),
).single().shardId == "facade-shard",
)
}
private fun cultCacheRawSnapshotsRoundTripThroughCultNetMessages() {