gomodule

package
v0.0.0-...-ed59bf1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CacheMiss = xerrors.Define("gomodule: cache hit miss")

Functions

This section is empty.

Types

type Config

type Config []*ModuleSetting

func ReadConfig

func ReadConfig(path string) (Config, error)

type GitHubProxy

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

func NewGitHubProxy

func NewGitHubProxy(cache *ModuleCache, ghClient *github.Client) *GitHubProxy

func (*GitHubProxy) Archive

func (g *GitHubProxy) Archive(ctx context.Context, w io.Writer, moduleRoot *ModuleRoot, moduleName, version string) error

func (*GitHubProxy) ArchiveRevision

func (g *GitHubProxy) ArchiveRevision(ctx context.Context, w io.Writer, moduleRoot *ModuleRoot, moduleName, version string) error

func (*GitHubProxy) GetGoMod

func (g *GitHubProxy) GetGoMod(ctx context.Context, moduleRoot *ModuleRoot, module *Module, version string) (string, error)

func (*GitHubProxy) GetGoModRevision

func (g *GitHubProxy) GetGoModRevision(ctx context.Context, moduleRoot *ModuleRoot, module *Module, pseudoVersion *PseudoVersion) (string, error)

func (*GitHubProxy) GetInfo

func (g *GitHubProxy) GetInfo(ctx context.Context, moduleRoot *ModuleRoot, module, version string) (Info, error)

func (*GitHubProxy) GetInfoRevision

func (g *GitHubProxy) GetInfoRevision(ctx context.Context, moduleRoot *ModuleRoot, module string, pseudoVersion *PseudoVersion) (Info, error)

type Info

type Info struct {
	Version string
	Time    time.Time
}

type Module

type Module struct {
	Path        string
	Versions    []*ModuleVersion
	Root        string
	ModFilePath string
	// contains filtered or unexported fields
}

func (*Module) LatestVersion

func (m *Module) LatestVersion(ctx context.Context) (*ModuleVersion, error)

func (*Module) ModuleFile

func (m *Module) ModuleFile(version string) ([]byte, error)

type ModuleArchive

type ModuleArchive struct {
	ModuleRoot *ModuleRoot
	Module     *Module
	Version    string
	Revision   string
	// contains filtered or unexported fields
}

func NewModuleArchiveFromGitHub

func NewModuleArchiveFromGitHub(ghClient *github.Client, moduleRoot *ModuleRoot, module, version string, commit *github.RepositoryCommit) (*ModuleArchive, error)

func (*ModuleArchive) Pack

func (a *ModuleArchive) Pack(ctx context.Context, w io.Writer) error

type ModuleCache

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

func NewModuleCache

func NewModuleCache(cachePool *client.SinglePool, endpoint, region, bucket, accessKey, secretAccessKey, caCertFile string) *ModuleCache

func (*ModuleCache) Archive

func (c *ModuleCache) Archive(ctx context.Context, module, version string, w io.Writer) error

func (*ModuleCache) CachedModFiles

func (c *ModuleCache) CachedModFiles(module string) ([]string, error)

func (*ModuleCache) CachedModInfos

func (c *ModuleCache) CachedModInfos(module string) ([]string, error)

func (*ModuleCache) CachedModuleRoots

func (c *ModuleCache) CachedModuleRoots() ([]*ModuleRoot, error)

func (*ModuleCache) FlushAll

func (c *ModuleCache) FlushAll() error

func (*ModuleCache) GetModFile

func (c *ModuleCache) GetModFile(module, version string) ([]byte, error)

func (*ModuleCache) GetModInfo

func (c *ModuleCache) GetModInfo(module, sha string) (time.Time, error)

func (*ModuleCache) GetModuleRoot

func (c *ModuleCache) GetModuleRoot(repoRoot string, baseDir string, vcs *VCS) (*ModuleRoot, error)

func (*ModuleCache) GetRepoRoot

func (c *ModuleCache) GetRepoRoot(importPath string) (repoRoot string, repoURL string, err error)

func (*ModuleCache) Invalidate

func (c *ModuleCache) Invalidate(module string) error

func (*ModuleCache) Ping

func (c *ModuleCache) Ping() error

func (*ModuleCache) SaveArchive

func (c *ModuleCache) SaveArchive(ctx context.Context, module, version string, data []byte) error

func (*ModuleCache) SetModFile

func (c *ModuleCache) SetModFile(module, version string, modFile []byte) error

func (*ModuleCache) SetModInfo

func (c *ModuleCache) SetModInfo(module, sha string, t time.Time) error

func (*ModuleCache) SetModuleRoot

func (c *ModuleCache) SetModuleRoot(moduleRoot *ModuleRoot) error

func (*ModuleCache) SetRepoRoot

func (c *ModuleCache) SetRepoRoot(importPath, repoRoot, repoURL string) error

type ModuleFetcher

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

func NewModuleFetcher

func NewModuleFetcher(baseDir string, cache *ModuleCache, tokenProvider *githubutil.TokenProvider, caBundle []byte) *ModuleFetcher

func (*ModuleFetcher) Get

func (f *ModuleFetcher) Get(ctx context.Context, importPath string, setting *ModuleSetting) (*ModuleRoot, error)

type ModuleProxy

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

func NewModuleProxy

func NewModuleProxy(conf Config, moduleDir string, cache *ModuleCache, ghClient *github.Client, tokenProvider *githubutil.TokenProvider, caBundle []byte) *ModuleProxy

func (*ModuleProxy) CachedModuleRoots

func (m *ModuleProxy) CachedModuleRoots() ([]*ModuleRoot, error)

func (*ModuleProxy) FlushAllCache

func (m *ModuleProxy) FlushAllCache() error

func (*ModuleProxy) GetConfig

func (m *ModuleProxy) GetConfig(module string) *ModuleSetting

func (*ModuleProxy) GetGoMod

func (m *ModuleProxy) GetGoMod(ctx context.Context, moduleName, version string) (string, error)

func (*ModuleProxy) GetInfo

func (m *ModuleProxy) GetInfo(ctx context.Context, moduleName, version string) (Info, error)

func (*ModuleProxy) GetLatestVersion

func (m *ModuleProxy) GetLatestVersion(ctx context.Context, module string) (Info, error)

func (*ModuleProxy) GetZip

func (m *ModuleProxy) GetZip(ctx context.Context, w io.Writer, moduleName, version string) error

func (*ModuleProxy) InvalidateCache

func (m *ModuleProxy) InvalidateCache(module string) error

func (*ModuleProxy) IsProxy

func (m *ModuleProxy) IsProxy(module string) bool

func (*ModuleProxy) IsUpstream

func (m *ModuleProxy) IsUpstream(module string) bool

func (*ModuleProxy) Ready

func (m *ModuleProxy) Ready() bool

func (*ModuleProxy) Versions

func (m *ModuleProxy) Versions(ctx context.Context, module string) ([]string, error)

type ModuleRoot

type ModuleRoot struct {
	RootPath      string
	RepositoryURL string
	Modules       []*Module
	IsGitHub      bool
	// contains filtered or unexported fields
}

func NewModuleRoot

func NewModuleRoot(ctx context.Context, rootPath string, vcsRepo *VCS, cache *ModuleCache, dir string) (*ModuleRoot, error)

func NewModuleRootFromCache

func NewModuleRootFromCache(rootPath string, modules []*Module, cache *ModuleCache, vcs *VCS, dir string) *ModuleRoot

func (*ModuleRoot) Archive

func (m *ModuleRoot) Archive(ctx context.Context, w io.Writer, module, version string) error

func (*ModuleRoot) FindModule

func (m *ModuleRoot) FindModule(module string) *Module

func (*ModuleRoot) SetCache

func (m *ModuleRoot) SetCache() error

type ModuleSetting

type ModuleSetting struct {
	ModuleName string `yaml:"module_name"`
	URLReplace string `yaml:"url_replace"`
	// contains filtered or unexported fields
}

type ModuleVersion

type ModuleVersion struct {
	Version string
	Semver  string
	Time    time.Time
}

type ProxyServer

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

func NewProxyServer

func NewProxyServer(addr string, upstream *url.URL, proxy *ModuleProxy) *ProxyServer

func (*ProxyServer) Start

func (s *ProxyServer) Start() error

func (*ProxyServer) Stop

func (s *ProxyServer) Stop(ctx context.Context) error

type PseudoVersion

type PseudoVersion struct {
	BaseVersion string
	Timestamp   string
	Revision    string
}

func ParsePseudoVersion

func ParsePseudoVersion(version string) (*PseudoVersion, error)

func (*PseudoVersion) String

func (p *PseudoVersion) String() string

type VCS

type VCS struct {
	Type     string
	CloneURL string
	URL      string
	// contains filtered or unexported fields
}

func NewVCS

func NewVCS(typ, cloneURL, originalURL string, tokenProvider *githubutil.TokenProvider, caBundle []byte) *VCS

func (*VCS) Create

func (vcs *VCS) Create(ctx context.Context, dir string) error

func (*VCS) Download

func (vcs *VCS) Download(ctx context.Context, dir string) error

func (*VCS) Open

func (vcs *VCS) Open(dir string) error

func (*VCS) Sync

func (vcs *VCS) Sync(ctx context.Context, dir string) error

Jump to

Keyboard shortcuts

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