format

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultRegistry

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

DefaultRegistry implements the FormatRegistry interface.

func NewRegistry

func NewRegistry() *DefaultRegistry

NewRegistry creates a new format registry.

func (*DefaultRegistry) Get

func (r *DefaultRegistry) Get(name string) (FormatHandler, error)

Get retrieves a handler by format name.

func (*DefaultRegistry) List

func (r *DefaultRegistry) List() []string

List returns all registered format names.

func (*DefaultRegistry) Register

func (r *DefaultRegistry) Register(handler FormatHandler) error

Register adds a new format handler.

func (*DefaultRegistry) Unregister

func (r *DefaultRegistry) Unregister(name string) error

Unregister removes a format handler.

type FormatHandler

type FormatHandler interface {
	// Name returns the format name (e.g., "docker", "maven", "npm")
	Name() string

	// Validate checks if the artifact conforms to the format specification
	Validate(ctx context.Context, data io.Reader) error

	// Parse extracts metadata from the artifact
	Parse(ctx context.Context, data io.Reader) (map[string]any, error)

	// GetContentType returns the MIME type for this format
	GetContentType() string

	// GetFileExtension returns the typical file extension for this format
	GetFileExtension() string
}

FormatHandler defines the interface for handling artifact format operations.

type FormatRegistry

type FormatRegistry interface {
	// Register adds a new format handler
	Register(handler FormatHandler) error

	// Get retrieves a handler by format name
	Get(name string) (FormatHandler, error)

	// List returns all registered format names
	List() []string

	// Unregister removes a format handler
	Unregister(name string) error
}

FormatRegistry manages registered format handlers.

Directories

Path Synopsis
Package base provides shared HTTP handler infrastructure for artifact format handlers.
Package base provides shared HTTP handler infrastructure for artifact format handlers.
Package conan serves a hosted Conan 2 remote: the REST API (v2) the conan client speaks, with revisions.
Package conan serves a hosted Conan 2 remote: the REST API (v2) the conan client speaks, with revisions.
Package formattest provides in-memory fakes shared by the format handler tests: a content-addressed blob store, a recording webhook publisher and a quarantine lookup.
Package formattest provides in-memory fakes shared by the format handler tests: a content-addressed blob store, a recording webhook publisher and a quarantine lookup.

Jump to

Keyboard shortcuts

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