lexbor_erl_worker (lexbor_erl v0.3.0)
View SourceIndividual worker process managing a Lexbor C port.
Each worker manages an independent C port process that communicates with the Lexbor library. Workers are:
- Single-threaded: Process one request at a time
- Isolated: Have their own document registry
- Supervised: Restarted independently if they crash
- Registered: Can be discovered by name
Workers register themselves with a unique name based on their worker ID, allowing the pool to discover them dynamically and enabling independent supervision.
Summary
Functions
Send a command to a worker and wait for reply.
Start a worker and register it with a unique name.
Generate the registered name for a worker.
Functions
Send a command to a worker and wait for reply.
-spec start_link(pos_integer()) -> {ok, pid()} | {error, term()}.
Start a worker and register it with a unique name.
The worker opens a port to the Lexbor C executable and registers itself as lexbor_erl_worker_N where N is the WorkerId.
Generate the registered name for a worker.