versionfile

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: AGPL-3.0 Imports: 11 Imported by: 5

Documentation

Index

Constants

View Source
const InstalledVersionStructVersion = 20230502
View Source
const (
	PluginStructVersion = 20220411
)

Variables

View Source
var (
	ErrNoContent = errors.New("no content")
)

Functions

func EnsureVersionFilesInPluginDirectories

func EnsureVersionFilesInPluginDirectories(ctx context.Context) error

EnsureVersionFilesInPluginDirectories attempts a backfill of the individual version.json for plugins this is required only once when upgrading from 0.20.x

Types

type InstalledVersion

type InstalledVersion struct {
	Name               string `json:"name"`
	Version            string `json:"version"`
	ImageDigest        string `json:"image_digest,omitempty"`
	BinaryDigest       string `json:"binary_digest,omitempty"`
	BinaryArchitecture string `json:"binary_arch,omitempty"`
	InstalledFrom      string `json:"installed_from,omitempty"`
	LastCheckedDate    string `json:"last_checked_date,omitempty"`
	InstallDate        string `json:"install_date,omitempty"`
	StructVersion      int64  `json:"struct_version"`
}

func EmptyInstalledVersion

func EmptyInstalledVersion() *InstalledVersion

func (*InstalledVersion) Equal

func (f *InstalledVersion) Equal(other *InstalledVersion) bool

Equal compares the `Name` and `BinaryDigest`

type PluginVersionFile

type PluginVersionFile struct {
	Plugins       map[string]*InstalledVersion `json:"plugins"`
	StructVersion int64                        `json:"struct_version"`
}

func LoadPluginVersionFile

func LoadPluginVersionFile(ctx context.Context) (*PluginVersionFile, error)

LoadPluginVersionFile migrates from the old version file format if necessary and loads the plugin version data

func (*PluginVersionFile) AddLocalPlugins

any plugins installed under the `local` folder are added to the plugin version file

func (*PluginVersionFile) EnsurePluginVersionFile

func (p *PluginVersionFile) EnsurePluginVersionFile(installData *InstalledVersion) error

EnsurePluginVersionFile reads the version file in the plugin directory (if exists) and overwrites it if the data in the argument is different. The comparison is done using the `Name` and `BinaryDigest` properties. If the file doesn't exist, or cannot be read/parsed, EnsurePluginVersionFile fails over to overwriting the data

func (*PluginVersionFile) IsValid

func (p *PluginVersionFile) IsValid() bool

IsValid checks whether the struct was correctly deserialized, by checking if the StructVersion is populated

func (*PluginVersionFile) Save

func (p *PluginVersionFile) Save() error

Save writes the config file to disk

Jump to

Keyboard shortcuts

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