Skip to content

Build circuits preemptively

eta requested to merge eta/arti:60 into main

This patch series introduces TargetCircUsage::Preemptive, a circuit usage that works somewhat differently from other ones: it requires at least 2 circuits to exist that can exit the port it contains in order for an existing circuit to match against it (path-spec.txt § 2.1.1); if that's not the case, that usage will require building new circuits (in order that we build enough to have 2 available).

This required refactoring how circuit reuse worked; now, CircList::find_open uses the new AbstractSpec::find_supported trait method, which we customize to implement the above check in the case of Preemptive circuit usages. To make that work, OpenEntry now takes two type parameters (the spec and circuit types), instead of taking a builder type parameter and using its associated types. (We also got rid of type constraints on that struct, yay!)

With that usage, we can then build a simple preemptive circuit predictor, and wire it up with arti-client.

Merge request reports

Loading