registry

package
v0.0.0-...-dbe7a22 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("module not found")

Functions

This section is empty.

Types

type Fake

type Fake struct {
	// contains filtered or unexported fields
}

func NewFake

func NewFake(name string) *Fake

func (*Fake) AddModule

func (f *Fake) AddModule(t *testing.T, name string, version string, moduleBazel string, fetcher fetch.Fetcher)

func (*Fake) GetFetcher

func (f *Fake) GetFetcher(key common.ModuleKey) (fetch.Fetcher, error)

func (*Fake) GetModuleBazel

func (f *Fake) GetModuleBazel(key common.ModuleKey) ([]byte, error)

func (*Fake) URL

func (f *Fake) URL() string

type Index

type Index struct {
	// contains filtered or unexported fields
}

Index represents an index registry. Its URL can have either an HTTP(S) scheme, or a file scheme (for a local directory).

func NewIndex

func NewIndex(url *urls.URL) (*Index, error)

func (*Index) GetFetcher

func (i *Index) GetFetcher(key common.ModuleKey) (fetch.Fetcher, error)

func (*Index) GetModuleBazel

func (i *Index) GetModuleBazel(key common.ModuleKey) ([]byte, error)

func (*Index) URL

func (i *Index) URL() string

type Registry

type Registry interface {
	// URL returns the URL uniquely identifying the registry.
	URL() string
	// GetModuleBazel retrieves the MODULE.bazel file of the module with the given key. Returns an error wrapping
	// ErrNotFound if no such module exists in the registry.
	GetModuleBazel(key common.ModuleKey) ([]byte, error)
	// GetFetcher returns the Fetcher object which can be used to fetch the module with the given key. Returns an error
	// wrapping ErrNotFound if no such module exists in the registry.
	GetFetcher(key common.ModuleKey) (fetch.Fetcher, error)
}

Registry represents a Bazel module registry.

func GetModuleBazel

func GetModuleBazel(key common.ModuleKey, registries []string, regOverride string) ([]byte, Registry, error)

GetModuleBazel gets the MODULE.bazel file contents for the module with the given key, using the list of registries with an optional override `regOverride` (use an empty string for no override). Returns the file contents, and the registry that actually has that module.

func New

func New(rawurl string) (Registry, error)

New creates a new Registry object from its URL. The scheme of the URL determines the type of the registry.

Jump to

Keyboard shortcuts

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