attachmentDirectory

fun attachmentDirectory(self: PeerId, interServerSeam: Seam, scope: CoroutineScope, clock: () -> Long, replica: ReplicaId = ReplicaId(interServerSeam.selfId.value), config: QuilterConfig = QuilterConfig()): AttachmentDirectory

Build an AttachmentDirectory for one server, replicating its attachments to the rest of the core over interServerSeam — the fully-meshed inter-server link. Each server calls this once with its own seam into the core.

Parameters

self

this server's PeerId — the value written for every client that attaches here.

interServerSeam

the seam this server holds into the fully-meshed core (the inter-server mesh seam). The directory takes sole ownership of the seam's incoming stream via its Quilter, per the single-collection contract — do not run another collector over the same seam.

scope

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

clock

a wall-clock millis source used to tag writes so a genuinely later attach wins under last-writer-wins. Required — inject a fixed or controlled clock in tests (never kotlin.time.Clock.System directly there).

replica

the Quilter replica id; defaults to the seam's selfId, satisfying the one-replicator-per-(replica, CRDT) precondition.

config

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