Documentation
¶
Overview ¶
Package pkg provides interfaces to interact with the package system used for plugins and scrapers.
Package http provides a repository implementation for HTTP.
Index ¶
- Constants
- type LocalPackageIndex
- type Manager
- func (m *Manager) Install(ctx context.Context, spec models.PackageSpecInput) error
- func (m *Manager) InstalledStatus(ctx context.Context) (PackageStatusIndex, error)
- func (m *Manager) ListInstalled(ctx context.Context) (LocalPackageIndex, error)
- func (m *Manager) ListInstalledRemotes(ctx context.Context, installed LocalPackageIndex) (RemotePackageIndex, error)
- func (m *Manager) ListRemote(ctx context.Context, remoteURL string) (RemotePackageIndex, error)
- func (m *Manager) Uninstall(ctx context.Context, spec models.PackageSpecInput) error
- type Manifest
- type PackageLocation
- type PackageMetadata
- type PackageStatus
- type PackageStatusIndex
- type PackageVersion
- type RemotePackage
- type RemotePackageGetter
- type RemotePackageIndex
- type RemotePackageLister
- type SourcePathGetter
- type Store
- type Time
Constants ¶
const ManifestFile = "manifest"
ManifestFile is the default filename for the package manifest.
const ( // TimeFormat is the format used for marshalling/unmarshalling time.Time. // Times are stored in UTC. TimeFormat = "2006-01-02 15:04:05" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalPackageIndex ¶
type LocalPackageIndex map[models.PackageSpecInput]Manifest
LocalPackageIndex is a map of package name to RemotePackage
type Manager ¶
type Manager struct {
Local *Store
PackagePathGetter SourcePathGetter
Client *http.Client
// contains filtered or unexported fields
}
Manager manages the installation of paks.
func (*Manager) InstalledStatus ¶
func (m *Manager) InstalledStatus(ctx context.Context) (PackageStatusIndex, error)
func (*Manager) ListInstalled ¶
func (m *Manager) ListInstalled(ctx context.Context) (LocalPackageIndex, error)
func (*Manager) ListInstalledRemotes ¶
func (m *Manager) ListInstalledRemotes(ctx context.Context, installed LocalPackageIndex) (RemotePackageIndex, error)
func (*Manager) ListRemote ¶
type Manifest ¶
type Manifest struct {
ID string `yaml:"id"`
Name string `yaml:"name"`
Metadata PackageMetadata `yaml:"metadata"`
PackageVersion `yaml:",inline"`
Requires []string `yaml:"requires"`
RepositoryURL string `yaml:"source_repository"`
Files []string `yaml:"files"`
}
func (Manifest) PackageSpecInput ¶
func (m Manifest) PackageSpecInput() models.PackageSpecInput
type PackageLocation ¶
type PackageMetadata ¶
type PackageMetadata map[string]interface{}
type PackageStatus ¶
type PackageStatus struct {
Local *Manifest
Remote *RemotePackage
}
func (PackageStatus) Upgradable ¶
func (s PackageStatus) Upgradable() bool
type PackageStatusIndex ¶
type PackageStatusIndex map[models.PackageSpecInput]PackageStatus
func MakePackageStatusIndex ¶
func MakePackageStatusIndex(installed LocalPackageIndex, remote RemotePackageIndex) PackageStatusIndex
func (PackageStatusIndex) Upgradable ¶
func (i PackageStatusIndex) Upgradable() []PackageStatus
type PackageVersion ¶
func (PackageVersion) String ¶
func (v PackageVersion) String() string
func (PackageVersion) Upgradable ¶
func (v PackageVersion) Upgradable(o PackageVersion) bool
type RemotePackage ¶
type RemotePackage struct {
ID string `yaml:"id"`
Name string `yaml:"name"`
Repository remoteRepository `yaml:"-"`
Requires []string `yaml:"requires"`
Metadata PackageMetadata `yaml:"metadata"`
PackageVersion `yaml:",inline"`
PackageLocation `yaml:",inline"`
}
func (RemotePackage) PackageSpecInput ¶
func (p RemotePackage) PackageSpecInput() models.PackageSpecInput
type RemotePackageGetter ¶
type RemotePackageGetter interface {
GetPackageZip(ctx context.Context, pkg RemotePackage) (io.ReadCloser, error)
}
type RemotePackageIndex ¶
type RemotePackageIndex map[models.PackageSpecInput]RemotePackage
RemotePackageIndex is a map of package name to RemotePackage
type RemotePackageLister ¶
type RemotePackageLister interface {
// List returns all specs in the repository.
List(ctx context.Context) ([]RemotePackage, error)
}
type SourcePathGetter ¶
type SourcePathGetter interface {
// GetAllSourcePaths gets all source paths.
GetAllSourcePaths() []string
// GetSourcePath gets the source path for the given package URL.
GetSourcePath(srcURL string) string
}
SourcePathGetter gets the source path for a given package URL.
type Store ¶
type Store struct {
BaseDir string
// ManifestFile is the filename of the package file.
ManifestFile string
}
Store is a folder-based local repository. Packages are installed in their own directory under BaseDir. The package details are stored in a file named based on PackageFile.
type Time ¶
Time is a wrapper around time.Time that allows for custom YAML marshalling/unmarshalling using TimeFormat.