librariesindex

package
v0.35.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: GPL-3.0 Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyIndex = &Index{Libraries: map[string]*Library{}}

EmptyIndex is an empty library index

Functions

This section is empty.

Types

type Dependency

type Dependency struct {
	Name              string
	VersionConstraint semver.Constraint
}

Dependency is a library dependency

func (*Dependency) GetConstraint

func (r *Dependency) GetConstraint() semver.Constraint

GetConstraint returns the version Constraint of the dependecy

func (*Dependency) GetName

func (r *Dependency) GetName() string

GetName returns the name of the dependency

type Index

type Index struct {
	Libraries map[string]*Library
}

Index represents the list of libraries available for download

func LoadIndex

func LoadIndex(indexFile *paths.Path) (*Index, error)

LoadIndex reads a library_index.json and create the corresponding Index

func (*Index) FindIndexedLibrary

func (idx *Index) FindIndexedLibrary(lib *libraries.Library) *Library

FindIndexedLibrary search an indexed library that matches the provided installed library or nil if not found

func (*Index) FindLibraryUpdate

func (idx *Index) FindLibraryUpdate(lib *libraries.Library) *Release

FindLibraryUpdate check if an installed library may be updated using one of the indexed libraries. This function returns the Release to install to update the library if found, otherwise nil is returned.

func (*Index) FindRelease

func (idx *Index) FindRelease(ref *Reference) *Release

FindRelease search a library Release in the index. Returns nil if the release is not found. If the version is not specified returns the latest version available.

func (*Index) ResolveDependencies

func (idx *Index) ResolveDependencies(lib *Release) []*Release

ResolveDependencies returns the dependencies of a library release.

type Library

type Library struct {
	Name     string
	Releases map[semver.NormalizedString]*Release
	Latest   *Release `json:"-"`
	Index    *Index   `json:"-"`
}

Library is a library available for download

func (*Library) Versions

func (library *Library) Versions() []*semver.Version

Versions returns an array of all versions available of the library

type Reference

type Reference struct {
	Name    string          // The name of the parsed item.
	Version *semver.Version // The Version of the parsed item.
}

Reference uniquely identify a Library in the library index

func (*Reference) String

func (r *Reference) String() string

type Release

type Release struct {
	Author           string
	Version          *semver.Version
	Dependencies     []semver.Dependency
	Maintainer       string
	Sentence         string
	Paragraph        string
	Website          string
	Category         string
	Architectures    []string
	Types            []string
	Resource         *resources.DownloadResource
	License          string
	ProvidesIncludes []string

	Library *Library `json:"-"`
}

Release is a release of a library available for download

func (*Release) GetDependencies

func (r *Release) GetDependencies() []semver.Dependency

GetDependencies returns the dependencies of this library.

func (*Release) GetName

func (r *Release) GetName() string

GetName returns the name of this library.

func (*Release) GetVersion

func (r *Release) GetVersion() *semver.Version

GetVersion returns the version of this library.

func (*Release) String

func (r *Release) String() string

func (*Release) ToRPCLibraryRelease

func (r *Release) ToRPCLibraryRelease() *rpc.LibraryRelease

ToRPCLibraryRelease transform this Release into a rpc.LibraryRelease

Jump to

Keyboard shortcuts

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