rustanalyst

package
v0.0.0-...-4aa7239 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2021 License: OSL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPathResolver

func DefaultPathResolver() (string, error)

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) Errors

func (a *Adapter) Errors() <-chan (error)

Errors provides access to errors that are produced after Run called.

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL