Owns one external project-file discovery process.
The worker monitors its requester and terminates the external process tree when cancelled or when the requester exits. Port output is accumulated asynchronously with byte and file-count bounds so project discovery cannot exhaust the VM.
Summary
Types
Cancellation result.
An external command with an executable, arguments, and working directory.
Worker options.
Transforms command output and exit status into a discovery result.
Worker state.
Functions
Cancels discovery and waits for its external process tree to terminate.
Returns a specification to start this module under a supervisor.
Starts an unlinked discovery worker monitored by its owner.
Types
@type cancel_result() :: :ok | {:error, String.t()}
Cancellation result.
An external command with an executable, arguments, and working directory.
@type option() :: {:max_output_bytes, pos_integer()} | {:max_file_count, pos_integer()}
Worker options.
@type parser() :: (String.t(), non_neg_integer() -> term())
Transforms command output and exit status into a discovery result.
@type t() :: %Minga.Project.FileFind.Worker{ file_count: non_neg_integer(), max_file_count: pos_integer(), max_output_bytes: pos_integer(), output: [binary()], output_bytes: non_neg_integer(), owner: pid(), owner_ref: reference(), parser: parser(), port: port() | nil }
Worker state.
Functions
@spec cancel(pid()) :: cancel_result()
Cancels discovery and waits for its external process tree to terminate.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec start(pid(), command(), parser(), [option()]) :: GenServer.on_start()
Starts an unlinked discovery worker monitored by its owner.