Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Archive ¶
type Archive interface {
// Ensure downloads the archive if it's not on disk yet.
Ensure(context.Context) error
// Close must finalize the downloaded archive. If one or more temporary
// files were created, they should be deleted here.
Close() error
// Path must return the path to the archive on the filesystem.
Path() string
// AdditionalFilePaths returns a map of filenames that should be put into
// the workspace's root. The value of each entry in the map is the location
// on the local filesystem. WorkspaceCreators need to copy the files into
// the workspaces.
AdditionalFilePaths() map[string]string
}
Archive implementations represent a downloaded repository archive.
type ArchiveRegistry ¶
type ArchiveRegistry interface {
// Checkout returns an Archive for the given repository and the given
// relative path in the repository. The Archive is possibly unfetched.
// Users need to call `Ensure()` on the Archive before using it and
// `Close()` once they're done using it.
Checkout(repo RepoRevision, path string) Archive
}
ArchiveRegistry abstracts the process of retrieving an archive for the given repository.
func NewArchiveRegistry ¶
func NewArchiveRegistry(client HTTPClient, dir string, deleteZips bool) ArchiveRegistry
type HTTPClient ¶
type HTTPClient interface {
// NewHTTPRequest creates an http.Request for the Sourcegraph API.
//
// path is joined against the API route. For example on Sourcegraph.com this
// will result the URL: https://sourcegraph.com/.api/path.
NewHTTPRequest(ctx context.Context, method, path string, body io.Reader) (*http.Request, error)
// Do runs an http.Request against the Sourcegraph API.
Do(req *http.Request) (*http.Response, error)
}
HTTPClient provides an interface to run API requests.
type NoopArchive ¶
type NoopArchive struct{}
func (*NoopArchive) AdditionalFilePaths ¶
func (a *NoopArchive) AdditionalFilePaths() map[string]string
func (*NoopArchive) Close ¶
func (a *NoopArchive) Close() error
func (*NoopArchive) Path ¶
func (a *NoopArchive) Path() string
type RepoRevision ¶
Click to show internal directories.
Click to hide internal directories.