Documentation
¶
Overview ¶
Package conan owns Conan's on-disk revision layout and write policy. A recipe revision's files are stored under user/name/version/channel/recipe-revision/export/ and a binary package revision's under recipe-revision/package/id/package-revision/, the conan-default layout Artifactory documents (ParseStored). A revision is committed once its conanmanifest.txt is stored, and only committed revisions enter the package index.
Role ¶
artifacts module, ecosystem layer: the Conan revision layout and write policy of the Conan slice. Its Handler plugs into the item service through the format hooks (decision 0032); the slice's http package (artifacts/ecosystem/conan/http) serves the Conan revision protocol over what it keeps.
Inputs ¶
- Driving: the format registry (artifacts/ecosystem), which hands the item service's hooks for conan repositories to Handler, and the work queue, which runs every format's reindex through it; and the protocol, which builds and parses revision paths (Reference, FilePath, ParseStored, Component, SafeFile), lists a repository's folders (Files) and marks its own writes (Native).
- Driven: the format hooks' environment (format.Env), through whose store Handler lists a repository's files and keeps the package index (artifacts/core/pkgindex); and the generic deploy policy (artifacts/ecosystem/generic), which Handler embeds and applies first.
- Settings: none.
Outputs ¶
- Handler: the hooks that admit a revision file only from the native protocol and only in the layout (Admit), and rebuild the index after a revision file is stored or removed (Deployed, Deleted, Reindex).
- The package index: a package per name@user/channel, with a version per recipe version whose files are those of its committed recipe and package revisions.
- The layout rules the protocol shares: Manifest, Reference, FilePath, ParseStored, Component, SafeFile, Files, Native and IsNative.
Invariants ¶
- A generic item write cannot create a Conan revision by choosing its storage path: only a write the protocol marked Native, or a remote's cached write, is admitted.
- The index lists only committed revisions: a recipe revision with its manifest, and a package revision with its own and its recipe revision's.
- A path component is refused before it becomes an item path if it could traverse or carries a control character.
References ¶
- Decision 0032: docs/research/decisions/0032-package-format-handlers.md (the format hooks; the protocol and storage decision); decision 0005: docs/research/decisions/0005-authentication-and-tokens.md (the login tokens the slice's protocol issues).
- docs/testing/conan.md (connecting Conan 2 and Conan 1, the commit marker, remote and virtual repositories, and the qualification).
- JFrog Conan repositories: https://docs.jfrog.com/artifactory/docs/conan-repositories, and the repository client support matrix: https://docs.jfrog.com/artifactory/docs/repository-support-for-package-clients.
- Target layout: docs/research/architecture-options/5-modular-monolith.md, line 233 (ecosystem/conan), line 379 (the slice row) and line 997 (the mapping row).
- Plan: docs/implementation/plan.md#p31-native-build-and-plugin-repositories and #p9d-modular-monolith-migration, epic ECO (https://github.com/weaveplatform/artifactweave/issues/943).
- https://github.com/weaveplatform/artifactweave/issues/770 and https://github.com/weaveplatform/artifactweave/issues/1038
Status ¶
Implemented P9c, which delivered the plan's P31 group (issues #770 to #775). Moved here in P9d.
Testing ¶
- path_test.go: the stored layout's recipe and package paths, and the components and file names it refuses.
The hooks are also tested end to end through the protocol, from the Conan suites in test/server/artifacts/conan (docs/testing/conan.md).
Index ¶
- Constants
- func Component(s string) bool
- func Files(ctx context.Context, st format.Store, c repo.Config, folder string) ([]model.Item, error)
- func IsNative(ctx context.Context) bool
- func Native(ctx context.Context) context.Context
- func SafeFile(name string) bool
- func Serves(t repo.PackageType) bool
- type FilePath
- type Handler
- func (h Handler) Admit(ctx context.Context, env format.Env, c repo.Config, w format.Write) (format.Write, error)
- func (h Handler) Deleted(ctx context.Context, env format.Env, c repo.Config, removed []model.Item) error
- func (Handler) Deleting(context.Context, format.Env, repo.Config, model.Item) error
- func (h Handler) Deployed(ctx context.Context, env format.Env, c repo.Config, it model.Item) error
- func (Handler) Reindex(ctx context.Context, env format.Env, c repo.Config) error
- type Reference
Constants ¶
const Manifest = "conanmanifest.txt"
Manifest is the file name of a revision's manifest, which the Conan client uploads last and which commits the revision: until it is stored, the revision's files are hidden from search, download and the index.
Variables ¶
This section is empty.
Functions ¶
func Component ¶
Component rejects traversal and control characters before a protocol segment can become an item path. Conan references do not contain slashes.
func Files ¶
func Files( ctx context.Context, st format.Store, c repo.Config, folder string, ) ([]model.Item, error)
Files walks one storage folder with bounded keyset pagination. The caller must filter by its principal before returning any name or metadata.
func IsNative ¶
IsNative reports whether ctx carries the mark Native sets, which Admit requires of every revision write that is not a remote's cached one.
func Native ¶
Native marks a write that entered through /api/conan. A generic item PUT cannot claim a Conan revision simply by choosing its storage path.
func SafeFile ¶
SafeFile permits Conan's metadata subfolders but no empty, dot, encoded separator or exceptionally long path component.
func Serves ¶
func Serves(t repo.PackageType) bool
Serves reports whether t is the Conan package type.
Types ¶
type FilePath ¶
FilePath is the item-tree interpretation of a native Conan file URL.
func ParseStored ¶
ParseStored recognizes the documented Artifactory conan-default layout: user/name/version/channel/recipe-revision/{export/file or package/id/package-revision/file}. It is deliberately independent of the HTTP route so restore and reindex use the same identity rules.
type Handler ¶
Handler keeps the common package index tied to committed Conan manifests. Files uploaded before a manifest are invisible to search and resolution; the Conan client uploads the manifest last for each revision.
func (Handler) Admit ¶
func (h Handler) Admit( ctx context.Context, env format.Env, c repo.Config, w format.Write, ) (format.Write, error)
Admit applies the generic deploy policy (black-out and include and exclude patterns) first, keeping its refusal's status, then passes a remote's cached write. Any other write must carry the Native mark, or a generic item write could create a revision by choosing its path (409), and its path must be in the stored layout (400).
func (Handler) Deleted ¶
func (h Handler) Deleted( ctx context.Context, env format.Env, c repo.Config, removed []model.Item, ) error
Deleted rebuilds the repository's index with Reindex when any removed item was a hosted file in the layout, so a deleted revision leaves the index.
func (Handler) Deleting ¶
Deleting does nothing: Deleted rebuilds the index once the items are gone.
func (Handler) Deployed ¶
Deployed rebuilds the repository's index with Reindex once a hosted file in the layout is stored, since that file may be the manifest that commits its revision. Folders, a remote's cached files and paths outside the layout change nothing.
func (Handler) Reindex ¶
Reindex rebuilds repository c's package index from its files (a remote's from its cache): a package per name@user/channel, a version per recipe version, and as each version's files those of its committed recipe revisions and of their committed package revisions. A version and a package take their oldest file's creation time. It fails rather than index part of a repository that holds more than 50,000 items.
type Reference ¶
type Reference struct {
Name, Version, User, Channel, Revision string
}
Reference is the Conan identity of a recipe. Missing user and channel are represented by underscores on the wire, as the Conan client does.
func (Reference) IsValid ¶
IsValid reports whether every part of r, the revision included, is a valid Component.
func (Reference) PackageRoot ¶
PackageRoot is the folder of binary package id at package revision revision, built from the recipe revision r.
func (Reference) RecipeRoot ¶
RecipeRoot is the folder of the recipe revision's own files, the export folder under Root.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package conanhttp serves the Conan revision protocol at /artifactory/api/conan/{repoKey}, for Conan 2 and for Conan 1 with revisions enabled: ping, the credential exchange and check, recipe search, recipe and package revision lists and latest revisions, file lists, file download and upload, package search, and revision deletion.
|
Package conanhttp serves the Conan revision protocol at /artifactory/api/conan/{repoKey}, for Conan 2 and for Conan 1 with revisions enabled: ping, the credential exchange and check, recipe search, recipe and package revision lists and latest revisions, file lists, file download and upload, package search, and revision deletion. |