mockregistry

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: Apache-2.0 Imports: 12 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 ErrorCode

type ErrorCode struct {
	Code    string         `json:"code"`
	Message string         `json:"message"`
	Detail  map[string]any `json:"detail,omitempty"`
}

ErrorCode represents an individual error in the response

type ErrorResponse

type ErrorResponse struct {
	Code       int
	ErrorCodes []ErrorCode
}

ErrorResponse represents a custom error response

type ManifestContent

type ManifestContent struct {
	Content      []byte
	MediaType    string
	Digest       digest.Digest
	Referrers    []descriptor.Descriptor
	ArtifactType string
}

ManifestContent represents a manifest and its metadata

type MockRegistry

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

MockRegistry provides a mock OCI registry implementation (distribution-spec)

func NewMockRegistry

func NewMockRegistry(content *RegistryContent) *MockRegistry

NewMockRegistry creates a new mock registry server

func (*MockRegistry) Close

func (m *MockRegistry) Close()

Close shuts down the mock registry server

func (*MockRegistry) URL

func (m *MockRegistry) URL() string

URL returns the URL of the mock registry

type Range

type Range struct {
	Start, End int64
}

Range represents a byte range

type RegistryContent

type RegistryContent struct {
	// Map of repository names to their content
	Repositories map[string]*RepositoryContent
	// Optional custom error responses
	ErrorResponses map[string]ErrorResponse
	// Optional custom headers for responses
	CustomHeaders map[string]map[string]string
}

RegistryContent represents the content stored in the mock registry

type RepositoryContent

type RepositoryContent struct {
	// Map of tag names to manifest digests
	Tags map[string]string
	// Map of manifest digests to their content
	Manifests map[string]ManifestContent
	// Map of blob digests to their content
	Blobs map[string][]byte
	// Map of upload UUIDs to their partial content
	Uploads map[string]*UploadState
	// Optional minimum chunk size for uploads
	MinChunkSize int64
}

RepositoryContent represents content within a repository

type UploadState

type UploadState struct {
	Data        []byte
	Offset      int64
	ID          string
	DigestValue string
}

UploadState tracks the state of a blob upload

Jump to

Keyboard shortcuts

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