Documentation
¶
Index ¶
Constants ¶
const ( LegacyArtifactTypeModelManifest = "application/vnd.cnai.model.manifest.v1+json" LegacyMediaTypeModelConfig = "application/vnd.cnai.model.config.v1+json" LegacyMediaTypeModelWeight = "application/vnd.cnai.model.weight.v1.tar" LegacyMediaTypeModelWeightRaw = "application/vnd.cnai.model.weight.v1.raw" LegacyMediaTypeModelWeightConfig = "application/vnd.cnai.model.weight.config.v1.tar" LegacyMediaTypeModelWeightConfigRaw = "application/vnd.cnai.model.weight.config.v1.raw" LegacyMediaTypeModelCode = "application/vnd.cnai.model.code.v1.tar" LegacyMediaTypeModelCodeRaw = "application/vnd.cnai.model.code.v1.raw" LegacyMediaTypeModelDoc = "application/vnd.cnai.model.doc.v1.tar" LegacyMediaTypeModelDocRaw = "application/vnd.cnai.model.doc.v1.raw" LegacyAnnotationFilepath = "org.cnai.model.filepath" LegacyAnnotationFileMetadata = "org.cnai.model.file.metadata+json" )
Transitional wire-format identifiers (vnd.cnai.* / org.cnai.*).
The source-of-truth model-spec moved from github.com/dragonflyoss/model-spec (vnd.cnai.* / org.cnai.*) to github.com/modelpack/model-spec (vnd.cncf.* / org.cncf.*) when the project graduated into the CNCF sandbox. Registries that registered their MODEL artifact processor against the legacy identifiers cannot dispatch vnd.cncf.* manifests and return "processor for artifact MODEL not found" on /additions endpoints.
These constants pin the wire-format strings emitted by modctl to the legacy values for compatibility with such registries. Once downstream registries register processors for the modelpack identifiers, delete this file and switch the build-path call sites back to modelspec.*.
Variables ¶
This section is empty.
Functions ¶
func BuildModelConfig ¶
func BuildModelConfig(modelConfig *buildconfig.Model, layers []ocispec.Descriptor) (modelspec.Model, error)
BuildModelConfig builds the model config.
Types ¶
type Builder ¶
type Builder interface {
// BuildLayer builds the layer blob from the given file path.
BuildLayer(ctx context.Context, mediaType, workDir, path, destPath string, hooks hooks.Hooks) (ocispec.Descriptor, error)
// BuildConfig builds the config blob of the artifact.
BuildConfig(ctx context.Context, config modelspec.Model, hooks hooks.Hooks) (ocispec.Descriptor, error)
// BuildManifest builds the manifest blob of the artifact.
BuildManifest(ctx context.Context, layers []ocispec.Descriptor, config ocispec.Descriptor, annotations map[string]string, hooks hooks.Hooks) (ocispec.Descriptor, error)
}
Builder is an interface for building artifacts.
func NewBuilder ¶
func NewBuilder(outputType OutputType, store storage.Storage, repo, tag string, opts ...Option) (Builder, error)
NewBuilder creates a new builder instance.
type Option ¶
type Option func(*config)
func WithInsecure ¶
func WithInterceptor ¶
func WithInterceptor(interceptor interceptor.Interceptor) Option
func WithPlainHTTP ¶
type OutputStrategy ¶
type OutputStrategy interface {
// OutputLayer outputs the layer blob to the storage (local or remote).
OutputLayer(ctx context.Context, mediaType, relPath, destPath, digest string, size int64, reader io.Reader, hooks hooks.Hooks) (ocispec.Descriptor, error)
// OutputConfig outputs the config blob to the storage (local or remote).
OutputConfig(ctx context.Context, mediaType, digest string, size int64, reader io.Reader, hooks hooks.Hooks) (ocispec.Descriptor, error)
// OutputManifest outputs the manifest blob to the storage (local or remote).
OutputManifest(ctx context.Context, mediaType, digest string, size int64, reader io.Reader, hooks hooks.Hooks) (ocispec.Descriptor, error)
}
func NewLocalOutput ¶
func NewLocalOutput(cfg *config, store storage.Storage, repo, tag string) (OutputStrategy, error)
func NewRemoteOutput ¶
func NewRemoteOutput(cfg *config, repo, tag string) (OutputStrategy, error)
type OutputType ¶
type OutputType string
OutputType defines the type of output to generate.
const ( // OutputTypeLocal indicates that the output should be stored locally in modctl local storage. OutputTypeLocal OutputType = "local" // OutputTypeRemote indicates that the output should be pushed to a remote registry directly. OutputTypeRemote OutputType = "remote" )