Documentation
¶
Overview ¶
Package conan holds what the Conan v2 proxy and group repositories share: the read paths of the REST API, and the JSON documents (revision lists, file lists, search results) they verify, cache and merge.
Index ¶
- Constants
- Variables
- func MergePackageSearch(docs ...map[string]json.RawMessage) []byte
- func NameOf(rel string) string
- func ParseFileMap(doc []byte) (map[string]string, error)
- func ParseFiles(doc []byte) ([]string, bool, error)
- func ParsePackageSearch(doc []byte) (map[string]json.RawMessage, error)
- func ParseSearch(doc []byte) ([]string, error)
- func RefName(ref string) string
- func RenderFileMap(m map[string]string) []byte
- func RenderRevision(rev Revision) []byte
- func RenderRevisions(revs []Revision) []byte
- func RenderSearch(results []string) []byte
- func RepoURL(origin, repo string) string
- func V1FileURL(base string, ref Ref, rrev, pid, prev, file string) string
- func ValidFilename(name string) bool
- func ValidRevision(s string) bool
- type Kind
- type Path
- type Ref
- type Revision
- type V1Kind
- type V1Path
Constants ¶
const ManifestFile = "conanmanifest.txt"
ManifestFile is the file whose presence publishes a revision.
const (
// SearchPath is the global recipe search.
SearchPath = "v2/conans/search"
)
Variables ¶
var ErrBadDocument = errors.New("invalid conan document")
ErrBadDocument is returned for a JSON document that is not what the Conan REST API sends.
Functions ¶
func MergePackageSearch ¶
func MergePackageSearch(docs ...map[string]json.RawMessage) []byte
MergePackageSearch unites package searches: a package id found by several keeps the entry of the first.
func NameOf ¶
NameOf is the package name a Conan 1 or 2 read path addresses, "" when it names none (the searches, paths that are not read paths).
func ParseFileMap ¶
ParseFileMap reads a Conan 1 document that maps file names to a string: the snapshot (file to MD5) or the download and digest URLs (file to URL).
func ParseFiles ¶
ParseFiles reads the answer of a file list endpoint: the file names, and whether the revision is published (its manifest is listed).
func ParsePackageSearch ¶
func ParsePackageSearch(doc []byte) (map[string]json.RawMessage, error)
ParsePackageSearch reads the answer of a package search: the object of each package id, kept as written (the client reads its settings and options).
func ParseSearch ¶
ParseSearch reads the answer of the recipe search: references written as name/version, with @user/channel when they have them.
func RefName ¶
RefName is the package name of a reference as the search writes it (name/version@user/channel); "" when ref has no name/version form.
func RenderFileMap ¶
RenderFileMap writes a document ParseFileMap reads.
func RenderRevision ¶
RenderRevision writes the answer of a latest endpoint.
func RenderRevisions ¶
RenderRevisions writes the answer of a revisions endpoint.
func RenderSearch ¶
RenderSearch writes the answer of the recipe search.
func RepoURL ¶
RepoURL is the URL of repository repo of the server at origin, which a client is configured with.
func V1FileURL ¶
V1FileURL is the URL below base (the repository's URL, no trailing slash) of a file of a revision: the recipe's when pid is empty, else the package's.
func ValidFilename ¶
ValidFilename reports whether name is a relative path of plain segments with no control characters, as Conan names its files (conanfile.py, metadata/sign/signature.json).
func ValidRevision ¶
ValidRevision reports whether s is a revision or package id: letters, digits, ".", "_" and "-" (Conan's are hex digests), and no directory name.
Types ¶
type Kind ¶
type Kind int
Kind is the endpoint a Conan v2 read path addresses.
const ( // KindOther is a path that is no Conan v2 read endpoint. KindOther Kind = iota // KindSearch is v2/conans/search: the recipes matching a pattern. KindSearch // KindRecipeLatest is .../latest of a recipe: its newest revision. KindRecipeLatest // KindRecipeRevisions is .../revisions of a recipe. KindRecipeRevisions // KindPackageSearch is the package search of a recipe (newest revision) or // of one recipe revision. KindPackageSearch // KindFiles is the file list of a recipe revision or package revision. KindFiles // KindFile is one file of a recipe revision or package revision. KindFile // KindPackageLatest is .../packages/{pid}/latest: the newest revision of a // package. KindPackageLatest // KindPackageRevisions is .../packages/{pid}/revisions. KindPackageRevisions )
type Path ¶
Path is a parsed Conan v2 read path. RRev, PID and PRev are set as far as the path names them; File is the file path of KindFile.
func ParsePath ¶
ParsePath classifies a path below the repository root, without a query. It accepts only well-formed Conan v2 read paths, so what it returns can be used to build an upstream URL, a cache key or a search pattern without further escaping: every component is a plain name of the characters Conan allows. ok is false for anything else, including the paths a Conan remote also serves but a read-only mirror does not (uploads, deletes).
type Ref ¶
type Ref struct {
Name, Version, User, Channel string
}
Ref is a recipe reference: name/version@user/channel, where "_" stands for an absent user or channel.
type Revision ¶
Revision is a published recipe or package revision and when it was published. Time keeps the server's own spelling, which the client parses itself.
func MergeRevisions ¶
MergeRevisions unites revision lists: a revision listed by several keeps the entry of the first list that has it, and the result is newest first (equal times keep their order of appearance).
func ParseRevision ¶
ParseRevision reads the answer of a latest endpoint.
func ParseRevisions ¶
ParseRevisions reads the answer of a revisions endpoint.
type V1Kind ¶
type V1Kind int
V1Kind is the endpoint a Conan 1 read path addresses.
const ( // V1Other is a path that is no Conan 1 read endpoint. V1Other V1Kind = iota // V1Search is v1/conans/search. V1Search // V1Snapshot is v1/conans/{ref}: file name to MD5 of the newest revision. V1Snapshot // V1PackageSearch is v1/conans/{ref}/search. V1PackageSearch // V1DownloadURLs is v1/conans/{ref}/download_urls. V1DownloadURLs // V1Digest is v1/conans/{ref}/digest. V1Digest // V1PackageSnapshot is v1/conans/{ref}/packages/{pid}. V1PackageSnapshot // V1PackageDownloadURLs is v1/conans/{ref}/packages/{pid}/download_urls. V1PackageDownloadURLs // V1PackageDigest is v1/conans/{ref}/packages/{pid}/digest. V1PackageDigest // V1File is v1/files/{ref}/{rrev}/export/{file}: a file of a recipe revision. V1File // V1PackageFile is v1/files/{ref}/{rrev}/package/{pid}/{prev}/{file}. V1PackageFile )
type V1Path ¶
V1Path is a parsed Conan 1 read path. RRev, PID and PRev are set as far as the path names them; File is the file path of V1File and V1PackageFile.
func ParseV1Path ¶
ParseV1Path classifies a path below the repository root, without a query, with the guarantees of ParsePath: only well-formed Conan 1 read paths are accepted, and every component is a plain name.