swift

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package swift implements the Swift package registry's stored archive format.

Index

Constants

View Source
const (
	MaxArchiveBytes = 512 << 20
)

Variables

This section is empty.

Functions

func Serves

func Serves(t repo.PackageType) bool

func ValidName

func ValidName(s string) bool

func ValidScope

func ValidScope(s string) bool

ValidScope and ValidName implement the registry specification's grammar, including the different maximum lengths and separator rules.

func ValidVersion

func ValidVersion(v string) bool

Types

type Archive

type Archive struct {
	Manifests map[string][]byte
	Tools     map[string]string
}

Archive describes a completely validated source ZIP. Manifests are kept bounded in memory; all other members are read to EOF so CRC, size and truncated-stream errors are checked before a release can be published.

func InspectArchive

func InspectArchive(ctx context.Context, body io.Reader, size int64) (Archive, error)

type Handler

type Handler struct{ generic.Handler }

Handler keeps the package index derived from immutable source archives. Every write path, including ordinary item PUT, copy and restore, passes through these hooks so no malformed source is advertised to SwiftPM.

func (Handler) Admit

func (h Handler) Admit(
	ctx context.Context,
	env format.Env,
	c repo.Config,
	w format.Write,
) (format.Write, error)

func (Handler) Classify

func (Handler) Classify(_ repo.Config, _ string) format.Class

func (Handler) Deleted

func (Handler) Deleting

func (Handler) Deployed

func (Handler) Deployed(ctx context.Context, env format.Env, c repo.Config, it types.Item) error

func (Handler) Inspect

func (Handler) Inspect(
	ctx context.Context,
	env format.Env,
	_ repo.Config,
	w format.Write,
) (any, error)

func (Handler) Reindex

func (Handler) Reindex(ctx context.Context, env format.Env, c repo.Config) error

Reindex restores the version index from current archives after delete, restore or import. Invalid legacy items are omitted, never advertised.

type Package

type Package struct {
	Scope, Name, Version string
}

Package is a Swift registry identity. A release has one immutable source archive at the Artifactory layout documented for local Swift repositories.

func ParseArchivePath

func ParseArchivePath(path string) (Package, bool)

ParseArchivePath accepts only the documented local archive layout. It never interprets another generic item as a Swift release.

func (Package) ArchivePath

func (p Package) ArchivePath() string

func (Package) ID

func (p Package) ID() string

func (Package) IsValid

func (p Package) IsValid() bool

Jump to

Keyboard shortcuts

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