Documentation
¶
Index ¶
- Constants
- Variables
- func EncodeRepodata(index Repodata, channel, subdir string) (map[string][]byte, error)
- func EncodeShards(index Repodata, channel, subdir, baseURL string) (map[string][]byte, error)
- func IndexPath(channel, subdir, filename string) string
- func IsMetadata(p string) bool
- func IsShardFilename(filename string) bool
- func Serves(t repo.PackageType) bool
- type Handler
- func (Handler) Admit(ctx context.Context, env format.Env, c repo.Config, w format.Write) (format.Write, error)
- func (Handler) Classify(_ repo.Config, p string) format.Class
- func (Handler) Deleted(ctx context.Context, env format.Env, c repo.Config, removed []types.Item) error
- func (Handler) Deleting(ctx context.Context, env format.Env, c repo.Config, it types.Item) error
- func (Handler) Deployed(ctx context.Context, env format.Env, c repo.Config, it types.Item) error
- func (Handler) GuardTransferSource(_ context.Context, _ format.Env, _ repo.Config, it types.Item) error
- func (Handler) Inspect(ctx context.Context, env format.Env, _ repo.Config, w format.Write) (any, error)
- func (Handler) Owed(c repo.Config, cached bool, p string) []format.WorkRef
- func (Handler) Reindex(ctx context.Context, env format.Env, c repo.Config) error
- func (h Handler) Work(ctx context.Context, env format.Env, work types.WorkItem) error
- func (Handler) WorkKinds() []string
- type MetadataPath
- type PackagePath
- type Record
- type Repodata
- type Settings
- type ShardIndex
Constants ¶
const ( KindIndex = "conda.repodata" PropName = "conda.name" PropVersion = "conda.version" PropBuild = "conda.build" PropSubdir = "conda.subdir" PropChannel = "conda.channel" )
const ShardIndexFilename = "repodata_shards.msgpack.zst"
Variables ¶
var ErrInvalidPackage = errors.New("conda: invalid package")
var ErrInvalidRepodata = errors.New("conda: invalid repodata")
Functions ¶
func EncodeRepodata ¶
func EncodeShards ¶
func IsMetadata ¶
func IsShardFilename ¶
func Serves ¶
func Serves(t repo.PackageType) bool
Types ¶
type Handler ¶
func (Handler) GuardTransferSource ¶
type MetadataPath ¶
type MetadataPath struct {
Path, Channel, Subdir, Filename string
}
MetadataPath is one channel/subdirectory index path.
func ParseMetadataPath ¶
func ParseMetadataPath(p string) (MetadataPath, bool)
type PackagePath ¶
type PackagePath struct {
Path, Channel, Subdir, Filename string
Name, Version, Build, Extension string
}
PackagePath is one channel-relative conda package file.
func ParsePackagePath ¶
func ParsePackagePath(p string) (PackagePath, bool)
ParsePackagePath rejects ambiguous identity and arbitrary repository paths. Conda package filenames are <name>-<version>-<build> with one of two suffixes.
type Record ¶
type Record struct {
Name string `json:"name"`
Version string `json:"version"`
Build string `json:"build"`
BuildNumber int `json:"build_number"`
Depends []string `json:"depends,omitempty"`
Constrains []string `json:"constrains,omitempty"`
Noarch string `json:"noarch,omitempty"`
Subdir string `json:"subdir,omitempty"`
Arch string `json:"arch,omitempty"`
Platform string `json:"platform,omitempty"`
License string `json:"license,omitempty"`
LicenseFamily string `json:"license_family,omitempty"`
Features string `json:"features,omitempty"`
TrackFeatures string `json:"track_features,omitempty"`
Timestamp int64 `json:"timestamp,omitempty"`
Size int64 `json:"size"`
SHA256 string `json:"sha256"`
MD5 string `json:"md5,omitempty"`
}
Record is the subset of info/index.json retained in the channel index. Checksums, size, filename and subdirectory are supplied from trusted stored content and path, never from fields embedded in a package.
func ReadPackage ¶
func ReadPackage( ctx context.Context, body io.ReadSeeker, size int64, id PackagePath, ) (Record, error)
ReadPackage validates one complete legacy or modern Conda archive and extracts only its bounded info/index.json. It does not trust package metadata to choose the repository path or checksums.
type Repodata ¶
type Repodata struct {
Info struct {
Subdir string `json:"subdir"`
} `json:"info"`
Packages map[string]Record `json:"packages"`
PackagesConda map[string]Record `json:"packages.conda"` //nolint:tagliatelle // Conda wire field is packages.conda.
Removed []string `json:"removed"`
RepodataVersion int `json:"repodata_version"`
}
Repodata is the Conda channel index for one platform subdirectory.
func DecodeRepodata ¶
func DecodeRepodata(body []byte, path MetadataPath) (Repodata, error)
DecodeRepodata validates each disclosed package path and integrity claim before a remote index enters the cache or a virtual index includes it.
func DecodeShard ¶
func DecodeShard(body []byte, id MetadataPath, name, digest string) (Repodata, error)
DecodeShard pins the compressed wire bytes before parsing, then validates every archive identity and digest using the classic repodata contract.
func EmptyRepodata ¶
type ShardIndex ¶
ShardIndex is CEP-16 version 1. Hashes are MessagePack binary values, not hex strings. The outward view always uses relative URLs into this channel.
func DecodeShardIndex ¶
func DecodeShardIndex(body []byte) (ShardIndex, error)