multiNodeWarpSim

suspend fun multiNodeWarpSim(n: Int, nodeScope: CoroutineScope, scheduler: TestCoroutineScheduler, quilterConfig: QuilterConfig = MULTI_NODE_WARP_SIM_QUILTER_CONFIG, heartbeatConfig: HeartbeatConfig = HeartbeatConfig(), strategy: ClaimStrategy = ClaimStrategy.RingWithIntent(), registryFactory: (MultiNodeWarpSim, PeerId) -> OpRegistry = { sim, id -> sim.trackedEchoRegistry(id) }, nodeFactory: (MultiNodeWarpSim, PeerId, Seam, CoroutineScope) -> WarpNode? = null): MultiNodeWarpSim

Weave an n-peer InMemoryLoom mesh and stand up one coordination-free WarpNode per peer, returning the ready MultiNodeWarpSim. Prefer warpSimTest, which also wires runTest(StandardTestDispatcher(), timeout = WARP_SIM_WEDGE_BACKSTOP) and teardown; use this directly only when the test needs to own the runTest invocation.

Parameters

n

Number of peers (the first hosts the mesh; the rest join).

nodeScope

Scope for node coroutines — pass kotlinx.coroutines.test.TestScope.backgroundScope so the re-arming anti-entropy and heartbeat loops are cancelled at test teardown.

scheduler

The test scheduler (kotlinx.coroutines.test.TestScope.testScheduler) — backs MultiNodeWarpSim.virtualClock so node clocks track virtual time.

quilterConfig

Anti-entropy cadence for every node. Defaults to the short-cadence MULTI_NODE_WARP_SIM_QUILTER_CONFIG.

heartbeatConfig

Heartbeat liveness timing for every node. Defaults to production timing (5 s / 15 s / 60 s) — virtual, so it is free; inject a short cadence to test partition detection.

strategy

Claim strategy for every node. Defaults to ClaimStrategy.RingWithIntent.

registryFactory

Builds each node's OpRegistry. Defaults to MultiNodeWarpSim.trackedEchoRegistry — a pass-through echo op that records into the sim's execution log. Ignored for nodes built by a custom nodeFactory.

nodeFactory

Override to wire a custom WarpNode (e.g. a lazyFetch-capable node). Parameters: (sim, id, seam, childScope). Use sim.virtualClock, sim.quilterConfig, and seam.rosterSnapshot() to stay on the harness's virtual timeline.