localpackages

package
v0.0.0-...-f6ab670 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 23 Imported by: 8

Documentation

Overview

Package localpackages implements the local storage for packages managed by the ConfigurePackage plugin.

Package localpackages implements the local storage for packages managed by the ConfigurePackage plugin.

Package localpackages implements the local storage for packages managed by the ConfigurePackage plugin.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DownloadDelegate

type DownloadDelegate func(tracer trace.Tracer, targetDirectory string) error

DownloadDelegate is a function that downloads a package to a directory provided by the repository

type FileSysDep

type FileSysDep interface {
	MakeDirExecute(destinationDir string) (err error)
	GetDirectoryNames(srcPath string) (directories []string, err error)
	GetFileNames(srcPath string) (files []string, err error)
	Exists(filePath string) bool
	RemoveAll(path string) error
	ReadFile(filename string) ([]byte, error)
	WriteFile(filename string, content string) error
}

dependency on filesystem and os utility functions

type InstallState

type InstallState uint

InstallState is an enum describing the installation state of a package

const (
	None              InstallState = iota // Package version not present in repository
	Unknown           InstallState = iota // Present in repository but no state information or corrupt state
	Failed            InstallState = iota // Installation of the package version was attempted but failed
	Uninstalling      InstallState = iota // Package version being uninstalled version but not yet uninstalled
	Uninstalled       InstallState = iota // Successfully uninstalled version of a package (but not yet deleted)
	New               InstallState = iota // Present in the repository but not yet installed
	Upgrading         InstallState = iota // Uninstalling previous version
	Installing        InstallState = iota // Package version being installed but not yet installed
	Installed         InstallState = iota // Successfully installed / updated version of a package
	RollbackUninstall InstallState = iota // Uninstalling as part of rollback
	RollbackInstall   InstallState = iota // Installing as part of rollback
	Updating          InstallState = iota // Package version being updated but the update script is not yet executed
)

NOTE: Do not change the order of this enum - the numeric value is serialized as package state and must deserialize to the same value

func (InstallState) String

func (state InstallState) String() string

String returns the string representation of the InstallState

type PackageInstallState

type PackageInstallState struct {
	Name                 string       `json:"name"`
	Version              string       `json:"version"`
	State                InstallState `json:"state"`
	Time                 time.Time    `json:"time"`
	LastInstalledVersion string       `json:"lastinstalledversion"`
	RetryCount           int          `json:"retrycount"`
}

PackageInstallState represents the json structure of the current package state

type PackageManifest

type PackageManifest struct {
	Name            string `json:"name"`
	Platform        string `json:"platform"`
	Architecture    string `json:"architecture"`
	Version         string `json:"version"`
	AppName         string `json:"appname"`         // optional inventory attribute
	AppPublisher    string `json:"apppublisher"`    // optional inventory attribute
	AppReferenceURL string `json:"appreferenceurl"` // optional inventory attribute
	AppType         string `json:"apptype"`         // optional inventory attribute
}

PackageManifest represents json structure of package's online configuration file.

type Repository

type Repository interface {
	GetInstalledVersion(tracer trace.Tracer, packageArn string) string
	ValidatePackage(tracer trace.Tracer, packageArn string, version string) error
	RefreshPackage(tracer trace.Tracer, packageArn string, version string, packageServiceName string, downloader DownloadDelegate) error
	AddPackage(tracer trace.Tracer, packageArn string, version string, packageServiceName string, downloader DownloadDelegate) error
	SetInstallState(tracer trace.Tracer, packageArn string, version string, state InstallState) error
	GetInstallState(tracer trace.Tracer, packageArn string) (state InstallState, version string)
	RemovePackage(tracer trace.Tracer, packageArn string, version string) error
	GetInventoryData(log log.T) []model.ApplicationData
	GetInstaller(tracer trace.Tracer, configuration contracts.Configuration, packageArn string, version string, additionalArguments string) installer.Installer

	LockPackage(tracer trace.Tracer, packageArn string, action string) error
	UnlockPackage(tracer trace.Tracer, packageArn string)

	ReadManifest(packageArn string, packageVersion string) ([]byte, error)
	WriteManifest(packageArn string, packageVersion string, content []byte) error
	DeleteManifest(packageArn string, packageVersion string) error
	ReadManifestHash(packageArn string, documentVersion string) ([]byte, error)
	WriteManifestHash(packageArn string, documentVersion string, content []byte) error

	LoadTraces(tracer trace.Tracer, packageArn string) error
	PersistTraces(tracer trace.Tracer, packageArn string) error
}

Repository represents local storage for packages managed by configurePackage Different formats for different versions are managed within the Repository abstraction

func NewRepository

func NewRepository() Repository

NewRepository is the factory method for the package repository with default file system dependencies

Directories

Path Synopsis
Package repository_mock implements the mock for Repository.
Package repository_mock implements the mock for Repository.

Jump to

Keyboard shortcuts

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