def SpanDraw.check

bend-trace-context@0.2.0.0 · trace_context.bend:1166

import bend-trace-context@0.2.0.0/trace_context.bend as TraceContext
import Base

1166# Check a complete span ID candidate: zero and the excluded span ID are
1167# retried; anything else is the span ID drawn.
1168def SpanDraw.check(candidate: Maybe<&2, SpanId>, excluded: Maybe<&2, SpanId>, remaining: Nat) -> SpanStep:
1169  match candidate:
1170    case None{}:
1171      SpanDraw.retry(remaining, excluded)
1172    case Some{+id}:
1173      match excluded:
1174        case None{}:
1175          DrawnSpanId{id}
1176        case Some{+old}:
1177          SpanDraw.reuse(SpanId.is_eq(id, old), id, old, remaining)

Uses (7)

Used by (1)