Skip to main content

Module builder

Module builder 

Source
Expand description

Background HNSW builder thread.

Each Data Plane core owns one builder thread. The core sends build requests with try_send and drains finished builds with try_recv once per tick, so a build never blocks the core’s reactor. Both channels are bounded:

  • The request queue holds capacity requests. When it is full the core keeps the job in its own backlog and sends it on a later tick. The segment stays searchable by brute force meanwhile.
  • The completion queue holds capacity results. When it is full the builder thread waits for the core to drain it.

The thread builds requests in FIFO order and stops when the core drops its request sender.

Constants§

BUILD_QUEUE_CAPACITY
Build requests a core’s builder queue holds. Each request carries a whole segment’s vectors, so the bound caps the memory in flight.

Functions§

spawn_builder
Spawn the HNSW builder thread for Data Plane core core_id, with request and completion queues of capacity entries each. Fails when the OS refuses the thread.

Type Aliases§

BuildSender
Sender half: TPC core sends build requests to the builder thread.
CompleteReceiver
Receiver half: TPC core receives completed builds.