Cotal TypeScript packages
    Preparing search index...

    Class KeyScope

    One counter namespace. A run has one at the root, and every branch of every concurrency scope gets its own child.

    Both counters are allocated synchronously at the call site, before the first await. That is the whole determinism argument: the allocating code is either sequential or is itself inside an already-deterministic namespace, so no two allocations can race.

    Index
    path: readonly ScopeFrame[] = []
    • The child namespace for one branch of a scope opened from here.

      Parameters

      • kind: PathKind
      • name: string | null
      • occurrence: number
      • branchKey: string

      Returns KeyScope

    • Allocate the next occurrence for an effect in this namespace, and build its key.

      Parameters

      • kind:
            | "conclave"
            | "waitUntil"
            | "spawn"
            | "participant"
            | "turn"
            | "ask"
            | "checkpoint"
            | "sleep"
            | "wait"
            | "notify"
            | "monitor"
      • name: string = ""

      Returns StepKey

    • Allocate the next occurrence for a concurrency scope entered from this namespace. Call once per combinator call, then branch once per branch.

      Parameters

      Returns number

    • The scope's OWN key, in the namespace that opened it.

      Allocation-free on purpose: KeyScope.nextScope already allocated the occurrence, and calling this must not consume a second one. The scope entry therefore sits beside the effects of the namespace that opened it (/race:first-answer#0), while its branches live under it.

      Parameters

      • kind: ScopeKind
      • name: string | null
      • occurrence: number

      Returns StepKey