Documentation
¶
Overview ¶
Package cargo validates crates and supplies Cargo sparse-index records.
Index ¶
- Constants
- Variables
- func CratePath(name, version string) string
- func Encode(r Record) (string, error)
- func IndexPath(name string) string
- func Inspect(ctx context.Context, body io.Reader, size int64, p string) (string, string, error)
- func ParseCratePath(p string) (name, version string, ok bool)
- func Serves(t repo.PackageType) bool
- func ValidName(s string) bool
- func ValidVersion(s string) bool
- type Dependency
- type Handler
- func (Handler) Admit(ctx context.Context, env format.Env, c repo.Config, w format.Write) (format.Write, error)
- func (Handler) Deployed(ctx context.Context, env 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) Reindex(ctx context.Context, env format.Env, c repo.Config) error
- type Record
Constants ¶
View Source
const ( MaxCrate = 64 << 20 MaxIndex = 16 << 20 RecordProperty = "cargo.index" YankedProperty = "cargo.yanked" )
Variables ¶
View Source
var (
ErrInvalid = errors.New("cargo: invalid cargo crate")
)
Functions ¶
func Inspect ¶
Inspect validates the complete bounded .crate gzip tarball. Every entry must be a unique path under the archive root, and the manifest identity must match the canonical item path.
func ParseCratePath ¶
func Serves ¶
func Serves(t repo.PackageType) bool
func ValidVersion ¶
Types ¶
type Dependency ¶
type Dependency struct {
Name string `json:"name"`
Req string `json:"req"`
Features []string `json:"features"`
Optional bool `json:"optional"`
DefaultFeatures bool `json:"default_features"`
Target *string `json:"target"`
Kind string `json:"kind"`
Registry *string `json:"registry"`
Package *string `json:"package"`
}
type Record ¶
type Record struct {
Name string `json:"name"`
Version string `json:"vers"`
Deps []Dependency `json:"deps"`
Checksum string `json:"cksum"`
Features map[string][]string `json:"features"`
Yanked bool `json:"yanked"`
Links *string `json:"links,omitempty"`
RustVersion *string `json:"rust_version,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.