Loading
client: thread-local RPC engine selection
Each thread draws a ticket from an atomic round-robin counter on its
first RPC and keeps it in a thread_local; its engine is ticket % N.
rpc_engine() and hosts() resolve through this index, so all existing
call sites use the calling thread's engine and its endpoints. A
thread_local needs no cleanup when libfuse retires worker threads. With
one engine the counter is not touched and every thread gets engine 0.
The assignment is logged at DEBUG.
The round-robin logic lives in a small header-only EngineSelector so it
can be unit tested.
Co-Authored-By:
Claude Opus 5.5 <noreply@anthropic.com>