MCPcopy Create free account
hub / github.com/Effect-TS/effect / makeCsrNodeWalker

Function makeCsrNodeWalker

packages/effect/src/Graph.ts:7647–7656  ·  view source on GitHub ↗
(
  graph: Graph<N, E, T> | MutableGraph<N, E, T>,
  makeIterator: <U>(cache: csr.Csr, f: (index: NodeIndex, data: N) => U) => Iterator<U>
)

Source from the content-addressed store, hash-verified

7645}
7646
7647const makeCsrNodeWalker = <N, E, T extends Kind>(
7648 graph: Graph<N, E, T> | MutableGraph<N, E, T>,
7649 makeIterator: <U>(cache: csr.Csr, f: (index: NodeIndex, data: N) => U) => Iterator<U>
7650): Walker<NodeIndex, N> => {
7651 return new Walker((f) => ({
7652 // Capture CSR at iterator creation so invalidation cannot change an in-flight mutable traversal.
7653 [Symbol.iterator]: () =>
7654 makeIterator(csr.get(graph), (index, data) => withMutationGuard(graph, () => f(index, data)))
7655 }))
7656}
7657
7658const traversalStarts = <N, E, T extends Kind>(
7659 graph: Graph<N, E, T> | MutableGraph<N, E, T>,

Callers 1

Graph.tsFile · 0.85

Calls 3

withMutationGuardFunction · 0.85
getMethod · 0.65
fFunction · 0.50

Tested by

no test coverage detected