Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultPathResolver ¶
DefaultPathResolver is used to locate an "analyzerd" binary in the local PATH.
Types ¶
type Adapter ¶
type Adapter struct { CmdBuilder analyst.CommandBuilder // PathResolver is a function that returns the path to the analyst process // to be spawned. If this value is nil, DefaultPathResolver is used. PathResolver func() (string, error) // contains filtered or unexported fields }
The Adapter spawns a child analyst-rust process, and marshals messages between the caller and the child process.
func (*Adapter) CompletedWorkItems ¶
func (a *Adapter) CompletedWorkItems() <-chan *contracts.CompletedResearchItem
CompletedWorkItems provides access to a stream of completed work items.
func (*Adapter) Done ¶
func (a *Adapter) Done() <-chan (struct{})
Done returns a channel that blocks until the adapter is done running.
func (*Adapter) Run ¶
func (a *Adapter) Run(ctx context.Context, pendingResearch *contracts.PendingResearchItem)
Run starts a rust analyst as a child process, pipes pendingResearch to the process via stdin, and listens for results on stdout. The returned CompletedResearchItem and error channels will remain open until all work is completed, at which time they are both closed. Any errors that occur before the adapter begins polling stdout will result in the closure of the CompletedResearchItem and error channels. However, any errors that occur while processing stdout are streamed to the outbound error channel. The adapter will continue to poll stdout until the pipe is either closed or the parent context is cancelled. If the parent context reports that it is Done, the child process is immediately killed (SIGKILL is sent to the child process).