package modregistry
import "cuelang.org/go/internal/mod/modregistry"
Index ¶
- Variables
- type CheckedModule
- func CheckModule(m module.Version, blobr io.ReaderAt, size int64) (*CheckedModule, error)
- func (m *CheckedModule) ModFile() *modfile.File
- func (m *CheckedModule) ModFileContent() []byte
- func (m *CheckedModule) Version() module.Version
- func (m *CheckedModule) Zip() *zip.Reader
- type Client
- func NewClient(registry ociregistry.Interface) *Client
- func (c *Client) GetModule(ctx context.Context, m module.Version) (*Module, error)
- func (c *Client) ModuleVersions(ctx context.Context, m string) ([]string, error)
- func (c *Client) PutCheckedModule(ctx context.Context, m *CheckedModule) error
- func (c *Client) PutModule(ctx context.Context, m module.Version, r io.ReaderAt, size int64) error
- type Module
Variables ¶
Types ¶
type CheckedModule ¶
type CheckedModule struct {
// contains filtered or unexported fields
}
CheckedModule represents module content that has passed the same checks made by Client.PutModule. The caller should not mutate any of the values returned by its methods.
func CheckModule ¶
CheckModule checks a module's zip file before uploading it. This does the same checks that Client.PutModule does, so can be used to avoid doing duplicate work when an uploader wishes to do more checks that are implemented by that method.
Note that the returned CheckedModule value contains r, so will be invalidated if r is closed.
func (*CheckedModule) ModFile ¶
func (m *CheckedModule) ModFile() *modfile.File
Version returns the parsed contents of the modules cue.mod/module.cue file.
func (*CheckedModule) ModFileContent ¶
func (m *CheckedModule) ModFileContent() []byte
ModFileContent returns the raw contents of the modules cue.mod/module.cue file.
func (*CheckedModule) Version ¶
func (m *CheckedModule) Version() module.Version
Version returns the version that the module will be tagged as.
func (*CheckedModule) Zip ¶
func (m *CheckedModule) Zip() *zip.Reader
Zip returns the reader for the module's zip archive.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a OCI-registry-backed client that provides a store for CUE modules.
func NewClient ¶
func NewClient(registry ociregistry.Interface) *Client
NewClient returns a new client that talks to the registry at the given hostname.
func (*Client) GetModule ¶
GetModule returns the module instance for the given version. It returns an error that satisfies errors.Is(ErrNotFound) if the module is not present in the store at this version.
func (*Client) ModuleVersions ¶
ModuleVersions returns all the versions for the module with the given path.
func (*Client) PutCheckedModule ¶
func (c *Client) PutCheckedModule(ctx context.Context, m *CheckedModule) error
PutCheckedModule is like Client.PutModule except that it allows the caller to do some additional checks (see CheckModule for more info).
func (*Client) PutModule ¶
PutModule puts a module whose contents are held as a zip archive inside f. It assumes all the module dependencies are correctly resolved and present inside the cue.mod/module.cue file.
TODO check deps are resolved correctly? Or is that too domain-specific for this package? Is it a problem to call zip.CheckZip twice?
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module represents a CUE module instance.
func (*Module) GetZip ¶
GetZip returns a reader that can be used to read the contents of the zip archive containing the module files. The reader should be closed after use, and the contents should not be assumed to be correct until the close error has been checked.
func (*Module) ModuleFile ¶
ModuleFile returns the contents of the cue.mod/module.cue file.
Source Files ¶
client.go
- Version
- v0.7.1
- Published
- Feb 12, 2024
- Platform
- darwin/amd64
- Imports
- 16 packages
- Last checked
- 25 minutes ago –
Tools for package owners.