Documentation ¶
Overview ¶
Package workspace contains a pipeline for processing a Go workspace.
Index ¶
- type LocalRepo
- type Pipeline
- func (p *Pipeline) AddImportPath(importPath string)
- func (p *Pipeline) AddPresented(r *RepoPresentation)
- func (p *Pipeline) AddRepository(r LocalRepo)
- func (p *Pipeline) AddRevision(importPath string, revision string)
- func (p *Pipeline) AddRevisionLatest(root, revision, latest string)
- func (p *Pipeline) AddSubrepo(s Subrepo)
- func (p *Pipeline) Done()
- func (p *Pipeline) RegisterPresenter(pr presenter.Presenter)
- func (p *Pipeline) RepoPresentations() <-chan *RepoPresentation
- type RepoPresentation
- type Subrepo
- type UpdateState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalRepo ¶
type LocalRepo struct { Path string // Full path to repository on disk. Root string // Import path corresponding to the root of the repository. VCS *vcs.Cmd }
LocalRepo represents a local repository on disk.
type Pipeline ¶
type Pipeline struct { // Packages is the working list of Go packages. // It's implemented as two slices and a map kept in sync, protected by a mutex. Packages struct { sync.Mutex Active []*RepoPresentation // Active repo presentations, latest at the end. History []*RepoPresentation // Historical repo presentations, latest at the end. ByRoot map[string]*RepoPresentation // Map key is repoRoot. } // contains filtered or unexported fields }
Pipeline for processing a Go workspace, where each repo has local and remote components.
func NewPipeline ¶
NewPipeline creates a Pipeline with working directory wd. Working directory is used to resolve relative import paths.
First, available presenters should be registered via RegisterPresenter. Then Go packages can be added via various means. Call Done once done adding. Processing begins as soon as Go packages are added to the pipeline. Results can be accessed via RepoPresentations at any time, as often as needed.
func (*Pipeline) AddImportPath ¶
AddImportPath adds a package with specified import path for processing.
func (*Pipeline) AddPresented ¶
func (p *Pipeline) AddPresented(r *RepoPresentation)
AddPresented adds a RepoPresentation the pipeline. It enables mocks to directly add presented repos.
func (*Pipeline) AddRepository ¶
AddRepository adds the specified repository for processing.
func (*Pipeline) AddRevision ¶
AddRevision adds a package with specified import path and revision for processing.
func (*Pipeline) AddRevisionLatest ¶
AddRevisionLatest adds a package with specified root, revision and latest.
func (*Pipeline) AddSubrepo ¶
AddSubrepo adds the specified Subrepo for processing.
func (*Pipeline) Done ¶
func (p *Pipeline) Done()
Done should be called after the workspace is finished being populated.
func (*Pipeline) RegisterPresenter ¶
RegisterPresenter registers a presenter. Presenters are consulted in the same order that they were registered.
func (*Pipeline) RepoPresentations ¶
func (p *Pipeline) RepoPresentations() <-chan *RepoPresentation
RepoPresentations returns a channel of all repo presentations. Repo presentations that are ready will be sent immediately. The remaining repo presentations will be sent onto the channel as they become available. Once all repo presentations have been sent, the channel will be closed. Therefore, iterating over the channel may block until all processing is done, but it will effectively return all repo presentations as soon as possible.
It's safe to call RepoPresentations at any time and concurrently to get multiple such channels.
type RepoPresentation ¶
type RepoPresentation struct { Repo *gps.Repo Presentation *presenter.Presentation UpdateState UpdateState }
RepoPresentation represents a repository update presentation.
type Subrepo ¶
type Subrepo struct { Root string RemoteVCS vcsstate.RemoteVCS // RemoteVCS allows getting the remote state of the VCS. RemoteURL string // RemoteURL is the remote URL, including scheme. Revision string }
Subrepo represents a "virtual" sub-repository inside a larger actual VCS repository.
type UpdateState ¶
type UpdateState uint8
UpdateState represents the state of an update.
TODO: Dedup.
const ( // Available represents an available update. Available UpdateState = iota // Updating represents an update in progress. Updating // Updated represents a completed update. Updated )