Documentation ¶
Index ¶
- Variables
- type CheckedModule
- type 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
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = fmt.Errorf("module not found")
Functions ¶
This section is empty.
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.