overlayServer

fun overlayServer(self: PeerId, coreSeam: Seam, directorySeam: Seam, scope: CoroutineScope, clock: () -> Long, directoryReplica: ReplicaId = ReplicaId(directorySeam.selfId.value), directoryConfig: QuilterConfig = QuilterConfig()): OverlayServer

Build an OverlayServer for one server, wiring its AttachmentDirectory and RoutedUnicastRouter together over the two inter-server channels.

The directory and the router each take sole ownership of a distinct seam's incoming stream, per the single-collection contract: the directory replicates over directorySeam (the CRDT gossip channel) and the router relays over coreSeam (the routing channel). In production these are separate channels over the one inter-server mesh; here they are separate Seams. Do not pass the same seam for both.

Parameters

self

this server's routing identity — the value written into the directory for every client admitted here and the address peer servers reach it at over coreSeam. Must equal coreSeam's selfId.

coreSeam

this server's seam into the fully-meshed core; the router owns its incoming.

directorySeam

this server's seam for directory replication; the directory's us.tractat.kuilt.quilter.Quilter owns its incoming. Must be a different seam from coreSeam.

scope

the CoroutineScope whose kotlinx.coroutines.Job parents both the directory replicator and the routing relay. Required — no real-dispatcher default; inject a test scope's backgroundScope under virtual time.

clock

a wall-clock millis source used to tag directory writes so a genuinely-later attach wins under last-writer-wins. Required — inject a fixed or controlled clock in tests.

directoryReplica

the directory us.tractat.kuilt.quilter.Quilter replica id; defaults to directorySeam's selfId.

directoryConfig

directory replication tuning; pass QuilterConfig(expectVirtualTime = true) in tests that run under UnconfinedTestDispatcher.